Skip to content

Commit

Permalink
Merge pull request #80721 from tom95/resource-node-path-renaming
Browse files Browse the repository at this point in the history
Recurse into resources to check for changed node paths
  • Loading branch information
akien-mga committed Oct 3, 2023
2 parents 530e01b + 42a3108 commit c3046f4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions editor/scene_tree_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1683,6 +1683,32 @@ bool SceneTreeDock::_check_node_path_recursive(Node *p_root_node, Variant &r_var
}
} break;

case Variant::OBJECT: {
Resource *resource = Object::cast_to<Resource>(r_variant);
if (!resource) {
break;
}

List<PropertyInfo> properties;
resource->get_property_list(&properties);

for (const PropertyInfo &E : properties) {
if (!(E.usage & (PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR))) {
continue;
}
String propertyname = E.name;
Variant old_variant = resource->get(propertyname);
Variant updated_variant = old_variant;
if (_check_node_path_recursive(p_root_node, updated_variant, p_renames)) {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->add_do_property(resource, propertyname, updated_variant);
undo_redo->add_undo_property(resource, propertyname, old_variant);
resource->set(propertyname, updated_variant);
}
}
break;
};

default: {
}
}
Expand Down

0 comments on commit c3046f4

Please sign in to comment.