Merge pull request #63250 from YuriSizov/toolbars-go-with-the-flow-3.x
This commit is contained in:
commit
a6e70f1f1c
|
@ -46,6 +46,7 @@
|
||||||
#include "scene/2d/skeleton_2d.h"
|
#include "scene/2d/skeleton_2d.h"
|
||||||
#include "scene/2d/sprite.h"
|
#include "scene/2d/sprite.h"
|
||||||
#include "scene/2d/touch_screen_button.h"
|
#include "scene/2d/touch_screen_button.h"
|
||||||
|
#include "scene/gui/flow_container.h"
|
||||||
#include "scene/gui/grid_container.h"
|
#include "scene/gui/grid_container.h"
|
||||||
#include "scene/gui/nine_patch_rect.h"
|
#include "scene/gui/nine_patch_rect.h"
|
||||||
#include "scene/gui/viewport_container.h"
|
#include "scene/gui/viewport_container.h"
|
||||||
|
@ -4401,7 +4402,7 @@ void CanvasItemEditor::_update_context_menu_stylebox() {
|
||||||
context_menu_stylebox->set_border_color(accent_color);
|
context_menu_stylebox->set_border_color(accent_color);
|
||||||
context_menu_stylebox->set_border_width(MARGIN_BOTTOM, Math::round(2 * EDSCALE));
|
context_menu_stylebox->set_border_width(MARGIN_BOTTOM, Math::round(2 * EDSCALE));
|
||||||
context_menu_stylebox->set_default_margin(MARGIN_BOTTOM, 0);
|
context_menu_stylebox->set_default_margin(MARGIN_BOTTOM, 0);
|
||||||
context_menu_container->add_style_override("panel", context_menu_stylebox);
|
context_menu_panel->add_style_override("panel", context_menu_stylebox);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasItemEditor::_update_scrollbars() {
|
void CanvasItemEditor::_update_scrollbars() {
|
||||||
|
@ -5737,11 +5738,11 @@ void CanvasItemEditor::remove_control_from_info_overlay(Control *p_control) {
|
||||||
void CanvasItemEditor::add_control_to_menu_panel(Control *p_control) {
|
void CanvasItemEditor::add_control_to_menu_panel(Control *p_control) {
|
||||||
ERR_FAIL_COND(!p_control);
|
ERR_FAIL_COND(!p_control);
|
||||||
|
|
||||||
hbc_context_menu->add_child(p_control);
|
context_menu_hbox->add_child(p_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasItemEditor::remove_control_from_menu_panel(Control *p_control) {
|
void CanvasItemEditor::remove_control_from_menu_panel(Control *p_control) {
|
||||||
hbc_context_menu->remove_child(p_control);
|
context_menu_hbox->remove_child(p_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasItemEditor::add_control_to_left_panel(Control *p_control) {
|
void CanvasItemEditor::add_control_to_left_panel(Control *p_control) {
|
||||||
|
@ -5868,9 +5869,14 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
editor->call_deferred("connect", "play_pressed", this, "_update_override_camera_button", make_binds(true));
|
editor->call_deferred("connect", "play_pressed", this, "_update_override_camera_button", make_binds(true));
|
||||||
editor->call_deferred("connect", "stop_pressed", this, "_update_override_camera_button", make_binds(false));
|
editor->call_deferred("connect", "stop_pressed", this, "_update_override_camera_button", make_binds(false));
|
||||||
|
|
||||||
hb = memnew(HBoxContainer);
|
// A fluid container for all toolbars.
|
||||||
add_child(hb);
|
HFlowContainer *main_flow = memnew(HFlowContainer);
|
||||||
hb->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
add_child(main_flow);
|
||||||
|
|
||||||
|
// Main toolbars.
|
||||||
|
HBoxContainer *main_menu_hbox = memnew(HBoxContainer);
|
||||||
|
main_menu_hbox->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
||||||
|
main_flow->add_child(main_menu_hbox);
|
||||||
|
|
||||||
bottom_split = memnew(VSplitContainer);
|
bottom_split = memnew(VSplitContainer);
|
||||||
add_child(bottom_split);
|
add_child(bottom_split);
|
||||||
|
@ -5968,82 +5974,82 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
updating_scroll = false;
|
updating_scroll = false;
|
||||||
|
|
||||||
select_button = memnew(ToolButton);
|
select_button = memnew(ToolButton);
|
||||||
hb->add_child(select_button);
|
main_menu_hbox->add_child(select_button);
|
||||||
select_button->set_toggle_mode(true);
|
select_button->set_toggle_mode(true);
|
||||||
select_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_SELECT));
|
select_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_SELECT));
|
||||||
select_button->set_pressed(true);
|
select_button->set_pressed(true);
|
||||||
select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode", TTR("Select Mode"), KEY_Q));
|
select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode", TTR("Select Mode"), KEY_Q));
|
||||||
select_button->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+Drag: Move selected node.") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Alt+Drag: Scale selected node.") + "\n" + TTR("V: Set selected node's pivot position.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("RMB: Add node at position clicked."));
|
select_button->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+Drag: Move selected node.") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Alt+Drag: Scale selected node.") + "\n" + TTR("V: Set selected node's pivot position.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("RMB: Add node at position clicked."));
|
||||||
|
|
||||||
hb->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
move_button = memnew(ToolButton);
|
move_button = memnew(ToolButton);
|
||||||
hb->add_child(move_button);
|
main_menu_hbox->add_child(move_button);
|
||||||
move_button->set_toggle_mode(true);
|
move_button->set_toggle_mode(true);
|
||||||
move_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_MOVE));
|
move_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_MOVE));
|
||||||
move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTR("Move Mode"), KEY_W));
|
move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTR("Move Mode"), KEY_W));
|
||||||
move_button->set_tooltip(TTR("Move Mode"));
|
move_button->set_tooltip(TTR("Move Mode"));
|
||||||
|
|
||||||
rotate_button = memnew(ToolButton);
|
rotate_button = memnew(ToolButton);
|
||||||
hb->add_child(rotate_button);
|
main_menu_hbox->add_child(rotate_button);
|
||||||
rotate_button->set_toggle_mode(true);
|
rotate_button->set_toggle_mode(true);
|
||||||
rotate_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_ROTATE));
|
rotate_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_ROTATE));
|
||||||
rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTR("Rotate Mode"), KEY_E));
|
rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTR("Rotate Mode"), KEY_E));
|
||||||
rotate_button->set_tooltip(TTR("Rotate Mode"));
|
rotate_button->set_tooltip(TTR("Rotate Mode"));
|
||||||
|
|
||||||
scale_button = memnew(ToolButton);
|
scale_button = memnew(ToolButton);
|
||||||
hb->add_child(scale_button);
|
main_menu_hbox->add_child(scale_button);
|
||||||
scale_button->set_toggle_mode(true);
|
scale_button->set_toggle_mode(true);
|
||||||
scale_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_SCALE));
|
scale_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_SCALE));
|
||||||
scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTR("Scale Mode"), KEY_S));
|
scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTR("Scale Mode"), KEY_S));
|
||||||
scale_button->set_tooltip(TTR("Shift: Scale proportionally."));
|
scale_button->set_tooltip(TTR("Shift: Scale proportionally."));
|
||||||
|
|
||||||
hb->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
list_select_button = memnew(ToolButton);
|
list_select_button = memnew(ToolButton);
|
||||||
hb->add_child(list_select_button);
|
main_menu_hbox->add_child(list_select_button);
|
||||||
list_select_button->set_toggle_mode(true);
|
list_select_button->set_toggle_mode(true);
|
||||||
list_select_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_LIST_SELECT));
|
list_select_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_LIST_SELECT));
|
||||||
list_select_button->set_tooltip(TTR("Show a list of all objects at the position clicked\n(same as Alt+RMB in select mode)."));
|
list_select_button->set_tooltip(TTR("Show a list of all objects at the position clicked\n(same as Alt+RMB in select mode)."));
|
||||||
|
|
||||||
pivot_button = memnew(ToolButton);
|
pivot_button = memnew(ToolButton);
|
||||||
hb->add_child(pivot_button);
|
main_menu_hbox->add_child(pivot_button);
|
||||||
pivot_button->set_toggle_mode(true);
|
pivot_button->set_toggle_mode(true);
|
||||||
pivot_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_EDIT_PIVOT));
|
pivot_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_EDIT_PIVOT));
|
||||||
pivot_button->set_tooltip(TTR("Click to change object's rotation pivot."));
|
pivot_button->set_tooltip(TTR("Click to change object's rotation pivot."));
|
||||||
|
|
||||||
pan_button = memnew(ToolButton);
|
pan_button = memnew(ToolButton);
|
||||||
hb->add_child(pan_button);
|
main_menu_hbox->add_child(pan_button);
|
||||||
pan_button->set_toggle_mode(true);
|
pan_button->set_toggle_mode(true);
|
||||||
pan_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_PAN));
|
pan_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_PAN));
|
||||||
pan_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/pan_mode", TTR("Pan Mode"), KEY_G));
|
pan_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/pan_mode", TTR("Pan Mode"), KEY_G));
|
||||||
pan_button->set_tooltip(TTR("Pan Mode"));
|
pan_button->set_tooltip(TTR("Pan Mode"));
|
||||||
|
|
||||||
ruler_button = memnew(ToolButton);
|
ruler_button = memnew(ToolButton);
|
||||||
hb->add_child(ruler_button);
|
main_menu_hbox->add_child(ruler_button);
|
||||||
ruler_button->set_toggle_mode(true);
|
ruler_button->set_toggle_mode(true);
|
||||||
ruler_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_RULER));
|
ruler_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_RULER));
|
||||||
ruler_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/ruler_mode", TTR("Ruler Mode"), KEY_R));
|
ruler_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/ruler_mode", TTR("Ruler Mode"), KEY_R));
|
||||||
ruler_button->set_tooltip(TTR("Ruler Mode"));
|
ruler_button->set_tooltip(TTR("Ruler Mode"));
|
||||||
|
|
||||||
hb->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
smart_snap_button = memnew(ToolButton);
|
smart_snap_button = memnew(ToolButton);
|
||||||
hb->add_child(smart_snap_button);
|
main_menu_hbox->add_child(smart_snap_button);
|
||||||
smart_snap_button->set_toggle_mode(true);
|
smart_snap_button->set_toggle_mode(true);
|
||||||
smart_snap_button->connect("toggled", this, "_button_toggle_smart_snap");
|
smart_snap_button->connect("toggled", this, "_button_toggle_smart_snap");
|
||||||
smart_snap_button->set_tooltip(TTR("Toggle smart snapping."));
|
smart_snap_button->set_tooltip(TTR("Toggle smart snapping."));
|
||||||
smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTR("Use Smart Snap"), KEY_MASK_SHIFT | KEY_S));
|
smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTR("Use Smart Snap"), KEY_MASK_SHIFT | KEY_S));
|
||||||
|
|
||||||
grid_snap_button = memnew(ToolButton);
|
grid_snap_button = memnew(ToolButton);
|
||||||
hb->add_child(grid_snap_button);
|
main_menu_hbox->add_child(grid_snap_button);
|
||||||
grid_snap_button->set_toggle_mode(true);
|
grid_snap_button->set_toggle_mode(true);
|
||||||
grid_snap_button->connect("toggled", this, "_button_toggle_grid_snap");
|
grid_snap_button->connect("toggled", this, "_button_toggle_grid_snap");
|
||||||
grid_snap_button->set_tooltip(TTR("Toggle grid snapping."));
|
grid_snap_button->set_tooltip(TTR("Toggle grid snapping."));
|
||||||
grid_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_grid_snap", TTR("Use Grid Snap"), KEY_MASK_SHIFT | KEY_G));
|
grid_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_grid_snap", TTR("Use Grid Snap"), KEY_MASK_SHIFT | KEY_G));
|
||||||
|
|
||||||
snap_config_menu = memnew(MenuButton);
|
snap_config_menu = memnew(MenuButton);
|
||||||
hb->add_child(snap_config_menu);
|
main_menu_hbox->add_child(snap_config_menu);
|
||||||
snap_config_menu->set_h_size_flags(SIZE_SHRINK_END);
|
snap_config_menu->set_h_size_flags(SIZE_SHRINK_END);
|
||||||
snap_config_menu->set_tooltip(TTR("Snapping Options"));
|
snap_config_menu->set_tooltip(TTR("Snapping Options"));
|
||||||
snap_config_menu->set_switch_on_hover(true);
|
snap_config_menu->set_switch_on_hover(true);
|
||||||
|
@ -6072,37 +6078,37 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_other_nodes", TTR("Snap to Other Nodes")), SNAP_USE_OTHER_NODES);
|
smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_other_nodes", TTR("Snap to Other Nodes")), SNAP_USE_OTHER_NODES);
|
||||||
smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_guides", TTR("Snap to Guides")), SNAP_USE_GUIDES);
|
smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_guides", TTR("Snap to Guides")), SNAP_USE_GUIDES);
|
||||||
|
|
||||||
hb->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
lock_button = memnew(ToolButton);
|
lock_button = memnew(ToolButton);
|
||||||
hb->add_child(lock_button);
|
main_menu_hbox->add_child(lock_button);
|
||||||
|
|
||||||
lock_button->connect("pressed", this, "_popup_callback", varray(LOCK_SELECTED));
|
lock_button->connect("pressed", this, "_popup_callback", varray(LOCK_SELECTED));
|
||||||
lock_button->set_tooltip(TTR("Lock the selected object in place (can't be moved)."));
|
lock_button->set_tooltip(TTR("Lock the selected object in place (can't be moved)."));
|
||||||
lock_button->set_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KEY_MASK_CMD | KEY_L));
|
lock_button->set_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KEY_MASK_CMD | KEY_L));
|
||||||
|
|
||||||
unlock_button = memnew(ToolButton);
|
unlock_button = memnew(ToolButton);
|
||||||
hb->add_child(unlock_button);
|
main_menu_hbox->add_child(unlock_button);
|
||||||
unlock_button->connect("pressed", this, "_popup_callback", varray(UNLOCK_SELECTED));
|
unlock_button->connect("pressed", this, "_popup_callback", varray(UNLOCK_SELECTED));
|
||||||
unlock_button->set_tooltip(TTR("Unlock the selected object (can be moved)."));
|
unlock_button->set_tooltip(TTR("Unlock the selected object (can be moved)."));
|
||||||
unlock_button->set_shortcut(ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_L));
|
unlock_button->set_shortcut(ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_L));
|
||||||
|
|
||||||
group_button = memnew(ToolButton);
|
group_button = memnew(ToolButton);
|
||||||
hb->add_child(group_button);
|
main_menu_hbox->add_child(group_button);
|
||||||
group_button->connect("pressed", this, "_popup_callback", varray(GROUP_SELECTED));
|
group_button->connect("pressed", this, "_popup_callback", varray(GROUP_SELECTED));
|
||||||
group_button->set_tooltip(TTR("Makes sure the object's children are not selectable."));
|
group_button->set_tooltip(TTR("Makes sure the object's children are not selectable."));
|
||||||
group_button->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KEY_MASK_CMD | KEY_G));
|
group_button->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KEY_MASK_CMD | KEY_G));
|
||||||
|
|
||||||
ungroup_button = memnew(ToolButton);
|
ungroup_button = memnew(ToolButton);
|
||||||
hb->add_child(ungroup_button);
|
main_menu_hbox->add_child(ungroup_button);
|
||||||
ungroup_button->connect("pressed", this, "_popup_callback", varray(UNGROUP_SELECTED));
|
ungroup_button->connect("pressed", this, "_popup_callback", varray(UNGROUP_SELECTED));
|
||||||
ungroup_button->set_tooltip(TTR("Restores the object's children's ability to be selected."));
|
ungroup_button->set_tooltip(TTR("Restores the object's children's ability to be selected."));
|
||||||
ungroup_button->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G));
|
ungroup_button->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G));
|
||||||
|
|
||||||
hb->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
skeleton_menu = memnew(MenuButton);
|
skeleton_menu = memnew(MenuButton);
|
||||||
hb->add_child(skeleton_menu);
|
main_menu_hbox->add_child(skeleton_menu);
|
||||||
skeleton_menu->set_tooltip(TTR("Skeleton Options"));
|
skeleton_menu->set_tooltip(TTR("Skeleton Options"));
|
||||||
skeleton_menu->set_switch_on_hover(true);
|
skeleton_menu->set_switch_on_hover(true);
|
||||||
|
|
||||||
|
@ -6117,21 +6123,21 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_bones", TTR("Clear Custom Bones")), SKELETON_CLEAR_BONES);
|
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_bones", TTR("Clear Custom Bones")), SKELETON_CLEAR_BONES);
|
||||||
p->connect("id_pressed", this, "_popup_callback");
|
p->connect("id_pressed", this, "_popup_callback");
|
||||||
|
|
||||||
hb->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
override_camera_button = memnew(ToolButton);
|
override_camera_button = memnew(ToolButton);
|
||||||
hb->add_child(override_camera_button);
|
main_menu_hbox->add_child(override_camera_button);
|
||||||
override_camera_button->connect("toggled", this, "_button_override_camera");
|
override_camera_button->connect("toggled", this, "_button_override_camera");
|
||||||
override_camera_button->set_toggle_mode(true);
|
override_camera_button->set_toggle_mode(true);
|
||||||
override_camera_button->set_disabled(true);
|
override_camera_button->set_disabled(true);
|
||||||
_update_override_camera_button(false);
|
_update_override_camera_button(false);
|
||||||
|
|
||||||
hb->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
view_menu = memnew(MenuButton);
|
view_menu = memnew(MenuButton);
|
||||||
// TRANSLATORS: Noun, name of the 2D/3D View menus.
|
// TRANSLATORS: Noun, name of the 2D/3D View menus.
|
||||||
view_menu->set_text(TTR("View"));
|
view_menu->set_text(TTR("View"));
|
||||||
hb->add_child(view_menu);
|
main_menu_hbox->add_child(view_menu);
|
||||||
view_menu->get_popup()->connect("id_pressed", this, "_popup_callback");
|
view_menu->get_popup()->connect("id_pressed", this, "_popup_callback");
|
||||||
view_menu->set_switch_on_hover(true);
|
view_menu->set_switch_on_hover(true);
|
||||||
|
|
||||||
|
@ -6164,20 +6170,20 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
p->add_separator();
|
p->add_separator();
|
||||||
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/preview_canvas_scale", TTR("Preview Canvas Scale"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_P), PREVIEW_CANVAS_SCALE);
|
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/preview_canvas_scale", TTR("Preview Canvas Scale"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_P), PREVIEW_CANVAS_SCALE);
|
||||||
|
|
||||||
hb->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
context_menu_container = memnew(PanelContainer);
|
context_menu_panel = memnew(PanelContainer);
|
||||||
hbc_context_menu = memnew(HBoxContainer);
|
context_menu_hbox = memnew(HBoxContainer);
|
||||||
context_menu_container->add_child(hbc_context_menu);
|
context_menu_panel->add_child(context_menu_hbox);
|
||||||
// Use a custom stylebox to make contextual menu items stand out from the rest.
|
// Use a custom stylebox to make contextual menu items stand out from the rest.
|
||||||
// This helps with editor usability as contextual menu items change when selecting nodes,
|
// This helps with editor usability as contextual menu items change when selecting nodes,
|
||||||
// even though it may not be immediately obvious at first.
|
// even though it may not be immediately obvious at first.
|
||||||
hb->add_child(context_menu_container);
|
main_flow->add_child(context_menu_panel);
|
||||||
_update_context_menu_stylebox();
|
_update_context_menu_stylebox();
|
||||||
|
|
||||||
presets_menu = memnew(MenuButton);
|
presets_menu = memnew(MenuButton);
|
||||||
presets_menu->set_text(TTR("Layout"));
|
presets_menu->set_text(TTR("Layout"));
|
||||||
hbc_context_menu->add_child(presets_menu);
|
context_menu_hbox->add_child(presets_menu);
|
||||||
presets_menu->hide();
|
presets_menu->hide();
|
||||||
presets_menu->set_switch_on_hover(true);
|
presets_menu->set_switch_on_hover(true);
|
||||||
|
|
||||||
|
@ -6190,13 +6196,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||||
anchors_popup->connect("id_pressed", this, "_popup_callback");
|
anchors_popup->connect("id_pressed", this, "_popup_callback");
|
||||||
|
|
||||||
anchor_mode_button = memnew(ToolButton);
|
anchor_mode_button = memnew(ToolButton);
|
||||||
hbc_context_menu->add_child(anchor_mode_button);
|
context_menu_hbox->add_child(anchor_mode_button);
|
||||||
anchor_mode_button->set_toggle_mode(true);
|
anchor_mode_button->set_toggle_mode(true);
|
||||||
anchor_mode_button->hide();
|
anchor_mode_button->hide();
|
||||||
anchor_mode_button->connect("toggled", this, "_button_toggle_anchor_mode");
|
anchor_mode_button->connect("toggled", this, "_button_toggle_anchor_mode");
|
||||||
|
|
||||||
animation_hb = memnew(HBoxContainer);
|
animation_hb = memnew(HBoxContainer);
|
||||||
hbc_context_menu->add_child(animation_hb);
|
context_menu_hbox->add_child(animation_hb);
|
||||||
animation_hb->add_child(memnew(VSeparator));
|
animation_hb->add_child(memnew(VSeparator));
|
||||||
animation_hb->hide();
|
animation_hb->hide();
|
||||||
|
|
||||||
|
|
|
@ -238,11 +238,10 @@ private:
|
||||||
|
|
||||||
HScrollBar *h_scroll;
|
HScrollBar *h_scroll;
|
||||||
VScrollBar *v_scroll;
|
VScrollBar *v_scroll;
|
||||||
HBoxContainer *hb;
|
|
||||||
// Used for secondary menu items which are displayed depending on the currently selected node
|
// Used for secondary menu items which are displayed depending on the currently selected node
|
||||||
// (such as MeshInstance's "Mesh" menu).
|
// (such as MeshInstance's "Mesh" menu).
|
||||||
PanelContainer *context_menu_container;
|
PanelContainer *context_menu_panel = nullptr;
|
||||||
HBoxContainer *hbc_context_menu;
|
HBoxContainer *context_menu_hbox = nullptr;
|
||||||
|
|
||||||
ToolButton *zoom_minus;
|
ToolButton *zoom_minus;
|
||||||
ToolButton *zoom_reset;
|
ToolButton *zoom_reset;
|
||||||
|
@ -584,8 +583,6 @@ protected:
|
||||||
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
HBoxContainer *get_panel_hb() { return hb; }
|
|
||||||
|
|
||||||
struct compare_items_x {
|
struct compare_items_x {
|
||||||
bool operator()(const CanvasItem *a, const CanvasItem *b) const {
|
bool operator()(const CanvasItem *a, const CanvasItem *b) const {
|
||||||
return a->get_global_transform().elements[2].x < b->get_global_transform().elements[2].x;
|
return a->get_global_transform().elements[2].x < b->get_global_transform().elements[2].x;
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include "scene/3d/physics_body.h"
|
#include "scene/3d/physics_body.h"
|
||||||
#include "scene/3d/room_manager.h"
|
#include "scene/3d/room_manager.h"
|
||||||
#include "scene/3d/visual_instance.h"
|
#include "scene/3d/visual_instance.h"
|
||||||
|
#include "scene/gui/flow_container.h"
|
||||||
#include "scene/gui/viewport_container.h"
|
#include "scene/gui/viewport_container.h"
|
||||||
#include "scene/resources/packed_scene.h"
|
#include "scene/resources/packed_scene.h"
|
||||||
#include "scene/resources/surface_tool.h"
|
#include "scene/resources/surface_tool.h"
|
||||||
|
@ -5810,7 +5811,7 @@ void SpatialEditor::_update_context_menu_stylebox() {
|
||||||
context_menu_stylebox->set_border_color(accent_color);
|
context_menu_stylebox->set_border_color(accent_color);
|
||||||
context_menu_stylebox->set_border_width(MARGIN_BOTTOM, Math::round(2 * EDSCALE));
|
context_menu_stylebox->set_border_width(MARGIN_BOTTOM, Math::round(2 * EDSCALE));
|
||||||
context_menu_stylebox->set_default_margin(MARGIN_BOTTOM, 0);
|
context_menu_stylebox->set_default_margin(MARGIN_BOTTOM, 0);
|
||||||
context_menu_container->add_style_override("panel", context_menu_stylebox);
|
context_menu_panel->add_style_override("panel", context_menu_stylebox);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatialEditor::_update_gizmos_menu() {
|
void SpatialEditor::_update_gizmos_menu() {
|
||||||
|
@ -6330,11 +6331,11 @@ void SpatialEditor::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatialEditor::add_control_to_menu_panel(Control *p_control) {
|
void SpatialEditor::add_control_to_menu_panel(Control *p_control) {
|
||||||
hbc_context_menu->add_child(p_control);
|
context_menu_hbox->add_child(p_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatialEditor::remove_control_from_menu_panel(Control *p_control) {
|
void SpatialEditor::remove_control_from_menu_panel(Control *p_control) {
|
||||||
hbc_context_menu->remove_child(p_control);
|
context_menu_hbox->remove_child(p_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatialEditor::set_can_preview(Camera *p_preview) {
|
void SpatialEditor::set_can_preview(Camera *p_preview) {
|
||||||
|
@ -6576,15 +6577,20 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||||
|
|
||||||
camera_override_viewport_id = 0;
|
camera_override_viewport_id = 0;
|
||||||
|
|
||||||
hbc_menu = memnew(HBoxContainer);
|
// A fluid container for all toolbars.
|
||||||
vbc->add_child(hbc_menu);
|
HFlowContainer *main_flow = memnew(HFlowContainer);
|
||||||
|
vbc->add_child(main_flow);
|
||||||
|
|
||||||
|
// Main toolbars.
|
||||||
|
HBoxContainer *main_menu_hbox = memnew(HBoxContainer);
|
||||||
|
main_flow->add_child(main_menu_hbox);
|
||||||
|
|
||||||
Vector<Variant> button_binds;
|
Vector<Variant> button_binds;
|
||||||
button_binds.resize(1);
|
button_binds.resize(1);
|
||||||
String sct;
|
String sct;
|
||||||
|
|
||||||
tool_button[TOOL_MODE_SELECT] = memnew(ToolButton);
|
tool_button[TOOL_MODE_SELECT] = memnew(ToolButton);
|
||||||
hbc_menu->add_child(tool_button[TOOL_MODE_SELECT]);
|
main_menu_hbox->add_child(tool_button[TOOL_MODE_SELECT]);
|
||||||
tool_button[TOOL_MODE_SELECT]->set_toggle_mode(true);
|
tool_button[TOOL_MODE_SELECT]->set_toggle_mode(true);
|
||||||
tool_button[TOOL_MODE_SELECT]->set_flat(true);
|
tool_button[TOOL_MODE_SELECT]->set_flat(true);
|
||||||
tool_button[TOOL_MODE_SELECT]->set_pressed(true);
|
tool_button[TOOL_MODE_SELECT]->set_pressed(true);
|
||||||
|
@ -6592,10 +6598,10 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||||
tool_button[TOOL_MODE_SELECT]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
tool_button[TOOL_MODE_SELECT]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
||||||
tool_button[TOOL_MODE_SELECT]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_select", TTR("Select Mode"), KEY_Q));
|
tool_button[TOOL_MODE_SELECT]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_select", TTR("Select Mode"), KEY_Q));
|
||||||
tool_button[TOOL_MODE_SELECT]->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked."));
|
tool_button[TOOL_MODE_SELECT]->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked."));
|
||||||
hbc_menu->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
tool_button[TOOL_MODE_MOVE] = memnew(ToolButton);
|
tool_button[TOOL_MODE_MOVE] = memnew(ToolButton);
|
||||||
hbc_menu->add_child(tool_button[TOOL_MODE_MOVE]);
|
main_menu_hbox->add_child(tool_button[TOOL_MODE_MOVE]);
|
||||||
tool_button[TOOL_MODE_MOVE]->set_toggle_mode(true);
|
tool_button[TOOL_MODE_MOVE]->set_toggle_mode(true);
|
||||||
tool_button[TOOL_MODE_MOVE]->set_flat(true);
|
tool_button[TOOL_MODE_MOVE]->set_flat(true);
|
||||||
button_binds.write[0] = MENU_TOOL_MOVE;
|
button_binds.write[0] = MENU_TOOL_MOVE;
|
||||||
|
@ -6603,7 +6609,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||||
tool_button[TOOL_MODE_MOVE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_move", TTR("Move Mode"), KEY_W));
|
tool_button[TOOL_MODE_MOVE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_move", TTR("Move Mode"), KEY_W));
|
||||||
|
|
||||||
tool_button[TOOL_MODE_ROTATE] = memnew(ToolButton);
|
tool_button[TOOL_MODE_ROTATE] = memnew(ToolButton);
|
||||||
hbc_menu->add_child(tool_button[TOOL_MODE_ROTATE]);
|
main_menu_hbox->add_child(tool_button[TOOL_MODE_ROTATE]);
|
||||||
tool_button[TOOL_MODE_ROTATE]->set_toggle_mode(true);
|
tool_button[TOOL_MODE_ROTATE]->set_toggle_mode(true);
|
||||||
tool_button[TOOL_MODE_ROTATE]->set_flat(true);
|
tool_button[TOOL_MODE_ROTATE]->set_flat(true);
|
||||||
button_binds.write[0] = MENU_TOOL_ROTATE;
|
button_binds.write[0] = MENU_TOOL_ROTATE;
|
||||||
|
@ -6611,17 +6617,17 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||||
tool_button[TOOL_MODE_ROTATE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_rotate", TTR("Rotate Mode"), KEY_E));
|
tool_button[TOOL_MODE_ROTATE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_rotate", TTR("Rotate Mode"), KEY_E));
|
||||||
|
|
||||||
tool_button[TOOL_MODE_SCALE] = memnew(ToolButton);
|
tool_button[TOOL_MODE_SCALE] = memnew(ToolButton);
|
||||||
hbc_menu->add_child(tool_button[TOOL_MODE_SCALE]);
|
main_menu_hbox->add_child(tool_button[TOOL_MODE_SCALE]);
|
||||||
tool_button[TOOL_MODE_SCALE]->set_toggle_mode(true);
|
tool_button[TOOL_MODE_SCALE]->set_toggle_mode(true);
|
||||||
tool_button[TOOL_MODE_SCALE]->set_flat(true);
|
tool_button[TOOL_MODE_SCALE]->set_flat(true);
|
||||||
button_binds.write[0] = MENU_TOOL_SCALE;
|
button_binds.write[0] = MENU_TOOL_SCALE;
|
||||||
tool_button[TOOL_MODE_SCALE]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
tool_button[TOOL_MODE_SCALE]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
||||||
tool_button[TOOL_MODE_SCALE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_scale", TTR("Scale Mode"), KEY_R));
|
tool_button[TOOL_MODE_SCALE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_scale", TTR("Scale Mode"), KEY_R));
|
||||||
|
|
||||||
hbc_menu->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
tool_button[TOOL_MODE_LIST_SELECT] = memnew(ToolButton);
|
tool_button[TOOL_MODE_LIST_SELECT] = memnew(ToolButton);
|
||||||
hbc_menu->add_child(tool_button[TOOL_MODE_LIST_SELECT]);
|
main_menu_hbox->add_child(tool_button[TOOL_MODE_LIST_SELECT]);
|
||||||
tool_button[TOOL_MODE_LIST_SELECT]->set_toggle_mode(true);
|
tool_button[TOOL_MODE_LIST_SELECT]->set_toggle_mode(true);
|
||||||
tool_button[TOOL_MODE_LIST_SELECT]->set_flat(true);
|
tool_button[TOOL_MODE_LIST_SELECT]->set_flat(true);
|
||||||
button_binds.write[0] = MENU_TOOL_LIST_SELECT;
|
button_binds.write[0] = MENU_TOOL_LIST_SELECT;
|
||||||
|
@ -6629,37 +6635,37 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||||
tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip(TTR("Show a list of all objects at the position clicked\n(same as Alt+RMB in select mode)."));
|
tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip(TTR("Show a list of all objects at the position clicked\n(same as Alt+RMB in select mode)."));
|
||||||
|
|
||||||
tool_button[TOOL_LOCK_SELECTED] = memnew(ToolButton);
|
tool_button[TOOL_LOCK_SELECTED] = memnew(ToolButton);
|
||||||
hbc_menu->add_child(tool_button[TOOL_LOCK_SELECTED]);
|
main_menu_hbox->add_child(tool_button[TOOL_LOCK_SELECTED]);
|
||||||
button_binds.write[0] = MENU_LOCK_SELECTED;
|
button_binds.write[0] = MENU_LOCK_SELECTED;
|
||||||
tool_button[TOOL_LOCK_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
tool_button[TOOL_LOCK_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
||||||
tool_button[TOOL_LOCK_SELECTED]->set_tooltip(TTR("Lock the selected object in place (can't be moved)."));
|
tool_button[TOOL_LOCK_SELECTED]->set_tooltip(TTR("Lock the selected object in place (can't be moved)."));
|
||||||
tool_button[TOOL_LOCK_SELECTED]->set_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KEY_MASK_CMD | KEY_L));
|
tool_button[TOOL_LOCK_SELECTED]->set_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KEY_MASK_CMD | KEY_L));
|
||||||
|
|
||||||
tool_button[TOOL_UNLOCK_SELECTED] = memnew(ToolButton);
|
tool_button[TOOL_UNLOCK_SELECTED] = memnew(ToolButton);
|
||||||
hbc_menu->add_child(tool_button[TOOL_UNLOCK_SELECTED]);
|
main_menu_hbox->add_child(tool_button[TOOL_UNLOCK_SELECTED]);
|
||||||
button_binds.write[0] = MENU_UNLOCK_SELECTED;
|
button_binds.write[0] = MENU_UNLOCK_SELECTED;
|
||||||
tool_button[TOOL_UNLOCK_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
tool_button[TOOL_UNLOCK_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
||||||
tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip(TTR("Unlock the selected object (can be moved)."));
|
tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip(TTR("Unlock the selected object (can be moved)."));
|
||||||
tool_button[TOOL_UNLOCK_SELECTED]->set_shortcut(ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_L));
|
tool_button[TOOL_UNLOCK_SELECTED]->set_shortcut(ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_L));
|
||||||
|
|
||||||
tool_button[TOOL_GROUP_SELECTED] = memnew(ToolButton);
|
tool_button[TOOL_GROUP_SELECTED] = memnew(ToolButton);
|
||||||
hbc_menu->add_child(tool_button[TOOL_GROUP_SELECTED]);
|
main_menu_hbox->add_child(tool_button[TOOL_GROUP_SELECTED]);
|
||||||
button_binds.write[0] = MENU_GROUP_SELECTED;
|
button_binds.write[0] = MENU_GROUP_SELECTED;
|
||||||
tool_button[TOOL_GROUP_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
tool_button[TOOL_GROUP_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
||||||
tool_button[TOOL_GROUP_SELECTED]->set_tooltip(TTR("Makes sure the object's children are not selectable."));
|
tool_button[TOOL_GROUP_SELECTED]->set_tooltip(TTR("Makes sure the object's children are not selectable."));
|
||||||
tool_button[TOOL_GROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KEY_MASK_CMD | KEY_G));
|
tool_button[TOOL_GROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KEY_MASK_CMD | KEY_G));
|
||||||
|
|
||||||
tool_button[TOOL_UNGROUP_SELECTED] = memnew(ToolButton);
|
tool_button[TOOL_UNGROUP_SELECTED] = memnew(ToolButton);
|
||||||
hbc_menu->add_child(tool_button[TOOL_UNGROUP_SELECTED]);
|
main_menu_hbox->add_child(tool_button[TOOL_UNGROUP_SELECTED]);
|
||||||
button_binds.write[0] = MENU_UNGROUP_SELECTED;
|
button_binds.write[0] = MENU_UNGROUP_SELECTED;
|
||||||
tool_button[TOOL_UNGROUP_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
tool_button[TOOL_UNGROUP_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
||||||
tool_button[TOOL_UNGROUP_SELECTED]->set_tooltip(TTR("Restores the object's children's ability to be selected."));
|
tool_button[TOOL_UNGROUP_SELECTED]->set_tooltip(TTR("Restores the object's children's ability to be selected."));
|
||||||
tool_button[TOOL_UNGROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G));
|
tool_button[TOOL_UNGROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G));
|
||||||
|
|
||||||
hbc_menu->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
tool_option_button[TOOL_OPT_LOCAL_COORDS] = memnew(ToolButton);
|
tool_option_button[TOOL_OPT_LOCAL_COORDS] = memnew(ToolButton);
|
||||||
hbc_menu->add_child(tool_option_button[TOOL_OPT_LOCAL_COORDS]);
|
main_menu_hbox->add_child(tool_option_button[TOOL_OPT_LOCAL_COORDS]);
|
||||||
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_toggle_mode(true);
|
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_toggle_mode(true);
|
||||||
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_flat(true);
|
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_flat(true);
|
||||||
button_binds.write[0] = MENU_TOOL_LOCAL_COORDS;
|
button_binds.write[0] = MENU_TOOL_LOCAL_COORDS;
|
||||||
|
@ -6667,17 +6673,17 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||||
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTR("Use Local Space"), KEY_T));
|
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTR("Use Local Space"), KEY_T));
|
||||||
|
|
||||||
tool_option_button[TOOL_OPT_USE_SNAP] = memnew(ToolButton);
|
tool_option_button[TOOL_OPT_USE_SNAP] = memnew(ToolButton);
|
||||||
hbc_menu->add_child(tool_option_button[TOOL_OPT_USE_SNAP]);
|
main_menu_hbox->add_child(tool_option_button[TOOL_OPT_USE_SNAP]);
|
||||||
tool_option_button[TOOL_OPT_USE_SNAP]->set_toggle_mode(true);
|
tool_option_button[TOOL_OPT_USE_SNAP]->set_toggle_mode(true);
|
||||||
tool_option_button[TOOL_OPT_USE_SNAP]->set_flat(true);
|
tool_option_button[TOOL_OPT_USE_SNAP]->set_flat(true);
|
||||||
button_binds.write[0] = MENU_TOOL_USE_SNAP;
|
button_binds.write[0] = MENU_TOOL_USE_SNAP;
|
||||||
tool_option_button[TOOL_OPT_USE_SNAP]->connect("toggled", this, "_menu_item_toggled", button_binds);
|
tool_option_button[TOOL_OPT_USE_SNAP]->connect("toggled", this, "_menu_item_toggled", button_binds);
|
||||||
tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut(ED_SHORTCUT("spatial_editor/snap", TTR("Use Snap"), KEY_Y));
|
tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut(ED_SHORTCUT("spatial_editor/snap", TTR("Use Snap"), KEY_Y));
|
||||||
|
|
||||||
hbc_menu->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA] = memnew(ToolButton);
|
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA] = memnew(ToolButton);
|
||||||
hbc_menu->add_child(tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]);
|
main_menu_hbox->add_child(tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]);
|
||||||
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_toggle_mode(true);
|
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_toggle_mode(true);
|
||||||
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_flat(true);
|
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_flat(true);
|
||||||
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_disabled(true);
|
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_disabled(true);
|
||||||
|
@ -6686,7 +6692,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||||
_update_camera_override_button(false);
|
_update_camera_override_button(false);
|
||||||
|
|
||||||
tool_button[TOOL_CONVERT_ROOMS] = memnew(ToolButton);
|
tool_button[TOOL_CONVERT_ROOMS] = memnew(ToolButton);
|
||||||
hbc_menu->add_child(tool_button[TOOL_CONVERT_ROOMS]);
|
main_menu_hbox->add_child(tool_button[TOOL_CONVERT_ROOMS]);
|
||||||
tool_button[TOOL_CONVERT_ROOMS]->set_toggle_mode(false);
|
tool_button[TOOL_CONVERT_ROOMS]->set_toggle_mode(false);
|
||||||
tool_button[TOOL_CONVERT_ROOMS]->set_flat(true);
|
tool_button[TOOL_CONVERT_ROOMS]->set_flat(true);
|
||||||
button_binds.write[0] = MENU_TOOL_CONVERT_ROOMS;
|
button_binds.write[0] = MENU_TOOL_CONVERT_ROOMS;
|
||||||
|
@ -6694,7 +6700,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||||
tool_button[TOOL_CONVERT_ROOMS]->set_shortcut(ED_SHORTCUT("spatial_editor/convert_rooms", TTR("Convert Rooms"), KEY_MASK_ALT | KEY_C));
|
tool_button[TOOL_CONVERT_ROOMS]->set_shortcut(ED_SHORTCUT("spatial_editor/convert_rooms", TTR("Convert Rooms"), KEY_MASK_ALT | KEY_C));
|
||||||
tool_button[TOOL_CONVERT_ROOMS]->set_tooltip(TTR("Converts rooms for portal culling."));
|
tool_button[TOOL_CONVERT_ROOMS]->set_tooltip(TTR("Converts rooms for portal culling."));
|
||||||
|
|
||||||
hbc_menu->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
// Drag and drop support;
|
// Drag and drop support;
|
||||||
preview_node = memnew(Spatial);
|
preview_node = memnew(Spatial);
|
||||||
|
@ -6727,7 +6733,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||||
transform_menu = memnew(MenuButton);
|
transform_menu = memnew(MenuButton);
|
||||||
transform_menu->set_text(TTR("Transform"));
|
transform_menu->set_text(TTR("Transform"));
|
||||||
transform_menu->set_switch_on_hover(true);
|
transform_menu->set_switch_on_hover(true);
|
||||||
hbc_menu->add_child(transform_menu);
|
main_menu_hbox->add_child(transform_menu);
|
||||||
|
|
||||||
p = transform_menu->get_popup();
|
p = transform_menu->get_popup();
|
||||||
p->add_shortcut(ED_SHORTCUT("spatial_editor/snap_to_floor", TTR("Snap Object to Floor"), KEY_PAGEDOWN), MENU_SNAP_TO_FLOOR);
|
p->add_shortcut(ED_SHORTCUT("spatial_editor/snap_to_floor", TTR("Snap Object to Floor"), KEY_PAGEDOWN), MENU_SNAP_TO_FLOOR);
|
||||||
|
@ -6742,17 +6748,17 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||||
// TRANSLATORS: Noun, name of the 2D/3D View menus.
|
// TRANSLATORS: Noun, name of the 2D/3D View menus.
|
||||||
view_menu->set_text(TTR("View"));
|
view_menu->set_text(TTR("View"));
|
||||||
view_menu->set_switch_on_hover(true);
|
view_menu->set_switch_on_hover(true);
|
||||||
hbc_menu->add_child(view_menu);
|
main_menu_hbox->add_child(view_menu);
|
||||||
|
|
||||||
hbc_menu->add_child(memnew(VSeparator));
|
main_menu_hbox->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
context_menu_container = memnew(PanelContainer);
|
context_menu_panel = memnew(PanelContainer);
|
||||||
hbc_context_menu = memnew(HBoxContainer);
|
context_menu_hbox = memnew(HBoxContainer);
|
||||||
context_menu_container->add_child(hbc_context_menu);
|
context_menu_panel->add_child(context_menu_hbox);
|
||||||
// Use a custom stylebox to make contextual menu items stand out from the rest.
|
// Use a custom stylebox to make contextual menu items stand out from the rest.
|
||||||
// This helps with editor usability as contextual menu items change when selecting nodes,
|
// This helps with editor usability as contextual menu items change when selecting nodes,
|
||||||
// even though it may not be immediately obvious at first.
|
// even though it may not be immediately obvious at first.
|
||||||
hbc_menu->add_child(context_menu_container);
|
main_flow->add_child(context_menu_panel);
|
||||||
_update_context_menu_stylebox();
|
_update_context_menu_stylebox();
|
||||||
|
|
||||||
// Get the view menu popup and have it stay open when a checkable item is selected
|
// Get the view menu popup and have it stay open when a checkable item is selected
|
||||||
|
|
|
@ -712,11 +712,10 @@ private:
|
||||||
void _update_camera_override_button(bool p_game_running);
|
void _update_camera_override_button(bool p_game_running);
|
||||||
void _update_camera_override_viewport(Object *p_viewport);
|
void _update_camera_override_viewport(Object *p_viewport);
|
||||||
|
|
||||||
HBoxContainer *hbc_menu;
|
|
||||||
// Used for secondary menu items which are displayed depending on the currently selected node
|
// Used for secondary menu items which are displayed depending on the currently selected node
|
||||||
// (such as MeshInstance's "Mesh" menu).
|
// (such as MeshInstance's "Mesh" menu).
|
||||||
PanelContainer *context_menu_container;
|
PanelContainer *context_menu_panel = nullptr;
|
||||||
HBoxContainer *hbc_context_menu;
|
HBoxContainer *context_menu_hbox = nullptr;
|
||||||
|
|
||||||
void _generate_selection_boxes();
|
void _generate_selection_boxes();
|
||||||
UndoRedo *undo_redo;
|
UndoRedo *undo_redo;
|
||||||
|
|
Loading…
Reference in New Issue