-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement GraphFrame and integrate it in VisualShader #88014
Conversation
1887b7d
to
caec519
Compare
Amazing work! Can't wait to try it out. I have a few questions:
I'll give it a spin tomorrow! |
855aa5e
to
e4c9615
Compare
Rebased and addressed all review comments.
|
I've tested the PR and overall it works great! I've only been able to find one issue: if you try to attach a frame to itself, the application will hang. It's not unfixable in user code, but I wonder if it should just be a no-op if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine now (except the autoshrink_margin
issue, but it's less important).
I left some style comments, otherwise it's good to go.
7ae944e
to
32c85e7
Compare
@Geometror would it be possible to resolve the conflict with extension_api_validation / squash? (I believe the conflict was caused by an urgent bugfix with Node::replace_by in #89992) |
32c85e7
to
a81561c
Compare
Rebased and fixed a small resizing issue. |
Thanks! |
sb_panel_flat->set_border_color(selected ? original_border_color : tint_color.lightened(0.3)); | ||
draw_style_box(sb_panel_flat, body_rect); | ||
} else if (sb_panel_texture.is_valid()) { | ||
sb_panel_texture = sb_panel_flat->duplicate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code might crash, as highlighted by this warning on my Linux CI: https://github.com/Zylann/godot_voxel/actions/runs/8560927646/job/23461023064
scene/gui/graph_frame.cpp:121:84: error: 'this' pointer is null [-Werror=nonnull]
121 | sb_panel_texture = sb_panel_flat->duplicate();
| ~~~~~~~~~~~~~~~~~~~~~~~~^~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading the code, I think the two identifiers might be swapped by mistake?
@Geometror Removing this part of our API is causing problems with some GDExtension plugins: it wasn't marked experimental, so this breaks all rust plugins since they hard-link to the whole API. See #90303 I think the easiest way to solve this is to add a stub Even though it extends from |
It would be easier to find this if when you search for "comment" it would also bring up the frame... |
This PR introduces
GraphFrame
, a newGraphElement
designed for organizing node graphs, and integrates it into the VisualShader editor (can be split if desired).It aims to reimplement the functionality that was lost when comment nodes were removed. While it works a bit differently (very similar to Blender) it should be a lot more predictable and much less problematic compared to the old implementation of comment nodes.
Finally closes godotengine/godot-proposals#5271.
godot.pr.frame.demo.mp4
Detailed changes:
GraphFrame
GraphEdit
's connection layer is not added as internal child #85005) since there is no better solution at the moment to keep it between background nodes, e.g. frames, and connectable nodes (just modifying the z_index of each node type would mess up the input and is just confusing)VisualShaderNodeComment
and replace it withVisualShaderNodeFrame
API
Note for users of GraphEdit: Integrating GraphFrame in your application is a bit more complicated that the old comment nodes (where you could just check a property and it "worked" out of the box), especially for Undo-Redo, but in return it should work more reliable and be a lot more useful.
attach_graph_element_to_frame(element, frame)
: Attach a node to a frame (params are string names)detach_graph_element_from_frame(element)
: Detach a node from its frame (param is string name)get_frame(element)
: Get the frame a node is attached toframe_size_changed (frame, new_size)
: Emitted when the size of a frame changesnodes_linked_to_frame_request(elements, frame)
: Emitted when nodes are dropped onto a frameresize_end
: Emitted after releasing the mouse button after resizing the nodetitle
: The title of the frameautoshrink_enabled
: Whether the frame should automatically shrink to fit its contents (attached nodes/frames)autoshrink_margin
: The margin to add to the frame size on each side when autoshrink is enableddrag_margin
: The margin around the frame where it can be draggedtint_color_enabled
: Whether the frame should be tinted in a colortint_color
: The color to tint the frame inget_titlebar_hbox
: Get the HBoxContainer of the titlebar (useful for customizing the titlebar)autoshrink_toggled
: Emitted when the autoshrink property is toggledattach_node_to_frame(node, frame)
: Attach a node to a framedetach_node_from_frame(node)
: Detach a node from its frameTODO:
Production edit: closes godotengine/godot-roadmap#13