33
33
34
34
void BoneAttachment3D::_validate_property (PropertyInfo &p_property) const {
35
35
if (p_property.name == " bone_name" ) {
36
- // Because it is a constant function, we cannot use the _get_skeleton_3d function.
36
+ // Because it is a constant function, we cannot use the get_skeleton function.
37
37
const Skeleton3D *parent = nullptr ;
38
38
if (use_external_skeleton) {
39
39
if (external_skeleton_node_cache.is_valid ()) {
@@ -134,7 +134,7 @@ void BoneAttachment3D::_update_external_skeleton_cache() {
134
134
}
135
135
136
136
void BoneAttachment3D::_check_bind () {
137
- Skeleton3D *sk = _get_skeleton3d ();
137
+ Skeleton3D *sk = get_skeleton ();
138
138
139
139
if (sk && !bound) {
140
140
if (bone_idx <= -1 ) {
@@ -148,7 +148,7 @@ void BoneAttachment3D::_check_bind() {
148
148
}
149
149
}
150
150
151
- Skeleton3D *BoneAttachment3D::_get_skeleton3d () {
151
+ Skeleton3D *BoneAttachment3D::get_skeleton () {
152
152
if (use_external_skeleton) {
153
153
if (external_skeleton_node_cache.is_valid ()) {
154
154
return Object::cast_to<Skeleton3D>(ObjectDB::get_instance (external_skeleton_node_cache));
@@ -166,7 +166,7 @@ Skeleton3D *BoneAttachment3D::_get_skeleton3d() {
166
166
167
167
void BoneAttachment3D::_check_unbind () {
168
168
if (bound) {
169
- Skeleton3D *sk = _get_skeleton3d ();
169
+ Skeleton3D *sk = get_skeleton ();
170
170
171
171
if (sk) {
172
172
sk->disconnect (SceneStringName (skeleton_updated), callable_mp (this , &BoneAttachment3D::on_skeleton_update));
@@ -181,7 +181,7 @@ void BoneAttachment3D::_transform_changed() {
181
181
}
182
182
183
183
if (override_pose && !overriding) {
184
- Skeleton3D *sk = _get_skeleton3d ();
184
+ Skeleton3D *sk = get_skeleton ();
185
185
186
186
ERR_FAIL_NULL_MSG (sk, " Cannot override pose: Skeleton not found!" );
187
187
ERR_FAIL_INDEX_MSG (bone_idx, sk->get_bone_count (), " Cannot override pose: Bone index is out of range!" );
@@ -200,7 +200,7 @@ void BoneAttachment3D::_transform_changed() {
200
200
201
201
void BoneAttachment3D::set_bone_name (const String &p_name) {
202
202
bone_name = p_name;
203
- Skeleton3D *sk = _get_skeleton3d ();
203
+ Skeleton3D *sk = get_skeleton ();
204
204
if (sk) {
205
205
set_bone_idx (sk->find_bone (bone_name));
206
206
}
@@ -217,7 +217,7 @@ void BoneAttachment3D::set_bone_idx(const int &p_idx) {
217
217
218
218
bone_idx = p_idx;
219
219
220
- Skeleton3D *sk = _get_skeleton3d ();
220
+ Skeleton3D *sk = get_skeleton ();
221
221
if (sk) {
222
222
if (bone_idx <= -1 || bone_idx >= sk->get_bone_count ()) {
223
223
WARN_PRINT (" Bone index out of range! Cannot connect BoneAttachment to node!" );
@@ -247,7 +247,7 @@ void BoneAttachment3D::set_override_pose(bool p_override) {
247
247
set_notify_transform (override_pose);
248
248
set_process_internal (override_pose);
249
249
if (!override_pose && bone_idx >= 0 ) {
250
- Skeleton3D *sk = _get_skeleton3d ();
250
+ Skeleton3D *sk = get_skeleton ();
251
251
if (sk) {
252
252
sk->reset_bone_pose (bone_idx);
253
253
}
@@ -318,7 +318,7 @@ void BoneAttachment3D::on_skeleton_update() {
318
318
}
319
319
updating = true ;
320
320
if (bone_idx >= 0 ) {
321
- Skeleton3D *sk = _get_skeleton3d ();
321
+ Skeleton3D *sk = get_skeleton ();
322
322
if (sk) {
323
323
if (!override_pose) {
324
324
if (use_external_skeleton) {
@@ -369,6 +369,8 @@ BoneAttachment3D::BoneAttachment3D() {
369
369
}
370
370
371
371
void BoneAttachment3D::_bind_methods () {
372
+ ClassDB::bind_method (D_METHOD (" get_skeleton" ), &BoneAttachment3D::get_skeleton);
373
+
372
374
ClassDB::bind_method (D_METHOD (" set_bone_name" , " bone_name" ), &BoneAttachment3D::set_bone_name);
373
375
ClassDB::bind_method (D_METHOD (" get_bone_name" ), &BoneAttachment3D::get_bone_name);
374
376
0 commit comments