Merge pull request #90966 from Calinou/debug-draw-use-runtime-colors

Use same colors for editor and running project for collision/path debug
This commit is contained in:
Rémi Verschelde 2024-05-07 16:49:31 +02:00
commit 594498e718
No known key found for this signature in database
GPG Key ID: C3336907360768E1
12 changed files with 10 additions and 14 deletions

View File

@ -393,9 +393,6 @@
<member name="editors/3d_gizmos/gizmo_colors/joint" type="Color" setter="" getter=""> <member name="editors/3d_gizmos/gizmo_colors/joint" type="Color" setter="" getter="">
The 3D editor gizmo color for [Joint3D]s and [PhysicalBone3D]s. The 3D editor gizmo color for [Joint3D]s and [PhysicalBone3D]s.
</member> </member>
<member name="editors/3d_gizmos/gizmo_colors/shape" type="Color" setter="" getter="">
The 3D editor gizmo color for [CollisionShape3D]s, [VehicleWheel3D]s, [RayCast3D]s and [SpringArm3D]s.
</member>
<member name="editors/animation/autorename_animation_tracks" type="bool" setter="" getter=""> <member name="editors/animation/autorename_animation_tracks" type="bool" setter="" getter="">
If [code]true[/code], automatically updates animation tracks' target paths when renaming or reparenting nodes in the Scene tree dock. If [code]true[/code], automatically updates animation tracks' target paths when renaming or reparenting nodes in the Scene tree dock.
</member> </member>

View File

@ -691,7 +691,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> 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/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/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/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) 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. // If a line is a multiple of this, it uses the primary grid color.

View File

@ -38,7 +38,7 @@
#include "scene/resources/surface_tool.h" #include "scene/resources/surface_tool.h"
CollisionObject3DGizmoPlugin::CollisionObject3DGizmoPlugin() { 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); create_material("shape_material", gizmo_color);
const float gizmo_value = gizmo_color.get_v(); const float gizmo_value = gizmo_color.get_v();
const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65);

View File

@ -35,7 +35,7 @@
#include "scene/3d/physics/collision_polygon_3d.h" #include "scene/3d/physics/collision_polygon_3d.h"
CollisionPolygon3DGizmoPlugin::CollisionPolygon3DGizmoPlugin() { 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); create_material("shape_material", gizmo_color);
const float gizmo_value = gizmo_color.get_v(); const float gizmo_value = gizmo_color.get_v();
const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65);

View File

@ -49,7 +49,7 @@
CollisionShape3DGizmoPlugin::CollisionShape3DGizmoPlugin() { CollisionShape3DGizmoPlugin::CollisionShape3DGizmoPlugin() {
helper.instantiate(); 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); create_material("shape_material", gizmo_color);
const float gizmo_value = gizmo_color.get_v(); const float gizmo_value = gizmo_color.get_v();
const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65);

View File

@ -35,7 +35,7 @@
#include "scene/3d/physics/ray_cast_3d.h" #include "scene/3d/physics/ray_cast_3d.h"
RayCast3DGizmoPlugin::RayCast3DGizmoPlugin() { 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); create_material("shape_material", gizmo_color);
const float gizmo_value = gizmo_color.get_v(); const float gizmo_value = gizmo_color.get_v();
const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65);

View File

@ -35,7 +35,7 @@
#include "scene/3d/physics/shape_cast_3d.h" #include "scene/3d/physics/shape_cast_3d.h"
ShapeCast3DGizmoPlugin::ShapeCast3DGizmoPlugin() { 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); create_material("shape_material", gizmo_color);
const float gizmo_value = gizmo_color.get_v(); const float gizmo_value = gizmo_color.get_v();
const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65);

View File

@ -35,7 +35,7 @@
#include "scene/3d/soft_body_3d.h" #include "scene/3d/soft_body_3d.h"
SoftBody3DGizmoPlugin::SoftBody3DGizmoPlugin() { 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_material("shape_material", gizmo_color);
create_handle_material("handles"); create_handle_material("handles");
} }

View File

@ -52,7 +52,7 @@ void SpringArm3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
} }
SpringArm3DGizmoPlugin::SpringArm3DGizmoPlugin() { 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); create_material("shape_material", gizmo_color);
} }

View File

@ -35,7 +35,7 @@
#include "scene/3d/physics/vehicle_body_3d.h" #include "scene/3d/physics/vehicle_body_3d.h"
VehicleWheel3DGizmoPlugin::VehicleWheel3DGizmoPlugin() { 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); create_material("shape_material", gizmo_color);
} }

View File

@ -1050,7 +1050,7 @@ int Path3DGizmoPlugin::get_priority() const {
} }
Path3DGizmoPlugin::Path3DGizmoPlugin(float p_disk_size) { 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)); 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; disk_size = p_disk_size;

View File

@ -144,7 +144,7 @@ void CollisionPolygon2D::_notification(int p_what) {
} }
#endif #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_polyline(polygon, stroke_color);
// Draw the last segment. // Draw the last segment.
draw_line(polygon[polygon.size() - 1], polygon[0], stroke_color); draw_line(polygon[polygon.size() - 1], polygon[0], stroke_color);