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

Fix internal resource detecting when pasting nodes #45950

Merged
merged 1 commit into from
Feb 18, 2021

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Feb 13, 2021

While backporting #34892 I discovered a "small" bug. Turns out built-in resources don't always have empty path, so you need additional check.

@KoBeWi KoBeWi added this to the 4.0 milestone Feb 13, 2021
@@ -2921,7 +2921,7 @@ void SceneTreeDock::_create_remap_for_node(Node *p_node, Map<RES, RES> &r_remap)
if (v.is_ref()) {
RES res = v;
if (res.is_valid()) {
if (res->get_path() == "" && !r_remap.has(res)) {
if ((res->get_path() == "" || res->get_path().find("::") > -1) && !r_remap.has(res)) {
Copy link
Member

Choose a reason for hiding this comment

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

On phone so I can't check, but I think we added some is_builtin() method somewhere (or similar name) to do exactly this kind of check.

Copy link
Member Author

Choose a reason for hiding this comment

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

I found only _is_built_in_script(). Although maybe adding such method to Resource would make sense to avoid problems like this.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah that's the one I had in mind I guess. That's probably material for another PR but I agree that it could be added to Resource (or Script? more local, but would require casting before calling).

@akien-mga akien-mga merged commit bdf3c57 into godotengine:master Feb 18, 2021
@akien-mga
Copy link
Member

Thanks!

@KoBeWi KoBeWi deleted the naughty_resources branch February 18, 2021 11:07
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.

2 participants