Merge pull request #70223 from KoBeWi/condition_of_arguable_usefulness

Remove unnecessary condition
This commit is contained in:
Rémi Verschelde 2022-12-18 00:11:25 +01:00
commit f4eac63bc2
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -1965,37 +1965,21 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) {
}
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
if (selected.size() == 1) {
Node *node = selected.front()->get();
Ref<Script> existing = node->get_script();
undo_redo->create_action(TTR("Attach Script"), UndoRedo::MERGE_DISABLE, node);
undo_redo->add_do_method(InspectorDock::get_singleton(), "store_script_properties", node);
undo_redo->add_undo_method(InspectorDock::get_singleton(), "store_script_properties", node);
undo_redo->add_do_method(node, "set_script", p_script);
undo_redo->add_undo_method(node, "set_script", existing);
undo_redo->add_do_method(InspectorDock::get_singleton(), "apply_script_properties", node);
undo_redo->add_undo_method(InspectorDock::get_singleton(), "apply_script_properties", node);
undo_redo->create_action(TTR("Attach Script"), UndoRedo::MERGE_DISABLE, selected.front()->get());
for (Node *E : selected) {
Ref<Script> existing = E->get_script();
undo_redo->add_do_method(InspectorDock::get_singleton(), "store_script_properties", E);
undo_redo->add_undo_method(InspectorDock::get_singleton(), "store_script_properties", E);
undo_redo->add_do_method(E, "set_script", p_script);
undo_redo->add_undo_method(E, "set_script", existing);
undo_redo->add_do_method(InspectorDock::get_singleton(), "apply_script_properties", E);
undo_redo->add_undo_method(InspectorDock::get_singleton(), "apply_script_properties", E);
undo_redo->add_do_method(this, "_update_script_button");
undo_redo->add_undo_method(this, "_update_script_button");
undo_redo->commit_action();
} else {
undo_redo->create_action(TTR("Attach Script"), UndoRedo::MERGE_DISABLE, selected.front()->get());
for (Node *E : selected) {
Ref<Script> existing = E->get_script();
undo_redo->add_do_method(InspectorDock::get_singleton(), "store_script_properties", E);
undo_redo->add_undo_method(InspectorDock::get_singleton(), "store_script_properties", E);
undo_redo->add_do_method(E, "set_script", p_script);
undo_redo->add_undo_method(E, "set_script", existing);
undo_redo->add_do_method(InspectorDock::get_singleton(), "apply_script_properties", E);
undo_redo->add_undo_method(InspectorDock::get_singleton(), "apply_script_properties", E);
undo_redo->add_do_method(this, "_update_script_button");
undo_redo->add_undo_method(this, "_update_script_button");
}
undo_redo->commit_action();
}
undo_redo->commit_action();
_push_item(p_script.operator->());
_push_item(p_script.ptr());
_update_script_button();
}