From b1a2394b3b7c0532641c33fc74e27036cd3492c1 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 21 Apr 2024 00:40:45 +0200 Subject: [PATCH] Use same colors for editor and running project for collision/path debug This harmonizes the appearance of collision shapes and paths between the editor and running project, in both 2D and 3D. This means that in 3D, paths are now green and shapes are now cyan instead of light blue. --- doc/classes/EditorSettings.xml | 3 --- editor/editor_settings.cpp | 1 - editor/plugins/gizmos/collision_object_3d_gizmo_plugin.cpp | 2 +- editor/plugins/gizmos/collision_polygon_3d_gizmo_plugin.cpp | 2 +- editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp | 2 +- editor/plugins/gizmos/ray_cast_3d_gizmo_plugin.cpp | 2 +- editor/plugins/gizmos/shape_cast_3d_gizmo_plugin.cpp | 2 +- editor/plugins/gizmos/soft_body_3d_gizmo_plugin.cpp | 2 +- editor/plugins/gizmos/spring_arm_3d_gizmo_plugin.cpp | 2 +- editor/plugins/gizmos/vehicle_body_3d_gizmo_plugin.cpp | 2 +- editor/plugins/path_3d_editor_plugin.cpp | 2 +- scene/2d/physics/collision_polygon_2d.cpp | 2 +- 12 files changed, 10 insertions(+), 14 deletions(-) diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 93a7b09fce1..810d55c79cd 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -393,9 +393,6 @@ The 3D editor gizmo color for [Joint3D]s and [PhysicalBone3D]s. - - The 3D editor gizmo color for [CollisionShape3D]s, [VehicleWheel3D]s, [RayCast3D]s and [SpringArm3D]s. - If [code]true[/code], automatically updates animation tracks' target paths when renaming or reparenting nodes in the Scene tree dock. diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index ca6be130f9d..43dbdfc75f7 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -689,7 +689,6 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { EDITOR_SETTING_USAGE(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d/selection_box_color", Color(1.0, 0.5, 0), "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED) EDITOR_SETTING_USAGE(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d_gizmos/gizmo_colors/instantiated", Color(0.7, 0.7, 0.7, 0.6), "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED) EDITOR_SETTING_USAGE(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d_gizmos/gizmo_colors/joint", Color(0.5, 0.8, 1), "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED) - EDITOR_SETTING_USAGE(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1), "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED) EDITOR_SETTING_USAGE(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d_gizmos/gizmo_colors/aabb", Color(0.28, 0.8, 0.82), "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED) // If a line is a multiple of this, it uses the primary grid color. diff --git a/editor/plugins/gizmos/collision_object_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/collision_object_3d_gizmo_plugin.cpp index caac143f237..9a0cf36c4c6 100644 --- a/editor/plugins/gizmos/collision_object_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/collision_object_3d_gizmo_plugin.cpp @@ -38,7 +38,7 @@ #include "scene/resources/surface_tool.h" CollisionObject3DGizmoPlugin::CollisionObject3DGizmoPlugin() { - const Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/shape"); + const Color gizmo_color = SceneTree::get_singleton()->get_debug_collisions_color(); create_material("shape_material", gizmo_color); const float gizmo_value = gizmo_color.get_v(); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); diff --git a/editor/plugins/gizmos/collision_polygon_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/collision_polygon_3d_gizmo_plugin.cpp index 7d19e8f677c..44814fd2ba2 100644 --- a/editor/plugins/gizmos/collision_polygon_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/collision_polygon_3d_gizmo_plugin.cpp @@ -35,7 +35,7 @@ #include "scene/3d/physics/collision_polygon_3d.h" CollisionPolygon3DGizmoPlugin::CollisionPolygon3DGizmoPlugin() { - const Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/shape"); + const Color gizmo_color = SceneTree::get_singleton()->get_debug_collisions_color(); create_material("shape_material", gizmo_color); const float gizmo_value = gizmo_color.get_v(); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); diff --git a/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp index 9d4c08ed571..01492c1dd04 100644 --- a/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp @@ -49,7 +49,7 @@ CollisionShape3DGizmoPlugin::CollisionShape3DGizmoPlugin() { helper.instantiate(); - const Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/shape"); + const Color gizmo_color = SceneTree::get_singleton()->get_debug_collisions_color(); create_material("shape_material", gizmo_color); const float gizmo_value = gizmo_color.get_v(); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); diff --git a/editor/plugins/gizmos/ray_cast_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/ray_cast_3d_gizmo_plugin.cpp index d783c4e4a7a..2731a76f521 100644 --- a/editor/plugins/gizmos/ray_cast_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/ray_cast_3d_gizmo_plugin.cpp @@ -35,7 +35,7 @@ #include "scene/3d/physics/ray_cast_3d.h" RayCast3DGizmoPlugin::RayCast3DGizmoPlugin() { - const Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/shape"); + const Color gizmo_color = SceneTree::get_singleton()->get_debug_collisions_color(); create_material("shape_material", gizmo_color); const float gizmo_value = gizmo_color.get_v(); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); diff --git a/editor/plugins/gizmos/shape_cast_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/shape_cast_3d_gizmo_plugin.cpp index 909f5b5f9aa..3bf8adb80ae 100644 --- a/editor/plugins/gizmos/shape_cast_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/shape_cast_3d_gizmo_plugin.cpp @@ -35,7 +35,7 @@ #include "scene/3d/physics/shape_cast_3d.h" ShapeCast3DGizmoPlugin::ShapeCast3DGizmoPlugin() { - const Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/shape"); + const Color gizmo_color = SceneTree::get_singleton()->get_debug_collisions_color(); create_material("shape_material", gizmo_color); const float gizmo_value = gizmo_color.get_v(); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); diff --git a/editor/plugins/gizmos/soft_body_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/soft_body_3d_gizmo_plugin.cpp index be48e3764a4..f5c8858a9ca 100644 --- a/editor/plugins/gizmos/soft_body_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/soft_body_3d_gizmo_plugin.cpp @@ -35,7 +35,7 @@ #include "scene/3d/soft_body_3d.h" SoftBody3DGizmoPlugin::SoftBody3DGizmoPlugin() { - Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/shape"); + Color gizmo_color = SceneTree::get_singleton()->get_debug_collisions_color(); create_material("shape_material", gizmo_color); create_handle_material("handles"); } diff --git a/editor/plugins/gizmos/spring_arm_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/spring_arm_3d_gizmo_plugin.cpp index 85e2c869471..74c55bf3ddd 100644 --- a/editor/plugins/gizmos/spring_arm_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/spring_arm_3d_gizmo_plugin.cpp @@ -52,7 +52,7 @@ void SpringArm3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { } SpringArm3DGizmoPlugin::SpringArm3DGizmoPlugin() { - Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/shape"); + Color gizmo_color = SceneTree::get_singleton()->get_debug_collisions_color(); create_material("shape_material", gizmo_color); } diff --git a/editor/plugins/gizmos/vehicle_body_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/vehicle_body_3d_gizmo_plugin.cpp index 69e87a55c0f..1015e46965c 100644 --- a/editor/plugins/gizmos/vehicle_body_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/vehicle_body_3d_gizmo_plugin.cpp @@ -35,7 +35,7 @@ #include "scene/3d/physics/vehicle_body_3d.h" VehicleWheel3DGizmoPlugin::VehicleWheel3DGizmoPlugin() { - Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/shape"); + Color gizmo_color = SceneTree::get_singleton()->get_debug_collisions_color(); create_material("shape_material", gizmo_color); } diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index 1cffdb64542..8be3dba86a6 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -1054,7 +1054,7 @@ int Path3DGizmoPlugin::get_priority() const { } Path3DGizmoPlugin::Path3DGizmoPlugin(float p_disk_size) { - Color path_color = EDITOR_DEF_RST("editors/3d_gizmos/gizmo_colors/path", Color(0.5, 0.5, 1.0, 0.9)); + Color path_color = SceneTree::get_singleton()->get_debug_paths_color(); Color path_tilt_color = EDITOR_DEF_RST("editors/3d_gizmos/gizmo_colors/path_tilt", Color(1.0, 1.0, 0.4, 0.9)); disk_size = p_disk_size; diff --git a/scene/2d/physics/collision_polygon_2d.cpp b/scene/2d/physics/collision_polygon_2d.cpp index 72ee4d52c5f..a9b47ef4d45 100644 --- a/scene/2d/physics/collision_polygon_2d.cpp +++ b/scene/2d/physics/collision_polygon_2d.cpp @@ -144,7 +144,7 @@ void CollisionPolygon2D::_notification(int p_what) { } #endif - const Color stroke_color = Color(0.9, 0.2, 0.0); + const Color stroke_color = get_tree()->get_debug_collisions_color(); draw_polyline(polygon, stroke_color); // Draw the last segment. draw_line(polygon[polygon.size() - 1], polygon[0], stroke_color);