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

VisualScriptEditor Fix in graph position calculation (do not skip zoom) #49854

Conversation

kleonc
Copy link
Member

@kleonc kleonc commented Jun 23, 2021

Calculations for converting in-editor position to in-graph position was made manually in many separate places, some of them didn't take zoom into account. Extracted that into seperate method.

Tested it briefly in 3.x, seems to work. But more testing is welcomed before merging.

Fixes #49840 (and probably more zoom-related issues, e.g. before this PR it was possible to start dragging a node by clicking outside of it, with this PR it seems to no longer be the case).
Cherry-pickable 3.x, 3.3.

@kleonc kleonc requested a review from a team as a code owner June 23, 2021 10:34
@Calinou Calinou added bug cherrypick:3.3 cherrypick:3.x Considered for cherry-picking into a future 3.x release topic:editor topic:visualscript labels Jun 23, 2021
@Calinou Calinou added this to the 4.0 milestone Jun 23, 2021
@Gallilus
Copy link
Contributor

Oh seeing this makes me happy.
I did a very similar thing in #49749 I have to admit this version is cleaner. Better readability etc.
I will let @fire merge this PR first then I will do a last rebase on my PR. That will provide the cleanest result.

Code seems good.
Tested The windows build its OK.
Only one request for @kleonc, do you have any id where the position is decided when you drag out from the sequence port?

image

It seems to set position on window zero or last position.

@kleonc
Copy link
Member Author

kleonc commented Jun 23, 2021

Only one request for @kleonc, do you have any id where the position is decided when you drag out from the sequence port?

After a little digging I think here's the relevant part (linked code includes this PR). As you can see it uses port_action_pos to determine the actual in-graph position. In the case you've mentioned port_action_pos seems to be set here. And indeed this condition doesn't check for output sequence port count so port_action_pos might not being set properly. In 3.x it's being set unconditionally. Will try to fix this in a moment.

@DavidCambre And big thanks for the review/feedback!

Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

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

Looks good.

Thanks for reviewing @DavidCambre and @kleonc for working on it.

@kleonc kleonc force-pushed the visual_script_editor-fix-position-when-zooming-master branch from f00e301 to 921e6ef Compare June 23, 2021 20:02
@Gallilus
Copy link
Contributor

@fire I do not now ho to ask. Please merge? So I can work on the rebase for PR49749

@fire fire merged commit d8f2845 into godotengine:master Jun 24, 2021
@fire
Copy link
Member

fire commented Jun 24, 2021

Thanks.

@kleonc kleonc deleted the visual_script_editor-fix-position-when-zooming-master branch June 24, 2021 17:46
@akien-mga
Copy link
Member

Cherry-pickable 3.x, 3.3.

This would need a dedicated PR for 3.x, there are significant conflicts to handle.

@kleonc
Copy link
Member Author

kleonc commented Jun 29, 2021

This would need a dedicated PR for 3.x, there are significant conflicts to handle.

It's because of this change since that changed condition is non-existant in 3.x (as I've mentioned in the comment above). Not sure if that condition is neccessary at all but I'll add it in 3.x too to sync that part with master (code involving port_action_pos (which is being changed conditionally in there) seems the same in both master and 3.x so it shouldn't break anything).

@akien-mga akien-mga removed cherrypick:3.3 cherrypick:3.x Considered for cherry-picking into a future 3.x release labels Jun 29, 2021
@veryprofessionaldodo
Copy link
Contributor

I think that this is still a problem. Currently building a plugin that uses a Visual Node system for dialogues, and I get this behaviour on 3.3.3.rc1 and 3.4.beta3. Here's a gif of it in action.

Sorry to resurrect an old issue, I'll open a new one if it is more appropriate.

@kleonc
Copy link
Member Author

kleonc commented Aug 16, 2021

@veryprofessionaldodo As I've just mentioned in the Reddit thread where you're describing your issue: this PR is actually not related to your issue. So yes, please open a new issue. Also provided gif is a nice addition but it's much easier to investigate the issue having minimal reproduction project provided (please provide one when opening new issue).

@veryprofessionaldodo
Copy link
Contributor

Hi there! It was actually my bad, and not related to this at all indeed. The problem was that I had a hidden AcceptDialog inside of the GraphEdit that was catching inputs, as it can be seen here. Sorry for adding entropy, it's already fixed!

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

Successfully merging this pull request may close these issues.

Adding new functions to visual script when zoomed out places them ' badly ' . .
6 participants