You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Unify usage of undo_redo in editor
This commit is contained in:
@@ -32,8 +32,10 @@
|
||||
|
||||
#include "core/input/input_event.h"
|
||||
#include "core/math/geometry_2d.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_scale.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_undo_redo_manager.h"
|
||||
#include "editor/plugins/canvas_item_editor_plugin.h"
|
||||
#include "scene/2d/skeleton_2d.h"
|
||||
#include "scene/gui/menu_button.h"
|
||||
@@ -150,6 +152,7 @@ void Polygon2DEditor::_sync_bones() {
|
||||
|
||||
Array new_bones = node->call("_get_bones");
|
||||
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
undo_redo->create_action(TTR("Sync Bones"));
|
||||
undo_redo->add_do_method(node, "_set_bones", new_bones);
|
||||
undo_redo->add_undo_method(node, "_set_bones", prev_bones);
|
||||
@@ -279,6 +282,7 @@ void Polygon2DEditor::_uv_edit_popup_hide() {
|
||||
}
|
||||
|
||||
void Polygon2DEditor::_menu_option(int p_option) {
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
switch (p_option) {
|
||||
case MODE_EDIT_UV: {
|
||||
if (node->get_texture().is_null()) {
|
||||
@@ -391,6 +395,7 @@ void Polygon2DEditor::_update_polygon_editing_state() {
|
||||
|
||||
void Polygon2DEditor::_commit_action() {
|
||||
// Makes that undo/redoing actions made outside of the UV editor still affect its polygon.
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
undo_redo->add_do_method(uv_edit_draw, "queue_redraw");
|
||||
undo_redo->add_undo_method(uv_edit_draw, "queue_redraw");
|
||||
undo_redo->add_do_method(CanvasItemEditor::get_singleton(), "update_viewport");
|
||||
@@ -458,8 +463,9 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
|
||||
mtx.columns[2] = -uv_draw_ofs;
|
||||
mtx.scale_basis(Vector2(uv_draw_zoom, uv_draw_zoom));
|
||||
|
||||
Ref<InputEventMouseButton> mb = p_input;
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
|
||||
Ref<InputEventMouseButton> mb = p_input;
|
||||
if (mb.is_valid()) {
|
||||
if (mb->get_button_index() == MouseButton::LEFT) {
|
||||
if (mb->is_pressed()) {
|
||||
|
||||
Reference in New Issue
Block a user