Merge pull request #96776 from aXu-AP/detach-script-undo

Make detach script non-destructive operation
This commit is contained in:
Rémi Verschelde 2024-09-16 13:34:58 +02:00
commit d4735ebd97
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -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));
}
}
}
}