Merge pull request #48621 from Calinou/editor-3d-hide-selection-box-no-gizmos-3.x

Hide the 3D editor selection box when View Gizmos is disabled (3.x)
This commit is contained in:
Rémi Verschelde 2021-07-26 12:45:00 +02:00 committed by GitHub
commit 8ecb5d2047
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4414,14 +4414,18 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) {
VS::get_singleton()->instance_geometry_set_cast_shadows_setting( VS::get_singleton()->instance_geometry_set_cast_shadows_setting(
si->sbox_instance, si->sbox_instance,
VS::SHADOW_CASTING_SETTING_OFF); VS::SHADOW_CASTING_SETTING_OFF);
VS::get_singleton()->instance_set_layer_mask(si->sbox_instance, 1 << SpatialEditorViewport::MISC_TOOL_LAYER); // Use the Edit layer to hide the selection box when View Gizmos is disabled, since it is a bit distracting.
// It's still possible to approximately guess what is selected by looking at the manipulation gizmo position.
VS::get_singleton()->instance_set_layer_mask(si->sbox_instance, 1 << SpatialEditorViewport::GIZMO_EDIT_LAYER);
si->sbox_instance_xray = VisualServer::get_singleton()->instance_create2( si->sbox_instance_xray = VisualServer::get_singleton()->instance_create2(
selection_box_xray->get_rid(), selection_box_xray->get_rid(),
sp->get_world()->get_scenario()); sp->get_world()->get_scenario());
VS::get_singleton()->instance_geometry_set_cast_shadows_setting( VS::get_singleton()->instance_geometry_set_cast_shadows_setting(
si->sbox_instance_xray, si->sbox_instance_xray,
VS::SHADOW_CASTING_SETTING_OFF); VS::SHADOW_CASTING_SETTING_OFF);
VS::get_singleton()->instance_set_layer_mask(si->sbox_instance_xray, 1 << SpatialEditorViewport::MISC_TOOL_LAYER); // Use the Edit layer to hide the selection box when View Gizmos is disabled, since it is a bit distracting.
// It's still possible to approximately guess what is selected by looking at the manipulation gizmo position.
VS::get_singleton()->instance_set_layer_mask(si->sbox_instance_xray, 1 << SpatialEditorViewport::GIZMO_EDIT_LAYER);
return si; return si;
} }