mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
make a copy of the AnimBundle before modifying
This commit is contained in:
parent
b2ba2b5246
commit
1f9f4b654e
@ -201,13 +201,17 @@ bind_anim(AnimBundle *anim, int hierarchy_match_flags,
|
|||||||
const PartSubset &subset) {
|
const PartSubset &subset) {
|
||||||
nassertr(Thread::get_current_pipeline_stage() == 0, NULL);
|
nassertr(Thread::get_current_pipeline_stage() == 0, NULL);
|
||||||
|
|
||||||
|
// Make sure this pointer doesn't destruct during the lifetime of this
|
||||||
|
// method.
|
||||||
|
PT(AnimBundle) ptanim = anim;
|
||||||
|
|
||||||
if ((hierarchy_match_flags & HMF_ok_wrong_root_name) == 0) {
|
if ((hierarchy_match_flags & HMF_ok_wrong_root_name) == 0) {
|
||||||
// Make sure the root names match.
|
// Make sure the root names match.
|
||||||
if (get_name() != anim->get_name()) {
|
if (get_name() != ptanim->get_name()) {
|
||||||
if (chan_cat.is_error()) {
|
if (chan_cat.is_error()) {
|
||||||
chan_cat.error()
|
chan_cat.error()
|
||||||
<< "Root name of part (" << get_name()
|
<< "Root name of part (" << get_name()
|
||||||
<< ") does not match that of anim (" << anim->get_name()
|
<< ") does not match that of anim (" << ptanim->get_name()
|
||||||
<< ")\n";
|
<< ")\n";
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -218,9 +222,12 @@ bind_anim(AnimBundle *anim, int hierarchy_match_flags,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
JointTransformList::iterator jti;
|
if (!_frozen_joints.empty()) {
|
||||||
for (jti = _frozen_joints.begin(); jti != _frozen_joints.end(); ++jti) {
|
ptanim = ptanim->copy_bundle();
|
||||||
anim->make_child_fixed((*jti).name, (*jti).transform);
|
JointTransformList::iterator jti;
|
||||||
|
for (jti = _frozen_joints.begin(); jti != _frozen_joints.end(); ++jti) {
|
||||||
|
ptanim->make_child_fixed((*jti).name, (*jti).transform);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plist<int> holes;
|
plist<int> holes;
|
||||||
@ -236,8 +243,8 @@ bind_anim(AnimBundle *anim, int hierarchy_match_flags,
|
|||||||
if (subset.is_include_empty()) {
|
if (subset.is_include_empty()) {
|
||||||
bound_joints = BitArray::all_on();
|
bound_joints = BitArray::all_on();
|
||||||
}
|
}
|
||||||
bind_hierarchy(anim, channel_index, joint_index, subset.is_include_empty(),
|
bind_hierarchy(ptanim, channel_index, joint_index,
|
||||||
bound_joints, subset);
|
subset.is_include_empty(), bound_joints, subset);
|
||||||
return new AnimControl(this, anim, channel_index, bound_joints);
|
return new AnimControl(this, anim, channel_index, bound_joints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user