diff options
| author | Juan Linietsky | 2017-05-20 12:38:03 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2017-05-20 17:05:38 -0300 |
| commit | 5b3709d3096df737b8bb2344446be818b0389bfe (patch) | |
| tree | 649a0989b1494f3c4687d59e503310f4e6bbeb40 /editor/plugins/tile_map_editor_plugin.cpp | |
| parent | 93f9a83062dbe74474a4a7928758c5cf5588238e (diff) | |
| download | godot-5b3709d3096df737b8bb2344446be818b0389bfe.tar.gz godot-5b3709d3096df737b8bb2344446be818b0389bfe.tar.zst godot-5b3709d3096df737b8bb2344446be818b0389bfe.zip | |
Diffstat (limited to 'editor/plugins/tile_map_editor_plugin.cpp')
| -rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 603 |
1 files changed, 300 insertions, 303 deletions
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 9f99a9b97..9f7a41b8b 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -179,14 +179,16 @@ void TileMapEditor::_text_changed(const String &p_text) { _update_palette(); } -void TileMapEditor::_sbox_input(const InputEvent &p_ie) { +void TileMapEditor::_sbox_input(const Ref<InputEvent> &p_ie) { - if (p_ie.type == InputEvent::KEY && (p_ie.key.scancode == KEY_UP || - p_ie.key.scancode == KEY_DOWN || - p_ie.key.scancode == KEY_PAGEUP || - p_ie.key.scancode == KEY_PAGEDOWN)) { + Ref<InputEventKey> k = p_ie; - palette->call("_gui_input", p_ie); + if (k.is_valid() && (k->get_scancode() == KEY_UP || + k->get_scancode() == KEY_DOWN || + k->get_scancode() == KEY_PAGEUP || + k->get_scancode() == KEY_PAGEDOWN)) { + + palette->call("_gui_input", k); search_box->accept_event(); } } @@ -622,7 +624,7 @@ static inline Vector<Point2i> line(int x0, int x1, int y0, int y1) { return points; } -bool TileMapEditor::forward_gui_input(const InputEvent &p_event) { +bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { if (!node || !node->get_tileset().is_valid() || !node->is_visible_in_tree()) return false; @@ -630,464 +632,459 @@ bool TileMapEditor::forward_gui_input(const InputEvent &p_event) { Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * node->get_global_transform(); Transform2D xform_inv = xform.affine_inverse(); - switch (p_event.type) { - - case InputEvent::MOUSE_BUTTON: { - - const InputEventMouseButton &mb = p_event.mouse_button; - - if (mb.button_index == BUTTON_LEFT) { + Ref<InputEventMouseButton> mb = p_event; - if (mb.pressed) { + if (mb.is_valid()) { + if (mb->get_button_index() == BUTTON_LEFT) { - if (Input::get_singleton()->is_key_pressed(KEY_SPACE)) - return false; //drag + if (mb->is_pressed()) { - if (tool == TOOL_NONE) { + if (Input::get_singleton()->is_key_pressed(KEY_SPACE)) + return false; //drag - if (mb.mod.shift) { + if (tool == TOOL_NONE) { - if (mb.mod.control) - tool = TOOL_RECTANGLE_PAINT; - else - tool = TOOL_LINE_PAINT; + if (mb->get_shift()) { - selection_active = false; - rectangle_begin = over_tile; + if (mb->get_control()) + tool = TOOL_RECTANGLE_PAINT; + else + tool = TOOL_LINE_PAINT; - return true; - } + selection_active = false; + rectangle_begin = over_tile; - if (mb.mod.control) { + return true; + } - tool = TOOL_PICKING; - _pick_tile(over_tile); + if (mb->get_control()) { - return true; - } + tool = TOOL_PICKING; + _pick_tile(over_tile); - tool = TOOL_PAINTING; + return true; } - if (tool == TOOL_PAINTING) { - - int id = get_selected_tile(); + tool = TOOL_PAINTING; + } - if (id != TileMap::INVALID_CELL) { + if (tool == TOOL_PAINTING) { - tool = TOOL_PAINTING; + int id = get_selected_tile(); - paint_undo.clear(); - paint_undo[over_tile] = _get_op_from_cell(over_tile); + if (id != TileMap::INVALID_CELL) { - _set_cell(over_tile, id, flip_h, flip_v, transpose); - } - } else if (tool == TOOL_PICKING) { + tool = TOOL_PAINTING; - _pick_tile(over_tile); - } else if (tool == TOOL_SELECTING) { + paint_undo.clear(); + paint_undo[over_tile] = _get_op_from_cell(over_tile); - selection_active = true; - rectangle_begin = over_tile; + _set_cell(over_tile, id, flip_h, flip_v, transpose); } + } else if (tool == TOOL_PICKING) { - return true; + _pick_tile(over_tile); + } else if (tool == TOOL_SELECTING) { - } else { + selection_active = true; + rectangle_begin = over_tile; + } + + return true; - if (tool != TOOL_NONE) { + } else { - if (tool == TOOL_PAINTING) { + if (tool != TOOL_NONE) { - int id = get_selected_tile(); + if (tool == TOOL_PAINTING) { - if (id != TileMap::INVALID_CELL && paint_undo.size()) { + int id = get_selected_tile(); - undo_redo->create_action(TTR("Paint TileMap")); - for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) { + if (id != TileMap::INVALID_CELL && paint_undo.size()) { - Point2 p = E->key(); - undo_redo->add_do_method(node, "set_cellv", p, id, flip_h, flip_v, transpose); - undo_redo->add_undo_method(node, "set_cellv", p, E->get().idx, E->get().xf, E->get().yf, E->get().tr); - } - undo_redo->commit_action(); + undo_redo->create_action(TTR("Paint TileMap")); + for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) { - paint_undo.clear(); + Point2 p = E->key(); + undo_redo->add_do_method(node, "set_cellv", p, id, flip_h, flip_v, transpose); + undo_redo->add_undo_method(node, "set_cellv", p, E->get().idx, E->get().xf, E->get().yf, E->get().tr); } - } else if (tool == TOOL_LINE_PAINT) { - - int id = get_selected_tile(); + undo_redo->commit_action(); - if (id != TileMap::INVALID_CELL) { + paint_undo.clear(); + } + } else if (tool == TOOL_LINE_PAINT) { - undo_redo->create_action("Line Draw"); - for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) { + int id = get_selected_tile(); - _set_cell(E->key(), id, flip_h, flip_v, transpose, true); - } - undo_redo->commit_action(); + if (id != TileMap::INVALID_CELL) { - paint_undo.clear(); + undo_redo->create_action("Line Draw"); + for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) { - canvas_item_editor->update(); + _set_cell(E->key(), id, flip_h, flip_v, transpose, true); } - } else if (tool == TOOL_RECTANGLE_PAINT) { - - int id = get_selected_tile(); - - if (id != TileMap::INVALID_CELL) { + undo_redo->commit_action(); - undo_redo->create_action("Rectangle Paint"); - for (int i = rectangle.pos.y; i <= rectangle.pos.y + rectangle.size.y; i++) { - for (int j = rectangle.pos.x; j <= rectangle.pos.x + rectangle.size.x; j++) { + paint_undo.clear(); - _set_cell(Point2i(j, i), id, flip_h, flip_v, transpose, true); - } - } - undo_redo->commit_action(); + canvas_item_editor->update(); + } + } else if (tool == TOOL_RECTANGLE_PAINT) { - canvas_item_editor->update(); - } - } else if (tool == TOOL_DUPLICATING) { + int id = get_selected_tile(); - Point2 ofs = over_tile - rectangle.pos; + if (id != TileMap::INVALID_CELL) { - undo_redo->create_action(TTR("Duplicate")); - for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) { + undo_redo->create_action("Rectangle Paint"); + for (int i = rectangle.pos.y; i <= rectangle.pos.y + rectangle.size.y; i++) { + for (int j = rectangle.pos.x; j <= rectangle.pos.x + rectangle.size.x; j++) { - _set_cell(E->get().pos + ofs, E->get().cell, E->get().flip_h, E->get().flip_v, E->get().transpose, true); + _set_cell(Point2i(j, i), id, flip_h, flip_v, transpose, true); + } } undo_redo->commit_action(); - copydata.clear(); - canvas_item_editor->update(); + } + } else if (tool == TOOL_DUPLICATING) { - } else if (tool == TOOL_SELECTING) { + Point2 ofs = over_tile - rectangle.pos; - canvas_item_editor->update(); + undo_redo->create_action(TTR("Duplicate")); + for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) { - } else if (tool == TOOL_BUCKET) { + _set_cell(E->get().pos + ofs, E->get().cell, E->get().flip_h, E->get().flip_v, E->get().transpose, true); + } + undo_redo->commit_action(); - Dictionary pop; - pop["id"] = node->get_cell(over_tile.x, over_tile.y); - pop["flip_h"] = node->is_cell_x_flipped(over_tile.x, over_tile.y); - pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y); - pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y); + copydata.clear(); + + canvas_item_editor->update(); - PoolVector<Vector2> points = _bucket_fill(over_tile); + } else if (tool == TOOL_SELECTING) { - if (points.size() == 0) - return false; + canvas_item_editor->update(); - Dictionary op; - op["id"] = get_selected_tile(); - op["flip_h"] = flip_h; - op["flip_v"] = flip_v; - op["transpose"] = transpose; + } else if (tool == TOOL_BUCKET) { - undo_redo->create_action("Bucket Fill"); + Dictionary pop; + pop["id"] = node->get_cell(over_tile.x, over_tile.y); + pop["flip_h"] = node->is_cell_x_flipped(over_tile.x, over_tile.y); + pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y); + pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y); - undo_redo->add_do_method(this, "_fill_points", points, op); - undo_redo->add_undo_method(this, "_fill_points", points, pop); + PoolVector<Vector2> points = _bucket_fill(over_tile); - undo_redo->commit_action(); - } + if (points.size() == 0) + return false; - tool = TOOL_NONE; + Dictionary op; + op["id"] = get_selected_tile(); + op["flip_h"] = flip_h; + op["flip_v"] = flip_v; + op["transpose"] = transpose; - return true; + undo_redo->create_action("Bucket Fill"); + + undo_redo->add_do_method(this, "_fill_points", points, op); + undo_redo->add_undo_method(this, "_fill_points", points, pop); + + undo_redo->commit_action(); } - } - } else if (mb.button_index == BUTTON_RIGHT) { - if (mb.pressed) { + tool = TOOL_NONE; - if (tool == TOOL_SELECTING || selection_active) { + return true; + } + } + } else if (mb->get_button_index() == BUTTON_RIGHT) { - tool = TOOL_NONE; - selection_active = false; + if (mb->is_pressed()) { - canvas_item_editor->update(); + if (tool == TOOL_SELECTING || selection_active) { - return true; - } + tool = TOOL_NONE; + selection_active = false; - if (tool == TOOL_DUPLICATING) { + canvas_item_editor->update(); - tool = TOOL_NONE; - copydata.clear(); + return true; + } - canvas_item_editor->update(); + if (tool == TOOL_DUPLICATING) { - return true; - } + tool = TOOL_NONE; + copydata.clear(); - if (tool == TOOL_NONE) { + canvas_item_editor->update(); - paint_undo.clear(); + return true; + } - Point2 local = node->world_to_map(xform_inv.xform(Point2(mb.x, mb.y))); + if (tool == TOOL_NONE) { - if (mb.mod.shift) { + paint_undo.clear(); - if (mb.mod.control) - tool = TOOL_RECTANGLE_ERASE; - else - tool = TOOL_LINE_ERASE; + Point2 local = node->world_to_map(xform_inv.xform(mb->get_pos())); - selection_active = false; - rectangle_begin = local; - } else { + if (mb->get_shift()) { - tool = TOOL_ERASING; + if (mb->get_control()) + tool = TOOL_RECTANGLE_ERASE; + else + tool = TOOL_LINE_ERASE; - paint_undo[local] = _get_op_from_cell(local); - _set_cell(local, TileMap::INVALID_CELL); - } + selection_active = false; + rectangle_begin = local; + } else { - return true; + tool = TOOL_ERASING; + + paint_undo[local] = _get_op_from_cell(local); + _set_cell(local, TileMap::INVALID_CELL); } - } else { - if (tool == TOOL_ERASING || tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) { + return true; + } - if (paint_undo.size()) { - undo_redo->create_action(TTR("Erase TileMap")); - for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) { + } else { + if (tool == TOOL_ERASING || tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) { - Point2 p = E->key(); - undo_redo->add_do_method(node, "set_cellv", p, TileMap::INVALID_CELL, false, false, false); - undo_redo->add_undo_method(node, "set_cellv", p, E->get().idx, E->get().xf, E->get().yf, E->get().tr); - } + if (paint_undo.size()) { + undo_redo->create_action(TTR("Erase TileMap")); + for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) { - undo_redo->commit_action(); - paint_undo.clear(); + Point2 p = E->key(); + undo_redo->add_do_method(node, "set_cellv", p, TileMap::INVALID_CELL, false, false, false); + undo_redo->add_undo_method(node, "set_cellv", p, E->get().idx, E->get().xf, E->get().yf, E->get().tr); } - if (tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) { - canvas_item_editor->update(); - } + undo_redo->commit_action(); + paint_undo.clear(); + } - tool = TOOL_NONE; + if (tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) { + canvas_item_editor->update(); + } - return true; + tool = TOOL_NONE; - } else if (tool == TOOL_BUCKET) { + return true; - Dictionary pop; - pop["id"] = node->get_cell(over_tile.x, over_tile.y); - pop["flip_h"] = node->is_cell_x_flipped(over_tile.x, over_tile.y); - pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y); - pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y); + } else if (tool == TOOL_BUCKET) { - PoolVector<Vector2> points = _bucket_fill(over_tile, true); + Dictionary pop; + pop["id"] = node->get_cell(over_tile.x, over_tile.y); + pop["flip_h"] = node->is_cell_x_flipped(over_tile.x, over_tile.y); + pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y); + pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y); - if (points.size() == 0) - return false; + PoolVector<Vector2> points = _bucket_fill(over_tile, true); - undo_redo->create_action("Bucket Fill"); + if (points.size() == 0) + return false; - undo_redo->add_do_method(this, "_erase_points", points); - undo_redo->add_undo_method(this, "_fill_points", points, pop); + undo_redo->create_action("Bucket Fill"); - undo_redo->commit_action(); - } + undo_redo->add_do_method(this, "_erase_points", points); + undo_redo->add_undo_method(this, "_fill_points", points, pop); + + undo_redo->commit_action(); } } - } break; - case InputEvent::MOUSE_MOTION: { + } + } - const InputEventMouseMotion &mm = p_event.mouse_motion; + Ref<InputEventMouseMotion> mm = p_event; - Point2i new_over_tile = node->world_to_map(xform_inv.xform(Point2(mm.x, mm.y))); + if (mm.is_valid()) { - if (new_over_tile != over_tile) { + Point2i new_over_tile = node->world_to_map(xform_inv.xform(mm->get_pos())); - over_tile = new_over_tile; - canvas_item_editor->update(); - } + if (new_over_tile != over_tile) { - int tile_under = node->get_cell(over_tile.x, over_tile.y); - String tile_name = "none"; + over_tile = new_over_tile; + canvas_item_editor->update(); + } - if (node->get_tileset()->has_tile(tile_under)) - tile_name = node->get_tileset()->tile_get_name(tile_under); - tile_info->set_text(String::num(over_tile.x) + ", " + String::num(over_tile.y) + " [" + tile_name + "]"); + int tile_under = node->get_cell(over_tile.x, over_tile.y); + String tile_name = "none"; - if (tool == TOOL_PAINTING) { + if (node->get_tileset()->has_tile(tile_under)) + tile_name = node->get_tileset()->tile_get_name(tile_under); + tile_info->set_text(String::num(over_tile.x) + ", " + String::num(over_tile.y) + " [" + tile_name + "]"); - int id = get_selected_tile(); - if (id != TileMap::INVALID_CELL) { + if (tool == TOOL_PAINTING) { - if (!paint_undo.has(over_tile)) { - paint_undo[over_tile] = _get_op_from_cell(over_tile); - } - - _set_cell(over_tile, id, flip_h, flip_v, transpose); + int id = get_selected_tile(); + if (id != TileMap::INVALID_CELL) { - return true; + if (!paint_undo.has(over_tile)) { + paint_undo[over_tile] = _get_op_from_cell(over_tile); } - } - if (tool == TOOL_SELECTING) { - - _select(rectangle_begin, over_tile); + _set_cell(over_tile, id, flip_h, flip_v, transpose); return true; } + } - if (tool == TOOL_LINE_PAINT || tool == TOOL_LINE_ERASE) { + if (tool == TOOL_SELECTING) { - int id = get_selected_tile(); - bool erasing = (tool == TOOL_LINE_ERASE); + _select(rectangle_begin, over_tile); - if (erasing && paint_undo.size()) { + return true; + } - for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) { + if (tool == TOOL_LINE_PAINT || tool == TOOL_LINE_ERASE) { - _set_cell(E->key(), E->get().idx, E->get().xf, E->get().yf, E->get().tr); - } - } + int id = get_selected_tile(); + bool erasing = (tool == TOOL_LINE_ERASE); - paint_undo.clear(); + if (erasing && paint_undo.size()) { + + for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) { + + _set_cell(E->key(), E->get().idx, E->get().xf, E->get().yf, E->get().tr); + } + } - if (id != TileMap::INVALID_CELL) { + paint_undo.clear(); - Vector<Point2i> points = line(rectangle_begin.x, over_tile.x, rectangle_begin.y, over_tile.y); + if (id != TileMap::INVALID_CELL) { - for (int i = 0; i < points.size(); i++) { + Vector<Point2i> points = line(rectangle_begin.x, over_tile.x, rectangle_begin.y, over_tile.y); - paint_undo[points[i]] = _get_op_from_cell(points[i]); + for (int i = 0; i < points.size(); i++) { - if (erasing) - _set_cell(points[i], TileMap::INVALID_CELL); - } + paint_undo[points[i]] = _get_op_from_cell(points[i]); - canvas_item_editor->update(); + if (erasing) + _set_cell(points[i], TileMap::INVALID_CELL); } - return true; + canvas_item_editor->update(); } - if (tool == TOOL_RECTANGLE_PAINT || tool == TOOL_RECTANGLE_ERASE) { - _select(rectangle_begin, over_tile); + return true; + } + if (tool == TOOL_RECTANGLE_PAINT || tool == TOOL_RECTANGLE_ERASE) { - if (tool == TOOL_RECTANGLE_ERASE) { + _select(rectangle_begin, over_tile); - if (paint_undo.size()) { + if (tool == TOOL_RECTANGLE_ERASE) { - for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) { + if (paint_undo.size()) { - _set_cell(E->key(), E->get().idx, E->get().xf, E->get().yf, E->get().tr); - } + for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) { + + _set_cell(E->key(), E->get().idx, E->get().xf, E->get().yf, E->get().tr); } + } - paint_undo.clear(); + paint_undo.clear(); - for (int i = rectangle.pos.y; i <= rectangle.pos.y + rectangle.size.y; i++) { - for (int j = rectangle.pos.x; j <= rectangle.pos.x + rectangle.size.x; j++) { + for (int i = rectangle.pos.y; i <= rectangle.pos.y + rectangle.size.y; i++) { + for (int j = rectangle.pos.x; j <= rectangle.pos.x + rectangle.size.x; j++) { - Point2i tile = Point2i(j, i); - paint_undo[tile] = _get_op_from_cell(tile); + Point2i tile = Point2i(j, i); + paint_undo[tile] = _get_op_from_cell(tile); - _set_cell(tile, TileMap::INVALID_CELL); - } + _set_cell(tile, TileMap::INVALID_CELL); } } - - return true; } - if (tool == TOOL_ERASING) { - - if (!paint_undo.has(over_tile)) { - paint_undo[over_tile] = _get_op_from_cell(over_tile); - } - _set_cell(over_tile, TileMap::INVALID_CELL); + return true; + } + if (tool == TOOL_ERASING) { - return true; + if (!paint_undo.has(over_tile)) { + paint_undo[over_tile] = _get_op_from_cell(over_tile); } - if (tool == TOOL_PICKING && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) { - _pick_tile(over_tile); + _set_cell(over_tile, TileMap::INVALID_CELL); - return true; - } - } break; - case InputEvent::KEY: { + return true; + } + if (tool == TOOL_PICKING && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) { - const InputEventKey &k = p_event.key; + _pick_tile(over_tile); - if (!k.pressed) - break; + return true; + } + } - if (k.scancode == KEY_ESCAPE) { + Ref<InputEventKey> k = p_event; - if (tool == TOOL_DUPLICATING) - copydata.clear(); - else if (tool == TOOL_SELECTING || selection_active) - selection_active = false; + if (k.is_valid() && k->is_pressed()) { - tool = TOOL_NONE; + if (k->get_scancode() == KEY_ESCAPE) { - canvas_item_editor->update(); + if (tool == TOOL_DUPLICATING) + copydata.clear(); + else if (tool == TOOL_SELECTING || selection_active) + selection_active = false; - return true; - } + tool = TOOL_NONE; - if (tool != TOOL_NONE || !mouse_over) - return false; + canvas_item_editor->update(); - if (ED_IS_SHORTCUT("tile_map_editor/erase_selection", p_event)) { - _menu_option(OPTION_ERASE_SELECTION); + return true; + } - return true; - } - if (ED_IS_SHORTCUT("tile_map_editor/select", p_event)) { - tool = TOOL_SELECTING; - selection_active = false; + if (tool != TOOL_NONE || !mouse_over) + return false; - canvas_item_editor->update(); + if (ED_IS_SHORTCUT("tile_map_editor/erase_selection", p_event)) { + _menu_option(OPTION_ERASE_SELECTION); - return true; - } - if (ED_IS_SHORTCUT("tile_map_editor/duplicate_selection", p_event)) { - _update_copydata(); + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/select", p_event)) { + tool = TOOL_SELECTING; + selection_active = false; - if (selection_active) { - tool = TOOL_DUPLICATING; + canvas_item_editor->update(); - canvas_item_editor->update(); + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/duplicate_selection", p_event)) { + _update_copydata(); - return true; - } - } - if (ED_IS_SHORTCUT("tile_map_editor/find_tile", p_event)) { - search_box->select_all(); - search_box->grab_focus(); + if (selection_active) { + tool = TOOL_DUPLICATING; - return true; - } - if (ED_IS_SHORTCUT("tile_map_editor/mirror_x", p_event)) { - flip_h = !flip_h; - mirror_x->set_pressed(flip_h); - canvas_item_editor->update(); - return true; - } - if (ED_IS_SHORTCUT("tile_map_editor/mirror_y", p_event)) { - flip_v = !flip_v; - mirror_y->set_pressed(flip_v); - canvas_item_editor->update(); - return true; - } - if (ED_IS_SHORTCUT("tile_map_editor/transpose", p_event)) { - transpose = !transpose; - transp->set_pressed(transpose); canvas_item_editor->update(); + return true; } - } break; + } + if (ED_IS_SHORTCUT("tile_map_editor/find_tile", p_event)) { + search_box->select_all(); + search_box->grab_focus(); + + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/mirror_x", p_event)) { + flip_h = !flip_h; + mirror_x->set_pressed(flip_h); + canvas_item_editor->update(); + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/mirror_y", p_event)) { + flip_v = !flip_v; + mirror_y->set_pressed(flip_v); + canvas_item_editor->update(); + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/transpose", p_event)) { + transpose = !transpose; + transp->set_pressed(transpose); + canvas_item_editor->update(); + return true; + } } return false; |
