-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rendering layer mask to GridMap #86992
base: master
Are you sure you want to change the base?
Conversation
modules/gridmap/grid_map.cpp
Outdated
@@ -1121,6 +1160,8 @@ void GridMap::_bind_methods() { | |||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "collision_priority"), "set_collision_priority", "get_collision_priority"); | |||
ADD_GROUP("Navigation", ""); | |||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bake_navigation"), "set_bake_navigation", "is_baking_navigation"); | |||
ADD_GROUP("Rendering", "rendering_"); | |||
ADD_PROPERTY(PropertyInfo(Variant::INT, "rendering_layer", PROPERTY_HINT_LAYERS_3D_RENDER), "set_rendering_layer_mask", "get_rendering_layer_mask"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ADD_PROPERTY(PropertyInfo(Variant::INT, "rendering_layer", PROPERTY_HINT_LAYERS_3D_RENDER), "set_rendering_layer_mask", "get_rendering_layer_mask"); | |
ADD_PROPERTY(PropertyInfo(Variant::INT, "rendering_layers", PROPERTY_HINT_LAYERS_3D_RENDER), "set_rendering_layer_mask", "get_rendering_layer_mask"); |
To match other use, it's layers
in VisualInstance3D
, and it's not a singular layer
modules/gridmap/grid_map.h
Outdated
@@ -151,6 +151,7 @@ class GridMap : public Node3D { | |||
|
|||
uint32_t collision_layer = 1; | |||
uint32_t collision_mask = 1; | |||
uint32_t rendering_layer = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint32_t rendering_layer = 1; | |
uint32_t rendering_layers = 1; |
modules/gridmap/grid_map.cpp
Outdated
@@ -962,11 +993,14 @@ void GridMap::_update_visibility() { | |||
for (int i = 0; i < octant->multimesh_instances.size(); i++) { | |||
const Octant::MultimeshInstance &mi = octant->multimesh_instances[i]; | |||
RS::get_singleton()->instance_set_visible(mi.instance, is_visible_in_tree()); | |||
RS::get_singleton()->instance_set_layer_mask(mi.instance, get_rendering_layer_mask()); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
520bf25
to
6db96b9
Compare
6db96b9
to
6db1545
Compare
This PR adds support for rendering layers to GridMap. It is mostly a straight-up copy of the code from VisualInstance3D. Perhaps it would be better to inherit from VisualInstance3D, but since GridMap handles collision and navigation also, I assumed that was the reason it didn't already.
Solves #40245