diff options
| author | Rémi Verschelde | 2017-08-25 08:37:38 +0200 |
|---|---|---|
| committer | GitHub | 2017-08-25 08:37:38 +0200 |
| commit | 490aef93699abc00da58f73b1596fb3473fd53c6 (patch) | |
| tree | 7912c7a540eca6b09392bbd2aa2f30fefe37f51a /scene/3d/bone_attachment.cpp | |
| parent | b1c0e45b03aa14453846c9a888763077eef2476b (diff) | |
| parent | cacced7e507f7603bacc03ae2616e58f0ede122a (diff) | |
| download | godot-490aef93699abc00da58f73b1596fb3473fd53c6.tar.gz godot-490aef93699abc00da58f73b1596fb3473fd53c6.tar.zst godot-490aef93699abc00da58f73b1596fb3473fd53c6.zip | |
Merge pull request #10581 from hpvb/fix-gcc6+
Make cast_to a static member of Object.
Diffstat (limited to 'scene/3d/bone_attachment.cpp')
| -rw-r--r-- | scene/3d/bone_attachment.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/scene/3d/bone_attachment.cpp b/scene/3d/bone_attachment.cpp index b55b788b5..067e151c6 100644 --- a/scene/3d/bone_attachment.cpp +++ b/scene/3d/bone_attachment.cpp @@ -51,9 +51,7 @@ bool BoneAttachment::_set(const StringName &p_name, const Variant &p_value) { } void BoneAttachment::_get_property_list(List<PropertyInfo> *p_list) const { - Skeleton *parent = NULL; - if (get_parent()) - parent = get_parent()->cast_to<Skeleton>(); + Skeleton *parent = Object::cast_to<Skeleton>(get_parent()); if (parent) { @@ -73,8 +71,8 @@ void BoneAttachment::_get_property_list(List<PropertyInfo> *p_list) const { void BoneAttachment::_check_bind() { - if (get_parent() && get_parent()->cast_to<Skeleton>()) { - Skeleton *sk = get_parent()->cast_to<Skeleton>(); + if (Skeleton *sk = Object::cast_to<Skeleton>(get_parent())) { + int idx = sk->find_bone(bone_name); if (idx != -1) { sk->bind_child_node_to_bone(idx, this); @@ -88,8 +86,8 @@ void BoneAttachment::_check_unbind() { if (bound) { - if (get_parent() && get_parent()->cast_to<Skeleton>()) { - Skeleton *sk = get_parent()->cast_to<Skeleton>(); + if (Skeleton *sk = Object::cast_to<Skeleton>(get_parent())) { + int idx = sk->find_bone(bone_name); if (idx != -1) { sk->unbind_child_node_from_bone(idx, this); |
