Skip to content

Commit

Permalink
Merge pull request #36667 from simpuid/paste-params-undo-feature
Browse files Browse the repository at this point in the history
Implement undo-redo feature for Parameter Paste in the Inspector
  • Loading branch information
akien-mga authored Feb 29, 2020
2 parents e4bc16b + f817ba8 commit 1399747
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions editor/editor_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,14 @@ void EditorData::restore_editor_global_states() {

void EditorData::paste_object_params(Object *p_object) {

ERR_FAIL_NULL(p_object);
undo_redo.create_action(TTR("Paste Params"));
for (List<PropertyData>::Element *E = clipboard.front(); E; E = E->next()) {

p_object->set(E->get().name, E->get().value);
String name = E->get().name;
undo_redo.add_do_property(p_object, name, E->get().value);
undo_redo.add_undo_property(p_object, name, p_object->get(name));
}
undo_redo.commit_action();
}

bool EditorData::call_build() {
Expand Down
1 change: 0 additions & 1 deletion editor/inspector_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ void InspectorDock::_menu_option(int p_option) {
editor_data->apply_changes_in_editors();
if (current)
editor_data->paste_object_params(current);
editor_data->get_undo_redo().clear_history();
} break;

case OBJECT_UNIQUE_RESOURCES: {
Expand Down

0 comments on commit 1399747

Please sign in to comment.