Fixed errors on startup.

This commit is contained in:
Relintai 2024-03-07 21:38:08 +01:00
parent f78dd78dc3
commit 12a6e10ddd
9 changed files with 100 additions and 100 deletions

View File

@ -347,7 +347,7 @@ void LayeredTileAtlasView::_draw_base_tiles_texture_grid() {
void LayeredTileAtlasView::_draw_base_tiles_shape_grid() { void LayeredTileAtlasView::_draw_base_tiles_shape_grid() {
// Draw the shapes. // Draw the shapes.
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
Vector2i tile_shape_size = tile_set->get_tile_size(); Vector2i tile_shape_size = tile_set->get_tile_size();
for (int i = 0; i < tile_set_atlas_source->get_tiles_count(); i++) { for (int i = 0; i < tile_set_atlas_source->get_tiles_count(); i++) {
Vector2i tile_id = tile_set_atlas_source->get_tile_id(i); Vector2i tile_id = tile_set_atlas_source->get_tile_id(i);
@ -572,7 +572,7 @@ void LayeredTileAtlasView::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED:
case NOTIFICATION_ENTER_TREE: { case NOTIFICATION_ENTER_TREE: {
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); //panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning")));
} break; } break;
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {

View File

@ -144,9 +144,9 @@ void DummyObject::clear_dummy_properties() {
void GenericTilePolygonEditor::_base_control_draw() { void GenericTilePolygonEditor::_base_control_draw() {
ERR_FAIL_COND(!tile_set.is_valid()); ERR_FAIL_COND(!tile_set.is_valid());
real_t grab_threshold = EDITOR_GET("editors/polygon_editor/point_grab_radius"); real_t grab_threshold = EDITOR_GET("editors/poly_editor/point_grab_radius");
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
const Ref<Texture> handle = get_theme_icon("EditorPathSharpHandle", "EditorIcons"); const Ref<Texture> handle = get_theme_icon("EditorPathSharpHandle", "EditorIcons");
const Ref<Texture> add_handle = get_theme_icon("EditorHandleAdd", "EditorIcons"); const Ref<Texture> add_handle = get_theme_icon("EditorHandleAdd", "EditorIcons");
const Ref<StyleBox> focus_stylebox = get_theme_stylebox("Focus", "EditorStyles"); const Ref<StyleBox> focus_stylebox = get_theme_stylebox("Focus", "EditorStyles");
@ -392,7 +392,7 @@ void GenericTilePolygonEditor::_advanced_menu_item_pressed(int p_item_pressed) {
} }
void GenericTilePolygonEditor::_grab_polygon_point(Vector2 p_pos, const Transform2D &p_polygon_xform, int &r_polygon_index, int &r_point_index) { void GenericTilePolygonEditor::_grab_polygon_point(Vector2 p_pos, const Transform2D &p_polygon_xform, int &r_polygon_index, int &r_point_index) {
const real_t grab_threshold = EDITOR_GET("editors/polygon_editor/point_grab_radius"); const real_t grab_threshold = EDITOR_GET("editors/poly_editor/point_grab_radius");
r_polygon_index = -1; r_polygon_index = -1;
r_point_index = -1; r_point_index = -1;
float closest_distance = grab_threshold + 1.0; float closest_distance = grab_threshold + 1.0;
@ -410,7 +410,7 @@ void GenericTilePolygonEditor::_grab_polygon_point(Vector2 p_pos, const Transfor
} }
void GenericTilePolygonEditor::_grab_polygon_segment_point(Vector2 p_pos, const Transform2D &p_polygon_xform, int &r_polygon_index, int &r_segment_index, Vector2 &r_point) { void GenericTilePolygonEditor::_grab_polygon_segment_point(Vector2 p_pos, const Transform2D &p_polygon_xform, int &r_polygon_index, int &r_segment_index, Vector2 &r_point) {
const real_t grab_threshold = EDITOR_GET("editors/polygon_editor/point_grab_radius"); const real_t grab_threshold = EDITOR_GET("editors/poly_editor/point_grab_radius");
Point2 point = p_polygon_xform.affine_inverse().xform(p_pos); Point2 point = p_polygon_xform.affine_inverse().xform(p_pos);
r_polygon_index = -1; r_polygon_index = -1;
@ -487,7 +487,7 @@ void GenericTilePolygonEditor::_snap_point(Point2 &r_point) {
void GenericTilePolygonEditor::_base_control_gui_input(Ref<InputEvent> p_event) { void GenericTilePolygonEditor::_base_control_gui_input(Ref<InputEvent> p_event) {
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
real_t grab_threshold = EDITOR_GET("editors/polygon_editor/point_grab_radius"); real_t grab_threshold = EDITOR_GET("editors/poly_editor/point_grab_radius");
hovered_polygon_index = -1; hovered_polygon_index = -1;
hovered_point_index = -1; hovered_point_index = -1;
@ -1029,7 +1029,7 @@ void TileDataDefaultEditor::_setup_undo_redo_action(LayeredTileSetAtlasSource *p
void TileDataDefaultEditor::forward_draw_over_atlas(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) { void TileDataDefaultEditor::forward_draw_over_atlas(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) {
if (drag_type == DRAG_TYPE_PAINT_RECT) { if (drag_type == DRAG_TYPE_PAINT_RECT) {
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
p_canvas_item->draw_set_transform_matrix(p_transform); p_canvas_item->draw_set_transform_matrix(p_transform);
@ -1267,7 +1267,7 @@ void TileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2
Color color = Color(1, 1, 1); Color color = Color(1, 1, 1);
if (p_selected) { if (p_selected) {
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
selection_color.set_v(0.9); selection_color.set_v(0.9);
color = selection_color; color = selection_color;
@ -1350,7 +1350,7 @@ TileDataDefaultEditor::TileDataDefaultEditor() {
picker_button = memnew(Button); picker_button = memnew(Button);
picker_button->set_theme_type_variation("FlatButton"); picker_button->set_theme_type_variation("FlatButton");
picker_button->set_toggle_mode(true); picker_button->set_toggle_mode(true);
picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", TTR("Picker"), KEY_P)); picker_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/picker", TTR("Picker"), KEY_P));
toolbar->add_child(picker_button); toolbar->add_child(picker_button);
} }
@ -1366,7 +1366,7 @@ void TileDataTextureOriginEditor::draw_over_tile(CanvasItem *p_canvas_item, Tran
Vector2i tile_set_tile_size = tile_set->get_tile_size(); Vector2i tile_set_tile_size = tile_set->get_tile_size();
Color color = Color(1.0, 1.0, 1.0); Color color = Color(1.0, 1.0, 1.0);
if (p_selected) { if (p_selected) {
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
color = selection_color; color = selection_color;
} }
@ -1407,7 +1407,7 @@ void TileDataPositionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform
Color color = Color(1.0, 1.0, 1.0); Color color = Color(1.0, 1.0, 1.0);
if (p_selected) { if (p_selected) {
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
color = selection_color; color = selection_color;
} }
@ -1421,7 +1421,7 @@ void TileDataYSortEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D
Color color = Color(1.0, 1.0, 1.0); Color color = Color(1.0, 1.0, 1.0);
if (p_selected) { if (p_selected) {
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
color = selection_color; color = selection_color;
} }
@ -1445,7 +1445,7 @@ void TileDataOcclusionShapeEditor::draw_over_tile(CanvasItem *p_canvas_item, Tra
LayeredTileData *tile_data = _get_tile_data(p_cell); LayeredTileData *tile_data = _get_tile_data(p_cell);
ERR_FAIL_NULL(tile_data); ERR_FAIL_NULL(tile_data);
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
Color color = grid_color.darkened(0.2); Color color = grid_color.darkened(0.2);
if (p_selected) { if (p_selected) {
@ -1777,7 +1777,7 @@ void TileDataCollisionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transfor
// Draw all shapes. // Draw all shapes.
Vector<Color> color; Vector<Color> color;
if (p_selected) { if (p_selected) {
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
selection_color.a = 0.7; selection_color.a = 0.7;
color.push_back(selection_color); color.push_back(selection_color);
@ -1968,7 +1968,7 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(LayeredTileAtlasView *p_til
if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET_RECT) { if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET_RECT) {
// Draw selection rectangle. // Draw selection rectangle.
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
p_canvas_item->draw_set_transform_matrix(p_transform); p_canvas_item->draw_set_transform_matrix(p_transform);
@ -2862,7 +2862,7 @@ TileDataTerrainsEditor::TileDataTerrainsEditor() {
picker_button = memnew(Button); picker_button = memnew(Button);
picker_button->set_theme_type_variation("FlatButton"); picker_button->set_theme_type_variation("FlatButton");
picker_button->set_toggle_mode(true); picker_button->set_toggle_mode(true);
picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", TTR("Picker"), KEY_P)); picker_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/picker", TTR("Picker"), KEY_P));
toolbar->add_child(picker_button); toolbar->add_child(picker_button);
// Setup // Setup
@ -2989,7 +2989,7 @@ void TileDataNavigationEditor::draw_over_tile(CanvasItem *p_canvas_item, Transfo
color = Navigation2DServer::get_singleton()->get_debug_navigation_geometry_face_color(); color = Navigation2DServer::get_singleton()->get_debug_navigation_geometry_face_color();
#endif // DEBUG_ENABLED #endif // DEBUG_ENABLED
if (p_selected) { if (p_selected) {
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
selection_color.a = 0.7; selection_color.a = 0.7;
color = selection_color; color = selection_color;

View File

@ -324,7 +324,7 @@ void LayeredTileMapLayerEditorTilesPlugin::_patterns_item_list_gui_input(const R
return; return;
} }
if (ED_IS_SHORTCUT("tiles_editor/paste", p_event) && p_event->is_pressed() && !p_event->is_echo()) { if (ED_IS_SHORTCUT("layered_tiles_editor/paste", p_event) && p_event->is_pressed() && !p_event->is_echo()) {
select_last_pattern = true; select_last_pattern = true;
int new_pattern_index = tile_set->get_patterns_count(); int new_pattern_index = tile_set->get_patterns_count();
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
@ -335,7 +335,7 @@ void LayeredTileMapLayerEditorTilesPlugin::_patterns_item_list_gui_input(const R
patterns_item_list->accept_event(); patterns_item_list->accept_event();
} }
if (ED_IS_SHORTCUT("tiles_editor/delete", p_event) && p_event->is_pressed() && !p_event->is_echo()) { if (ED_IS_SHORTCUT("layered_tiles_editor/delete", p_event) && p_event->is_pressed() && !p_event->is_echo()) {
Vector<int> selected = patterns_item_list->get_selected_items(); Vector<int> selected = patterns_item_list->get_selected_items();
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
undo_redo->create_action(TTR("Remove LayeredTileSet patterns")); undo_redo->create_action(TTR("Remove LayeredTileSet patterns"));
@ -516,11 +516,7 @@ void LayeredTileMapLayerEditorTilesPlugin::_scenes_list_multi_selected(int p_ind
_update_selection_pattern_from_tileset_tiles_selection(); _update_selection_pattern_from_tileset_tiles_selection();
} }
void LayeredTileMapLayerEditorTilesPlugin::_scenes_list_lmb_empty_clicked(const Vector2 &p_pos, int p_mouse_button_index) { void LayeredTileMapLayerEditorTilesPlugin::_scenes_list_lmb_empty_clicked() {
if (p_mouse_button_index != BUTTON_LEFT) {
return;
}
scene_tiles_list->unselect_all(); scene_tiles_list->unselect_all();
tile_set_selection.clear(); tile_set_selection.clear();
tile_map_selection.clear(); tile_map_selection.clear();
@ -571,7 +567,7 @@ bool LayeredTileMapLayerEditorTilesPlugin::forward_canvas_gui_input(const Ref<In
} }
// Shortcuts // Shortcuts
if (ED_IS_SHORTCUT("tiles_editor/cut", p_event) || ED_IS_SHORTCUT("tiles_editor/copy", p_event)) { if (ED_IS_SHORTCUT("layered_tiles_editor/cut", p_event) || ED_IS_SHORTCUT("layered_tiles_editor/copy", p_event)) {
// Fill in the clipboard. // Fill in the clipboard.
if (!tile_map_selection.empty()) { if (!tile_map_selection.empty()) {
tile_map_clipboard.instance(); tile_map_clipboard.instance();
@ -584,7 +580,7 @@ bool LayeredTileMapLayerEditorTilesPlugin::forward_canvas_gui_input(const Ref<In
tile_map_clipboard = edited_layer->get_pattern(coords_array); tile_map_clipboard = edited_layer->get_pattern(coords_array);
} }
if (ED_IS_SHORTCUT("tiles_editor/cut", p_event)) { if (ED_IS_SHORTCUT("layered_tiles_editor/cut", p_event)) {
// Delete selected tiles. // Delete selected tiles.
if (!tile_map_selection.empty()) { if (!tile_map_selection.empty()) {
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
@ -606,21 +602,21 @@ bool LayeredTileMapLayerEditorTilesPlugin::forward_canvas_gui_input(const Ref<In
return true; return true;
} }
if (ED_IS_SHORTCUT("tiles_editor/paste", p_event)) { if (ED_IS_SHORTCUT("layered_tiles_editor/paste", p_event)) {
if (drag_type == DRAG_TYPE_NONE) { if (drag_type == DRAG_TYPE_NONE) {
drag_type = DRAG_TYPE_CLIPBOARD_PASTE; drag_type = DRAG_TYPE_CLIPBOARD_PASTE;
} }
CanvasItemEditor::get_singleton()->update_viewport(); CanvasItemEditor::get_singleton()->update_viewport();
return true; return true;
} }
if (ED_IS_SHORTCUT("tiles_editor/cancel", p_event)) { if (ED_IS_SHORTCUT("layered_tiles_editor/cancel", p_event)) {
if (drag_type == DRAG_TYPE_CLIPBOARD_PASTE) { if (drag_type == DRAG_TYPE_CLIPBOARD_PASTE) {
drag_type = DRAG_TYPE_NONE; drag_type = DRAG_TYPE_NONE;
CanvasItemEditor::get_singleton()->update_viewport(); CanvasItemEditor::get_singleton()->update_viewport();
return true; return true;
} }
} }
if (ED_IS_SHORTCUT("tiles_editor/delete", p_event)) { if (ED_IS_SHORTCUT("layered_tiles_editor/delete", p_event)) {
// Delete selected tiles. // Delete selected tiles.
if (!tile_map_selection.empty()) { if (!tile_map_selection.empty()) {
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
@ -844,7 +840,7 @@ void LayeredTileMapLayerEditorTilesPlugin::forward_canvas_draw_over_viewport(Con
if (drag_type == DRAG_TYPE_MOVE || (drag_type == DRAG_TYPE_SELECT && !Input::get_singleton()->is_key_pressed(KEY_META) && !Input::get_singleton()->is_key_pressed(KEY_SHIFT))) { if (drag_type == DRAG_TYPE_MOVE || (drag_type == DRAG_TYPE_SELECT && !Input::get_singleton()->is_key_pressed(KEY_META) && !Input::get_singleton()->is_key_pressed(KEY_SHIFT))) {
// Do nothing. // Do nothing.
} else { } else {
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
tile_set->draw_cells_outline(p_overlay, tile_map_selection, selection_color, xform); tile_set->draw_cells_outline(p_overlay, tile_map_selection, selection_color, xform);
} }
@ -952,9 +948,9 @@ void LayeredTileMapLayerEditorTilesPlugin::forward_canvas_draw_over_viewport(Con
const int fading = 5; const int fading = 5;
// Draw the lines of the grid behind the preview. // Draw the lines of the grid behind the preview.
bool display_grid = EDITOR_GET("editors/tiles_editor/display_grid"); bool display_grid = EDITOR_GET("editors/layered_tiles_editor/display_grid");
if (display_grid) { if (display_grid) {
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
if (drawn_grid_rect.size.x > 0 && drawn_grid_rect.size.y > 0) { if (drawn_grid_rect.size.x > 0 && drawn_grid_rect.size.y > 0) {
drawn_grid_rect = drawn_grid_rect.grow(fading); drawn_grid_rect = drawn_grid_rect.grow(fading);
for (int x = drawn_grid_rect.position.x; x < (drawn_grid_rect.position.x + drawn_grid_rect.size.x); x++) { for (int x = drawn_grid_rect.position.x; x < (drawn_grid_rect.position.x + drawn_grid_rect.size.x); x++) {
@ -1734,10 +1730,8 @@ void LayeredTileMapLayerEditorTilesPlugin::_fix_invalid_tiles_in_tile_map_select
tile_map_selection.erase(cell); tile_map_selection.erase(cell);
} }
} }
void LayeredTileMapLayerEditorTilesPlugin::patterns_item_list_empty_clicked(const Vector2 &p_pos, int p_mouse_button_index) { void LayeredTileMapLayerEditorTilesPlugin::patterns_item_list_empty_clicked() {
if (p_mouse_button_index == BUTTON_LEFT) { _update_selection_pattern_from_tileset_pattern_selection();
_update_selection_pattern_from_tileset_pattern_selection();
}
} }
void LayeredTileMapLayerEditorTilesPlugin::_update_selection_pattern_from_tilemap_selection() { void LayeredTileMapLayerEditorTilesPlugin::_update_selection_pattern_from_tilemap_selection() {
@ -1906,7 +1900,7 @@ void LayeredTileMapLayerEditorTilesPlugin::_tile_atlas_control_draw() {
} }
// Draw the selection. // Draw the selection.
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
for (const RBSet<LayeredTileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) { for (const RBSet<LayeredTileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
if (E->get().source_id == source_id && E->get().alternative_tile == 0) { if (E->get().source_id == source_id && E->get().alternative_tile == 0) {
@ -2247,7 +2241,6 @@ void LayeredTileMapLayerEditorTilesPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("_tile_alternatives_control_gui_input"), &LayeredTileMapLayerEditorTilesPlugin::_tile_alternatives_control_gui_input); ClassDB::bind_method(D_METHOD("_tile_alternatives_control_gui_input"), &LayeredTileMapLayerEditorTilesPlugin::_tile_alternatives_control_gui_input);
ClassDB::bind_method(D_METHOD("_scenes_list_multi_selected"), &LayeredTileMapLayerEditorTilesPlugin::_scenes_list_multi_selected); ClassDB::bind_method(D_METHOD("_scenes_list_multi_selected"), &LayeredTileMapLayerEditorTilesPlugin::_scenes_list_multi_selected);
ClassDB::bind_method(D_METHOD("_scenes_list_lmb_empty_clicked"), &LayeredTileMapLayerEditorTilesPlugin::_scenes_list_lmb_empty_clicked); ClassDB::bind_method(D_METHOD("_scenes_list_lmb_empty_clicked"), &LayeredTileMapLayerEditorTilesPlugin::_scenes_list_lmb_empty_clicked);
ClassDB::bind_method(D_METHOD("_tab_changed"), &LayeredTileMapLayerEditorTilesPlugin::_tab_changed);
ClassDB::bind_method(D_METHOD("_patterns_item_list_gui_input"), &LayeredTileMapLayerEditorTilesPlugin::_patterns_item_list_gui_input); ClassDB::bind_method(D_METHOD("_patterns_item_list_gui_input"), &LayeredTileMapLayerEditorTilesPlugin::_patterns_item_list_gui_input);
ClassDB::bind_method(D_METHOD("patterns_item_list_empty_clicked"), &LayeredTileMapLayerEditorTilesPlugin::patterns_item_list_empty_clicked); ClassDB::bind_method(D_METHOD("patterns_item_list_empty_clicked"), &LayeredTileMapLayerEditorTilesPlugin::patterns_item_list_empty_clicked);
ClassDB::bind_method(D_METHOD("_update_tile_set_sources_list"), &LayeredTileMapLayerEditorTilesPlugin::_update_tile_set_sources_list); ClassDB::bind_method(D_METHOD("_update_tile_set_sources_list"), &LayeredTileMapLayerEditorTilesPlugin::_update_tile_set_sources_list);
@ -2287,11 +2280,11 @@ LayeredTileMapLayerEditorTilesPlugin::LayeredTileMapLayerEditorTilesPlugin() {
CanvasItemEditor::get_singleton()->get_viewport_control()->connect("mouse_exited", this, "_mouse_exited_viewport"); CanvasItemEditor::get_singleton()->get_viewport_control()->connect("mouse_exited", this, "_mouse_exited_viewport");
// --- Shortcuts --- // --- Shortcuts ---
ED_SHORTCUT("tiles_editor/cut", TTR("Cut"), KEY_MASK_CMD | KEY_X); ED_SHORTCUT("layered_tiles_editor/cut", TTR("Cut"), KEY_MASK_CMD | KEY_X);
ED_SHORTCUT("tiles_editor/copy", TTR("Copy"), KEY_MASK_CMD | KEY_C); ED_SHORTCUT("layered_tiles_editor/copy", TTR("Copy"), KEY_MASK_CMD | KEY_C);
ED_SHORTCUT("tiles_editor/paste", TTR("Paste"), KEY_MASK_CMD | KEY_V); ED_SHORTCUT("layered_tiles_editor/paste", TTR("Paste"), KEY_MASK_CMD | KEY_V);
ED_SHORTCUT("tiles_editor/cancel", TTR("Cancel"), KEY_ESCAPE); ED_SHORTCUT("layered_tiles_editor/cancel", TTR("Cancel"), KEY_ESCAPE);
ED_SHORTCUT("tiles_editor/delete", TTR("Delete"), KEY_DELETE); ED_SHORTCUT("layered_tiles_editor/delete", TTR("Delete"), KEY_DELETE);
// --- Initialize references --- // --- Initialize references ---
tile_map_clipboard.instance(); tile_map_clipboard.instance();
@ -2308,7 +2301,7 @@ LayeredTileMapLayerEditorTilesPlugin::LayeredTileMapLayerEditorTilesPlugin() {
select_tool_button->set_theme_type_variation("FlatButton"); select_tool_button->set_theme_type_variation("FlatButton");
select_tool_button->set_toggle_mode(true); select_tool_button->set_toggle_mode(true);
select_tool_button->set_button_group(tool_buttons_group); select_tool_button->set_button_group(tool_buttons_group);
select_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/selection_tool", TTR("Selection"), KEY_S)); select_tool_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/selection_tool", TTR("Selection"), KEY_S));
select_tool_button->connect("pressed", this, "_update_toolbar"); select_tool_button->connect("pressed", this, "_update_toolbar");
tilemap_tiles_tools_buttons->add_child(select_tool_button); tilemap_tiles_tools_buttons->add_child(select_tool_button);
viewport_shortcut_buttons.push_back(select_tool_button); viewport_shortcut_buttons.push_back(select_tool_button);
@ -2317,7 +2310,7 @@ LayeredTileMapLayerEditorTilesPlugin::LayeredTileMapLayerEditorTilesPlugin() {
paint_tool_button->set_theme_type_variation("FlatButton"); paint_tool_button->set_theme_type_variation("FlatButton");
paint_tool_button->set_toggle_mode(true); paint_tool_button->set_toggle_mode(true);
paint_tool_button->set_button_group(tool_buttons_group); paint_tool_button->set_button_group(tool_buttons_group);
paint_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/paint_tool", TTR("Paint"), KEY_D)); paint_tool_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/paint_tool", TTR("Paint"), KEY_D));
paint_tool_button->set_tooltip(TTR("Shift: Draw line.") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Shift: Draw rectangle.")); paint_tool_button->set_tooltip(TTR("Shift: Draw line.") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Shift: Draw rectangle."));
paint_tool_button->connect("pressed", this, "_update_toolbar"); paint_tool_button->connect("pressed", this, "_update_toolbar");
tilemap_tiles_tools_buttons->add_child(paint_tool_button); tilemap_tiles_tools_buttons->add_child(paint_tool_button);
@ -2328,7 +2321,7 @@ LayeredTileMapLayerEditorTilesPlugin::LayeredTileMapLayerEditorTilesPlugin() {
line_tool_button->set_toggle_mode(true); line_tool_button->set_toggle_mode(true);
line_tool_button->set_button_group(tool_buttons_group); line_tool_button->set_button_group(tool_buttons_group);
// TRANSLATORS: This refers to the line tool in the tilemap editor. // TRANSLATORS: This refers to the line tool in the tilemap editor.
line_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/line_tool", TTR("Line", "Tool"), KEY_L)); line_tool_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/line_tool", TTR("Line", "Tool"), KEY_L));
line_tool_button->connect("pressed", this, "_update_toolbar"); line_tool_button->connect("pressed", this, "_update_toolbar");
tilemap_tiles_tools_buttons->add_child(line_tool_button); tilemap_tiles_tools_buttons->add_child(line_tool_button);
viewport_shortcut_buttons.push_back(line_tool_button); viewport_shortcut_buttons.push_back(line_tool_button);
@ -2337,7 +2330,7 @@ LayeredTileMapLayerEditorTilesPlugin::LayeredTileMapLayerEditorTilesPlugin() {
rect_tool_button->set_theme_type_variation("FlatButton"); rect_tool_button->set_theme_type_variation("FlatButton");
rect_tool_button->set_toggle_mode(true); rect_tool_button->set_toggle_mode(true);
rect_tool_button->set_button_group(tool_buttons_group); rect_tool_button->set_button_group(tool_buttons_group);
rect_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/rect_tool", TTR("Rect"), KEY_R)); rect_tool_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/rect_tool", TTR("Rect"), KEY_R));
rect_tool_button->connect("pressed", this, "_update_toolbar"); rect_tool_button->connect("pressed", this, "_update_toolbar");
tilemap_tiles_tools_buttons->add_child(rect_tool_button); tilemap_tiles_tools_buttons->add_child(rect_tool_button);
viewport_shortcut_buttons.push_back(rect_tool_button); viewport_shortcut_buttons.push_back(rect_tool_button);
@ -2346,7 +2339,7 @@ LayeredTileMapLayerEditorTilesPlugin::LayeredTileMapLayerEditorTilesPlugin() {
bucket_tool_button->set_theme_type_variation("FlatButton"); bucket_tool_button->set_theme_type_variation("FlatButton");
bucket_tool_button->set_toggle_mode(true); bucket_tool_button->set_toggle_mode(true);
bucket_tool_button->set_button_group(tool_buttons_group); bucket_tool_button->set_button_group(tool_buttons_group);
bucket_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/bucket_tool", TTR("Bucket"), KEY_B)); bucket_tool_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/bucket_tool", TTR("Bucket"), KEY_B));
bucket_tool_button->connect("pressed", this, "_update_toolbar"); bucket_tool_button->connect("pressed", this, "_update_toolbar");
tilemap_tiles_tools_buttons->add_child(bucket_tool_button); tilemap_tiles_tools_buttons->add_child(bucket_tool_button);
toolbar->add_child(tilemap_tiles_tools_buttons); toolbar->add_child(tilemap_tiles_tools_buttons);
@ -2363,7 +2356,7 @@ LayeredTileMapLayerEditorTilesPlugin::LayeredTileMapLayerEditorTilesPlugin() {
picker_button = memnew(Button); picker_button = memnew(Button);
picker_button->set_theme_type_variation("FlatButton"); picker_button->set_theme_type_variation("FlatButton");
picker_button->set_toggle_mode(true); picker_button->set_toggle_mode(true);
picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", TTR("Picker"), KEY_P)); picker_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/picker", TTR("Picker"), KEY_P));
int key = (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios")) ? KEY_META : KEY_CONTROL; int key = (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios")) ? KEY_META : KEY_CONTROL;
picker_button->set_tooltip(vformat(TTR("Alternatively hold %s with other tools to pick tile."), find_keycode_name(key))); picker_button->set_tooltip(vformat(TTR("Alternatively hold %s with other tools to pick tile."), find_keycode_name(key)));
picker_button->connect("pressed", CanvasItemEditor::get_singleton(), "update_viewport"); picker_button->connect("pressed", CanvasItemEditor::get_singleton(), "update_viewport");
@ -2374,7 +2367,7 @@ LayeredTileMapLayerEditorTilesPlugin::LayeredTileMapLayerEditorTilesPlugin() {
erase_button = memnew(Button); erase_button = memnew(Button);
erase_button->set_theme_type_variation("FlatButton"); erase_button->set_theme_type_variation("FlatButton");
erase_button->set_toggle_mode(true); erase_button->set_toggle_mode(true);
erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", TTR("Eraser"), KEY_E)); erase_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/eraser", TTR("Eraser"), KEY_E));
erase_button->set_tooltip(TTR("Alternatively use RMB to erase tiles.")); erase_button->set_tooltip(TTR("Alternatively use RMB to erase tiles."));
erase_button->connect("pressed", CanvasItemEditor::get_singleton(), "update_viewport"); erase_button->connect("pressed", CanvasItemEditor::get_singleton(), "update_viewport");
tools_settings->add_child(erase_button); tools_settings->add_child(erase_button);
@ -2387,28 +2380,28 @@ LayeredTileMapLayerEditorTilesPlugin::LayeredTileMapLayerEditorTilesPlugin() {
transform_button_rotate_left = memnew(Button); transform_button_rotate_left = memnew(Button);
transform_button_rotate_left->set_theme_type_variation("FlatButton"); transform_button_rotate_left->set_theme_type_variation("FlatButton");
transform_button_rotate_left->set_shortcut(ED_SHORTCUT("tiles_editor/rotate_tile_left", TTR("Rotate Tile Left"), KEY_Z)); transform_button_rotate_left->set_shortcut(ED_SHORTCUT("layered_tiles_editor/rotate_tile_left", TTR("Rotate Tile Left"), KEY_Z));
transform_toolbar->add_child(transform_button_rotate_left); transform_toolbar->add_child(transform_button_rotate_left);
transform_button_rotate_left->connect("pressed", this, "_apply_transform", varray(TRANSFORM_ROTATE_LEFT)); transform_button_rotate_left->connect("pressed", this, "_apply_transform", varray(TRANSFORM_ROTATE_LEFT));
viewport_shortcut_buttons.push_back(transform_button_rotate_left); viewport_shortcut_buttons.push_back(transform_button_rotate_left);
transform_button_rotate_right = memnew(Button); transform_button_rotate_right = memnew(Button);
transform_button_rotate_right->set_theme_type_variation("FlatButton"); transform_button_rotate_right->set_theme_type_variation("FlatButton");
transform_button_rotate_right->set_shortcut(ED_SHORTCUT("tiles_editor/rotate_tile_right", TTR("Rotate Tile Right"), KEY_X)); transform_button_rotate_right->set_shortcut(ED_SHORTCUT("layered_tiles_editor/rotate_tile_right", TTR("Rotate Tile Right"), KEY_X));
transform_toolbar->add_child(transform_button_rotate_right); transform_toolbar->add_child(transform_button_rotate_right);
transform_button_rotate_right->connect("pressed", this, "_apply_transform", varray(TRANSFORM_ROTATE_RIGHT)); transform_button_rotate_right->connect("pressed", this, "_apply_transform", varray(TRANSFORM_ROTATE_RIGHT));
viewport_shortcut_buttons.push_back(transform_button_rotate_right); viewport_shortcut_buttons.push_back(transform_button_rotate_right);
transform_button_flip_h = memnew(Button); transform_button_flip_h = memnew(Button);
transform_button_flip_h->set_theme_type_variation("FlatButton"); transform_button_flip_h->set_theme_type_variation("FlatButton");
transform_button_flip_h->set_shortcut(ED_SHORTCUT("tiles_editor/flip_tile_horizontal", TTR("Flip Tile Horizontally"), KEY_C)); transform_button_flip_h->set_shortcut(ED_SHORTCUT("layered_tiles_editor/flip_tile_horizontal", TTR("Flip Tile Horizontally"), KEY_C));
transform_toolbar->add_child(transform_button_flip_h); transform_toolbar->add_child(transform_button_flip_h);
transform_button_flip_h->connect("pressed", this, "_apply_transform", varray(TRANSFORM_FLIP_H)); transform_button_flip_h->connect("pressed", this, "_apply_transform", varray(TRANSFORM_FLIP_H));
viewport_shortcut_buttons.push_back(transform_button_flip_h); viewport_shortcut_buttons.push_back(transform_button_flip_h);
transform_button_flip_v = memnew(Button); transform_button_flip_v = memnew(Button);
transform_button_flip_v->set_theme_type_variation("FlatButton"); transform_button_flip_v->set_theme_type_variation("FlatButton");
transform_button_flip_v->set_shortcut(ED_SHORTCUT("tiles_editor/flip_tile_vertical", TTR("Flip Tile Vertically"), KEY_V)); transform_button_flip_v->set_shortcut(ED_SHORTCUT("layered_tiles_editor/flip_tile_vertical", TTR("Flip Tile Vertically"), KEY_V));
transform_toolbar->add_child(transform_button_flip_v); transform_toolbar->add_child(transform_button_flip_v);
transform_button_flip_v->connect("pressed", this, "_apply_transform", varray(TRANSFORM_FLIP_V)); transform_button_flip_v->connect("pressed", this, "_apply_transform", varray(TRANSFORM_FLIP_V));
viewport_shortcut_buttons.push_back(transform_button_flip_v); viewport_shortcut_buttons.push_back(transform_button_flip_v);
@ -2461,7 +2454,7 @@ LayeredTileMapLayerEditorTilesPlugin::LayeredTileMapLayerEditorTilesPlugin() {
// FIXME: This can trigger theme updates when the nodes that we want to update are not yet available. // FIXME: This can trigger theme updates when the nodes that we want to update are not yet available.
// The toolbar should be extracted to a dedicated control and theme updates should be handled through // The toolbar should be extracted to a dedicated control and theme updates should be handled through
// the notification. // the notification.
tiles_bottom_panel->connect("theme_changed", this, "_update_theme"); //tiles_bottom_panel->connect("theme_changed", this, "_update_theme");
tiles_bottom_panel->connect("visibility_changed", this, "_stop_dragging"); tiles_bottom_panel->connect("visibility_changed", this, "_stop_dragging");
tiles_bottom_panel->connect("visibility_changed", this, "_tab_changed"); tiles_bottom_panel->connect("visibility_changed", this, "_tab_changed");
tiles_bottom_panel->set_name(TTR("Tiles")); tiles_bottom_panel->set_name(TTR("Tiles"));
@ -2511,7 +2504,6 @@ LayeredTileMapLayerEditorTilesPlugin::LayeredTileMapLayerEditorTilesPlugin() {
sources_list->set_stretch_ratio(0.25); sources_list->set_stretch_ratio(0.25);
sources_list->set_custom_minimum_size(Size2(70, 0) * EDSCALE); sources_list->set_custom_minimum_size(Size2(70, 0) * EDSCALE);
sources_list->connect("item_selected", this, "_sources_list_item_selected"); sources_list->connect("item_selected", this, "_sources_list_item_selected");
sources_list->connect("item_selected", this, "_sources_list_item_selected");
sources_list->connect("item_selected", LayeredTilesEditorUtils::get_singleton(), "set_sources_lists_current"); sources_list->connect("item_selected", LayeredTilesEditorUtils::get_singleton(), "set_sources_lists_current");
sources_list->connect("item_activated", this, "_sources_list_item_activated"); sources_list->connect("item_activated", this, "_sources_list_item_activated");
sources_list->connect("visibility_changed", LayeredTilesEditorUtils::get_singleton(), "synchronize_sources_list", varray(sources_list, source_sort_button)); sources_list->connect("visibility_changed", LayeredTilesEditorUtils::get_singleton(), "synchronize_sources_list", varray(sources_list, source_sort_button));
@ -2547,7 +2539,7 @@ LayeredTileMapLayerEditorTilesPlugin::LayeredTileMapLayerEditorTilesPlugin() {
scene_tiles_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); scene_tiles_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
scene_tiles_list->set_select_mode(ItemList::SELECT_MULTI); scene_tiles_list->set_select_mode(ItemList::SELECT_MULTI);
scene_tiles_list->connect("multi_selected", this, "_scenes_list_multi_selected"); scene_tiles_list->connect("multi_selected", this, "_scenes_list_multi_selected");
scene_tiles_list->connect("empty_clicked", this, "_scenes_list_lmb_empty_clicked"); scene_tiles_list->connect("nothing_selected", this, "_scenes_list_lmb_empty_clicked");
atlas_sources_split_container->add_child(scene_tiles_list); atlas_sources_split_container->add_child(scene_tiles_list);
// Invalid source label. // Invalid source label.
@ -2576,7 +2568,7 @@ LayeredTileMapLayerEditorTilesPlugin::LayeredTileMapLayerEditorTilesPlugin() {
patterns_item_list->connect("gui_input", this, "_patterns_item_list_gui_input"); patterns_item_list->connect("gui_input", this, "_patterns_item_list_gui_input");
patterns_item_list->connect("item_selected", this, "_patterns_item_list_item_activated"); patterns_item_list->connect("item_selected", this, "_patterns_item_list_item_activated");
patterns_item_list->connect("item_activated", this, "_patterns_item_list_item_activated"); patterns_item_list->connect("item_activated", this, "_patterns_item_list_item_activated");
patterns_item_list->connect("empty_clicked", this, "patterns_item_list_empty_clicked"); patterns_item_list->connect("nothing_selected", this, "patterns_item_list_empty_clicked");
patterns_bottom_panel->add_child(patterns_item_list); patterns_bottom_panel->add_child(patterns_item_list);
patterns_help_label = memnew(Label); patterns_help_label = memnew(Label);
@ -3332,9 +3324,9 @@ void LayeredTileMapLayerEditorTerrainsPlugin::forward_canvas_draw_over_viewport(
const int fading = 5; const int fading = 5;
// Draw the lines of the grid behind the preview. // Draw the lines of the grid behind the preview.
bool display_grid = EDITOR_GET("editors/tiles_editor/display_grid"); bool display_grid = EDITOR_GET("editors/layered_tiles_editor/display_grid");
if (display_grid) { if (display_grid) {
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
if (drawn_grid_rect.size.x > 0 && drawn_grid_rect.size.y > 0) { if (drawn_grid_rect.size.x > 0 && drawn_grid_rect.size.y > 0) {
drawn_grid_rect = drawn_grid_rect.grow(fading); drawn_grid_rect = drawn_grid_rect.grow(fading);
for (int x = drawn_grid_rect.position.x; x < (drawn_grid_rect.position.x + drawn_grid_rect.size.x); x++) { for (int x = drawn_grid_rect.position.x; x < (drawn_grid_rect.position.x + drawn_grid_rect.size.x); x++) {
@ -3623,7 +3615,7 @@ LayeredTileMapLayerEditorTerrainsPlugin::LayeredTileMapLayerEditorTerrainsPlugin
// FIXME: This can trigger theme updates when the nodes that we want to update are not yet available. // FIXME: This can trigger theme updates when the nodes that we want to update are not yet available.
// The toolbar should be extracted to a dedicated control and theme updates should be handled through // The toolbar should be extracted to a dedicated control and theme updates should be handled through
// the notification. // the notification.
main_vbox_container->connect("theme_changed", this, "_update_theme"); //main_vbox_container->connect("theme_changed", this, "_update_theme");
main_vbox_container->set_name(TTR("Terrains")); main_vbox_container->set_name(TTR("Terrains"));
HSplitContainer *tilemap_tab_terrains = memnew(HSplitContainer); HSplitContainer *tilemap_tab_terrains = memnew(HSplitContainer);
@ -3658,7 +3650,7 @@ LayeredTileMapLayerEditorTerrainsPlugin::LayeredTileMapLayerEditorTerrainsPlugin
paint_tool_button->set_toggle_mode(true); paint_tool_button->set_toggle_mode(true);
paint_tool_button->set_button_group(tool_buttons_group); paint_tool_button->set_button_group(tool_buttons_group);
paint_tool_button->set_pressed(true); paint_tool_button->set_pressed(true);
paint_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/paint_tool", TTR("Paint"), KEY_D)); paint_tool_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/paint_tool", TTR("Paint"), KEY_D));
paint_tool_button->connect("pressed", this, "_update_toolbar"); paint_tool_button->connect("pressed", this, "_update_toolbar");
tilemap_tiles_tools_buttons->add_child(paint_tool_button); tilemap_tiles_tools_buttons->add_child(paint_tool_button);
viewport_shortcut_buttons.push_back(paint_tool_button); viewport_shortcut_buttons.push_back(paint_tool_button);
@ -3667,7 +3659,7 @@ LayeredTileMapLayerEditorTerrainsPlugin::LayeredTileMapLayerEditorTerrainsPlugin
line_tool_button->set_theme_type_variation("FlatButton"); line_tool_button->set_theme_type_variation("FlatButton");
line_tool_button->set_toggle_mode(true); line_tool_button->set_toggle_mode(true);
line_tool_button->set_button_group(tool_buttons_group); line_tool_button->set_button_group(tool_buttons_group);
line_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/line_tool", TTR("Line"), KEY_L)); line_tool_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/line_tool", TTR("Line"), KEY_L));
line_tool_button->connect("pressed", this, "_update_toolbar"); line_tool_button->connect("pressed", this, "_update_toolbar");
tilemap_tiles_tools_buttons->add_child(line_tool_button); tilemap_tiles_tools_buttons->add_child(line_tool_button);
viewport_shortcut_buttons.push_back(line_tool_button); viewport_shortcut_buttons.push_back(line_tool_button);
@ -3676,7 +3668,7 @@ LayeredTileMapLayerEditorTerrainsPlugin::LayeredTileMapLayerEditorTerrainsPlugin
rect_tool_button->set_theme_type_variation("FlatButton"); rect_tool_button->set_theme_type_variation("FlatButton");
rect_tool_button->set_toggle_mode(true); rect_tool_button->set_toggle_mode(true);
rect_tool_button->set_button_group(tool_buttons_group); rect_tool_button->set_button_group(tool_buttons_group);
rect_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/rect_tool", TTR("Rect"), KEY_R)); rect_tool_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/rect_tool", TTR("Rect"), KEY_R));
rect_tool_button->connect("pressed", this, "_update_toolbar"); rect_tool_button->connect("pressed", this, "_update_toolbar");
tilemap_tiles_tools_buttons->add_child(rect_tool_button); tilemap_tiles_tools_buttons->add_child(rect_tool_button);
viewport_shortcut_buttons.push_back(rect_tool_button); viewport_shortcut_buttons.push_back(rect_tool_button);
@ -3685,7 +3677,7 @@ LayeredTileMapLayerEditorTerrainsPlugin::LayeredTileMapLayerEditorTerrainsPlugin
bucket_tool_button->set_theme_type_variation("FlatButton"); bucket_tool_button->set_theme_type_variation("FlatButton");
bucket_tool_button->set_toggle_mode(true); bucket_tool_button->set_toggle_mode(true);
bucket_tool_button->set_button_group(tool_buttons_group); bucket_tool_button->set_button_group(tool_buttons_group);
bucket_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/bucket_tool", TTR("Bucket"), KEY_B)); bucket_tool_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/bucket_tool", TTR("Bucket"), KEY_B));
bucket_tool_button->connect("pressed", this, "_update_toolbar"); bucket_tool_button->connect("pressed", this, "_update_toolbar");
tilemap_tiles_tools_buttons->add_child(bucket_tool_button); tilemap_tiles_tools_buttons->add_child(bucket_tool_button);
viewport_shortcut_buttons.push_back(bucket_tool_button); viewport_shortcut_buttons.push_back(bucket_tool_button);
@ -3703,7 +3695,7 @@ LayeredTileMapLayerEditorTerrainsPlugin::LayeredTileMapLayerEditorTerrainsPlugin
picker_button = memnew(Button); picker_button = memnew(Button);
picker_button->set_theme_type_variation("FlatButton"); picker_button->set_theme_type_variation("FlatButton");
picker_button->set_toggle_mode(true); picker_button->set_toggle_mode(true);
picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", TTR("Picker"), KEY_P)); picker_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/picker", TTR("Picker"), KEY_P));
picker_button->connect("pressed", CanvasItemEditor::get_singleton(), "update_viewport"); picker_button->connect("pressed", CanvasItemEditor::get_singleton(), "update_viewport");
tools_settings->add_child(picker_button); tools_settings->add_child(picker_button);
viewport_shortcut_buttons.push_back(picker_button); viewport_shortcut_buttons.push_back(picker_button);
@ -3712,7 +3704,7 @@ LayeredTileMapLayerEditorTerrainsPlugin::LayeredTileMapLayerEditorTerrainsPlugin
erase_button = memnew(Button); erase_button = memnew(Button);
erase_button->set_theme_type_variation("FlatButton"); erase_button->set_theme_type_variation("FlatButton");
erase_button->set_toggle_mode(true); erase_button->set_toggle_mode(true);
erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", TTR("Eraser"), KEY_E)); erase_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/eraser", TTR("Eraser"), KEY_E));
erase_button->connect("pressed", CanvasItemEditor::get_singleton(), "update_viewport"); erase_button->connect("pressed", CanvasItemEditor::get_singleton(), "update_viewport");
tools_settings->add_child(erase_button); tools_settings->add_child(erase_button);
viewport_shortcut_buttons.push_back(erase_button); viewport_shortcut_buttons.push_back(erase_button);
@ -3749,8 +3741,9 @@ void LayeredTileMapLayerEditor::_notification(int p_what) {
warning_pattern_texture = get_theme_icon("WarningPattern", "EditorIcons"); warning_pattern_texture = get_theme_icon("WarningPattern", "EditorIcons");
advanced_menu_button->set_icon(get_theme_icon("Tools", "EditorIcons")); advanced_menu_button->set_icon(get_theme_icon("Tools", "EditorIcons"));
toggle_grid_button->set_icon(get_theme_icon("Grid", "EditorIcons")); toggle_grid_button->set_icon(get_theme_icon("Grid", "EditorIcons"));
toggle_grid_button->set_pressed(EDITOR_GET("editors/tiles_editor/display_grid")); toggle_grid_button->set_pressed(EDITOR_GET("editors/layered_tiles_editor/display_grid"));
toggle_highlight_selected_layer_button->set_icon(get_theme_icon("LayeredTileMapHighlightSelected", "EditorIcons")); toggle_highlight_selected_layer_button->set_icon(get_theme_icon("LayeredTileMapHighlightSelected", "EditorIcons"));
} break; } break;
case NOTIFICATION_INTERNAL_PROCESS: { case NOTIFICATION_INTERNAL_PROCESS: {
@ -3765,7 +3758,7 @@ void LayeredTileMapLayerEditor::_notification(int p_what) {
} break; } break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
toggle_grid_button->set_pressed_no_signal(EDITOR_GET("editors/tiles_editor/display_grid")); toggle_grid_button->set_pressed_no_signal(EDITOR_GET("editors/layered_tiles_editor/display_grid"));
} break; } break;
} }
} }
@ -3785,8 +3778,11 @@ void LayeredTileMapLayerEditor::_bind_methods() {
} }
void LayeredTileMapLayerEditor::_on_grid_toggled(bool p_pressed) { void LayeredTileMapLayerEditor::_on_grid_toggled(bool p_pressed) {
EditorSettings::get_singleton()->set("editors/tiles_editor/display_grid", p_pressed); EditorSettings::get_singleton()->set("editors/layered_tiles_editor/display_grid", p_pressed);
CanvasItemEditor::get_singleton()->update_viewport();
if (is_inside_tree()) {
CanvasItemEditor::get_singleton()->update_viewport();
}
} }
void LayeredTileMapLayerEditor::_layers_selection_item_selected(int p_index) { void LayeredTileMapLayerEditor::_layers_selection_item_selected(int p_index) {
@ -3963,7 +3959,10 @@ void LayeredTileMapLayerEditor::_tab_changed(int p_tab_id) {
// Graphical update. // Graphical update.
tabs_data[tabs_bar->get_current_tab()].panel->update(); tabs_data[tabs_bar->get_current_tab()].panel->update();
CanvasItemEditor::get_singleton()->update_viewport();
if (is_inside_tree()) {
CanvasItemEditor::get_singleton()->update_viewport();
}
} }
void LayeredTileMapLayerEditor::_layers_select_next_or_previous(bool p_next) { void LayeredTileMapLayerEditor::_layers_select_next_or_previous(bool p_next) {
@ -4081,12 +4080,12 @@ void LayeredTileMapLayerEditor::_move_tile_map_array_element(Object *p_undo_redo
} }
bool LayeredTileMapLayerEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_event) { bool LayeredTileMapLayerEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_event) {
if (ED_IS_SHORTCUT("tiles_editor/select_next_layer", p_event) && p_event->is_pressed()) { if (ED_IS_SHORTCUT("layered_tiles_editor/select_next_layer", p_event) && p_event->is_pressed()) {
_layers_select_next_or_previous(true); _layers_select_next_or_previous(true);
return true; return true;
} }
if (ED_IS_SHORTCUT("tiles_editor/select_previous_layer", p_event) && p_event->is_pressed()) { if (ED_IS_SHORTCUT("layered_tiles_editor/select_previous_layer", p_event) && p_event->is_pressed()) {
_layers_select_next_or_previous(false); _layers_select_next_or_previous(false);
return true; return true;
} }
@ -4190,9 +4189,9 @@ void LayeredTileMapLayerEditor::forward_canvas_draw_over_viewport(Control *p_ove
} }
// Draw the grid. // Draw the grid.
bool display_grid = EDITOR_GET("editors/tiles_editor/display_grid"); bool display_grid = EDITOR_GET("editors/layered_tiles_editor/display_grid");
if (display_grid) { if (display_grid) {
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
for (int x = displayed_rect.position.x; x < (displayed_rect.position.x + displayed_rect.size.x); x++) { for (int x = displayed_rect.position.x; x < (displayed_rect.position.x + displayed_rect.size.x); x++) {
for (int y = displayed_rect.position.y; y < (displayed_rect.position.y + displayed_rect.size.y); y++) { for (int y = displayed_rect.position.y; y < (displayed_rect.position.y + displayed_rect.size.y); y++) {
Vector2i pos_in_rect = Vector2i(x, y) - displayed_rect.position; Vector2i pos_in_rect = Vector2i(x, y) - displayed_rect.position;
@ -4301,8 +4300,8 @@ LayeredTileMapLayerEditor::LayeredTileMapLayerEditor() {
set_process_internal(true); set_process_internal(true);
// Shortcuts. // Shortcuts.
ED_SHORTCUT("tiles_editor/select_next_layer", TTR("Select Next Tile Map Layer"), KEY_PAGEDOWN); ED_SHORTCUT("layered_tiles_editor/select_next_layer", TTR("Select Next Tile Map Layer"), KEY_PAGEDOWN);
ED_SHORTCUT("tiles_editor/select_previous_layer", TTR("Select Previous Tile Map Layer"), KEY_PAGEUP); ED_SHORTCUT("layered_tiles_editor/select_previous_layer", TTR("Select Previous Tile Map Layer"), KEY_PAGEUP);
// LayeredTileMap editor plugins // LayeredTileMap editor plugins
tile_map_editor_plugins.push_back(memnew(LayeredTileMapLayerEditorTilesPlugin)); tile_map_editor_plugins.push_back(memnew(LayeredTileMapLayerEditorTilesPlugin));

View File

@ -169,7 +169,7 @@ private:
void _update_fix_selected_and_hovered(); void _update_fix_selected_and_hovered();
void _fix_invalid_tiles_in_tile_map_selection(); void _fix_invalid_tiles_in_tile_map_selection();
void patterns_item_list_empty_clicked(const Vector2 &p_pos, int p_mouse_button_index); void patterns_item_list_empty_clicked();
///// Bottom panel common //// ///// Bottom panel common ////
void _tab_changed(); void _tab_changed();
@ -218,7 +218,7 @@ private:
void _update_scenes_collection_view(); void _update_scenes_collection_view();
void _scene_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_ud); void _scene_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_ud);
void _scenes_list_multi_selected(int p_index, bool p_selected); void _scenes_list_multi_selected(int p_index, bool p_selected);
void _scenes_list_lmb_empty_clicked(const Vector2 &p_pos, int p_mouse_button_index); void _scenes_list_lmb_empty_clicked();
///// Bottom panel patterns //// ///// Bottom panel patterns ////
VBoxContainer *patterns_bottom_panel = nullptr; VBoxContainer *patterns_bottom_panel = nullptr;

View File

@ -33,6 +33,7 @@
#include "editor/editor_properties.h" #include "editor/editor_properties.h"
#include "core/os/keyboard.h"
#include "editor/editor_scale.h" #include "editor/editor_scale.h"
#include "editor/editor_settings.h" #include "editor/editor_settings.h"
#include "scene/gui/dialogs.h" #include "scene/gui/dialogs.h"
@ -44,11 +45,7 @@
#include "core/object/undo_redo.h" #include "core/object/undo_redo.h"
void LayeredTileProxiesManagerDialog::_right_clicked(int p_item, Vector2 p_local_mouse_pos, int p_mouse_button_index, Object *p_item_list) { void LayeredTileProxiesManagerDialog::_right_clicked(int p_item, Vector2 p_local_mouse_pos, Object *p_item_list) {
if (p_mouse_button_index != BUTTON_RIGHT) {
return;
}
ItemList *item_list = Object::cast_to<ItemList>(p_item_list); ItemList *item_list = Object::cast_to<ItemList>(p_item_list);
popup_menu->set_size(Size2()); popup_menu->set_size(Size2());
popup_menu->set_position(get_position() + item_list->get_global_mouse_position()); popup_menu->set_position(get_position() + item_list->get_global_mouse_position());
@ -367,7 +364,7 @@ LayeredTileProxiesManagerDialog::LayeredTileProxiesManagerDialog() {
source_level_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); source_level_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
source_level_list->set_select_mode(ItemList::SELECT_MULTI); source_level_list->set_select_mode(ItemList::SELECT_MULTI);
source_level_list->set_allow_rmb_select(true); source_level_list->set_allow_rmb_select(true);
source_level_list->connect("item_clicked", this, "_right_clicked", varray(source_level_list)); source_level_list->connect("item_rmb_selected", this, "_right_clicked", varray(source_level_list));
vbox_container->add_child(source_level_list); vbox_container->add_child(source_level_list);
Label *coords_level_label = memnew(Label); Label *coords_level_label = memnew(Label);
@ -378,7 +375,7 @@ LayeredTileProxiesManagerDialog::LayeredTileProxiesManagerDialog() {
coords_level_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); coords_level_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
coords_level_list->set_select_mode(ItemList::SELECT_MULTI); coords_level_list->set_select_mode(ItemList::SELECT_MULTI);
coords_level_list->set_allow_rmb_select(true); coords_level_list->set_allow_rmb_select(true);
coords_level_list->connect("item_clicked", this, "_right_clicked", varray(coords_level_list)); coords_level_list->connect("item_rmb_selected", this, "_right_clicked", varray(coords_level_list));
vbox_container->add_child(coords_level_list); vbox_container->add_child(coords_level_list);
Label *alternative_level_label = memnew(Label); Label *alternative_level_label = memnew(Label);
@ -389,11 +386,11 @@ LayeredTileProxiesManagerDialog::LayeredTileProxiesManagerDialog() {
alternative_level_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); alternative_level_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
alternative_level_list->set_select_mode(ItemList::SELECT_MULTI); alternative_level_list->set_select_mode(ItemList::SELECT_MULTI);
alternative_level_list->set_allow_rmb_select(true); alternative_level_list->set_allow_rmb_select(true);
alternative_level_list->connect("item_clicked", this, "_right_clicked", varray(alternative_level_list)); alternative_level_list->connect("item_rmb_selected", this, "_right_clicked", varray(alternative_level_list));
vbox_container->add_child(alternative_level_list); vbox_container->add_child(alternative_level_list);
popup_menu = memnew(PopupMenu); popup_menu = memnew(PopupMenu);
popup_menu->add_shortcut(ED_GET_SHORTCUT("ui_text_delete")); popup_menu->add_shortcut(ED_SHORTCUT("layered_tiles_editor/delete", TTR("Delete"), KEY_DELETE));
popup_menu->connect("id_pressed", this, "_menu_id_pressed"); popup_menu->connect("id_pressed", this, "_menu_id_pressed");
add_child(popup_menu); add_child(popup_menu);

View File

@ -62,7 +62,7 @@ private:
EditorPropertyInteger *alternative_to_property_editor = nullptr; EditorPropertyInteger *alternative_to_property_editor = nullptr;
PopupMenu *popup_menu = nullptr; PopupMenu *popup_menu = nullptr;
void _right_clicked(int p_item, Vector2 p_local_mouse_pos, int p_mouse_button_index, Object *p_item_list); void _right_clicked(int p_item, Vector2 p_local_mouse_pos, Object *p_item_list);
void _menu_id_pressed(int p_id); void _menu_id_pressed(int p_id);
void _delete_selected_bindings(); void _delete_selected_bindings();
void _update_lists(); void _update_lists();

View File

@ -1730,7 +1730,7 @@ void LayeredTileSetAtlasSourceEditor::_menu_option(int p_option) {
void LayeredTileSetAtlasSourceEditor::shortcut_input(const Ref<InputEvent> &p_event) { void LayeredTileSetAtlasSourceEditor::shortcut_input(const Ref<InputEvent> &p_event) {
// Check for shortcuts. // Check for shortcuts.
if (ED_IS_SHORTCUT("tiles_editor/delete_tile", p_event)) { if (ED_IS_SHORTCUT("layered_tiles_editor/delete_tile", p_event)) {
if (tools_button_group->get_pressed_button() == tool_select_button && !selection.empty()) { if (tools_button_group->get_pressed_button() == tool_select_button && !selection.empty()) {
_menu_option(TILE_DELETE); _menu_option(TILE_DELETE);
accept_event(); accept_event();
@ -2681,7 +2681,7 @@ LayeredTileSetAtlasSourceEditor::LayeredTileSetAtlasSourceEditor() {
tools_settings_erase_button = memnew(Button); tools_settings_erase_button = memnew(Button);
tools_settings_erase_button->set_theme_type_variation("FlatButton"); tools_settings_erase_button->set_theme_type_variation("FlatButton");
tools_settings_erase_button->set_toggle_mode(true); tools_settings_erase_button->set_toggle_mode(true);
tools_settings_erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", TTR("Eraser"), KEY_E)); tools_settings_erase_button->set_shortcut(ED_SHORTCUT("layered_tiles_editor/eraser", TTR("Eraser"), KEY_E));
tools_settings_erase_button->set_shortcut_context(this); tools_settings_erase_button->set_shortcut_context(this);
tool_settings->add_child(tools_settings_erase_button); tool_settings->add_child(tools_settings_erase_button);
@ -2743,7 +2743,7 @@ LayeredTileSetAtlasSourceEditor::LayeredTileSetAtlasSourceEditor() {
tile_create_help->set_position(pos); tile_create_help->set_position(pos);
base_tile_popup_menu = memnew(PopupMenu); base_tile_popup_menu = memnew(PopupMenu);
base_tile_popup_menu->add_shortcut(ED_SHORTCUT("tiles_editor/delete", TTR("Delete"), KEY_DELETE), TILE_DELETE); base_tile_popup_menu->add_shortcut(ED_SHORTCUT("layered_tiles_editor/delete", TTR("Delete"), KEY_DELETE), TILE_DELETE);
base_tile_popup_menu->add_item(TTR("Create an Alternative Tile"), TILE_CREATE_ALTERNATIVE); base_tile_popup_menu->add_item(TTR("Create an Alternative Tile"), TILE_CREATE_ALTERNATIVE);
base_tile_popup_menu->connect("id_pressed", this, "_menu_option"); base_tile_popup_menu->connect("id_pressed", this, "_menu_option");
tile_atlas_view->add_child(base_tile_popup_menu); tile_atlas_view->add_child(base_tile_popup_menu);
@ -2765,7 +2765,7 @@ LayeredTileSetAtlasSourceEditor::LayeredTileSetAtlasSourceEditor() {
tile_atlas_control_unscaled->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); tile_atlas_control_unscaled->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
alternative_tile_popup_menu = memnew(PopupMenu); alternative_tile_popup_menu = memnew(PopupMenu);
alternative_tile_popup_menu->add_shortcut(ED_SHORTCUT("tiles_editor/delete_tile", TTR("Delete"), KEY_DELETE), TILE_DELETE); alternative_tile_popup_menu->add_shortcut(ED_SHORTCUT("layered_tiles_editor/delete_tile", TTR("Delete"), KEY_DELETE), TILE_DELETE);
alternative_tile_popup_menu->connect("id_pressed", this, "_menu_option"); alternative_tile_popup_menu->connect("id_pressed", this, "_menu_option");
tile_atlas_view->add_child(alternative_tile_popup_menu); tile_atlas_view->add_child(alternative_tile_popup_menu);
@ -2789,7 +2789,7 @@ LayeredTileSetAtlasSourceEditor::LayeredTileSetAtlasSourceEditor() {
confirm_auto_create_tiles->get_ok()->set_text(TTR("Yes")); confirm_auto_create_tiles->get_ok()->set_text(TTR("Yes"));
confirm_auto_create_tiles->get_cancel()->set_text(TTR("No")); confirm_auto_create_tiles->get_cancel()->set_text(TTR("No"));
confirm_auto_create_tiles->connect("confirmed", this, "_auto_create_tiles"); confirm_auto_create_tiles->connect("confirmed", this, "_auto_create_tiles");
confirm_auto_create_tiles->connect("canceled", this, "_cancel_auto_create_tiles"); confirm_auto_create_tiles->get_cancel()->connect("pressed", this, "_cancel_auto_create_tiles");
add_child(confirm_auto_create_tiles); add_child(confirm_auto_create_tiles);
// Inspector plugin. // Inspector plugin.

View File

@ -438,7 +438,7 @@ void LayeredTileSetEditor::_notification(int p_what) {
void LayeredTileSetEditor::_patterns_item_list_gui_input(const Ref<InputEvent> &p_event) { void LayeredTileSetEditor::_patterns_item_list_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(!tile_set.is_valid()); ERR_FAIL_COND(!tile_set.is_valid());
if (ED_IS_SHORTCUT("tiles_editor/delete", p_event) && p_event->is_pressed() && !p_event->is_echo()) { if (ED_IS_SHORTCUT("layered_tiles_editor/delete", p_event) && p_event->is_pressed() && !p_event->is_echo()) {
Vector<int> selected = patterns_item_list->get_selected_items(); Vector<int> selected = patterns_item_list->get_selected_items();
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
undo_redo->create_action(TTR("Remove LayeredTileSet patterns")); undo_redo->create_action(TTR("Remove LayeredTileSet patterns"));
@ -804,7 +804,7 @@ void LayeredTileSetEditor::add_expanded_editor(Control *p_editor) {
expanded_area->show(); expanded_area->show();
expanded_area->set_size(Vector2(parent_container->get_global_rect().get_end().x - expanded_area->get_global_position().x, expanded_area->get_size().y)); expanded_area->set_size(Vector2(parent_container->get_global_rect().get_end().x - expanded_area->get_global_position().x, expanded_area->get_size().y));
for (int i = 0; i < disable_on_expand.size(); ++i) { for (uint32_t i = 0; i < disable_on_expand.size(); ++i) {
SplitContainer *split = disable_on_expand[i]; SplitContainer *split = disable_on_expand[i];
split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN); split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN);
@ -828,7 +828,7 @@ void LayeredTileSetEditor::remove_expanded_editor() {
expanded_editor_parent = ObjectID(); expanded_editor_parent = ObjectID();
expanded_area->hide(); expanded_area->hide();
for (int i = 0; i < disable_on_expand.size(); ++i) { for (uint32_t i = 0; i < disable_on_expand.size(); ++i) {
SplitContainer *split = disable_on_expand[i]; SplitContainer *split = disable_on_expand[i];
split->set_dragger_visibility(SplitContainer::DRAGGER_VISIBLE); split->set_dragger_visibility(SplitContainer::DRAGGER_VISIBLE);
@ -898,7 +898,7 @@ LayeredTileSetEditor::LayeredTileSetEditor() {
sources_list->connect("item_selected", LayeredTilesEditorUtils::get_singleton(), "set_sources_lists_current"); sources_list->connect("item_selected", LayeredTilesEditorUtils::get_singleton(), "set_sources_lists_current");
sources_list->connect("visibility_changed", LayeredTilesEditorUtils::get_singleton(), "synchronize_sources_list", varray(sources_list, source_sort_button)); sources_list->connect("visibility_changed", LayeredTilesEditorUtils::get_singleton(), "synchronize_sources_list", varray(sources_list, source_sort_button));
sources_list->add_user_signal(MethodInfo("sort_request")); sources_list->add_user_signal(MethodInfo("sort_request"));
sources_list->connect("sort_request", this, "_update_sources_list"); sources_list->connect("sort_request", this, "_update_sources_list", varray(-1));
sources_list->set_drag_forwarding(this); sources_list->set_drag_forwarding(this);

View File

@ -585,9 +585,13 @@ ObjectID LayeredTileSetEditorPlugin::get_edited_tileset() const {
} }
LayeredTileSetEditorPlugin::LayeredTileSetEditorPlugin(EditorNode *p_node) { LayeredTileSetEditorPlugin::LayeredTileSetEditorPlugin(EditorNode *p_node) {
EDITOR_DEF("editors/layered_tiles_editor/display_grid", true);
EDITOR_DEF("editors/layered_tiles_editor/grid_color", Color(1.0, 0.5, 0.2, 0.5));
if (!LayeredTilesEditorUtils::get_singleton()) { if (!LayeredTilesEditorUtils::get_singleton()) {
memnew(LayeredTilesEditorUtils); memnew(LayeredTilesEditorUtils);
} }
tile_set_plugin_singleton = this; tile_set_plugin_singleton = this;
editor = memnew(LayeredTileSetEditor); editor = memnew(LayeredTileSetEditor);