mirror of
https://github.com/godotengine/godot.git
synced 2024-11-12 23:24:26 +00:00
Merge pull request #96776 from aXu-AP/detach-script-undo
Make detach script non-destructive operation
This commit is contained in:
commit
d4735ebd97
@ -744,6 +744,14 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||||||
if (existing != empty) {
|
if (existing != empty) {
|
||||||
undo_redo->add_do_method(n, "set_script", empty);
|
undo_redo->add_do_method(n, "set_script", empty);
|
||||||
undo_redo->add_undo_method(n, "set_script", existing);
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user