diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-06-29 17:41:00 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-06-29 18:18:11 +0300 |
commit | d140e70c496122915eb5c05aba83153e2e0d7998 (patch) | |
tree | 1e589247d69da64aa7b0e7802319237ec050b5d6 /source/blender/blenkernel/intern/action.c | |
parent | 147bd16ed1bb3415b30408b0eab110d0854eadd2 (diff) | |
parent | 295d0c52a26730edc6d4ed1276e4051cce006be5 (diff) |
Merge branch 'master' into temp-ghash-experimentstemp-ghash-experiments
Note that 'store hash' feature was removed for now - to complex to maintain (conflicts)
and relatively easy to re-add if we ever really want this one day.
Conflicts:
source/blender/blenlib/BLI_ghash.h
source/blender/blenlib/intern/BLI_ghash.c
source/blender/blenlib/intern/hash_mm2a.c
source/blender/bmesh/tools/bmesh_region_match.c
tests/gtests/blenlib/BLI_ghash_performance_test.cc
tests/gtests/blenlib/BLI_ghash_test.cc
tests/gtests/blenlib/CMakeLists.txt
Diffstat (limited to 'source/blender/blenkernel/intern/action.c')
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index f9556bf39ab..1b73978b524 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -54,6 +54,7 @@ #include "BKE_animsys.h" #include "BKE_constraint.h" #include "BKE_deform.h" +#include "BKE_depsgraph.h" #include "BKE_fcurve.h" #include "BKE_global.h" #include "BKE_idprop.h" @@ -716,6 +717,57 @@ void BKE_pose_channels_hash_free(bPose *pose) } /** + * Selectively remove pose channels. + */ +void BKE_pose_channels_remove( + Object *ob, + bool (*filter_fn)(const char *bone_name, void *user_data), void *user_data) +{ + /* First erase any associated pose channel */ + if (ob->pose) { + bPoseChannel *pchan, *pchan_next; + bConstraint *con; + + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan_next) { + pchan_next = pchan->next; + + if (filter_fn(pchan->name, user_data)) { + BKE_pose_channel_free(pchan); + if (ob->pose->chanhash) { + BLI_ghash_remove(ob->pose->chanhash, pchan->name, NULL, NULL); + } + BLI_freelinkN(&ob->pose->chanbase, pchan); + } + else { + for (con = pchan->constraints.first; con; con = con->next) { + const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); + ListBase targets = {NULL, NULL}; + bConstraintTarget *ct; + + if (cti && cti->get_constraint_targets) { + cti->get_constraint_targets(con, &targets); + + for (ct = targets.first; ct; ct = ct->next) { + if (ct->tar == ob) { + if (ct->subtarget[0]) { + if (filter_fn(ct->subtarget, user_data)) { + con->flag |= CONSTRAINT_DISABLE; + ct->subtarget[0] = 0; + } + } + } + } + + if (cti->flush_constraint_targets) + cti->flush_constraint_targets(con, &targets, 0); + } + } + } + } + } +} + +/** * Deallocates a pose channel. * Does not free the pose channel itself. */ @@ -929,6 +981,12 @@ void BKE_pose_update_constraint_flags(bPose *pose) pchan->constflag |= PCHAN_HAS_CONST; } } + pose->flag &= ~POSE_CONSTRAINTS_NEED_UPDATE_FLAGS; +} + +void BKE_pose_tag_update_constraint_flags(bPose *pose) +{ + pose->flag |= POSE_CONSTRAINTS_NEED_UPDATE_FLAGS; } /* Clears all BONE_UNKEYED flags for every pose channel in every pose @@ -1311,6 +1369,16 @@ bool BKE_pose_copy_result(bPose *to, bPose *from) return true; } +/* Tag pose for recalc. Also tag all related data to be recalc. */ +void BKE_pose_tag_recalc(Main *bmain, bPose *pose) +{ + pose->flag |= POSE_RECALC; + /* Depsgraph components depends on actual pose state, + * if pose was changed depsgraph is to be updated as well. + */ + DAG_relations_tag_update(bmain); +} + /* For the calculation of the effects of an Action at the given frame on an object * This is currently only used for the Action Constraint */ |