Add an editor setting for the 3D selection box color
A restart is required to apply the setting change.
(cherry picked from commit 8221037be0
)
This commit is contained in:
parent
a227eefd2d
commit
1062bedaaa
2 changed files with 7 additions and 3 deletions
|
@ -501,6 +501,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
||||||
_initial_set("editors/3d/primary_grid_color", Color(0.56, 0.56, 0.56, 0.5));
|
_initial_set("editors/3d/primary_grid_color", Color(0.56, 0.56, 0.56, 0.5));
|
||||||
_initial_set("editors/3d/secondary_grid_color", Color(0.38, 0.38, 0.38, 0.5));
|
_initial_set("editors/3d/secondary_grid_color", Color(0.38, 0.38, 0.38, 0.5));
|
||||||
|
|
||||||
|
// 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.
|
// 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.
|
// 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);
|
_initial_set("editors/3d/primary_grid_steps", 8);
|
||||||
|
|
|
@ -4534,8 +4534,8 @@ void SpatialEditor::_generate_selection_boxes() {
|
||||||
|
|
||||||
Ref<SpatialMaterial> mat = memnew(SpatialMaterial);
|
Ref<SpatialMaterial> mat = memnew(SpatialMaterial);
|
||||||
mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||||
// Use a similar color to the 2D editor selection.
|
const Color selection_box_color = EDITOR_GET("editors/3d/selection_box_color");
|
||||||
mat->set_albedo(Color(1, 0.5, 0));
|
mat->set_albedo(selection_box_color);
|
||||||
mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||||
st->set_material(mat);
|
st->set_material(mat);
|
||||||
selection_box = st->commit();
|
selection_box = st->commit();
|
||||||
|
@ -4543,7 +4543,7 @@ void SpatialEditor::_generate_selection_boxes() {
|
||||||
Ref<SpatialMaterial> mat_xray = memnew(SpatialMaterial);
|
Ref<SpatialMaterial> mat_xray = memnew(SpatialMaterial);
|
||||||
mat_xray->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
mat_xray->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||||
mat_xray->set_flag(SpatialMaterial::FLAG_DISABLE_DEPTH_TEST, true);
|
mat_xray->set_flag(SpatialMaterial::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_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
mat_xray->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||||
st_xray->set_material(mat_xray);
|
st_xray->set_material(mat_xray);
|
||||||
selection_box_xray = st_xray->commit();
|
selection_box_xray = st_xray->commit();
|
||||||
|
|
Loading…
Reference in a new issue