diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-12-29 07:35:59 +0100 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-12-29 07:35:59 +0100 |
commit | 8221037be0b22219d942ea746784592732e7b14e (patch) | |
tree | aa17562ad7213bb220e7f4f6c5c76d7bdbe1c960 | |
parent | 6cebb8c11773b203039c811c2ee50ba25c99e5e1 (diff) |
Add an editor setting for the 3D selection box color
A restart is required to apply the setting change.
-rw-r--r-- | editor/editor_settings.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 3d131d373a..9ecf1f5051 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -521,6 +521,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("editors/3d/secondary_grid_color", Color(0.38, 0.38, 0.38, 0.5)); hints["editors/3d/secondary_grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/secondary_grid_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT); + // Use a similar color to the 2D editor selection. + _initial_set("editors/3d/selection_box_color", Color(1.0, 0.5, 0)); + hints["editors/3d/selection_box_color"] = PropertyInfo(Variant::COLOR, "editors/3d/selection_box_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + // If a line is a multiple of this, it uses the primary grid color. // Use a power of 2 value by default as it's more common to use powers of 2 in level design. _initial_set("editors/3d/primary_grid_steps", 8); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index b609f4ffe8..9581323b0e 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -4574,8 +4574,8 @@ void Node3DEditor::_generate_selection_boxes() { Ref<StandardMaterial3D> mat = memnew(StandardMaterial3D); mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); - // Use a similar color to the 2D editor selection. - mat->set_albedo(Color(1, 0.5, 0)); + const Color selection_box_color = EDITOR_GET("editors/3d/selection_box_color"); + mat->set_albedo(selection_box_color); mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); st->set_material(mat); selection_box = st->commit(); @@ -4583,7 +4583,7 @@ void Node3DEditor::_generate_selection_boxes() { Ref<StandardMaterial3D> mat_xray = memnew(StandardMaterial3D); mat_xray->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); mat_xray->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true); - mat_xray->set_albedo(Color(1, 0.5, 0, 0.15)); + mat_xray->set_albedo(selection_box_color * Color(1, 1, 1, 0.15)); mat_xray->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); st_xray->set_material(mat_xray); selection_box_xray = st_xray->commit(); |