Add ability to hide grid per viewport
This commit is contained in:
parent
fb10e67fef
commit
df431542c3
2 changed files with 17 additions and 2 deletions
|
@ -3433,7 +3433,8 @@ void Node3DEditorViewport::_menu_option(int p_option) {
|
|||
int idx = view_menu->get_popup()->get_item_index(VIEW_GIZMOS);
|
||||
bool current = view_menu->get_popup()->is_item_checked(idx);
|
||||
current = !current;
|
||||
uint32_t layers = ((1 << 20) - 1) | (1 << (GIZMO_BASE_LAYER + index)) | (1 << GIZMO_GRID_LAYER) | (1 << MISC_TOOL_LAYER);
|
||||
uint32_t layers = camera->get_cull_mask();
|
||||
layers &= ~(1 << GIZMO_EDIT_LAYER);
|
||||
if (current) {
|
||||
layers |= (1 << GIZMO_EDIT_LAYER);
|
||||
}
|
||||
|
@ -3457,7 +3458,18 @@ void Node3DEditorViewport::_menu_option(int p_option) {
|
|||
int idx = view_menu->get_popup()->get_item_index(VIEW_FRAME_TIME);
|
||||
bool current = view_menu->get_popup()->is_item_checked(idx);
|
||||
view_menu->get_popup()->set_item_checked(idx, !current);
|
||||
|
||||
} break;
|
||||
case VIEW_GRID: {
|
||||
int idx = view_menu->get_popup()->get_item_index(VIEW_GRID);
|
||||
bool current = view_menu->get_popup()->is_item_checked(idx);
|
||||
current = !current;
|
||||
uint32_t layers = camera->get_cull_mask();
|
||||
layers &= ~(1 << GIZMO_GRID_LAYER);
|
||||
if (current) {
|
||||
layers |= (1 << GIZMO_GRID_LAYER);
|
||||
}
|
||||
camera->set_cull_mask(layers);
|
||||
view_menu->get_popup()->set_item_checked(idx, current);
|
||||
} break;
|
||||
case VIEW_DISPLAY_NORMAL:
|
||||
case VIEW_DISPLAY_WIREFRAME:
|
||||
|
@ -5131,6 +5143,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p
|
|||
view_menu->get_popup()->add_separator();
|
||||
view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_environment", TTR("View Environment")), VIEW_ENVIRONMENT);
|
||||
view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_gizmos", TTR("View Gizmos")), VIEW_GIZMOS);
|
||||
view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_grid_lines", TTR("View Grid")), VIEW_GRID);
|
||||
view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_information", TTR("View Information")), VIEW_INFORMATION);
|
||||
view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_fps", TTR("View Frame Time")), VIEW_FRAME_TIME);
|
||||
view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_ENVIRONMENT), true);
|
||||
|
@ -5140,6 +5153,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p
|
|||
view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_audio_listener", TTR("Audio Listener")), VIEW_AUDIO_LISTENER);
|
||||
view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_audio_doppler", TTR("Enable Doppler")), VIEW_AUDIO_DOPPLER);
|
||||
view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_GIZMOS), true);
|
||||
view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_GRID), true);
|
||||
|
||||
view_menu->get_popup()->add_separator();
|
||||
view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_cinematic_preview", TTR("Cinematic Preview")), VIEW_CINEMATIC_PREVIEW);
|
||||
|
|
|
@ -124,6 +124,7 @@ class Node3DEditorViewport : public Control {
|
|||
VIEW_AUDIO_LISTENER,
|
||||
VIEW_AUDIO_DOPPLER,
|
||||
VIEW_GIZMOS,
|
||||
VIEW_GRID,
|
||||
VIEW_INFORMATION,
|
||||
VIEW_FRAME_TIME,
|
||||
|
||||
|
|
Loading…
Reference in a new issue