Merge pull request #114431 from TokageItLab/fix-limitation-gizmo-on-root
Fix IKModifier/JointLimitation gizmo on root bone and dirty handling
This commit is contained in:
@@ -71,11 +71,11 @@ void IKModifier3D::_set_active(bool p_active) {
|
||||
}
|
||||
|
||||
void IKModifier3D::_skeleton_changed(Skeleton3D *p_old, Skeleton3D *p_new) {
|
||||
if (p_old && p_old->is_connected(SNAME("rest_updated"), callable_mp(this, &IKModifier3D::_make_all_joints_dirty))) {
|
||||
p_old->disconnect(SNAME("rest_updated"), callable_mp(this, &IKModifier3D::_make_all_joints_dirty));
|
||||
if (p_old && p_old->is_connected(SNAME("rest_updated"), callable_mp(this, &IKModifier3D::_rest_updated))) {
|
||||
p_old->disconnect(SNAME("rest_updated"), callable_mp(this, &IKModifier3D::_rest_updated));
|
||||
}
|
||||
if (p_new && !p_new->is_connected(SNAME("rest_updated"), callable_mp(this, &IKModifier3D::_make_all_joints_dirty))) {
|
||||
p_new->connect(SNAME("rest_updated"), callable_mp(this, &IKModifier3D::_make_all_joints_dirty));
|
||||
if (p_new && !p_new->is_connected(SNAME("rest_updated"), callable_mp(this, &IKModifier3D::_rest_updated))) {
|
||||
p_new->connect(SNAME("rest_updated"), callable_mp(this, &IKModifier3D::_rest_updated));
|
||||
}
|
||||
_make_all_joints_dirty();
|
||||
}
|
||||
@@ -84,6 +84,22 @@ void IKModifier3D::_validate_bone_names() {
|
||||
//
|
||||
}
|
||||
|
||||
void IKModifier3D::_rest_updated() {
|
||||
_make_all_joints_dirty();
|
||||
if (is_inside_tree()) {
|
||||
Skeleton3D *skeleton = get_skeleton();
|
||||
if (skeleton) {
|
||||
for (uint32_t i = 0; i < settings.size(); i++) {
|
||||
_init_joints(skeleton, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef TOOLS_ENABLED
|
||||
_update_mutable_info();
|
||||
_make_gizmo_dirty();
|
||||
#endif // TOOLS_ENABLED
|
||||
}
|
||||
|
||||
void IKModifier3D::_make_all_joints_dirty() {
|
||||
//
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ protected:
|
||||
|
||||
virtual void _validate_bone_names() override;
|
||||
|
||||
void _rest_updated();
|
||||
virtual void _make_all_joints_dirty();
|
||||
virtual void _init_joints(Skeleton3D *p_skeleton, int p_index);
|
||||
virtual void _update_joints(int p_index);
|
||||
|
||||
Reference in New Issue
Block a user