From fa46a3d41562252eabeb9479f43b48842d72c629 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 27 Jun 2024 20:19:40 +0200 Subject: [PATCH] Disable debug draw modes in the 3D editor according to current rendering method - Add tooltips to some debug draw modes, including when it's unsupported due to the current rendering method in use. - Improve documentation related to debug draw modes. --- doc/classes/RenderingServer.xml | 32 +++++-- doc/classes/Viewport.xml | 40 ++++++-- editor/plugins/node_3d_editor_plugin.cpp | 112 ++++++++++++++--------- editor/plugins/node_3d_editor_plugin.h | 8 ++ 4 files changed, 135 insertions(+), 57 deletions(-) diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 3c9f0fc7aff42..1dec6f3e85498 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -4908,10 +4908,11 @@ Objects are displayed with only light information. + [b]Note:[/b] When using this debug draw mode, custom shaders are ignored since all materials in the scene temporarily use a debug material. This means the result from custom shader functions (such as vertex displacement) won't be visible anymore when using this debug draw mode. Objects are displayed semi-transparent with additive blending so you can see where they are drawing over top of one another. A higher overdraw (represented by brighter colors) means you are wasting performance on drawing pixels that are being hidden behind others. - [b]Note:[/b] When using this debug draw mode, custom shaders will be ignored. This means vertex displacement won't be visible anymore. + [b]Note:[/b] When using this debug draw mode, custom shaders are ignored since all materials in the scene temporarily use a debug material. This means the result from custom shader functions (such as vertex displacement) won't be visible anymore when using this debug draw mode. Debug draw draws objects in wireframe. @@ -4920,13 +4921,16 @@ Normal buffer is drawn instead of regular scene so you can see the per-pixel normals that will be used by post-processing effects. - Objects are displayed with only the albedo value from [VoxelGI]s. + Objects are displayed with only the albedo value from [VoxelGI]s. Requires at least one visible [VoxelGI] node that has been baked to have a visible effect. + [b]Note:[/b] Only supported when using the Forward+ rendering method. - Objects are displayed with only the lighting value from [VoxelGI]s. + Objects are displayed with only the lighting value from [VoxelGI]s. Requires at least one visible [VoxelGI] node that has been baked to have a visible effect. + [b]Note:[/b] Only supported when using the Forward+ rendering method. - Objects are displayed with only the emission color from [VoxelGI]s. + Objects are displayed with only the emission color from [VoxelGI]s. Requires at least one visible [VoxelGI] node that has been baked to have a visible effect. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws the shadow atlas that stores shadows from [OmniLight3D]s and [SpotLight3D]s in the upper left quadrant of the [Viewport]. @@ -4938,51 +4942,67 @@ Draws the estimated scene luminance. This is a 1×1 texture that is generated when autoexposure is enabled to control the scene's exposure. + [b]Note:[/b] Only supported when using the Forward+ or Mobile rendering methods. Draws the screen space ambient occlusion texture instead of the scene so that you can clearly see how it is affecting objects. In order for this display mode to work, you must have [member Environment.ssao_enabled] set in your [WorldEnvironment]. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws the screen space indirect lighting texture instead of the scene so that you can clearly see how it is affecting objects. In order for this display mode to work, you must have [member Environment.ssil_enabled] set in your [WorldEnvironment]. + [b]Note:[/b] Only supported when using the Forward+ rendering method. - Colors each PSSM split for the [DirectionalLight3D]s in the scene a different color so you can see where the splits are. In order they will be colored red, green, blue, yellow. + Colors each PSSM split for the [DirectionalLight3D]s in the scene a different color so you can see where the splits are. In order (from closest to furthest from the camera), they are colored red, green, blue, and yellow. + [b]Note:[/b] When using this debug draw mode, custom shaders are ignored since all materials in the scene temporarily use a debug material. This means the result from custom shader functions (such as vertex displacement) won't be visible anymore when using this debug draw mode. + [b]Note:[/b] Only supported when using the Forward+ or Mobile rendering methods. Draws the decal atlas that stores decal textures from [Decal]s. + [b]Note:[/b] Only supported when using the Forward+ or Mobile rendering methods. Draws SDFGI cascade data. This is the data structure that is used to bounce lighting against and create reflections. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws SDFGI probe data. This is the data structure that is used to give indirect lighting dynamic objects moving within the scene. + [b]Note:[/b] Only supported when using the Forward+ rendering method. - Draws the global illumination buffer ([VoxelGI] or SDFGI). + Draws the global illumination buffer from [VoxelGI] or SDFGI. Requires [VoxelGI] (at least one visible baked VoxelGI node) or SDFGI ([member Environment.sdfgi_enabled]) to be enabled to have a visible effect. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Disable mesh LOD. All meshes are drawn with full detail, which can be used to compare performance. Draws the [OmniLight3D] cluster. Clustering determines where lights are positioned in screen-space, which allows the engine to only process these portions of the screen for lighting. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws the [SpotLight3D] cluster. Clustering determines where lights are positioned in screen-space, which allows the engine to only process these portions of the screen for lighting. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws the [Decal] cluster. Clustering determines where decals are positioned in screen-space, which allows the engine to only process these portions of the screen for decals. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws the [ReflectionProbe] cluster. Clustering determines where reflection probes are positioned in screen-space, which allows the engine to only process these portions of the screen for reflection probes. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws the occlusion culling buffer. This low-resolution occlusion culling buffer is rasterized on the CPU and is used to check whether instances are occluded by other objects. + [b]Note:[/b] Only supported when using the Forward+ or Mobile rendering methods. Draws the motion vectors buffer. This is used by temporal antialiasing to correct for motion that occurs during gameplay. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Internal buffer is drawn instead of regular scene so you can see the per-pixel output that will be used by post-processing effects. + [b]Note:[/b] Only supported when using the Forward+ or Mobile rendering methods. Variable rate shading is disabled. diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index b288ee7ff63ab..be510c259e47c 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -524,24 +524,30 @@ Objects are displayed without textures and only with lighting information. + [b]Note:[/b] When using this debug draw mode, custom shaders are ignored since all materials in the scene temporarily use a debug material. This means the result from custom shader functions (such as vertex displacement) won't be visible anymore when using this debug draw mode. Objects are displayed semi-transparent with additive blending so you can see where they are drawing over top of one another. A higher overdraw means you are wasting performance on drawing pixels that are being hidden behind others. + [b]Note:[/b] When using this debug draw mode, custom shaders are ignored since all materials in the scene temporarily use a debug material. This means the result from custom shader functions (such as vertex displacement) won't be visible anymore when using this debug draw mode. Objects are displayed as wireframe models. Objects are displayed without lighting information and their textures replaced by normal mapping. + [b]Note:[/b] Only supported when using the Forward+ rendering method. - Objects are displayed with only the albedo value from [VoxelGI]s. + Objects are displayed with only the albedo value from [VoxelGI]s. Requires at least one visible [VoxelGI] node that has been baked to have a visible effect. + [b]Note:[/b] Only supported when using the Forward+ rendering method. - Objects are displayed with only the lighting value from [VoxelGI]s. + Objects are displayed with only the lighting value from [VoxelGI]s. Requires at least one visible [VoxelGI] node that has been baked to have a visible effect. + [b]Note:[/b] Only supported when using the Forward+ rendering method. - Objects are displayed with only the emission color from [VoxelGI]s. + Objects are displayed with only the emission color from [VoxelGI]s. Requires at least one visible [VoxelGI] node that has been baked to have a visible effect. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws the shadow atlas that stores shadows from [OmniLight3D]s and [SpotLight3D]s in the upper left quadrant of the [Viewport]. @@ -551,53 +557,69 @@ Draws the scene luminance buffer (if available) in the upper left quadrant of the [Viewport]. + [b]Note:[/b] Only supported when using the Forward+ or Mobile rendering methods. Draws the screen-space ambient occlusion texture instead of the scene so that you can clearly see how it is affecting objects. In order for this display mode to work, you must have [member Environment.ssao_enabled] set in your [WorldEnvironment]. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws the screen-space indirect lighting texture instead of the scene so that you can clearly see how it is affecting objects. In order for this display mode to work, you must have [member Environment.ssil_enabled] set in your [WorldEnvironment]. + [b]Note:[/b] Only supported when using the Forward+ rendering method. - Colors each PSSM split for the [DirectionalLight3D]s in the scene a different color so you can see where the splits are. In order, they will be colored red, green, blue, and yellow. + Colors each PSSM split for the [DirectionalLight3D]s in the scene a different color so you can see where the splits are. In order (from closest to furthest from the camera), they are colored red, green, blue, and yellow. + [b]Note:[/b] When using this debug draw mode, custom shaders are ignored since all materials in the scene temporarily use a debug material. This means the result from custom shader functions (such as vertex displacement) won't be visible anymore when using this debug draw mode. + [b]Note:[/b] Only supported when using the Forward+ or Mobile rendering methods. Draws the decal atlas used by [Decal]s and light projector textures in the upper left quadrant of the [Viewport]. + [b]Note:[/b] Only supported when using the Forward+ or Mobile rendering methods. Draws the cascades used to render signed distance field global illumination (SDFGI). - Does nothing if the current environment's [member Environment.sdfgi_enabled] is [code]false[/code] or SDFGI is not supported on the platform. + Does nothing if the current environment's [member Environment.sdfgi_enabled] is [code]false[/code]. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws the probes used for signed distance field global illumination (SDFGI). - Does nothing if the current environment's [member Environment.sdfgi_enabled] is [code]false[/code] or SDFGI is not supported on the platform. + Does nothing if the current environment's [member Environment.sdfgi_enabled] is [code]false[/code]. + [b]Note:[/b] Only supported when using the Forward+ rendering method. - Draws the buffer used for global illumination (GI). + Draws the buffer used for global illumination from [VoxelGI] or SDFGI. Requires [VoxelGI] (at least one visible baked VoxelGI node) or SDFGI ([member Environment.sdfgi_enabled]) to be enabled to have a visible effect. + [b]Note:[/b] Only supported when using the Forward+ rendering method. - Draws all of the objects at their highest polycount, without low level of detail (LOD). + Draws all of the objects at their highest polycount regardless of their distance from the camera. No low level of detail (LOD) is applied. Draws the cluster used by [OmniLight3D] nodes to optimize light rendering. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws the cluster used by [SpotLight3D] nodes to optimize light rendering. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws the cluster used by [Decal] nodes to optimize decal rendering. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws the cluster used by [ReflectionProbe] nodes to optimize decal rendering. + [b]Note:[/b] Only supported when using the Forward+ rendering method. Draws the buffer used for occlusion culling. + [b]Note:[/b] Only supported when using the Forward+ or Mobile rendering methods. Draws vector lines over the viewport to indicate the movement of pixels between frames. + [b]Note:[/b] Only supported when using the Forward+ rendering method. - Draws the internal resolution buffer of the scene before post-processing is applied. + Draws the internal resolution buffer of the scene in linear colorspace before tonemapping or post-processing is applied. + [b]Note:[/b] Only supported when using the Forward+ or Mobile rendering methods. The texture filter reads from the nearest pixel only. This makes the texture look pixelated from up close, and grainy from a distance (due to mipmaps not being sampled). diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 54526d28df1c8..6f39df0cec53d 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -5179,6 +5179,36 @@ void Node3DEditorViewport::_set_lock_view_rotation(bool p_lock_rotation) { } } +void Node3DEditorViewport::_add_advanced_debug_draw_mode_item(PopupMenu *p_popup, const String &p_name, int p_value, SupportedRenderingMethods p_rendering_methods, const String &p_tooltip) { + display_submenu->add_radio_check_item(p_name, p_value); + + bool disabled = false; + String disabled_tooltip; + switch (p_rendering_methods) { + case SupportedRenderingMethods::ALL: + break; + case SupportedRenderingMethods::FORWARD_PLUS_MOBILE: + disabled = OS::get_singleton()->get_current_rendering_method() == "gl_compatibility"; + disabled_tooltip = TTR("This debug draw mode is not supported when using the Compatibility rendering method."); + break; + case SupportedRenderingMethods::FORWARD_PLUS: + disabled = OS::get_singleton()->get_current_rendering_method() == "gl_compatibility" || OS::get_singleton()->get_current_rendering_method() == "mobile"; + disabled_tooltip = TTR("This debug draw mode is not supported when using the Mobile or Compatibility rendering methods."); + break; + } + + display_submenu->set_item_disabled(-1, disabled); + String tooltip = p_tooltip; + if (disabled) { + if (tooltip.is_empty()) { + tooltip = disabled_tooltip; + } else { + tooltip += "\n\n" + disabled_tooltip; + } + } + display_submenu->set_item_tooltip(-1, tooltip); +} + Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p_index) { cpu_time_history_index = 0; gpu_time_history_index = 0; @@ -5261,38 +5291,56 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p display_submenu = memnew(PopupMenu); display_submenu->set_hide_on_checkable_item_selection(false); - display_submenu->add_radio_check_item(TTR("Directional Shadow Splits"), VIEW_DISPLAY_DEBUG_PSSM_SPLITS); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("Directional Shadow Splits"), VIEW_DISPLAY_DEBUG_PSSM_SPLITS, SupportedRenderingMethods::FORWARD_PLUS_MOBILE, + TTR("Displays directional shadow splits in different colors to make adjusting split thresholds easier. \nRed: 1st split (closest to the camera), Green: 2nd split, Blue: 3rd split, Yellow: 4th split (furthest from the camera)")); display_submenu->add_separator(); - display_submenu->add_radio_check_item(TTR("Normal Buffer"), VIEW_DISPLAY_NORMAL_BUFFER); + // TRANSLATORS: "Normal" as in "normal vector", not "normal life". + _add_advanced_debug_draw_mode_item(display_submenu, TTR("Normal Buffer"), VIEW_DISPLAY_NORMAL_BUFFER, SupportedRenderingMethods::FORWARD_PLUS); display_submenu->add_separator(); - display_submenu->add_radio_check_item(TTR("Shadow Atlas"), VIEW_DISPLAY_DEBUG_SHADOW_ATLAS); - display_submenu->add_radio_check_item(TTR("Directional Shadow Map"), VIEW_DISPLAY_DEBUG_DIRECTIONAL_SHADOW_ATLAS); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("Shadow Atlas"), VIEW_DISPLAY_DEBUG_SHADOW_ATLAS); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("Directional Shadow Map"), VIEW_DISPLAY_DEBUG_DIRECTIONAL_SHADOW_ATLAS); display_submenu->add_separator(); - display_submenu->add_radio_check_item(TTR("Decal Atlas"), VIEW_DISPLAY_DEBUG_DECAL_ATLAS); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("Decal Atlas"), VIEW_DISPLAY_DEBUG_DECAL_ATLAS, SupportedRenderingMethods::FORWARD_PLUS_MOBILE); display_submenu->add_separator(); - display_submenu->add_radio_check_item(TTR("VoxelGI Lighting"), VIEW_DISPLAY_DEBUG_VOXEL_GI_LIGHTING); - display_submenu->add_radio_check_item(TTR("VoxelGI Albedo"), VIEW_DISPLAY_DEBUG_VOXEL_GI_ALBEDO); - display_submenu->add_radio_check_item(TTR("VoxelGI Emission"), VIEW_DISPLAY_DEBUG_VOXEL_GI_EMISSION); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("VoxelGI Lighting"), VIEW_DISPLAY_DEBUG_VOXEL_GI_LIGHTING, SupportedRenderingMethods::FORWARD_PLUS, + TTR("Requires a visible VoxelGI node that has been baked to have a visible effect.")); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("VoxelGI Albedo"), VIEW_DISPLAY_DEBUG_VOXEL_GI_ALBEDO, SupportedRenderingMethods::FORWARD_PLUS, + TTR("Requires a visible VoxelGI node that has been baked to have a visible effect.")); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("VoxelGI Emission"), VIEW_DISPLAY_DEBUG_VOXEL_GI_EMISSION, SupportedRenderingMethods::FORWARD_PLUS, + TTR("Requires a visible VoxelGI node that has been baked to have a visible effect.")); display_submenu->add_separator(); - display_submenu->add_radio_check_item(TTR("SDFGI Cascades"), VIEW_DISPLAY_DEBUG_SDFGI); - display_submenu->add_radio_check_item(TTR("SDFGI Probes"), VIEW_DISPLAY_DEBUG_SDFGI_PROBES); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("SDFGI Cascades"), VIEW_DISPLAY_DEBUG_SDFGI, SupportedRenderingMethods::FORWARD_PLUS, + TTR("Requires SDFGI to be enabled in Environment to have a visible effect.")); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("SDFGI Probes"), VIEW_DISPLAY_DEBUG_SDFGI_PROBES, SupportedRenderingMethods::FORWARD_PLUS, + TTR("Requires SDFGI to be enabled in Environment to have a visible effect.")); display_submenu->add_separator(); - display_submenu->add_radio_check_item(TTR("Scene Luminance"), VIEW_DISPLAY_DEBUG_SCENE_LUMINANCE); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("Scene Luminance"), VIEW_DISPLAY_DEBUG_SCENE_LUMINANCE, SupportedRenderingMethods::FORWARD_PLUS_MOBILE, + TTR("Displays the scene luminance computed from the 3D buffer. This is used for Auto Exposure calculation.\nRequires Auto Exposure to be enabled in CameraAttributes to have a visible effect.")); display_submenu->add_separator(); - display_submenu->add_radio_check_item(TTR("SSAO"), VIEW_DISPLAY_DEBUG_SSAO); - display_submenu->add_radio_check_item(TTR("SSIL"), VIEW_DISPLAY_DEBUG_SSIL); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("SSAO"), VIEW_DISPLAY_DEBUG_SSAO, SupportedRenderingMethods::FORWARD_PLUS, + TTR("Displays the screen-space ambient occlusion buffer. Requires SSAO to be enabled in Environment to have a visible effect.")); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("SSIL"), VIEW_DISPLAY_DEBUG_SSIL, SupportedRenderingMethods::FORWARD_PLUS, + TTR("Displays the screen-space indirect lighting buffer. Requires SSIL to be enabled in Environment to have a visible effect.")); display_submenu->add_separator(); - display_submenu->add_radio_check_item(TTR("VoxelGI/SDFGI Buffer"), VIEW_DISPLAY_DEBUG_GI_BUFFER); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("VoxelGI/SDFGI Buffer"), VIEW_DISPLAY_DEBUG_GI_BUFFER, SupportedRenderingMethods::FORWARD_PLUS, + TTR("Requires SDFGI or VoxelGI to be enabled to have a visible effect.")); display_submenu->add_separator(); - display_submenu->add_radio_check_item(TTR("Disable Mesh LOD"), VIEW_DISPLAY_DEBUG_DISABLE_LOD); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("Disable Mesh LOD"), VIEW_DISPLAY_DEBUG_DISABLE_LOD, SupportedRenderingMethods::ALL, + TTR("Renders all meshes with their highest level of detail regardless of their distance from the camera.")); display_submenu->add_separator(); - display_submenu->add_radio_check_item(TTR("OmniLight3D Cluster"), VIEW_DISPLAY_DEBUG_CLUSTER_OMNI_LIGHTS); - display_submenu->add_radio_check_item(TTR("SpotLight3D Cluster"), VIEW_DISPLAY_DEBUG_CLUSTER_SPOT_LIGHTS); - display_submenu->add_radio_check_item(TTR("Decal Cluster"), VIEW_DISPLAY_DEBUG_CLUSTER_DECALS); - display_submenu->add_radio_check_item(TTR("ReflectionProbe Cluster"), VIEW_DISPLAY_DEBUG_CLUSTER_REFLECTION_PROBES); - display_submenu->add_radio_check_item(TTR("Occlusion Culling Buffer"), VIEW_DISPLAY_DEBUG_OCCLUDERS); - display_submenu->add_radio_check_item(TTR("Motion Vectors"), VIEW_DISPLAY_MOTION_VECTORS); - display_submenu->add_radio_check_item(TTR("Internal Buffer"), VIEW_DISPLAY_INTERNAL_BUFFER); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("OmniLight3D Cluster"), VIEW_DISPLAY_DEBUG_CLUSTER_OMNI_LIGHTS, SupportedRenderingMethods::FORWARD_PLUS, + TTR("Highlights tiles of pixels that are affected by at least one OmniLight3D.")); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("SpotLight3D Cluster"), VIEW_DISPLAY_DEBUG_CLUSTER_SPOT_LIGHTS, SupportedRenderingMethods::FORWARD_PLUS, + TTR("Highlights tiles of pixels that are affected by at least one SpotLight3D.")); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("Decal Cluster"), VIEW_DISPLAY_DEBUG_CLUSTER_DECALS, SupportedRenderingMethods::FORWARD_PLUS, + TTR("Highlights tiles of pixels that are affected by at least one Decal.")); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("ReflectionProbe Cluster"), VIEW_DISPLAY_DEBUG_CLUSTER_REFLECTION_PROBES, SupportedRenderingMethods::FORWARD_PLUS, + TTR("Highlights tiles of pixels that are affected by at least one ReflectionProbe.")); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("Occlusion Culling Buffer"), VIEW_DISPLAY_DEBUG_OCCLUDERS, SupportedRenderingMethods::FORWARD_PLUS_MOBILE, + TTR("Represents occluders with black pixels. Requires occlusion culling to be enabled to have a visible effect.")); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("Motion Vectors"), VIEW_DISPLAY_MOTION_VECTORS, SupportedRenderingMethods::FORWARD_PLUS); + _add_advanced_debug_draw_mode_item(display_submenu, TTR("Internal Buffer"), VIEW_DISPLAY_INTERNAL_BUFFER, SupportedRenderingMethods::FORWARD_PLUS_MOBILE, + TTR("Shows the scene rendered in linear colorspace before any tonemapping or post-processing.")); view_menu->get_popup()->add_submenu_node_item(TTR("Display Advanced..."), display_submenu, VIEW_DISPLAY_ADVANCED); view_menu->get_popup()->add_separator(); @@ -5322,26 +5370,6 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p display_submenu->connect(SceneStringName(id_pressed), callable_mp(this, &Node3DEditorViewport::_menu_option)); view_menu->set_disable_shortcuts(true); - // TODO: Re-evaluate with new OpenGL3 renderer, and implement. - //if (OS::get_singleton()->get_current_video_driver() == OS::RENDERING_DRIVER_OPENGL3) { - if (false) { - // Alternate display modes only work when using the Vulkan renderer; make this explicit. - const int normal_idx = view_menu->get_popup()->get_item_index(VIEW_DISPLAY_NORMAL); - const int wireframe_idx = view_menu->get_popup()->get_item_index(VIEW_DISPLAY_WIREFRAME); - const int overdraw_idx = view_menu->get_popup()->get_item_index(VIEW_DISPLAY_OVERDRAW); - const int shadeless_idx = view_menu->get_popup()->get_item_index(VIEW_DISPLAY_UNSHADED); - const String unsupported_tooltip = TTR("Not available when using the OpenGL renderer."); - - view_menu->get_popup()->set_item_disabled(normal_idx, true); - view_menu->get_popup()->set_item_tooltip(normal_idx, unsupported_tooltip); - view_menu->get_popup()->set_item_disabled(wireframe_idx, true); - view_menu->get_popup()->set_item_tooltip(wireframe_idx, unsupported_tooltip); - view_menu->get_popup()->set_item_disabled(overdraw_idx, true); - view_menu->get_popup()->set_item_tooltip(overdraw_idx, unsupported_tooltip); - view_menu->get_popup()->set_item_disabled(shadeless_idx, true); - view_menu->get_popup()->set_item_tooltip(shadeless_idx, unsupported_tooltip); - } - register_shortcut_action("spatial_editor/freelook_left", TTR("Freelook Left"), Key::A, true); register_shortcut_action("spatial_editor/freelook_right", TTR("Freelook Right"), Key::D, true); register_shortcut_action("spatial_editor/freelook_forward", TTR("Freelook Forward"), Key::W, true); diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 580c00123890e..997c191227e4e 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -466,7 +466,15 @@ class Node3DEditorViewport : public Control { void register_shortcut_action(const String &p_path, const String &p_name, Key p_keycode, bool p_physical = false); void shortcut_changed_callback(const Ref p_shortcut, const String &p_shortcut_path); + // Supported rendering methods for advanced debug draw mode items. + enum SupportedRenderingMethods { + ALL, + FORWARD_PLUS, + FORWARD_PLUS_MOBILE, + }; + void _set_lock_view_rotation(bool p_lock_rotation); + void _add_advanced_debug_draw_mode_item(PopupMenu *p_popup, const String &p_name, int p_value, SupportedRenderingMethods p_rendering_methods = SupportedRenderingMethods::ALL, const String &p_tooltip = ""); protected: void _notification(int p_what);