diff options
-rw-r--r-- | source/blender/blenkernel/BKE_animsys.h | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 81 | ||||
-rw-r--r-- | source/blender/blenkernel/nla_private.h | 2 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_lib.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 7 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_anim_types.h | 41 |
7 files changed, 30 insertions, 112 deletions
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index 0b7405c64a0..394351d1df2 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -32,7 +32,6 @@ */ struct AnimData; -struct AnimMapper; struct ChannelDriver; struct Depsgraph; struct FCurve; @@ -184,7 +183,7 @@ void BKE_animsys_evaluate_animdata(struct Depsgraph *depsgraph, struct Scene *sc void BKE_animsys_evaluate_all_animation(struct Main *main, struct Depsgraph *depsgraph, struct Scene *scene, float ctime); /* TODO(sergey): This is mainly a temp public function. */ -bool BKE_animsys_execute_fcurve(struct PointerRNA *ptr, struct AnimMapper *remap, struct FCurve *fcu, float curval); +bool BKE_animsys_execute_fcurve(struct PointerRNA *ptr, struct FCurve *fcu, float curval); /* ------------ Specialized API --------------- */ /* There are a few special tools which require these following functions. They are NOT to be used @@ -195,10 +194,10 @@ bool BKE_animsys_execute_fcurve(struct PointerRNA *ptr, struct AnimMapper *remap */ /* Evaluate Action (F-Curve Bag) */ -void animsys_evaluate_action(struct Depsgraph *depsgraph, struct PointerRNA *ptr, struct bAction *act, struct AnimMapper *remap, float ctime); +void animsys_evaluate_action(struct Depsgraph *depsgraph, struct PointerRNA *ptr, struct bAction *act, float ctime); /* Evaluate Action Group */ -void animsys_evaluate_action_group(struct PointerRNA *ptr, struct bAction *act, struct bActionGroup *agrp, struct AnimMapper *remap, float ctime); +void animsys_evaluate_action_group(struct PointerRNA *ptr, struct bAction *act, struct bActionGroup *agrp, float ctime); /* ************************************* */ diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 68029ea72f6..115ed29818a 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1447,7 +1447,7 @@ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, c RNA_id_pointer_create(&workob->id, &id_ptr); /* execute action for this group only */ - animsys_evaluate_action_group(&id_ptr, act, agrp, NULL, cframe); + animsys_evaluate_action_group(&id_ptr, act, agrp, cframe); } else { AnimData adt = {NULL}; diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 17940b947cb..d4355546c19 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1468,34 +1468,14 @@ void BKE_keyingsets_free(ListBase *list) /* ***************************************** */ /* Evaluation Data-Setting Backend */ -/* Retrieve string to act as RNA-path, adjusted using mapping-table if provided - * It returns whether the string needs to be freed (i.e. if it was a temp remapped one) - * // FIXME: maybe it would be faster if we didn't have to alloc/free strings like this all the time, but for now it's safer - * - * - remap: remapping table to use - * - path: original path string (as stored in F-Curve data) - * - dst: destination string to write data to - */ -static bool animsys_remap_path(AnimMapper *UNUSED(remap), char *path, char **dst) -{ - /* nothing suitable found, so just set dst to look at path (i.e. no alloc/free needed) */ - *dst = path; - return false; -} - static bool animsys_store_rna_setting( - PointerRNA *ptr, AnimMapper *remap, + PointerRNA *ptr, /* typically 'fcu->rna_path', 'fcu->array_index' */ const char *rna_path, const int array_index, PathResolvedRNA *r_result) { bool success = false; - - char *path = NULL; - bool free_path; - - /* get path, remapped as appropriate to work in its new environment */ - free_path = animsys_remap_path(remap, (char *)rna_path, &path); + const char *path = rna_path; /* write value to setting */ if (path) { @@ -1529,11 +1509,6 @@ static bool animsys_store_rna_setting( } } - /* free temp path-info */ - if (free_path) { - MEM_freeN((void *)path); - } - return success; } @@ -1678,12 +1653,12 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val } /* Simple replacement based data-setting of the FCurve using RNA */ -bool BKE_animsys_execute_fcurve(PointerRNA *ptr, AnimMapper *remap, FCurve *fcu, float curval) +bool BKE_animsys_execute_fcurve(PointerRNA *ptr, FCurve *fcu, float curval) { PathResolvedRNA anim_rna; bool ok = false; - if (animsys_store_rna_setting(ptr, remap, fcu->rna_path, fcu->array_index, &anim_rna)) { + if (animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { ok = animsys_write_rna_setting(&anim_rna, curval); } @@ -1693,7 +1668,6 @@ bool BKE_animsys_execute_fcurve(PointerRNA *ptr, AnimMapper *remap, FCurve *fcu, static void animsys_write_orig_anim_rna( PointerRNA *ptr, - AnimMapper *remap, const char *rna_path, int array_index, float value) @@ -1711,7 +1685,7 @@ static void animsys_write_orig_anim_rna( orig_ptr.data = orig_ptr.id.data; PathResolvedRNA orig_anim_rna; /* TODO(sergey): Is there a faster way to get anim_rna of original ID? */ - if (animsys_store_rna_setting(&orig_ptr, remap, rna_path, array_index, &orig_anim_rna)) { + if (animsys_store_rna_setting(&orig_ptr, rna_path, array_index, &orig_anim_rna)) { animsys_write_rna_setting(&orig_anim_rna, value); } } @@ -1720,7 +1694,7 @@ static void animsys_write_orig_anim_rna( * This performs a set of standard checks. If extra checks are required, separate code should be used */ static void animsys_evaluate_fcurves( - Depsgraph *depsgraph, PointerRNA *ptr, ListBase *list, AnimMapper *remap, float ctime) + Depsgraph *depsgraph, PointerRNA *ptr, ListBase *list, float ctime) { const bool is_active_depsgraph = DEG_is_active(depsgraph); /* Calculate then execute each curve. */ @@ -1734,11 +1708,11 @@ static void animsys_evaluate_fcurves( continue; } PathResolvedRNA anim_rna; - if (animsys_store_rna_setting(ptr, remap, fcu->rna_path, fcu->array_index, &anim_rna)) { + if (animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { const float curval = calculate_fcurve(&anim_rna, fcu, ctime); animsys_write_rna_setting(&anim_rna, curval); if (is_active_depsgraph) { - animsys_write_orig_anim_rna(ptr, remap, fcu->rna_path, fcu->array_index, curval); + animsys_write_orig_anim_rna(ptr, fcu->rna_path, fcu->array_index, curval); } } } @@ -1769,7 +1743,7 @@ static void animsys_evaluate_drivers(PointerRNA *ptr, AnimData *adt, float ctime * new to only be done when drivers only changed */ PathResolvedRNA anim_rna; - if (animsys_store_rna_setting(ptr, NULL, fcu->rna_path, fcu->array_index, &anim_rna)) { + if (animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { const float curval = calculate_fcurve(&anim_rna, fcu, ctime); ok = animsys_write_rna_setting(&anim_rna, curval); } @@ -1822,13 +1796,12 @@ static void action_idcode_patch_check(ID *id, bAction *act) /* ----------------------------------------- */ /* Evaluate Action Group */ -void animsys_evaluate_action_group(PointerRNA *ptr, bAction *act, bActionGroup *agrp, AnimMapper *remap, float ctime) +void animsys_evaluate_action_group(PointerRNA *ptr, bAction *act, bActionGroup *agrp, float ctime) { FCurve *fcu; /* check if mapper is appropriate for use here (we set to NULL if it's inappropriate) */ if (ELEM(NULL, act, agrp)) return; - if ((remap) && (remap->target != act)) remap = NULL; action_idcode_patch_check(ptr->id.data, act); @@ -1841,7 +1814,7 @@ void animsys_evaluate_action_group(PointerRNA *ptr, bAction *act, bActionGroup * /* check if this curve should be skipped */ if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) == 0) { PathResolvedRNA anim_rna; - if (animsys_store_rna_setting(ptr, remap, fcu->rna_path, fcu->array_index, &anim_rna)) { + if (animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { const float curval = calculate_fcurve(&anim_rna, fcu, ctime); animsys_write_rna_setting(&anim_rna, curval); } @@ -1851,21 +1824,20 @@ void animsys_evaluate_action_group(PointerRNA *ptr, bAction *act, bActionGroup * /* Evaluate Action (F-Curve Bag) */ static void animsys_evaluate_action_ex( - Depsgraph *depsgraph, PointerRNA *ptr, bAction *act, AnimMapper *remap, float ctime) + Depsgraph *depsgraph, PointerRNA *ptr, bAction *act, float ctime) { /* check if mapper is appropriate for use here (we set to NULL if it's inappropriate) */ if (act == NULL) return; - if ((remap) && (remap->target != act)) remap = NULL; action_idcode_patch_check(ptr->id.data, act); /* calculate then execute each curve */ - animsys_evaluate_fcurves(depsgraph, ptr, &act->curves, remap, ctime); + animsys_evaluate_fcurves(depsgraph, ptr, &act->curves, ctime); } -void animsys_evaluate_action(Depsgraph *depsgraph, PointerRNA *ptr, bAction *act, AnimMapper *remap, float ctime) +void animsys_evaluate_action(Depsgraph *depsgraph, PointerRNA *ptr, bAction *act, float ctime) { - animsys_evaluate_action_ex(depsgraph, ptr, act, remap, ctime); + animsys_evaluate_action_ex(depsgraph, ptr, act, ctime); } /* ***************************************** */ @@ -1904,7 +1876,7 @@ static void nlastrip_evaluate_controls(Depsgraph *depsgraph, NlaStrip *strip, fl RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &strip_ptr); /* execute these settings as per normal */ - animsys_evaluate_fcurves(depsgraph, &strip_ptr, &strip->fcurves, NULL, ctime); + animsys_evaluate_fcurves(depsgraph, &strip_ptr, &strip->fcurves, ctime); } /* analytically generate values for influence and time (if applicable) @@ -2104,10 +2076,9 @@ static float nlaevalchan_init_value(PathResolvedRNA *rna) } /* verify that an appropriate NlaEvalChannel for this F-Curve exists */ -static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, NlaEvalStrip *nes, FCurve *fcu, bool *newChan) +static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, FCurve *fcu, bool *newChan) { NlaEvalChannel *nec; - NlaStrip *strip = nes->strip; PathResolvedRNA rna; /* sanity checks */ @@ -2115,7 +2086,7 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, N return NULL; /* get RNA pointer+property info from F-Curve for more convenient handling */ - if (!animsys_store_rna_setting(ptr, strip->remap, fcu->rna_path, fcu->array_index, &rna)) { + if (!animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &rna)) { return NULL; } @@ -2131,7 +2102,6 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, N nec->rna = rna; /* store parameters for use with write_orig_anim_rna */ - nec->remap = strip->remap; nec->rna_path = fcu->rna_path; /* initialise value using default value of property [#35856] */ @@ -2341,7 +2311,7 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr, ListBase *channels, Li /* get an NLA evaluation channel to work with, and accumulate the evaluated value with the value(s) * stored in this channel if it has been used already */ - nec = nlaevalchan_verify(ptr, channels, nes, fcu, &newChan); + nec = nlaevalchan_verify(ptr, channels, fcu, &newChan); if (nec) nlaevalchan_accumulate(nec, nes, value, newChan); } @@ -2496,7 +2466,7 @@ void nladata_flush_channels(Depsgraph *depsgraph, PointerRNA *ptr, ListBase *cha for (nec = channels->first; nec; nec = nec->next) { animsys_write_rna_setting(&nec->rna, nec->value); if (is_active_depsgraph) { - animsys_write_orig_anim_rna(ptr, nec->remap, nec->rna_path, nec->rna.prop_index, nec->value); + animsys_write_orig_anim_rna(ptr, nec->rna_path, nec->rna.prop_index, nec->value); } } } @@ -2573,7 +2543,6 @@ static void animsys_evaluate_nla(Depsgraph *depsgraph, ListBase *echannels, Poin else { /* set settings of dummy NLA strip from AnimData settings */ dummy_strip.act = adt->action; - dummy_strip.remap = adt->remap; /* action range is calculated taking F-Modifiers into account (which making new strips doesn't do due to the troublesome nature of that) */ calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1); @@ -2596,7 +2565,7 @@ static void animsys_evaluate_nla(Depsgraph *depsgraph, ListBase *echannels, Poin /* TODO: this is really just a stop-gap measure... */ if (G.debug & G_DEBUG) printf("NLA Eval: Stopgap for active action on NLA Stack - no strips case\n"); - animsys_evaluate_action(depsgraph, ptr, adt->action, adt->remap, ctime); + animsys_evaluate_action(depsgraph, ptr, adt->action, ctime); BLI_freelistN(&estrips); return; } @@ -2647,7 +2616,7 @@ static void animsys_evaluate_overrides(PointerRNA *ptr, AnimData *adt) /* for each override, simply execute... */ for (aor = adt->overrides.first; aor; aor = aor->next) { PathResolvedRNA anim_rna; - if (animsys_store_rna_setting(ptr, NULL, aor->rna_path, aor->array_index, &anim_rna)) { + if (animsys_store_rna_setting(ptr, aor->rna_path, aor->array_index, &anim_rna)) { animsys_write_rna_setting(&anim_rna, aor->value); } } @@ -2719,7 +2688,7 @@ void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, A } /* evaluate Active Action only */ else if (adt->action) - animsys_evaluate_action_ex(depsgraph, &id_ptr, adt->action, adt->remap, ctime); + animsys_evaluate_action_ex(depsgraph, &id_ptr, adt->action, ctime); /* reset tag */ adt->recalc &= ~ADT_RECALC_ANIM; @@ -2961,12 +2930,12 @@ void BKE_animsys_eval_driver(Depsgraph *depsgraph, //printf("\told val = %f\n", fcu->curval); PathResolvedRNA anim_rna; - if (animsys_store_rna_setting(&id_ptr, NULL, fcu->rna_path, fcu->array_index, &anim_rna)) { + if (animsys_store_rna_setting(&id_ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { const float ctime = DEG_get_ctime(depsgraph); const float curval = evaluate_fcurve_driver(&anim_rna, fcu, driver_orig, ctime); ok = animsys_write_rna_setting(&anim_rna, curval); if (ok && DEG_is_active(depsgraph)) { - animsys_write_orig_anim_rna(&id_ptr, NULL, fcu->rna_path, fcu->array_index, curval); + animsys_write_orig_anim_rna(&id_ptr, fcu->rna_path, fcu->array_index, curval); } } diff --git a/source/blender/blenkernel/nla_private.h b/source/blender/blenkernel/nla_private.h index 1c6fd3a3e7d..67728445f3a 100644 --- a/source/blender/blenkernel/nla_private.h +++ b/source/blender/blenkernel/nla_private.h @@ -34,7 +34,6 @@ #define __NLA_PRIVATE_H__ struct Depsgraph; -struct AnimMapper; #include "RNA_types.h" @@ -75,7 +74,6 @@ typedef struct NlaEvalChannel { PathResolvedRNA rna; /* Original parameters used to look up the reference for write_orig_anim_rna */ - struct AnimMapper *remap; const char *rna_path; float value; /* value of this channel */ diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index e1cc954e587..eeefcf39799 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -1026,7 +1026,7 @@ static void poselib_apply_pose(tPoseLib_PreviewData *pld) } if (ok) - animsys_evaluate_action_group(ptr, act, agrp, NULL, (float)frame); + animsys_evaluate_action_group(ptr, act, agrp, (float)frame); } } } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 0a35b572bbe..5c01f02c3ef 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2063,9 +2063,6 @@ static void make_local_animdata_tag_strips(ListBase *strips) if (strip->act) { strip->act->id.tag &= ~LIB_TAG_PRE_EXISTING; } - if (strip->remap && strip->remap->target) { - strip->remap->target->id.tag &= ~LIB_TAG_PRE_EXISTING; - } make_local_animdata_tag_strips(&strip->strips); } @@ -2082,10 +2079,6 @@ static void make_local_animdata_tag(AnimData *adt) if (adt->tmpact) { adt->tmpact->id.tag &= ~LIB_TAG_PRE_EXISTING; } - /* Remaps */ - if (adt->remap && adt->remap->target) { - adt->remap->target->id.tag &= ~LIB_TAG_PRE_EXISTING; - } /* Drivers */ /* TODO: need to handle the ID-targets too? */ diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index 4fee5fc6d70..515e84c917d 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -566,42 +566,6 @@ typedef enum eFCurve_Smoothing { /* ************************************************ */ -/* Animation Reuse - i.e. users of Actions */ - -/* Retargetting ----------------------------------- */ - -/* Retargetting Pair - * - * Defines what parts of the paths should be remapped from 'abc' to 'xyz'. - * TODO: - * - Regrex (possibly provided through PY, though having our own module might be faster) - * would be important to have at some point. Current replacements are just simple - * string matches... - */ -typedef struct AnimMapPair { - char from[128]; /* part of path to bed replaced */ - char to[128]; /* part of path to replace with */ -} AnimMapPair; - -/* Retargetting Information for Actions - * - * This should only be used if it is strictly necessary (i.e. user will need to explicitly - * add this when they find that some channels do not match, or motion is not going to right - * places). When executing an action, this will be checked to see if it provides any useful - * remaps for the given paths. - * - * NOTE: we currently don't store this in the Action itself, as that causes too many problems. - */ -// FIXME: will this be too clumsy or slow? If we're using RNA paths anyway, we'll have to accept -// such consequences... -typedef struct AnimMapper { - struct AnimMapper *next, *prev; - - bAction *target; /* target action */ - ListBase mappings; /* remapping table (bAnimMapPair) */ -} AnimMapper; - -/* ************************************************ */ /* NLA - Non-Linear Animation */ /* NLA Strips ------------------------------------- */ @@ -616,7 +580,6 @@ typedef struct NlaStrip { ListBase strips; /* 'Child' strips (used for 'meta' strips) */ bAction *act; /* Action that is referenced by this strip (strip is 'user' of the action) */ - AnimMapper *remap; /* Remapping info this strip (for tweaking correspondence of action with context) */ ListBase fcurves; /* F-Curves for controlling this strip's influence and timing */ // TODO: move out? ListBase modifiers; /* F-Curve modifiers to be applied to the entire strip's referenced F-Curves */ @@ -902,10 +865,6 @@ typedef struct AnimData { * took over to be edited in the Animation Editors) */ bAction *tmpact; - /* remapping-info for active action - should only be used if needed - * (for 'foreign' actions that aren't working correctly) - */ - AnimMapper *remap; /* nla-tracks */ ListBase nla_tracks; |