Skip to content

Commit

Permalink
Make detach script non-destructive operation
Browse files Browse the repository at this point in the history
Fix detach script not returning script's property values on undo.
  • Loading branch information
aXu-AP committed Sep 10, 2024
1 parent 2124995 commit e4db0bc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions editor/scene_tree_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (existing != empty) {
undo_redo->add_do_method(n, "set_script", empty);
undo_redo->add_undo_method(n, "set_script", existing);

List<PropertyInfo> properties;
n->get_property_list(&properties);
for (const PropertyInfo &property : properties) {
if (property.usage & (PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR)) {
undo_redo->add_undo_property(n, property.name, n->get(property.name));
}
}
}
}

Expand Down

0 comments on commit e4db0bc

Please sign in to comment.