Skip to content
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

Fixes issues where node preview does not toggle correctly #484

Merged
merged 7 commits into from
Jul 12, 2022

Conversation

BlacRyu
Copy link
Contributor

@BlacRyu BlacRyu commented Jul 10, 2022

Fixes #481, #482, and #483

I've tested this on various nodes, trying to make sure it would work cleanly with any type of parameter. This is my first contribution, so apologies if there are any conflicts with design or code style.

- Fixed node previews not being hidden on mouse-over after loading a graph with node previews already enabled.
- Fixed an issue where a node's preview didn't toggle visibility if another UI element was covering the node when the cursor entered/exited.
- Fixed an issue where an incorrect preview was shown if the mouse exited the node before the preview was ready.
@RodZill4
Copy link
Owner

This looks pretty good, but I really don't like the gradient editor part (looks too specific, this hints it might break if value edit controls are modified).

@RodZill4
Copy link
Owner

BTW, do you have this problem that when you create a new gradient cursor, it is shown in front of the preview?

@BlacRyu
Copy link
Contributor Author

BlacRyu commented Jul 11, 2022

This looks pretty good, but I really don't like the gradient editor part (looks too specific, this hints it might break if value edit controls are modified).

Yeah, ideally I was hoping Godot would have a signal indicating that a new node was added to the scene tree. Then I could just check for any new children down the tree in generic.gd rather than needing to manually put checks in the control script(s). Not sure of a clean way to future proof it without something generic like that though.

BTW, do you have this problem that when you create a new gradient cursor, it is shown in front of the preview?

I didn't notice that, no. Thanks for fixing it. I must have always created the cursors before the preview in my testing.

@BlacRyu
Copy link
Contributor Author

BlacRyu commented Jul 11, 2022

Actually it looks like the scene tree does emit a signal when nodes are added, I'll see if I can use that here to make it connect new children in a clean generic way.

@RodZill4
Copy link
Owner

I don't think it's a good idea, the scene tree emits a signal whenever a node is added, I don't think we want all nodes to listen to that signal. But maybe I'm wrong...

@BlacRyu
Copy link
Contributor Author

BlacRyu commented Jul 11, 2022

Yeah I'm not knowledgeable enough about the performance overhead of signals, so if that's a concern I can just leave it as it is.

@BlacRyu
Copy link
Contributor Author

BlacRyu commented Jul 11, 2022

It looks like the signals we really want, child_entered_tree and child_exited_tree have been added to godot 4, but aren't available in 3.x (yet). It looks like they may be added in 3.5 though: godotengine/godot#57541

Edit: Except that is only for direct children, so maybe still not applicable.

@RodZill4
Copy link
Owner

Yeah I'm not knowledgeable enough about the performance overhead of signals, so if that's a concern I can just leave it as it is.

Hmm I tried to implement it, and it seems to behave OK. Profiling did not reveal a problem with this. I'm surprise, I was expecting it to be worse (though it only happens when those preview are shown...).

@BlacRyu
Copy link
Contributor Author

BlacRyu commented Jul 11, 2022

Yeah in the thread I posted above they talk about node_added having "a huge performance cost and is only really relevant for debugging / editor tools". When they talk about performance they may be talking more of real-time performance for things like games though which need the highest framerate possible. If you can add a few hundred nodes all with previews on and not chug it's probably fine.

@BlacRyu
Copy link
Contributor Author

BlacRyu commented Jul 11, 2022

Btw, Github only auto-linked the first issue I mentioned in the PR and it looks like I can't link the others. If you could, link #482 and #483 as this pr will close them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment