Added bindings for methods related to obtaining base an instance from VisualInstance

(cherry picked from commit 33a0011ab2)
This commit is contained in:
Juan Linietsky 2019-04-22 19:27:30 -03:00 committed by Rémi Verschelde
parent 08113feb5f
commit fcbe50befa
2 changed files with 10 additions and 0 deletions

View File

@ -123,6 +123,8 @@ 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("get_base"), &VisualInstance::get_base);
ClassDB::bind_method(D_METHOD("get_instance"), &VisualInstance::get_instance);
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);
@ -136,6 +138,12 @@ void VisualInstance::_bind_methods() {
void VisualInstance::set_base(const RID &p_base) {
VisualServer::get_singleton()->instance_set_base(instance, p_base);
base = p_base;
}
RID VisualInstance::get_base() const {
return base;
}
VisualInstance::VisualInstance() {

View File

@ -43,6 +43,7 @@ class VisualInstance : public Spatial {
GDCLASS(VisualInstance, Spatial);
OBJ_CATEGORY("3D Visual Nodes");
RID base;
RID instance;
uint32_t layers;
@ -69,6 +70,7 @@ public:
virtual AABB get_transformed_aabb() const; // helper
void set_base(const RID &p_base);
RID get_base() const;
void set_layer_mask(uint32_t p_mask);
uint32_t get_layer_mask() const;