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

ScriptTextEditor Fix checking if script is attached to any node belonging to scene #66212

Conversation

kleonc
Copy link
Member

@kleonc kleonc commented Sep 21, 2022

Fixes #66209.

_find_script_node function was not traversing children not owned by the given scene so nodes added in the given scene to a subscene's root / its editable children weren't reached and thus their scripts were not checked. Now it traverses all children but checks the scripts only for the nodes owned by the given scene.

The changed _find_script_node function is used only for this check so it shouldn't break anything:

Node *sn = _find_script_node(scene_root, scene_root, script);
if (!sn) {
EditorNode::get_singleton()->show_warning(vformat(TTR("Can't drop nodes because script '%s' is not used in this scene."), get_name()));
return;
}

@kleonc kleonc added bug topic:editor cherrypick:3.x Considered for cherry-picking into a future 3.x release cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release labels Sep 21, 2022
@kleonc kleonc added this to the 4.0 milestone Sep 21, 2022
@kleonc kleonc requested a review from a team as a code owner September 21, 2022 13:32
@akien-mga

This comment was marked as outdated.

@kleonc kleonc force-pushed the script-text-editor-fix-check-if-script-used-within-scene branch from 8ee65ca to 7f7966e Compare September 21, 2022 13:46
@akien-mga akien-mga merged commit f3373e8 into godotengine:master Sep 21, 2022
@akien-mga
Copy link
Member

Thanks!

@kleonc kleonc deleted the script-text-editor-fix-check-if-script-used-within-scene branch September 21, 2022 20:08
@akien-mga
Copy link
Member

Cherry-picked for 3.6.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Nov 30, 2022
@timothyqiu
Copy link
Member

Cherry-picked for 3.5.2

@timothyqiu timothyqiu removed the cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release label Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants