diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/plugins/tile_map_editor_plugin.cpp | 21 | ||||
-rw-r--r-- | tools/editor/plugins/tile_map_editor_plugin.h | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index b1ddac7076..a5147851ac 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -1208,6 +1208,16 @@ void TileMapEditor::_tileset_settings_changed() { canvas_item_editor->update(); } +void TileMapEditor::_icon_size_changed(float p_value) { + if (node) { + Size2 size = node->get_cell_size() * p_value; + palette->set_min_icon_size(size + Size2(4, 0)); //4px gap between tiles + palette->set_icon_stretch_to_max_size(true); + palette->set_max_icon_size(size); + _update_palette(); + } +} + void TileMapEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_text_entered"),&TileMapEditor::_text_entered); @@ -1222,6 +1232,8 @@ void TileMapEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_fill_points"),&TileMapEditor::_fill_points); ObjectTypeDB::bind_method(_MD("_erase_points"),&TileMapEditor::_erase_points); + + ObjectTypeDB::bind_method(_MD("_icon_size_changed"), &TileMapEditor::_icon_size_changed); } TileMapEditor::CellOp TileMapEditor::_get_op_from_cell(const Point2i& p_pos) @@ -1297,6 +1309,15 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { search_box->connect("input_event", this, "_sbox_input"); add_child(search_box); + size_slider = memnew( HSlider ); + size_slider->set_h_size_flags(SIZE_EXPAND_FILL); + size_slider->set_min(0.1f); + size_slider->set_max(4.0f); + size_slider->set_step(0.1f); + size_slider->set_val(1.0f); + size_slider->connect("value_changed", this, "_icon_size_changed"); + add_child(size_slider); + int mw = EDITOR_DEF("tile_map/palette_min_width", 80); // Add tile palette diff --git a/tools/editor/plugins/tile_map_editor_plugin.h b/tools/editor/plugins/tile_map_editor_plugin.h index 92b54a4cbb..f586c5bf13 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.h +++ b/tools/editor/plugins/tile_map_editor_plugin.h @@ -76,6 +76,7 @@ class TileMapEditor : public VBoxContainer { Control *canvas_item_editor; LineEdit *search_box; + HSlider *size_slider; ItemList *palette; HBoxContainer *toolbar; @@ -151,6 +152,7 @@ class TileMapEditor : public VBoxContainer { void _canvas_mouse_enter(); void _canvas_mouse_exit(); void _tileset_settings_changed(); + void _icon_size_changed(float p_value); protected: |