Put misc. 3D tool visible instances on their own layer
This makes that visible stuff invisible to ReflectionProbes, whose preview in the editor shouldn't involve them.
This commit is contained in:
parent
e4f2f899db
commit
08a46bbacd
3 changed files with 14 additions and 6 deletions
|
@ -2980,10 +2980,11 @@ void SpatialEditorViewport::_menu_option(int p_option) {
|
||||||
int idx = view_menu->get_popup()->get_item_index(VIEW_GIZMOS);
|
int idx = view_menu->get_popup()->get_item_index(VIEW_GIZMOS);
|
||||||
bool current = view_menu->get_popup()->is_item_checked(idx);
|
bool current = view_menu->get_popup()->is_item_checked(idx);
|
||||||
current = !current;
|
current = !current;
|
||||||
if (current)
|
uint32_t layers = ((1 << 20) - 1) | (1 << (GIZMO_BASE_LAYER + index)) | (1 << GIZMO_GRID_LAYER) | (1 << MISC_TOOL_LAYER);
|
||||||
camera->set_cull_mask(((1 << 20) - 1) | (1 << (GIZMO_BASE_LAYER + index)) | (1 << GIZMO_EDIT_LAYER) | (1 << GIZMO_GRID_LAYER));
|
if (current) {
|
||||||
else
|
layers |= (1 << GIZMO_EDIT_LAYER);
|
||||||
camera->set_cull_mask(((1 << 20) - 1) | (1 << (GIZMO_BASE_LAYER + index)) | (1 << GIZMO_GRID_LAYER));
|
}
|
||||||
|
camera->set_cull_mask(layers);
|
||||||
view_menu->get_popup()->set_item_checked(idx, current);
|
view_menu->get_popup()->set_item_checked(idx, current);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
@ -3866,7 +3867,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
|
||||||
surface->set_clip_contents(true);
|
surface->set_clip_contents(true);
|
||||||
camera = memnew(Camera);
|
camera = memnew(Camera);
|
||||||
camera->set_disable_gizmo(true);
|
camera->set_disable_gizmo(true);
|
||||||
camera->set_cull_mask(((1 << 20) - 1) | (1 << (GIZMO_BASE_LAYER + p_index)) | (1 << GIZMO_EDIT_LAYER) | (1 << GIZMO_GRID_LAYER));
|
camera->set_cull_mask(((1 << 20) - 1) | (1 << (GIZMO_BASE_LAYER + p_index)) | (1 << GIZMO_EDIT_LAYER) | (1 << GIZMO_GRID_LAYER) | (1 << MISC_TOOL_LAYER));
|
||||||
viewport->add_child(camera);
|
viewport->add_child(camera);
|
||||||
camera->make_current();
|
camera->make_current();
|
||||||
surface->set_focus_mode(FOCUS_ALL);
|
surface->set_focus_mode(FOCUS_ALL);
|
||||||
|
@ -4478,12 +4479,14 @@ 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);
|
||||||
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);
|
||||||
|
|
||||||
return si;
|
return si;
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,7 +217,8 @@ public:
|
||||||
enum {
|
enum {
|
||||||
GIZMO_BASE_LAYER = 27,
|
GIZMO_BASE_LAYER = 27,
|
||||||
GIZMO_EDIT_LAYER = 26,
|
GIZMO_EDIT_LAYER = 26,
|
||||||
GIZMO_GRID_LAYER = 25
|
GIZMO_GRID_LAYER = 25,
|
||||||
|
MISC_TOOL_LAYER = 24
|
||||||
};
|
};
|
||||||
|
|
||||||
enum NavigationScheme {
|
enum NavigationScheme {
|
||||||
|
|
|
@ -1084,11 +1084,15 @@ void GridMapEditor::_notification(int p_what) {
|
||||||
|
|
||||||
grid[i] = VS::get_singleton()->mesh_create();
|
grid[i] = VS::get_singleton()->mesh_create();
|
||||||
grid_instance[i] = VS::get_singleton()->instance_create2(grid[i], get_tree()->get_root()->get_world()->get_scenario());
|
grid_instance[i] = VS::get_singleton()->instance_create2(grid[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||||
|
VS::get_singleton()->instance_set_layer_mask(grid_instance[i], 1 << SpatialEditorViewport::MISC_TOOL_LAYER);
|
||||||
selection_level_instance[i] = VisualServer::get_singleton()->instance_create2(selection_level_mesh[i], get_tree()->get_root()->get_world()->get_scenario());
|
selection_level_instance[i] = VisualServer::get_singleton()->instance_create2(selection_level_mesh[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||||
|
VS::get_singleton()->instance_set_layer_mask(selection_level_instance[i], 1 << SpatialEditorViewport::MISC_TOOL_LAYER);
|
||||||
}
|
}
|
||||||
|
|
||||||
selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh, get_tree()->get_root()->get_world()->get_scenario());
|
selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh, get_tree()->get_root()->get_world()->get_scenario());
|
||||||
|
VS::get_singleton()->instance_set_layer_mask(selection_instance, 1 << SpatialEditorViewport::MISC_TOOL_LAYER);
|
||||||
paste_instance = VisualServer::get_singleton()->instance_create2(paste_mesh, get_tree()->get_root()->get_world()->get_scenario());
|
paste_instance = VisualServer::get_singleton()->instance_create2(paste_mesh, get_tree()->get_root()->get_world()->get_scenario());
|
||||||
|
VS::get_singleton()->instance_set_layer_mask(paste_instance, 1 << SpatialEditorViewport::MISC_TOOL_LAYER);
|
||||||
|
|
||||||
_update_selection_transform();
|
_update_selection_transform();
|
||||||
_update_paste_indicator();
|
_update_paste_indicator();
|
||||||
|
|
Loading…
Reference in a new issue