diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_plugin.cpp | 30 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 6 | ||||
-rw-r--r-- | editor/icons/HFlowContainer.svg | 1 | ||||
-rw-r--r-- | editor/icons/VFlowContainer.svg | 1 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 30 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.h | 10 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 54 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.h | 13 |
8 files changed, 111 insertions, 34 deletions
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index aeca340cb1..6579b1eb31 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -421,14 +421,10 @@ void EditorPlugin::add_control_to_container(CustomControlContainer p_location, C } break; case CONTAINER_SPATIAL_EDITOR_SIDE_LEFT: { - Node3DEditor::get_singleton()->get_palette_split()->add_child(p_control); - Node3DEditor::get_singleton()->get_palette_split()->move_child(p_control, 0); - + Node3DEditor::get_singleton()->add_control_to_left_panel(p_control); } break; case CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT: { - Node3DEditor::get_singleton()->get_palette_split()->add_child(p_control); - Node3DEditor::get_singleton()->get_palette_split()->move_child(p_control, 1); - + Node3DEditor::get_singleton()->add_control_to_right_panel(p_control); } break; case CONTAINER_SPATIAL_EDITOR_BOTTOM: { Node3DEditor::get_singleton()->get_shader_split()->add_child(p_control); @@ -439,14 +435,10 @@ void EditorPlugin::add_control_to_container(CustomControlContainer p_location, C } break; case CONTAINER_CANVAS_EDITOR_SIDE_LEFT: { - CanvasItemEditor::get_singleton()->get_palette_split()->add_child(p_control); - CanvasItemEditor::get_singleton()->get_palette_split()->move_child(p_control, 0); - + CanvasItemEditor::get_singleton()->add_control_to_left_panel(p_control); } break; case CONTAINER_CANVAS_EDITOR_SIDE_RIGHT: { - CanvasItemEditor::get_singleton()->get_palette_split()->add_child(p_control); - CanvasItemEditor::get_singleton()->get_palette_split()->move_child(p_control, 1); - + CanvasItemEditor::get_singleton()->add_control_to_right_panel(p_control); } break; case CONTAINER_CANVAS_EDITOR_BOTTOM: { CanvasItemEditor::get_singleton()->get_bottom_split()->add_child(p_control); @@ -481,10 +473,11 @@ void EditorPlugin::remove_control_from_container(CustomControlContainer p_locati Node3DEditor::get_singleton()->remove_control_from_menu_panel(p_control); } break; - case CONTAINER_SPATIAL_EDITOR_SIDE_LEFT: + case CONTAINER_SPATIAL_EDITOR_SIDE_LEFT: { + Node3DEditor::get_singleton()->remove_control_from_left_panel(p_control); + } break; case CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT: { - Node3DEditor::get_singleton()->get_palette_split()->remove_child(p_control); - + Node3DEditor::get_singleton()->remove_control_from_right_panel(p_control); } break; case CONTAINER_SPATIAL_EDITOR_BOTTOM: { Node3DEditor::get_singleton()->get_shader_split()->remove_child(p_control); @@ -494,10 +487,11 @@ void EditorPlugin::remove_control_from_container(CustomControlContainer p_locati CanvasItemEditor::get_singleton()->remove_control_from_menu_panel(p_control); } break; - case CONTAINER_CANVAS_EDITOR_SIDE_LEFT: + case CONTAINER_CANVAS_EDITOR_SIDE_LEFT: { + CanvasItemEditor::get_singleton()->remove_control_from_left_panel(p_control); + } break; case CONTAINER_CANVAS_EDITOR_SIDE_RIGHT: { - CanvasItemEditor::get_singleton()->get_palette_split()->remove_child(p_control); - + CanvasItemEditor::get_singleton()->remove_control_from_right_panel(p_control); } break; case CONTAINER_CANVAS_EDITOR_BOTTOM: { CanvasItemEditor::get_singleton()->get_bottom_split()->remove_child(p_control); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 5b7ea65b04..c26a139e4b 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1123,6 +1123,12 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_constant("margin_bottom", "MarginContainer", 0); theme->set_constant("hseparation", "GridContainer", default_margin_size * EDSCALE); theme->set_constant("vseparation", "GridContainer", default_margin_size * EDSCALE); + theme->set_constant("hseparation", "FlowContainer", default_margin_size * EDSCALE); + theme->set_constant("vseparation", "FlowContainer", default_margin_size * EDSCALE); + theme->set_constant("hseparation", "HFlowContainer", default_margin_size * EDSCALE); + theme->set_constant("vseparation", "HFlowContainer", default_margin_size * EDSCALE); + theme->set_constant("hseparation", "VFlowContainer", default_margin_size * EDSCALE); + theme->set_constant("vseparation", "VFlowContainer", default_margin_size * EDSCALE); // Window diff --git a/editor/icons/HFlowContainer.svg b/editor/icons/HFlowContainer.svg new file mode 100644 index 0000000000..0ab03f686e --- /dev/null +++ b/editor/icons/HFlowContainer.svg @@ -0,0 +1 @@ +<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M3 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2H3zm0 2h10v10H3V3zm2 1c-.554 0-1 .446-1 1s.446 1 1 1h2c.554 0 1-.446 1-1s-.446-1-1-1H5zm4.996 0c-.554 0-1 .446-1 1s.446 1 1 1H11c.554 0 1-.446 1-1s-.446-1-1-1H9.996zM5 7c-.554 0-1 .446-1 1s.446 1 1 1 1-.446 1-1-.446-1-1-1zm3 0c-.554 0-1 .446-1 1s.446 1 1 1h3c.554 0 1-.446 1-1s-.446-1-1-1H8zm-3.004 3c-.554 0-1 .446-1 1s.446 1 1 1H9c.554 0 1-.446 1-1s-.446-1-1-1H4.996z" style="fill:#8eef97;fill-opacity:1"/></svg> diff --git a/editor/icons/VFlowContainer.svg b/editor/icons/VFlowContainer.svg new file mode 100644 index 0000000000..9023bf2245 --- /dev/null +++ b/editor/icons/VFlowContainer.svg @@ -0,0 +1 @@ +<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M3 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2H3zm0 2h10v10H3V3zm7.998.998c-.554 0-1 .446-1 1v4.004c0 .554.446 1 1 1s1-.446 1-1V4.998c0-.554-.446-1-1-1zm-6 .004c-.554 0-1 .446-1 1v2c0 .554.446 1 1 1s1-.446 1-1v-2c0-.554-.446-1-1-1zm3 0c-.554 0-1 .446-1 1s.446 1 1 1 1-.446 1-1-.446-1-1-1zm0 3c-.554 0-1 .446-1 1v3c0 .554.446 1 1 1s1-.446 1-1v-3c0-.554-.446-1-1-1zm-3 1.996c-.554 0-1 .446-1 1v1.004c0 .554.446 1 1 1s1-.446 1-1V9.998c0-.554-.446-1-1-1z" style="fill:#8eef97;fill-opacity:1"/></svg> diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 970d53a137..14f488f096 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5129,8 +5129,22 @@ void CanvasItemEditor::remove_control_from_menu_panel(Control *p_control) { hbc_context_menu->remove_child(p_control); } -HSplitContainer *CanvasItemEditor::get_palette_split() { - return palette_split; +void CanvasItemEditor::add_control_to_left_panel(Control *p_control) { + left_panel_split->add_child(p_control); + left_panel_split->move_child(p_control, 0); +} + +void CanvasItemEditor::add_control_to_right_panel(Control *p_control) { + right_panel_split->add_child(p_control); + right_panel_split->move_child(p_control, 1); +} + +void CanvasItemEditor::remove_control_from_left_panel(Control *p_control) { + left_panel_split->remove_child(p_control); +} + +void CanvasItemEditor::remove_control_from_right_panel(Control *p_control) { + right_panel_split->remove_child(p_control); } VSplitContainer *CanvasItemEditor::get_bottom_split() { @@ -5221,12 +5235,16 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { add_child(bottom_split); bottom_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); - palette_split = memnew(HSplitContainer); - bottom_split->add_child(palette_split); - palette_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); + left_panel_split = memnew(HSplitContainer); + bottom_split->add_child(left_panel_split); + left_panel_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); + + right_panel_split = memnew(HSplitContainer); + left_panel_split->add_child(right_panel_split); + right_panel_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); viewport_scrollable = memnew(Control); - palette_split->add_child(viewport_scrollable); + right_panel_split->add_child(viewport_scrollable); viewport_scrollable->set_mouse_filter(MOUSE_FILTER_PASS); viewport_scrollable->set_clip_contents(true); viewport_scrollable->set_v_size_flags(Control::SIZE_EXPAND_FILL); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 8bba5130d4..d58fb17356 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -527,7 +527,8 @@ private: void _update_override_camera_button(bool p_game_running); - HSplitContainer *palette_split; + HSplitContainer *left_panel_split; + HSplitContainer *right_panel_split; VSplitContainer *bottom_split; void _update_context_menu_stylebox(); @@ -571,7 +572,12 @@ public: void add_control_to_menu_panel(Control *p_control); void remove_control_from_menu_panel(Control *p_control); - HSplitContainer *get_palette_split(); + void add_control_to_left_panel(Control *p_control); + void remove_control_from_left_panel(Control *p_control); + + void add_control_to_right_panel(Control *p_control); + void remove_control_from_right_panel(Control *p_control); + VSplitContainer *get_bottom_split(); Control *get_viewport_control() { return viewport; } diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index ef9c6a65e7..20f86c6a81 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -6880,8 +6880,46 @@ VSplitContainer *Node3DEditor::get_shader_split() { return shader_split; } -HSplitContainer *Node3DEditor::get_palette_split() { - return palette_split; +void Node3DEditor::add_control_to_left_panel(Control *p_control) { + left_panel_split->add_child(p_control); + left_panel_split->move_child(p_control, 0); +} + +void Node3DEditor::add_control_to_right_panel(Control *p_control) { + right_panel_split->add_child(p_control); + right_panel_split->move_child(p_control, 1); +} + +void Node3DEditor::remove_control_from_left_panel(Control *p_control) { + left_panel_split->remove_child(p_control); +} + +void Node3DEditor::remove_control_from_right_panel(Control *p_control) { + right_panel_split->remove_child(p_control); +} + +void Node3DEditor::move_control_to_left_panel(Control *p_control) { + ERR_FAIL_NULL(p_control); + if (p_control->get_parent() == left_panel_split) { + return; + } + + ERR_FAIL_COND(p_control->get_parent() != right_panel_split); + right_panel_split->remove_child(p_control); + + add_control_to_left_panel(p_control); +} + +void Node3DEditor::move_control_to_right_panel(Control *p_control) { + ERR_FAIL_NULL(p_control); + if (p_control->get_parent() == right_panel_split) { + return; + } + + ERR_FAIL_COND(p_control->get_parent() != left_panel_split); + left_panel_split->remove_child(p_control); + + add_control_to_right_panel(p_control); } void Node3DEditor::_request_gizmo(Object *p_obj) { @@ -7534,13 +7572,17 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { /* REST OF MENU */ - palette_split = memnew(HSplitContainer); - palette_split->set_v_size_flags(SIZE_EXPAND_FILL); - vbc->add_child(palette_split); + left_panel_split = memnew(HSplitContainer); + left_panel_split->set_v_size_flags(SIZE_EXPAND_FILL); + vbc->add_child(left_panel_split); + + right_panel_split = memnew(HSplitContainer); + right_panel_split->set_v_size_flags(SIZE_EXPAND_FILL); + left_panel_split->add_child(right_panel_split); shader_split = memnew(VSplitContainer); shader_split->set_h_size_flags(SIZE_EXPAND_FILL); - palette_split->add_child(shader_split); + right_panel_split->add_child(shader_split); viewport_base = memnew(Node3DEditorViewportContainer); shader_split->add_child(viewport_base); viewport_base->set_v_size_flags(SIZE_EXPAND_FILL); diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index da560f4d83..20a782c8a8 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -527,7 +527,8 @@ private: Node3DEditorViewportContainer *viewport_base; Node3DEditorViewport *viewports[VIEWPORTS_COUNT]; VSplitContainer *shader_split; - HSplitContainer *palette_split; + HSplitContainer *left_panel_split; + HSplitContainer *right_panel_split; ///// @@ -801,8 +802,16 @@ public: void add_control_to_menu_panel(Control *p_control); void remove_control_from_menu_panel(Control *p_control); + void add_control_to_left_panel(Control *p_control); + void remove_control_from_left_panel(Control *p_control); + + void add_control_to_right_panel(Control *p_control); + void remove_control_from_right_panel(Control *p_control); + + void move_control_to_left_panel(Control *p_control); + void move_control_to_right_panel(Control *p_control); + VSplitContainer *get_shader_split(); - HSplitContainer *get_palette_split(); Node3D *get_single_selected_node() { return selected; } bool is_current_selected_gizmo(const EditorNode3DGizmo *p_gizmo); |