Added checks to remove meta arrays when creating and undoing guides
Added checks to remove meta arrays when creating and undoing guides Update editor/plugins/canvas_item_editor_plugin.cpp Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Update editor/plugins/canvas_item_editor_plugin.cpp Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
This commit is contained in:
parent
6da4ad1662
commit
a7b2819540
1 changed files with 20 additions and 4 deletions
|
@ -1155,7 +1155,11 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
|
|||
vguides.push_back(edited.x);
|
||||
undo_redo->create_action(TTR("Create Vertical Guide"));
|
||||
undo_redo->add_do_method(EditorNode::get_singleton()->get_edited_scene(), "set_meta", "_edit_vertical_guides_", vguides);
|
||||
if (prev_vguides.is_empty()) {
|
||||
undo_redo->add_undo_method(EditorNode::get_singleton()->get_edited_scene(), "remove_meta", "_edit_vertical_guides_");
|
||||
} else {
|
||||
undo_redo->add_undo_method(EditorNode::get_singleton()->get_edited_scene(), "set_meta", "_edit_vertical_guides_", prev_vguides);
|
||||
}
|
||||
undo_redo->add_undo_method(viewport, "queue_redraw");
|
||||
undo_redo->commit_action();
|
||||
}
|
||||
|
@ -1188,7 +1192,11 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
|
|||
hguides.push_back(edited.y);
|
||||
undo_redo->create_action(TTR("Create Horizontal Guide"));
|
||||
undo_redo->add_do_method(EditorNode::get_singleton()->get_edited_scene(), "set_meta", "_edit_horizontal_guides_", hguides);
|
||||
if (prev_hguides.is_empty()) {
|
||||
undo_redo->add_undo_method(EditorNode::get_singleton()->get_edited_scene(), "remove_meta", "_edit_horizontal_guides_");
|
||||
} else {
|
||||
undo_redo->add_undo_method(EditorNode::get_singleton()->get_edited_scene(), "set_meta", "_edit_horizontal_guides_", prev_hguides);
|
||||
}
|
||||
undo_redo->add_undo_method(viewport, "queue_redraw");
|
||||
undo_redo->commit_action();
|
||||
}
|
||||
|
@ -1216,8 +1224,16 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
|
|||
undo_redo->create_action(TTR("Create Horizontal and Vertical Guides"));
|
||||
undo_redo->add_do_method(EditorNode::get_singleton()->get_edited_scene(), "set_meta", "_edit_vertical_guides_", vguides);
|
||||
undo_redo->add_do_method(EditorNode::get_singleton()->get_edited_scene(), "set_meta", "_edit_horizontal_guides_", hguides);
|
||||
if (prev_vguides.is_empty()) {
|
||||
undo_redo->add_undo_method(EditorNode::get_singleton()->get_edited_scene(), "remove_meta", "_edit_vertical_guides_");
|
||||
} else {
|
||||
undo_redo->add_undo_method(EditorNode::get_singleton()->get_edited_scene(), "set_meta", "_edit_vertical_guides_", prev_vguides);
|
||||
}
|
||||
if (prev_hguides.is_empty()) {
|
||||
undo_redo->add_undo_method(EditorNode::get_singleton()->get_edited_scene(), "remove_meta", "_edit_horizontal_guides_");
|
||||
} else {
|
||||
undo_redo->add_undo_method(EditorNode::get_singleton()->get_edited_scene(), "set_meta", "_edit_horizontal_guides_", prev_hguides);
|
||||
}
|
||||
undo_redo->add_undo_method(viewport, "queue_redraw");
|
||||
undo_redo->commit_action();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue