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

Use % when dropping unique scene nodes into script #61148

Merged
merged 1 commit into from
May 18, 2022

Conversation

Jummit
Copy link
Contributor

@Jummit Jummit commented May 18, 2022

This expands upon #60708, using get_node("%NodeName") for nodes that have a unique scene name to avoid having to change the onready statements when the paths of the nodes change.

Preview:

@onready var login_screen: Control = $"%LoginScreen"

@Jummit Jummit requested a review from a team as a code owner May 18, 2022 10:31
Copy link
Member

@timothyqiu timothyqiu left a comment

Choose a reason for hiding this comment

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

I think you just have to replace path here with "%" + node->get_name() when it's a unique name.

String path = sn->get_path_to(node);

@Jummit
Copy link
Contributor Author

Jummit commented May 18, 2022

I think you just have to replace path here with "%" + node->get_name() when it's a unique name.

String path = sn->get_path_to(node);

Done.

This expands uppon godotengine#60708, using `get_node("%NodeName")` for nodes that
have a unique scene name to avoid having to change the onready
statements when the paths of the nodes change.
@Jummit Jummit force-pushed the drop-unique-nodes branch from f22699d to 1101f6c Compare May 18, 2022 13:21
@akien-mga akien-mga merged commit e786862 into godotengine:master May 18, 2022
@akien-mga
Copy link
Member

Thanks!

@Jummit Jummit deleted the drop-unique-nodes branch May 18, 2022 14:18
@timothyqiu timothyqiu added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jul 3, 2022
@timothyqiu
Copy link
Member

Tested locally. I think this PR is also good to cherrypick to 3.x.

@akien-mga
Copy link
Member

Cherry-picked for 3.5.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jul 3, 2022
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.

4 participants