mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-23 20:36:53 +01:00
Ported: Use FlowContainer to handle toolbar overflow more gracefully - YuriSizov
842c3a644f
This commit is contained in:
parent
56f71c7275
commit
dfe183d3e0
@ -70,6 +70,7 @@
|
||||
#include "scene/gui/check_box.h"
|
||||
#include "scene/gui/container.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
#include "scene/gui/flow_container.h"
|
||||
#include "scene/gui/grid_container.h"
|
||||
#include "scene/gui/label.h"
|
||||
#include "scene/gui/menu_button.h"
|
||||
@ -3951,7 +3952,7 @@ void CanvasItemEditor::_update_context_menu_stylebox() {
|
||||
context_menu_stylebox->set_border_color(accent_color);
|
||||
context_menu_stylebox->set_border_width(MARGIN_BOTTOM, Math::round(2 * EDSCALE));
|
||||
context_menu_stylebox->set_default_margin(MARGIN_BOTTOM, 0);
|
||||
context_menu_container->add_theme_style_override("panel", context_menu_stylebox);
|
||||
context_menu_panel->add_theme_style_override("panel", context_menu_stylebox);
|
||||
}
|
||||
|
||||
void CanvasItemEditor::_update_scrollbars() {
|
||||
@ -5231,11 +5232,11 @@ void CanvasItemEditor::remove_control_from_info_overlay(Control *p_control) {
|
||||
void CanvasItemEditor::add_control_to_menu_panel(Control *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) {
|
||||
hbc_context_menu->remove_child(p_control);
|
||||
context_menu_hbox->remove_child(p_control);
|
||||
}
|
||||
|
||||
void CanvasItemEditor::add_control_to_left_panel(Control *p_control) {
|
||||
@ -5359,9 +5360,14 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||
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));
|
||||
|
||||
hb = memnew(HBoxContainer);
|
||||
add_child(hb);
|
||||
hb->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
||||
// A fluid container for all toolbars.
|
||||
HFlowContainer *main_flow = memnew(HFlowContainer);
|
||||
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);
|
||||
add_child(bottom_split);
|
||||
@ -5459,82 +5465,82 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||
updating_scroll = false;
|
||||
|
||||
select_button = memnew(ToolButton);
|
||||
hb->add_child(select_button);
|
||||
main_menu_hbox->add_child(select_button);
|
||||
select_button->set_toggle_mode(true);
|
||||
select_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_SELECT));
|
||||
select_button->set_pressed(true);
|
||||
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."));
|
||||
|
||||
hb->add_child(memnew(VSeparator));
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
move_button = memnew(ToolButton);
|
||||
hb->add_child(move_button);
|
||||
main_menu_hbox->add_child(move_button);
|
||||
move_button->set_toggle_mode(true);
|
||||
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_tooltip(TTR("Move Mode"));
|
||||
|
||||
rotate_button = memnew(ToolButton);
|
||||
hb->add_child(rotate_button);
|
||||
main_menu_hbox->add_child(rotate_button);
|
||||
rotate_button->set_toggle_mode(true);
|
||||
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_tooltip(TTR("Rotate Mode"));
|
||||
|
||||
scale_button = memnew(ToolButton);
|
||||
hb->add_child(scale_button);
|
||||
main_menu_hbox->add_child(scale_button);
|
||||
scale_button->set_toggle_mode(true);
|
||||
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_tooltip(TTR("Shift: Scale proportionally."));
|
||||
|
||||
hb->add_child(memnew(VSeparator));
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
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->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)."));
|
||||
|
||||
pivot_button = memnew(ToolButton);
|
||||
hb->add_child(pivot_button);
|
||||
main_menu_hbox->add_child(pivot_button);
|
||||
pivot_button->set_toggle_mode(true);
|
||||
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."));
|
||||
|
||||
pan_button = memnew(ToolButton);
|
||||
hb->add_child(pan_button);
|
||||
main_menu_hbox->add_child(pan_button);
|
||||
pan_button->set_toggle_mode(true);
|
||||
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_tooltip(TTR("Pan Mode"));
|
||||
|
||||
ruler_button = memnew(ToolButton);
|
||||
hb->add_child(ruler_button);
|
||||
main_menu_hbox->add_child(ruler_button);
|
||||
ruler_button->set_toggle_mode(true);
|
||||
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_tooltip(TTR("Ruler Mode"));
|
||||
|
||||
hb->add_child(memnew(VSeparator));
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
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->connect("toggled", this, "_button_toggle_smart_snap");
|
||||
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));
|
||||
|
||||
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->connect("toggled", this, "_button_toggle_grid_snap");
|
||||
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));
|
||||
|
||||
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_tooltip(TTR("Snapping Options"));
|
||||
snap_config_menu->set_switch_on_hover(true);
|
||||
@ -5563,37 +5569,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_guides", TTR("Snap to Guides")), SNAP_USE_GUIDES);
|
||||
|
||||
hb->add_child(memnew(VSeparator));
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
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->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));
|
||||
|
||||
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->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));
|
||||
|
||||
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->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));
|
||||
|
||||
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->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));
|
||||
|
||||
hb->add_child(memnew(VSeparator));
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
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_switch_on_hover(true);
|
||||
|
||||
@ -5604,20 +5610,20 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_make_bones", TTR("Make Bone2D Node(s) from Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B), SKELETON_MAKE_BONES);
|
||||
p->connect("id_pressed", this, "_popup_callback");
|
||||
|
||||
hb->add_child(memnew(VSeparator));
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
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->set_toggle_mode(true);
|
||||
override_camera_button->set_disabled(true);
|
||||
_update_override_camera_button(false);
|
||||
|
||||
hb->add_child(memnew(VSeparator));
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
view_menu = memnew(MenuButton);
|
||||
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->set_switch_on_hover(true);
|
||||
|
||||
@ -5638,20 +5644,20 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||
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);
|
||||
|
||||
hb->add_child(memnew(VSeparator));
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
context_menu_container = memnew(PanelContainer);
|
||||
hbc_context_menu = memnew(HBoxContainer);
|
||||
context_menu_container->add_child(hbc_context_menu);
|
||||
context_menu_panel = memnew(PanelContainer);
|
||||
context_menu_hbox = memnew(HBoxContainer);
|
||||
context_menu_panel->add_child(context_menu_hbox);
|
||||
// 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,
|
||||
// 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();
|
||||
|
||||
presets_menu = memnew(MenuButton);
|
||||
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->set_switch_on_hover(true);
|
||||
|
||||
@ -5664,13 +5670,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
||||
anchors_popup->connect("id_pressed", this, "_popup_callback");
|
||||
|
||||
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->hide();
|
||||
anchor_mode_button->connect("toggled", this, "_button_toggle_anchor_mode");
|
||||
|
||||
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->hide();
|
||||
|
||||
|
@ -260,11 +260,11 @@ private:
|
||||
|
||||
HScrollBar *h_scroll;
|
||||
VScrollBar *v_scroll;
|
||||
HBoxContainer *hb;
|
||||
|
||||
// Used for secondary menu items which are displayed depending on the currently selected node
|
||||
// (such as MeshInstance's "Mesh" menu).
|
||||
PanelContainer *context_menu_container;
|
||||
HBoxContainer *hbc_context_menu;
|
||||
PanelContainer *context_menu_panel;
|
||||
HBoxContainer *context_menu_hbox;
|
||||
|
||||
ToolButton *zoom_minus;
|
||||
ToolButton *zoom_reset;
|
||||
@ -590,8 +590,6 @@ protected:
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
HBoxContainer *get_panel_hb() { return hb; }
|
||||
|
||||
struct compare_items_x {
|
||||
bool operator()(const CanvasItem *a, const CanvasItem *b) const {
|
||||
return a->get_global_transform().columns[2].x < b->get_global_transform().columns[2].x;
|
||||
|
@ -74,6 +74,7 @@
|
||||
#include "scene/3d/physics_body.h"
|
||||
#include "scene/3d/room_manager.h"
|
||||
#include "scene/3d/visual_instance.h"
|
||||
#include "scene/gui/flow_container.h"
|
||||
#include "scene/gui/check_box.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
#include "scene/gui/label.h"
|
||||
@ -6273,7 +6274,7 @@ void SpatialEditor::_update_context_menu_stylebox() {
|
||||
context_menu_stylebox->set_border_color(accent_color);
|
||||
context_menu_stylebox->set_border_width(MARGIN_BOTTOM, Math::round(2 * EDSCALE));
|
||||
context_menu_stylebox->set_default_margin(MARGIN_BOTTOM, 0);
|
||||
context_menu_container->add_theme_style_override("panel", context_menu_stylebox);
|
||||
context_menu_panel->add_theme_style_override("panel", context_menu_stylebox);
|
||||
}
|
||||
|
||||
void SpatialEditor::_update_gizmos_menu() {
|
||||
@ -6836,11 +6837,11 @@ Vector<int> SpatialEditor::get_subgizmo_selection() {
|
||||
}
|
||||
|
||||
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) {
|
||||
hbc_context_menu->remove_child(p_control);
|
||||
context_menu_hbox->remove_child(p_control);
|
||||
}
|
||||
|
||||
void SpatialEditor::set_can_preview(Camera *p_preview) {
|
||||
@ -7140,15 +7141,20 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||
|
||||
camera_override_viewport_id = 0;
|
||||
|
||||
hbc_menu = memnew(HBoxContainer);
|
||||
vbc->add_child(hbc_menu);
|
||||
// A fluid container for all toolbars.
|
||||
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;
|
||||
button_binds.resize(1);
|
||||
String sct;
|
||||
|
||||
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_flat(true);
|
||||
tool_button[TOOL_MODE_SELECT]->set_pressed(true);
|
||||
@ -7156,10 +7162,10 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||
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_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);
|
||||
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_flat(true);
|
||||
button_binds.write[0] = MENU_TOOL_MOVE;
|
||||
@ -7167,7 +7173,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_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_flat(true);
|
||||
button_binds.write[0] = MENU_TOOL_ROTATE;
|
||||
@ -7175,17 +7181,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_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_flat(true);
|
||||
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]->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);
|
||||
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_flat(true);
|
||||
button_binds.write[0] = MENU_TOOL_LIST_SELECT;
|
||||
@ -7193,37 +7199,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_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;
|
||||
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_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KEY_MASK_CMD | KEY_L));
|
||||
|
||||
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;
|
||||
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_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);
|
||||
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;
|
||||
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_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KEY_MASK_CMD | KEY_G));
|
||||
|
||||
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;
|
||||
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_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);
|
||||
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_flat(true);
|
||||
button_binds.write[0] = MENU_TOOL_LOCAL_COORDS;
|
||||
@ -7231,17 +7237,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_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_flat(true);
|
||||
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]->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);
|
||||
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_flat(true);
|
||||
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_disabled(true);
|
||||
@ -7250,7 +7256,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||
_update_camera_override_button(false);
|
||||
|
||||
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_flat(true);
|
||||
button_binds.write[0] = MENU_TOOL_CONVERT_ROOMS;
|
||||
@ -7258,7 +7264,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_tooltip(TTR("Converts rooms for portal culling."));
|
||||
|
||||
hbc_menu->add_child(memnew(VSeparator));
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
// Drag and drop support;
|
||||
preview_node = memnew(Spatial);
|
||||
@ -7291,7 +7297,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||
transform_menu = memnew(MenuButton);
|
||||
transform_menu->set_text(TTR("Transform"));
|
||||
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->add_shortcut(ED_SHORTCUT("spatial_editor/snap_to_floor", TTR("Snap Object to Floor"), KEY_PAGEDOWN), MENU_SNAP_TO_FLOOR);
|
||||
@ -7305,17 +7311,17 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||
view_menu = memnew(MenuButton);
|
||||
view_menu->set_text(TTR("View"));
|
||||
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);
|
||||
hbc_context_menu = memnew(HBoxContainer);
|
||||
context_menu_container->add_child(hbc_context_menu);
|
||||
context_menu_panel = memnew(PanelContainer);
|
||||
context_menu_hbox = memnew(HBoxContainer);
|
||||
context_menu_panel->add_child(context_menu_hbox);
|
||||
// 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,
|
||||
// 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();
|
||||
|
||||
// Get the view menu popup and have it stay open when a checkable item is selected
|
||||
@ -7521,7 +7527,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||
update_portal_tools();
|
||||
|
||||
tool_button[TOOL_MODE_EXTERNAL] = memnew(ToolButton);
|
||||
hbc_menu->add_child(tool_button[TOOL_MODE_EXTERNAL]);
|
||||
//hbc_menu->add_child(tool_button[TOOL_MODE_EXTERNAL]);
|
||||
button_binds.write[0] = MENU_TOOL_EXTERNAL;
|
||||
tool_button[TOOL_MODE_EXTERNAL]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
||||
}
|
||||
|
@ -39,12 +39,13 @@
|
||||
#include "scene/3d/skeleton.h"
|
||||
#include "scene/gui/spin_box.h"
|
||||
|
||||
#include "core/math/color.h"
|
||||
#include "core/variant/dictionary.h"
|
||||
#include "core/error/error_macros.h"
|
||||
#include "core/containers/hash_map.h"
|
||||
#include "core/containers/list.h"
|
||||
#include "core/containers/rid.h"
|
||||
#include "core/containers/vector.h"
|
||||
#include "core/error/error_macros.h"
|
||||
#include "core/math/aabb.h"
|
||||
#include "core/math/color.h"
|
||||
#include "core/math/math_defs.h"
|
||||
#include "core/math/transform.h"
|
||||
#include "core/math/vector2.h"
|
||||
@ -53,11 +54,10 @@
|
||||
#include "core/object/object_id.h"
|
||||
#include "core/object/reference.h"
|
||||
#include "core/object/resource.h"
|
||||
#include "core/containers/rid.h"
|
||||
#include "core/typedefs.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/typedefs.h"
|
||||
#include "core/variant/dictionary.h"
|
||||
#include "core/variant/variant.h"
|
||||
#include "core/containers/vector.h"
|
||||
#include "editor/editor_scale.h"
|
||||
|
||||
#include "editor/spatial_editor_gizmos.h"
|
||||
@ -699,11 +699,10 @@ private:
|
||||
void _update_camera_override_button(bool p_game_running);
|
||||
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
|
||||
// (such as MeshInstance's "Mesh" menu).
|
||||
PanelContainer *context_menu_container;
|
||||
HBoxContainer *hbc_context_menu;
|
||||
PanelContainer *context_menu_panel;
|
||||
HBoxContainer *context_menu_hbox;
|
||||
|
||||
void _generate_selection_boxes();
|
||||
UndoRedo *undo_redo;
|
||||
|
Loading…
Reference in New Issue
Block a user