diff options
Diffstat (limited to 'source/blender/blenkernel/intern/action.c')
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index c6dcca576fb..f9556bf39ab 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -215,6 +215,10 @@ bAction *BKE_action_copy(bAction *src) } } + if (src->id.lib) { + BKE_id_lib_local_paths(G.main, src->id.lib, &dst->id); + } + return dst; } @@ -450,9 +454,9 @@ bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name) return NULL; if (pose->chanhash) - return BLI_ghash_lookup(pose->chanhash, (void *)name); + return BLI_ghash_lookup(pose->chanhash, (const void *)name); - return BLI_findstring(&((bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name)); + return BLI_findstring(&((const bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name)); } /** @@ -729,7 +733,7 @@ void BKE_pose_channel_free_ex(bPoseChannel *pchan, bool do_id_user) pchan->mpath = NULL; } - BKE_constraints_free(&pchan->constraints); + BKE_constraints_free_ex(&pchan->constraints, do_id_user); if (pchan->prop) { IDP_FreeProperty(pchan->prop); @@ -966,7 +970,7 @@ bActionGroup *BKE_pose_add_group(bPose *pose, const char *name) BLI_addtail(&pose->agroups, grp); BLI_uniquename(&pose->agroups, grp, name, '.', offsetof(bActionGroup, name), sizeof(grp->name)); - pose->active_group = BLI_countlist(&pose->agroups); + pose->active_group = BLI_listbase_count(&pose->agroups); return grp; } @@ -998,8 +1002,12 @@ void BKE_pose_remove_group(bPose *pose, bActionGroup *grp, const int index) /* now, remove it from the pose */ BLI_freelinkN(&pose->agroups, grp); if (pose->active_group >= idx) { + const bool has_groups = !BLI_listbase_is_empty(&pose->agroups); pose->active_group--; - if (pose->active_group < 0 || BLI_listbase_is_empty(&pose->agroups)) { + if (pose->active_group == 0 && has_groups) { + pose->active_group = 1; + } + else if (pose->active_group < 0 || !has_groups) { pose->active_group = 0; } } @@ -1028,12 +1036,12 @@ bool action_has_motion(const bAction *act) if (act) { for (fcu = act->curves.first; fcu; fcu = fcu->next) { if (fcu->totvert) - return 1; + return true; } } /* nothing found */ - return 0; + return false; } /* Calculate the extents of given action */ |