Depsgraph: Make sure evaluated pose channels are pointing to evaluated bones

This commit is contained in:
Sergey Sharybin 2018-05-03 16:10:37 +02:00
parent a06b0d29aa
commit d8b43a8066
Notes: blender-bot 2023-02-14 09:09:43 +01:00
Referenced by issue #54812, COW Operators: Pose Armature
3 changed files with 15 additions and 0 deletions

View File

@ -99,6 +99,7 @@ float distfactor_to_bone(const float vec[3], const float b1[3], const float b2[3
void BKE_armature_where_is(struct bArmature *arm);
void BKE_armature_where_is_bone(struct Bone *bone, struct Bone *prevbone, const bool use_recursion);
void BKE_pose_clear_pointers(struct bPose *pose);
void BKE_pose_remap_bone_pointers(struct bArmature *armature, struct bPose *pose);
void BKE_pose_rebuild(struct Object *ob, struct bArmature *arm);
void BKE_pose_where_is(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
void BKE_pose_where_is_bone(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime, bool do_extra);

View File

@ -1943,6 +1943,15 @@ void BKE_pose_clear_pointers(bPose *pose)
}
}
void BKE_pose_remap_bone_pointers(bArmature *armature, bPose *pose)
{
GHash *bone_hash = BKE_armature_bone_from_name_map(armature);
for (bPoseChannel *pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
pchan->bone = BLI_ghash_lookup(bone_hash, pchan->name);
}
BLI_ghash_free(bone_hash, NULL, NULL);
}
/* only after leave editmode, duplicating, validating older files, library syncing */
/* NOTE: pose->flag is set for it */
void BKE_pose_rebuild(Object *ob, bArmature *arm)

View File

@ -81,6 +81,7 @@ extern "C" {
#include "BKE_action.h"
#include "BKE_animsys.h"
#include "BKE_armature.h"
#include "BKE_editmesh.h"
#include "BKE_library_query.h"
#include "BKE_object.h"
@ -419,6 +420,10 @@ void update_special_pointers(const Depsgraph *depsgraph,
BLI_assert(object_cow->derivedFinal == NULL);
BLI_assert(object_cow->derivedDeform == NULL);
object_cow->mode = object_orig->mode;
if (object_cow->type == OB_ARMATURE) {
BKE_pose_remap_bone_pointers((bArmature *)object_cow->data,
object_cow->pose);
}
break;
}
case ID_ME: