Skip to content

Bump Godot version to 4.3#18

Merged
RailKill merged 5 commits into
mainfrom
gd-4.3
Aug 18, 2024
Merged

Bump Godot version to 4.3#18
RailKill merged 5 commits into
mainfrom
gd-4.3

Conversation

@atomic-junky

@atomic-junky atomic-junky commented Aug 15, 2024

Copy link
Copy Markdown
Collaborator

Godot 4.3 adds many new features/changes, especially with graph elements but also comes with breaking bugs.

Summary by Sourcery

Update the script to use a new method get_nodes() that filters children nodes to only include MonologueGraphNode instances, improving the handling of nodes in the graph.

Enhancements:

  • Replace the use of get_children() with get_nodes() to filter and retrieve only MonologueGraphNode instances in the graph.

@sourcery-ai

sourcery-ai Bot commented Aug 15, 2024

Copy link
Copy Markdown

Reviewer's Guide by Sourcery

This pull request updates the Godot version to 4.3, which introduces changes in how graph elements are handled. The main modifications are in the MonologueGraphEdit.gd and MonologueControl.gd scripts, where the method for accessing child nodes has been changed from get_children() to a new custom get_nodes() function. This change ensures that only MonologueGraphNode instances are processed, improving type safety and potentially fixing issues related to the new Godot version.

File-Level Changes

Files Changes
Scripts/MonologueGraphEdit.gd
Scripts/MonologueControl.gd
Replaced get_children() calls with get_nodes() to filter for MonologueGraphNode instances
Scripts/MonologueGraphEdit.gd Added a new get_nodes() function that filters child nodes to return only MonologueGraphNode instances
Scripts/MonologueGraphEdit.gd Implemented a type check in the _on_node_selected function to ensure the node is a MonologueGraphNode

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

@atomic-junky

Copy link
Copy Markdown
Collaborator Author

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @atomic-junky - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Could you provide more context on the specific issues this PR is addressing? The description mentions breaking bugs in Godot 4.3, but it's not clear how these changes relate to those issues.
  • The introduction of get_nodes() seems to be a significant change. Can you explain the reasoning behind this and whether you've considered any potential performance implications, especially if this method is called frequently?
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment thread Scripts/MonologueGraphEdit.gd Outdated
Comment thread Scripts/MonologueControl.gd

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @atomic-junky - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Could you provide more context on the specific issues this PR is addressing? The description mentions breaking bugs in Godot 4.3, but it's not clear how these changes relate to those issues.
  • The new get_nodes() function uses filter(), which could potentially impact performance if called frequently. Consider the performance implications and possibly optimize if necessary.
  • The addition of a type check in _on_node_selected suggests that non-MonologueGraphNode objects might be passed to this function. This could indicate a design issue that needs addressing.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment thread Scripts/MonologueGraphEdit.gd
@atomic-junky

atomic-junky commented Aug 15, 2024

Copy link
Copy Markdown
Collaborator Author

The main bug is when you call get_children() (only tested on GraphEdit) it also gives you internal childrens.
The function get_nodes() is not called frequently and the function get_nodes() declares to return an array and not a MonologueGraphNode array, because Godot doesn't understand that the filter() result can only return that.

@monologue-tool monologue-tool deleted a comment from sourcery-ai Bot Aug 15, 2024

@RailKill RailKill left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static Typing

I think using .filter() as a one-liner is neat, but functional programming in Godot foregoes static typing which isn't good for maintainability. It's as you say, Godot doesn't understand that. This is optional but I recommend a more verbose option which isn't as neat but does the same thing, if you'd like:

func get_nodes() -> Array[MonologueGraphNode]:
    var list: Array[MonologueGraphNode] = []
    for node in get_children():
        if node is MonologueGraphNode:
            list.append(node)
    return list

Crash in Test

I tried running Test with MrSharpener example, when it tries to exit back to the Test main menu, it throws an error on Main.gd line 73. Can you check if this happens on your side too?

Not sure what's the actual cause, seems like there's some cyclic dependency that's being caught in Godot 4.3 here. The easiest way to get around this problem is to just change from preload() to load() for the menu scene. If you want to fix the cyclic dependency itself, I think it probably has something to do with the option_button.tscn in the menu scene. Up to you how you'd like to fix this.

If you can run Test without crashing, this PR should be good to merge 👍

@atomic-junky

Copy link
Copy Markdown
Collaborator Author

Done!

@atomic-junky atomic-junky requested a review from RailKill August 18, 2024 08:36
@RailKill RailKill merged commit 1f79072 into main Aug 18, 2024
@atomic-junky atomic-junky deleted the gd-4.3 branch August 18, 2024 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants