You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Cleanup remaining EditorUndoRedoManager usages
This commit is contained in:
@@ -272,6 +272,7 @@ void TileMapEditorTilesPlugin::_patterns_item_list_gui_input(const Ref<InputEven
|
||||
if (ED_IS_SHORTCUT("tiles_editor/paste", p_event) && p_event->is_pressed() && !p_event->is_echo()) {
|
||||
select_last_pattern = true;
|
||||
int new_pattern_index = tile_set->get_patterns_count();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
undo_redo->create_action(TTR("Add TileSet pattern"));
|
||||
undo_redo->add_do_method(*tile_set, "add_pattern", tile_map_clipboard, new_pattern_index);
|
||||
undo_redo->add_undo_method(*tile_set, "remove_pattern", new_pattern_index);
|
||||
@@ -281,6 +282,7 @@ void TileMapEditorTilesPlugin::_patterns_item_list_gui_input(const Ref<InputEven
|
||||
|
||||
if (ED_IS_SHORTCUT("tiles_editor/delete", p_event) && p_event->is_pressed() && !p_event->is_echo()) {
|
||||
Vector<int> selected = patterns_item_list->get_selected_items();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
undo_redo->create_action(TTR("Remove TileSet patterns"));
|
||||
for (int i = 0; i < selected.size(); i++) {
|
||||
int pattern_index = selected[i];
|
||||
@@ -511,6 +513,7 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
|
||||
if (ED_IS_SHORTCUT("tiles_editor/cut", p_event)) {
|
||||
// Delete selected tiles.
|
||||
if (!tile_map_selection.is_empty()) {
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
undo_redo->create_action(TTR("Delete tiles"));
|
||||
for (const Vector2i &E : tile_map_selection) {
|
||||
undo_redo->add_do_method(tile_map, "set_cell", tile_map_layer, E, TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
|
||||
@@ -542,6 +545,7 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
|
||||
if (ED_IS_SHORTCUT("tiles_editor/delete", p_event)) {
|
||||
// Delete selected tiles.
|
||||
if (!tile_map_selection.is_empty()) {
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
undo_redo->create_action(TTR("Delete tiles"));
|
||||
for (const Vector2i &E : tile_map_selection) {
|
||||
undo_redo->add_do_method(tile_map, "set_cell", tile_map_layer, E, TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
|
||||
@@ -1233,6 +1237,7 @@ void TileMapEditorTilesPlugin::_stop_dragging() {
|
||||
Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * tile_map->get_global_transform();
|
||||
Vector2 mpos = xform.affine_inverse().xform(CanvasItemEditor::get_singleton()->get_viewport_control()->get_local_mouse_position());
|
||||
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
switch (drag_type) {
|
||||
case DRAG_TYPE_SELECT: {
|
||||
undo_redo->create_action(TTR("Change selection"));
|
||||
@@ -2012,8 +2017,6 @@ void TileMapEditorTilesPlugin::_bind_methods() {
|
||||
}
|
||||
|
||||
TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
|
||||
undo_redo = EditorNode::get_undo_redo();
|
||||
|
||||
CanvasItemEditor::get_singleton()
|
||||
->get_viewport_control()
|
||||
->connect("mouse_exited", callable_mp(this, &TileMapEditorTilesPlugin::_mouse_exited_viewport));
|
||||
@@ -2634,6 +2637,7 @@ void TileMapEditorTerrainsPlugin::_stop_dragging() {
|
||||
Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * tile_map->get_global_transform();
|
||||
Vector2 mpos = xform.affine_inverse().xform(CanvasItemEditor::get_singleton()->get_viewport_control()->get_local_mouse_position());
|
||||
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
switch (drag_type) {
|
||||
case DRAG_TYPE_PICK: {
|
||||
Vector2i coords = tile_map->local_to_map(mpos);
|
||||
@@ -3304,8 +3308,6 @@ void TileMapEditorTerrainsPlugin::edit(ObjectID p_tile_map_id, int p_tile_map_la
|
||||
}
|
||||
|
||||
TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() {
|
||||
undo_redo = EditorNode::get_undo_redo();
|
||||
|
||||
main_vbox_container = memnew(VBoxContainer);
|
||||
main_vbox_container->connect("tree_entered", callable_mp(this, &TileMapEditorTerrainsPlugin::_update_theme));
|
||||
main_vbox_container->connect("theme_changed", callable_mp(this, &TileMapEditorTerrainsPlugin::_update_theme));
|
||||
@@ -3479,6 +3481,7 @@ void TileMapEditor::_advanced_menu_button_id_pressed(int p_id) {
|
||||
}
|
||||
|
||||
if (p_id == 0) { // Replace Tile Proxies
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo();
|
||||
undo_redo->create_action(TTR("Replace Tiles with Proxies"));
|
||||
for (int layer_index = 0; layer_index < tile_map->get_layers_count(); layer_index++) {
|
||||
TypedArray<Vector2i> used_cells = tile_map->get_used_cells(layer_index);
|
||||
@@ -3952,8 +3955,6 @@ void TileMapEditor::edit(TileMap *p_tile_map) {
|
||||
}
|
||||
|
||||
TileMapEditor::TileMapEditor() {
|
||||
undo_redo = EditorNode::get_undo_redo();
|
||||
|
||||
set_process_internal(true);
|
||||
|
||||
// Shortcuts.
|
||||
|
||||
Reference in New Issue
Block a user