mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Add extra functions to toggle bits in visualinstance and camera, same as physics. Helps with #6685
This commit is contained in:
@@ -105,12 +105,28 @@ uint32_t VisualInstance::get_layer_mask() const {
|
||||
return layers;
|
||||
}
|
||||
|
||||
void VisualInstance::set_layer_mask_bit(int p_layer, bool p_enable) {
|
||||
ERR_FAIL_INDEX(p_layer, 32);
|
||||
if (p_enable) {
|
||||
set_layer_mask(layers | (1 << p_layer));
|
||||
} else {
|
||||
set_layer_mask(layers & (~(1 << p_layer)));
|
||||
}
|
||||
}
|
||||
|
||||
bool VisualInstance::get_layer_mask_bit(int p_layer) const {
|
||||
ERR_FAIL_INDEX_V(p_layer, 32, false);
|
||||
return (layers & (1 << p_layer));
|
||||
}
|
||||
|
||||
void VisualInstance::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_get_visual_instance_rid"), &VisualInstance::_get_visual_instance_rid);
|
||||
ClassDB::bind_method(D_METHOD("set_base", "base"), &VisualInstance::set_base);
|
||||
ClassDB::bind_method(D_METHOD("set_layer_mask", "mask"), &VisualInstance::set_layer_mask);
|
||||
ClassDB::bind_method(D_METHOD("get_layer_mask"), &VisualInstance::get_layer_mask);
|
||||
ClassDB::bind_method(D_METHOD("set_layer_mask_bit", "layer", "enabled"), &VisualInstance::set_layer_mask_bit);
|
||||
ClassDB::bind_method(D_METHOD("get_layer_mask_bit", "layer"), &VisualInstance::get_layer_mask_bit);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_transformed_aabb"), &VisualInstance::get_transformed_aabb);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user