Skip to content

Commit

Permalink
Merge pull request #96776 from aXu-AP/detach-script-undo
Browse files Browse the repository at this point in the history
Make detach script non-destructive operation
  • Loading branch information
akien-mga committed Sep 16, 2024
2 parents 6b67d44 + e4db0bc commit d4735eb
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 @@ -744,6 +744,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 d4735eb

Please sign in to comment.