diff options
| author | Juan Linietsky | 2015-01-02 11:55:51 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2015-01-02 11:55:51 -0300 |
| commit | ffe970daf640be08dd8ed40f29619f7b0018bcb1 (patch) | |
| tree | 0f8282efea9d1896f75053563e30a8824cbb0042 /tools/editor/plugins/tile_map_editor_plugin.cpp | |
| parent | bc492c0bcaca1df9ade0968bff580b908569063a (diff) | |
| parent | 4faf47eb503931f3fd44d617aadca8f34cc0ae47 (diff) | |
| download | godot-ffe970daf640be08dd8ed40f29619f7b0018bcb1.tar.gz godot-ffe970daf640be08dd8ed40f29619f7b0018bcb1.tar.zst godot-ffe970daf640be08dd8ed40f29619f7b0018bcb1.zip | |
Merge pull request #1074 from not-surt/master
Replace TileMapEditor floating tile palette with HSplitContainer.
Diffstat (limited to 'tools/editor/plugins/tile_map_editor_plugin.cpp')
| -rw-r--r-- | tools/editor/plugins/tile_map_editor_plugin.cpp | 51 |
1 files changed, 15 insertions, 36 deletions
diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index a25997108..21474205d 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -42,7 +42,6 @@ void TileMapEditor::_notification(int p_what) { case NOTIFICATION_READY: { - pane_drag->connect("dragged", this,"_pane_drag"); mirror_x->set_icon( get_icon("MirrorX","EditorIcons")); mirror_y->set_icon( get_icon("MirrorY","EditorIcons")); @@ -701,23 +700,10 @@ void TileMapEditor::_tileset_settings_changed() { canvas_item_editor->update(); } -void TileMapEditor::_pane_drag(const Point2& p_to) { - - int x = theme_panel->get_margin(MARGIN_RIGHT); - - x+=p_to.x; - if (x<10) - x=10; - if (x>300) - x=300; - theme_panel->set_margin(MARGIN_RIGHT,x); -} - void TileMapEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_menu_option"),&TileMapEditor::_menu_option); ObjectTypeDB::bind_method(_MD("_canvas_draw"),&TileMapEditor::_canvas_draw); - ObjectTypeDB::bind_method(_MD("_pane_drag"),&TileMapEditor::_pane_drag); ObjectTypeDB::bind_method(_MD("_canvas_mouse_enter"),&TileMapEditor::_canvas_mouse_enter); ObjectTypeDB::bind_method(_MD("_canvas_mouse_exit"),&TileMapEditor::_canvas_mouse_exit); ObjectTypeDB::bind_method(_MD("_tileset_settings_changed"),&TileMapEditor::_tileset_settings_changed); @@ -731,36 +717,30 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { editor=p_editor; undo_redo = editor->get_undo_redo(); - theme_panel = memnew( Panel ); - theme_panel->set_anchor(MARGIN_BOTTOM,ANCHOR_END); - theme_panel->set_begin( Point2(0,26)); - theme_panel->set_end( Point2(100,0) ); - p_editor->get_viewport()->add_child(theme_panel); - theme_panel->hide(); + int mw = EDITOR_DEF("tile_map/palette_min_width",80); + EmptyControl *ec = memnew( EmptyControl); + ec->set_minsize(Size2(mw,0)); + add_child(ec); + // Add tile palette palette = memnew( Tree ); - palette->set_area_as_parent_rect(4); - palette->set_margin(MARGIN_TOP,25);; - theme_panel->add_child(palette); - - pane_drag = memnew( PaneDrag ) ; - pane_drag->set_anchor(MARGIN_LEFT,ANCHOR_END); - pane_drag->set_begin(Point2(16,4)); - theme_panel->add_child(pane_drag); - - add_child( memnew( VSeparator )); + palette->set_v_size_flags(SIZE_EXPAND_FILL); + add_child(palette); + // Add menu items + HBoxContainer *canvas_item_editor_hb = memnew( HBoxContainer ); + CanvasItemEditor::get_singleton()->add_control_to_menu_panel(canvas_item_editor_hb); + canvas_item_editor_hb->add_child( memnew( VSeparator )); mirror_x = memnew( ToolButton ); mirror_x->set_toggle_mode(true); mirror_x->set_tooltip("Mirror X (A)"); mirror_x->set_focus_mode(FOCUS_NONE); - add_child(mirror_x); + canvas_item_editor_hb->add_child(mirror_x); mirror_y = memnew( ToolButton ); mirror_y->set_toggle_mode(true); mirror_y->set_tooltip("Mirror Y (S)"); mirror_y->set_focus_mode(FOCUS_NONE); - add_child(mirror_y); - + canvas_item_editor_hb->add_child(mirror_y); tool=TOOL_NONE; selection_active=false; @@ -782,12 +762,10 @@ void TileMapEditorPlugin::make_visible(bool p_visible) { if (p_visible) { tile_map_editor->show(); - tile_map_editor->theme_panel->show(); } else { tile_map_editor->hide(); - tile_map_editor->theme_panel->hide(); tile_map_editor->edit(NULL); } @@ -797,7 +775,8 @@ TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) { editor=p_node; tile_map_editor = memnew( TileMapEditor(p_node) ); - CanvasItemEditor::get_singleton()->add_control_to_menu_panel(tile_map_editor); + CanvasItemEditor::get_singleton()->get_palette_split()->add_child(tile_map_editor); + CanvasItemEditor::get_singleton()->get_palette_split()->move_child(tile_map_editor,0); tile_map_editor->hide(); |
