Animation: Remove depsgraph argument from a lot of API

Use explicit boolean flag to indicate whether flush to original data
is needed or not. Makes it possible to avoid confusion on whether an
evaluated or any depsgraph can be passed to the API.

Allows to remove depsgraph from bAnimContext as well.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5379
This commit is contained in:
Sergey Sharybin 2019-07-31 14:56:17 +02:00
parent 9c0e7f7dd6
commit 64e029ea92
22 changed files with 104 additions and 132 deletions

View File

@ -217,10 +217,10 @@ void BKE_fcurves_id_cb(struct ID *id, ID_FCurve_Edit_Callback func, void *user_d
typedef struct NlaKeyframingContext NlaKeyframingContext;
struct NlaKeyframingContext *BKE_animsys_get_nla_keyframing_context(struct ListBase *cache,
struct Depsgraph *depsgraph,
struct PointerRNA *ptr,
struct AnimData *adt,
float ctime);
float ctime,
const bool flush_to_original);
bool BKE_animsys_nla_remap_keyframe_values(struct NlaKeyframingContext *context,
struct PointerRNA *prop_ptr,
struct PropertyRNA *prop,
@ -244,12 +244,12 @@ typedef enum eAnimData_Recalc {
} eAnimData_Recalc;
/* Evaluation loop for evaluating animation data */
void BKE_animsys_evaluate_animdata(struct Depsgraph *depsgraph,
struct Scene *scene,
void BKE_animsys_evaluate_animdata(struct Scene *scene,
struct ID *id,
struct AnimData *adt,
float ctime,
short recalc);
short recalc,
const bool flush_to_original);
/* Evaluation of all ID-blocks with Animation Data blocks - Animation Data Only */
void BKE_animsys_evaluate_all_animation(struct Main *main,
@ -269,10 +269,10 @@ bool BKE_animsys_execute_fcurve(struct PointerRNA *ptr, struct FCurve *fcu, floa
*/
/* Evaluate Action (F-Curve Bag) */
void animsys_evaluate_action(struct Depsgraph *depsgraph,
struct PointerRNA *ptr,
void animsys_evaluate_action(struct PointerRNA *ptr,
struct bAction *act,
float ctime);
float ctime,
const bool flush_to_original);
/* Evaluate Action Group */
void animsys_evaluate_action_group(struct PointerRNA *ptr,

View File

@ -1612,6 +1612,6 @@ void what_does_obaction(
adt.action = act;
/* execute effects of Action on to workob (or it's PoseChannels) */
BKE_animsys_evaluate_animdata(NULL, NULL, &workob->id, &adt, cframe, ADT_RECALC_ANIM);
BKE_animsys_evaluate_animdata(NULL, &workob->id, &adt, cframe, ADT_RECALC_ANIM, false);
}
}

View File

@ -1882,12 +1882,11 @@ static void animsys_write_orig_anim_rna(PointerRNA *ptr,
* 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,
static void animsys_evaluate_fcurves(PointerRNA *ptr,
ListBase *list,
float ctime)
float ctime,
bool flush_to_original)
{
const bool is_active_depsgraph = DEG_is_active(depsgraph);
/* Calculate then execute each curve. */
for (FCurve *fcu = list->first; fcu; fcu = fcu->next) {
/* Check if this F-Curve doesn't belong to a muted group. */
@ -1906,7 +1905,7 @@ static void animsys_evaluate_fcurves(Depsgraph *depsgraph,
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) {
if (flush_to_original) {
animsys_write_orig_anim_rna(ptr, fcu->rna_path, fcu->array_index, curval);
}
}
@ -2025,10 +2024,10 @@ 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,
static void animsys_evaluate_action_ex(PointerRNA *ptr,
bAction *act,
float ctime)
float ctime,
const bool flush_to_original)
{
/* check if mapper is appropriate for use here (we set to NULL if it's inappropriate) */
if (act == NULL) {
@ -2038,12 +2037,15 @@ static void animsys_evaluate_action_ex(Depsgraph *depsgraph,
action_idcode_patch_check(ptr->id.data, act);
/* calculate then execute each curve */
animsys_evaluate_fcurves(depsgraph, ptr, &act->curves, ctime);
animsys_evaluate_fcurves(ptr, &act->curves, ctime, flush_to_original);
}
void animsys_evaluate_action(Depsgraph *depsgraph, PointerRNA *ptr, bAction *act, float ctime)
void animsys_evaluate_action(PointerRNA *ptr,
bAction *act,
float ctime,
const bool flush_to_original)
{
animsys_evaluate_action_ex(depsgraph, ptr, act, ctime);
animsys_evaluate_action_ex(ptr, act, ctime, flush_to_original);
}
/* ***************************************** */
@ -2072,7 +2074,7 @@ static float nlastrip_get_influence(NlaStrip *strip, float cframe)
}
/* evaluate the evaluation time and influence for the strip, storing the results in the strip */
static void nlastrip_evaluate_controls(Depsgraph *depsgraph, NlaStrip *strip, float ctime)
static void nlastrip_evaluate_controls(NlaStrip *strip, float ctime, const bool flush_to_original)
{
/* now strip's evaluate F-Curves for these settings (if applicable) */
if (strip->fcurves.first) {
@ -2082,7 +2084,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, ctime);
animsys_evaluate_fcurves(&strip_ptr, &strip->fcurves, ctime, flush_to_original);
}
/* analytically generate values for influence and time (if applicable)
@ -2115,7 +2117,7 @@ static void nlastrip_evaluate_controls(Depsgraph *depsgraph, NlaStrip *strip, fl
/* gets the strip active at the current time for a list of strips for evaluation purposes */
NlaEvalStrip *nlastrips_ctime_get_strip(
Depsgraph *depsgraph, ListBase *list, ListBase *strips, short index, float ctime)
ListBase *list, ListBase *strips, short index, float ctime, const bool flush_to_original)
{
NlaStrip *strip, *estrip = NULL;
NlaEvalStrip *nes;
@ -2198,7 +2200,7 @@ NlaEvalStrip *nlastrips_ctime_get_strip(
*/
/* TODO: this sounds a bit hacky having a few isolated F-Curves
* stuck on some data it operates on... */
nlastrip_evaluate_controls(depsgraph, estrip, ctime);
nlastrip_evaluate_controls(estrip, ctime, flush_to_original);
if (estrip->influence <= 0.0f) {
return NULL;
}
@ -2220,8 +2222,8 @@ NlaEvalStrip *nlastrips_ctime_get_strip(
}
/* evaluate controls for the relevant extents of the bordering strips... */
nlastrip_evaluate_controls(depsgraph, estrip->prev, estrip->start);
nlastrip_evaluate_controls(depsgraph, estrip->next, estrip->end);
nlastrip_evaluate_controls(estrip->prev, estrip->start, flush_to_original);
nlastrip_evaluate_controls(estrip->next, estrip->end, flush_to_original);
break;
}
@ -3141,12 +3143,12 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr,
}
/* evaluate transition strip */
static void nlastrip_evaluate_transition(Depsgraph *depsgraph,
PointerRNA *ptr,
static void nlastrip_evaluate_transition(PointerRNA *ptr,
NlaEvalData *channels,
ListBase *modifiers,
NlaEvalStrip *nes,
NlaEvalSnapshot *snapshot)
NlaEvalSnapshot *snapshot,
const bool flush_to_original)
{
ListBase tmp_modifiers = {NULL, NULL};
NlaEvalSnapshot snapshot1, snapshot2;
@ -3187,13 +3189,13 @@ static void nlastrip_evaluate_transition(Depsgraph *depsgraph,
tmp_nes.strip_mode = NES_TIME_TRANSITION_START;
tmp_nes.strip = s1;
nlaeval_snapshot_init(&snapshot1, channels, snapshot);
nlastrip_evaluate(depsgraph, ptr, channels, &tmp_modifiers, &tmp_nes, &snapshot1);
nlastrip_evaluate(ptr, channels, &tmp_modifiers, &tmp_nes, &snapshot1, flush_to_original);
/* second strip */
tmp_nes.strip_mode = NES_TIME_TRANSITION_END;
tmp_nes.strip = s2;
nlaeval_snapshot_init(&snapshot2, channels, snapshot);
nlastrip_evaluate(depsgraph, ptr, channels, &tmp_modifiers, &tmp_nes, &snapshot2);
nlastrip_evaluate(ptr, channels, &tmp_modifiers, &tmp_nes, &snapshot2, flush_to_original);
/* accumulate temp-buffer and full-buffer, using the 'real' strip */
nlaeval_snapshot_mix_and_free(channels, snapshot, &snapshot1, &snapshot2, nes->strip_time);
@ -3203,12 +3205,12 @@ static void nlastrip_evaluate_transition(Depsgraph *depsgraph,
}
/* evaluate meta-strip */
static void nlastrip_evaluate_meta(Depsgraph *depsgraph,
PointerRNA *ptr,
static void nlastrip_evaluate_meta(PointerRNA *ptr,
NlaEvalData *channels,
ListBase *modifiers,
NlaEvalStrip *nes,
NlaEvalSnapshot *snapshot)
NlaEvalSnapshot *snapshot,
const bool flush_to_original)
{
ListBase tmp_modifiers = {NULL, NULL};
NlaStrip *strip = nes->strip;
@ -3228,13 +3230,13 @@ static void nlastrip_evaluate_meta(Depsgraph *depsgraph,
/* find the child-strip to evaluate */
evaltime = (nes->strip_time * (strip->end - strip->start)) + strip->start;
tmp_nes = nlastrips_ctime_get_strip(depsgraph, NULL, &strip->strips, -1, evaltime);
tmp_nes = nlastrips_ctime_get_strip(NULL, &strip->strips, -1, evaltime, flush_to_original);
/* directly evaluate child strip into accumulation buffer...
* - there's no need to use a temporary buffer (as it causes issues [T40082])
*/
if (tmp_nes) {
nlastrip_evaluate(depsgraph, ptr, channels, &tmp_modifiers, tmp_nes, snapshot);
nlastrip_evaluate(ptr, channels, &tmp_modifiers, tmp_nes, snapshot, flush_to_original);
/* free temp eval-strip */
MEM_freeN(tmp_nes);
@ -3245,12 +3247,12 @@ static void nlastrip_evaluate_meta(Depsgraph *depsgraph,
}
/* evaluates the given evaluation strip */
void nlastrip_evaluate(Depsgraph *depsgraph,
PointerRNA *ptr,
void nlastrip_evaluate(PointerRNA *ptr,
NlaEvalData *channels,
ListBase *modifiers,
NlaEvalStrip *nes,
NlaEvalSnapshot *snapshot)
NlaEvalSnapshot *snapshot,
const bool flush_to_original)
{
NlaStrip *strip = nes->strip;
@ -3272,10 +3274,10 @@ void nlastrip_evaluate(Depsgraph *depsgraph,
nlastrip_evaluate_actionclip(ptr, channels, modifiers, nes, snapshot);
break;
case NLASTRIP_TYPE_TRANSITION: /* transition */
nlastrip_evaluate_transition(depsgraph, ptr, channels, modifiers, nes, snapshot);
nlastrip_evaluate_transition(ptr, channels, modifiers, nes, snapshot, flush_to_original);
break;
case NLASTRIP_TYPE_META: /* meta */
nlastrip_evaluate_meta(depsgraph, ptr, channels, modifiers, nes, snapshot);
nlastrip_evaluate_meta(ptr, channels, modifiers, nes, snapshot, flush_to_original);
break;
default: /* do nothing */
@ -3287,18 +3289,16 @@ void nlastrip_evaluate(Depsgraph *depsgraph,
}
/* write the accumulated settings to */
void nladata_flush_channels(Depsgraph *depsgraph,
PointerRNA *ptr,
void nladata_flush_channels(PointerRNA *ptr,
NlaEvalData *channels,
NlaEvalSnapshot *snapshot)
NlaEvalSnapshot *snapshot,
const bool flush_to_original)
{
/* sanity checks */
if (channels == NULL) {
return;
}
const bool is_active_depsgraph = DEG_is_active(depsgraph);
/* for each channel with accumulated values, write its value on the property it affects */
for (NlaEvalChannel *nec = channels->channels.first; nec; nec = nec->next) {
NlaEvalChannelSnapshot *nec_snapshot = nlaeval_snapshot_find_channel(snapshot, nec);
@ -3312,7 +3312,7 @@ void nladata_flush_channels(Depsgraph *depsgraph,
rna.prop_index = i;
}
animsys_write_rna_setting(&rna, value);
if (is_active_depsgraph) {
if (flush_to_original) {
animsys_write_orig_anim_rna(ptr, nec->rna_path, rna.prop_index, value);
}
}
@ -3422,11 +3422,11 @@ static void animsys_evaluate_nla_domain(PointerRNA *ptr, NlaEvalData *channels,
* data about the currently edited strip is stored here and excluded from value calculation.
* \return false if NLA evaluation isn't actually applicable.
*/
static bool animsys_evaluate_nla(Depsgraph *depsgraph,
NlaEvalData *echannels,
static bool animsys_evaluate_nla(NlaEvalData *echannels,
PointerRNA *ptr,
AnimData *adt,
float ctime,
const bool flush_to_original,
NlaKeyframingContext *r_context)
{
NlaTrack *nlt;
@ -3473,7 +3473,7 @@ static bool animsys_evaluate_nla(Depsgraph *depsgraph,
}
/* otherwise, get strip to evaluate for this channel */
nes = nlastrips_ctime_get_strip(depsgraph, &estrips, &nlt->strips, track_index, ctime);
nes = nlastrips_ctime_get_strip(&estrips, &nlt->strips, track_index, ctime, flush_to_original);
if (nes) {
nes->track = nlt;
}
@ -3539,7 +3539,7 @@ static bool animsys_evaluate_nla(Depsgraph *depsgraph,
/* add this to our list of evaluation strips */
if (r_context == NULL) {
nlastrips_ctime_get_strip(depsgraph, &estrips, &dummy_trackslist, -1, ctime);
nlastrips_ctime_get_strip(&estrips, &dummy_trackslist, -1, ctime, flush_to_original);
}
/* If computing the context for keyframing, store data there instead of the list. */
else {
@ -3549,7 +3549,7 @@ static bool animsys_evaluate_nla(Depsgraph *depsgraph,
NLASTRIP_EXTEND_HOLD;
r_context->eval_strip = nes = nlastrips_ctime_get_strip(
depsgraph, NULL, &dummy_trackslist, -1, ctime);
NULL, &dummy_trackslist, -1, ctime, flush_to_original);
/* These setting combinations require no data from strips below, so exit immediately. */
if ((nes == NULL) ||
@ -3574,7 +3574,7 @@ static bool animsys_evaluate_nla(Depsgraph *depsgraph,
/* 2. for each strip, evaluate then accumulate on top of existing channels,
* but don't set values yet. */
for (nes = estrips.first; nes; nes = nes->next) {
nlastrip_evaluate(depsgraph, ptr, echannels, NULL, nes, &echannels->eval_snapshot);
nlastrip_evaluate(ptr, echannels, NULL, nes, &echannels->eval_snapshot, flush_to_original);
}
/* 3. free temporary evaluation data that's not used elsewhere */
@ -3586,22 +3586,22 @@ static bool animsys_evaluate_nla(Depsgraph *depsgraph,
* - All channels that will be affected are not cleared anymore. Instead, we just evaluate into
* some temp channels, where values can be accumulated in one go.
*/
static void animsys_calculate_nla(Depsgraph *depsgraph,
PointerRNA *ptr,
static void animsys_calculate_nla(PointerRNA *ptr,
AnimData *adt,
float ctime)
float ctime,
const bool flush_to_original)
{
NlaEvalData echannels;
nlaeval_init(&echannels);
/* evaluate the NLA stack, obtaining a set of values to flush */
if (animsys_evaluate_nla(depsgraph, &echannels, ptr, adt, ctime, NULL)) {
if (animsys_evaluate_nla(&echannels, ptr, adt, ctime, flush_to_original, NULL)) {
/* reset any channels touched by currently inactive actions to default value */
animsys_evaluate_nla_domain(ptr, &echannels, adt);
/* flush effects of accumulating channels in NLA to the actual data they affect */
nladata_flush_channels(depsgraph, ptr, &echannels, &echannels.eval_snapshot);
nladata_flush_channels(ptr, &echannels, &echannels.eval_snapshot, flush_to_original);
}
else {
/* special case - evaluate as if there isn't any NLA data */
@ -3610,7 +3610,7 @@ static void animsys_calculate_nla(Depsgraph *depsgraph,
CLOG_WARN(&LOG, "NLA Eval: Stopgap for active action on NLA Stack - no strips case");
}
animsys_evaluate_action(depsgraph, ptr, adt->action, ctime);
animsys_evaluate_action(ptr, adt->action, ctime, flush_to_original);
}
/* free temp data */
@ -3629,10 +3629,10 @@ static void animsys_calculate_nla(Depsgraph *depsgraph,
* \return Keyframing context, or NULL if not necessary.
*/
NlaKeyframingContext *BKE_animsys_get_nla_keyframing_context(struct ListBase *cache,
struct Depsgraph *depsgraph,
struct PointerRNA *ptr,
struct AnimData *adt,
float ctime)
float ctime,
const bool flush_to_original)
{
/* No remapping needed if NLA is off or no action. */
if ((adt == NULL) || (adt->action == NULL) || (adt->nla_tracks.first == NULL) ||
@ -3655,7 +3655,7 @@ NlaKeyframingContext *BKE_animsys_get_nla_keyframing_context(struct ListBase *ca
ctx->adt = adt;
nlaeval_init(&ctx->nla_channels);
animsys_evaluate_nla(depsgraph, &ctx->nla_channels, ptr, adt, ctime, ctx);
animsys_evaluate_nla(&ctx->nla_channels, ptr, adt, ctime, flush_to_original, ctx);
BLI_assert(ELEM(ctx->strip.act, NULL, adt->action));
BLI_addtail(cache, ctx);
@ -3846,7 +3846,7 @@ static void animsys_evaluate_overrides(PointerRNA *ptr, AnimData *adt)
* have been set already by the depsgraph. Now, we use the recalc
*/
void BKE_animsys_evaluate_animdata(
Depsgraph *depsgraph, Scene *scene, ID *id, AnimData *adt, float ctime, short recalc)
Scene *scene, ID *id, AnimData *adt, float ctime, short recalc, const bool flush_to_original)
{
PointerRNA id_ptr;
@ -3869,11 +3869,11 @@ void BKE_animsys_evaluate_animdata(
/* evaluate NLA-stack
* - active action is evaluated as part of the NLA stack as the last item
*/
animsys_calculate_nla(depsgraph, &id_ptr, adt, ctime);
animsys_calculate_nla(&id_ptr, adt, ctime, flush_to_original);
}
/* evaluate Active Action only */
else if (adt->action) {
animsys_evaluate_action_ex(depsgraph, &id_ptr, adt->action, ctime);
animsys_evaluate_action_ex(&id_ptr, adt->action, ctime, flush_to_original);
}
}
@ -3920,6 +3920,8 @@ void BKE_animsys_evaluate_all_animation(Main *main,
printf("Evaluate all animation - %f\n", ctime);
}
const bool flush_to_original = -DEG_is_active(depsgraph);
/* macros for less typing
* - only evaluate animation data for id if it has users (and not just fake ones)
* - whether animdata exists is checked for by the evaluation function, though taking
@ -3929,7 +3931,7 @@ void BKE_animsys_evaluate_all_animation(Main *main,
for (id = first; id; id = id->next) { \
if (ID_REAL_USERS(id) > 0) { \
AnimData *adt = BKE_animdata_from_id(id); \
BKE_animsys_evaluate_animdata(depsgraph, scene, id, adt, ctime, aflag); \
BKE_animsys_evaluate_animdata(scene, id, adt, ctime, aflag, flush_to_original); \
} \
} \
(void)0
@ -3948,9 +3950,9 @@ void BKE_animsys_evaluate_all_animation(Main *main,
if (ntp->nodetree) { \
AnimData *adt2 = BKE_animdata_from_id((ID *)ntp->nodetree); \
BKE_animsys_evaluate_animdata( \
depsgraph, scene, (ID *)ntp->nodetree, adt2, ctime, ADT_RECALC_ANIM); \
scene, (ID *)ntp->nodetree, adt2, ctime, ADT_RECALC_ANIM, flush_to_original); \
} \
BKE_animsys_evaluate_animdata(depsgraph, scene, id, adt, ctime, aflag); \
BKE_animsys_evaluate_animdata(scene, id, adt, ctime, aflag, flush_to_original); \
} \
} \
(void)0
@ -4055,7 +4057,8 @@ void BKE_animsys_eval_animdata(Depsgraph *depsgraph, ID *id)
* which should get handled as part of the dependency graph instead. */
Scene *scene = NULL;
DEG_debug_print_eval_time(depsgraph, __func__, id->name, id, ctime);
BKE_animsys_evaluate_animdata(depsgraph, scene, id, adt, ctime, ADT_RECALC_ANIM);
const bool flush_to_original = DEG_is_active(depsgraph);
BKE_animsys_evaluate_animdata(scene, id, adt, ctime, ADT_RECALC_ANIM, flush_to_original);
}
void BKE_animsys_update_driver_array(ID *id)

View File

@ -2562,7 +2562,8 @@ static void object_where_is_calc_ex(Depsgraph *depsgraph,
void BKE_object_where_is_calc_time(Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime)
{
/* Execute drivers and animation. */
BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL);
const bool flush_to_original = DEG_is_active(depsgraph);
BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL, flush_to_original);
object_where_is_calc_ex(depsgraph, scene, ob, ctime, NULL, NULL);
}
@ -4335,6 +4336,7 @@ bool BKE_object_modifier_update_subframe(Depsgraph *depsgraph,
float frame,
int type)
{
const bool flush_to_original = DEG_is_active(depsgraph);
ModifierData *md = modifiers_findByType(ob, (ModifierType)type);
bConstraint *con;
@ -4399,7 +4401,8 @@ bool BKE_object_modifier_update_subframe(Depsgraph *depsgraph,
/* TODO(sergey): What about animation? */
ob->id.recalc |= ID_RECALC_ALL;
if (update_mesh) {
BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, frame, ADT_RECALC_ANIM);
BKE_animsys_evaluate_animdata(
scene, &ob->id, ob->adt, frame, ADT_RECALC_ANIM, flush_to_original);
/* ignore cache clear during subframe updates
* to not mess up cache validity */
object_cacheIgnoreClear(ob, 1);
@ -4413,12 +4416,14 @@ bool BKE_object_modifier_update_subframe(Depsgraph *depsgraph,
/* for curve following objects, parented curve has to be updated too */
if (ob->type == OB_CURVE) {
Curve *cu = ob->data;
BKE_animsys_evaluate_animdata(depsgraph, scene, &cu->id, cu->adt, frame, ADT_RECALC_ANIM);
BKE_animsys_evaluate_animdata(
scene, &cu->id, cu->adt, frame, ADT_RECALC_ANIM, flush_to_original);
}
/* and armatures... */
if (ob->type == OB_ARMATURE) {
bArmature *arm = ob->data;
BKE_animsys_evaluate_animdata(depsgraph, scene, &arm->id, arm->adt, frame, ADT_RECALC_ANIM);
BKE_animsys_evaluate_animdata(
scene, &arm->id, arm->adt, frame, ADT_RECALC_ANIM, flush_to_original);
BKE_pose_where_is(depsgraph, scene, ob);
}

View File

@ -3753,8 +3753,9 @@ static void dynamics_step_sph_classical_calc_density_task_cb_ex(
sphclassical_calc_dens(pa, pa->state.time, sphdata);
}
static void dynamics_step_sph_classical_integrate_task_cb_ex(
void *__restrict userdata, const int p, const TaskParallelTLS *__restrict tls)
static void dynamics_step_sph_classical_integrate_task_cb_ex(void *__restrict userdata,
const int p,
const TaskParallelTLS *__restrict tls)
{
DynamicStepSolverTaskData *data = userdata;
ParticleSimulationData *sim = data->sim;
@ -4662,7 +4663,7 @@ void particle_system_update(struct Depsgraph *depsgraph,
hcfra = 100.0f * (float)i / (float)psys->part->hair_step;
if ((part->flag & PART_HAIR_REGROW) == 0) {
BKE_animsys_evaluate_animdata(
depsgraph, scene, &part_local->id, part_local->adt, hcfra, ADT_RECALC_ANIM);
scene, &part_local->id, part_local->adt, hcfra, ADT_RECALC_ANIM, false);
}
system_step(&sim, hcfra, use_render_params);
psys->cfra = hcfra;

View File

@ -3336,8 +3336,7 @@ static ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr
/* anim-data */
adt = BKE_animdata_from_id(&mask->id);
BKE_animsys_evaluate_animdata(
context->depsgraph, context->scene, &mask_temp->id, adt, nr, ADT_RECALC_ANIM);
BKE_animsys_evaluate_animdata(context->scene, &mask_temp->id, adt, nr, ADT_RECALC_ANIM, false);
maskbuf = MEM_mallocN(sizeof(float) * context->rectx * context->recty, __func__);

View File

@ -167,16 +167,16 @@ float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode);
* in which they get defined. */
NlaEvalStrip *nlastrips_ctime_get_strip(
struct Depsgraph *depsgraph, ListBase *list, ListBase *strips, short index, float ctime);
void nlastrip_evaluate(struct Depsgraph *depsgraph,
PointerRNA *ptr,
ListBase *list, ListBase *strips, short index, float ctime, const bool flush_to_original);
void nlastrip_evaluate(PointerRNA *ptr,
NlaEvalData *channels,
ListBase *modifiers,
NlaEvalStrip *nes,
NlaEvalSnapshot *snapshot);
void nladata_flush_channels(struct Depsgraph *depsgraph,
PointerRNA *ptr,
NlaEvalSnapshot *snapshot,
const bool flush_to_original);
void nladata_flush_channels(PointerRNA *ptr,
NlaEvalData *channels,
NlaEvalSnapshot *snapshot);
NlaEvalSnapshot *snapshot,
const bool flush_to_original);
#endif /* __NLA_PRIVATE_H__ */

View File

@ -74,7 +74,7 @@ static void eevee_motion_blur_camera_get_matrix_at_time(Scene *scene,
/* FIXME : This is a temporal solution that does not take care of parent animations */
/* Recalc Anim manually */
BKE_animsys_evaluate_animdata(
draw_ctx->depsgraph, scene, &camdata_cpy.id, camdata_cpy.adt, time, ADT_RECALC_ALL);
scene, &camdata_cpy.id, camdata_cpy.adt, time, ADT_RECALC_ALL, false);
BKE_object_where_is_calc_time(draw_ctx->depsgraph, scene, &cam_cpy, time);
/* Compute winmat */

View File

@ -4340,7 +4340,6 @@ static void achannel_setting_slider_cb(bContext *C, void *id_poin, void *fcu_poi
AnimData *adt = BKE_animdata_from_id(id);
FCurve *fcu = (FCurve *)fcu_poin;
Depsgraph *depsgraph = CTX_data_depsgraph(C);
ReportList *reports = CTX_wm_reports(C);
Scene *scene = CTX_data_scene(C);
ToolSettings *ts = scene->toolsettings;
@ -4356,7 +4355,7 @@ static void achannel_setting_slider_cb(bContext *C, void *id_poin, void *fcu_poi
/* Get NLA context for value remapping */
NlaKeyframingContext *nla_context = BKE_animsys_get_nla_keyframing_context(
&nla_cache, depsgraph, &id_ptr, adt, (float)CFRA);
&nla_cache, &id_ptr, adt, (float)CFRA, false);
/* get current frame and apply NLA-mapping to it (if applicable) */
cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
@ -4395,7 +4394,6 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi
KeyBlock *kb = (KeyBlock *)kb_poin;
char *rna_path = BKE_keyblock_curval_rnapath_get(key, kb);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
ReportList *reports = CTX_wm_reports(C);
Scene *scene = CTX_data_scene(C);
ToolSettings *ts = scene->toolsettings;
@ -4411,7 +4409,7 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi
/* Get NLA context for value remapping */
NlaKeyframingContext *nla_context = BKE_animsys_get_nla_keyframing_context(
&nla_cache, depsgraph, &id_ptr, key->adt, (float)CFRA);
&nla_cache, &id_ptr, key->adt, (float)CFRA, false);
/* get current frame and apply NLA-mapping to it (if applicable) */
cfra = BKE_nla_tweakedit_remap(key->adt, (float)CFRA, NLATIME_CONVERT_UNMAP);

View File

@ -412,7 +412,6 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
if (scene) {
ac->markers = ED_context_get_markers(C);
}
ac->depsgraph = CTX_data_depsgraph(C);
ac->view_layer = CTX_data_view_layer(C);
ac->obact = (ac->view_layer->basact) ? ac->view_layer->basact->object : NULL;
ac->sa = sa;

View File

@ -1323,7 +1323,6 @@ static bool insert_keyframe_fcurve_value(Main *bmain,
* index of -1 keys all array indices
*/
short insert_keyframe(Main *bmain,
Depsgraph *depsgraph,
ReportList *reports,
ID *id,
bAction *act,
@ -1381,7 +1380,7 @@ short insert_keyframe(Main *bmain,
if (adt && adt->action == act) {
/* Get NLA context for value remapping. */
nla_context = BKE_animsys_get_nla_keyframing_context(
nla_cache ? nla_cache : &tmp_nla_cache, depsgraph, &id_ptr, adt, cfra);
nla_cache ? nla_cache : &tmp_nla_cache, &id_ptr, adt, cfra, false);
/* Apply NLA-mapping to frame. */
cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
@ -2348,7 +2347,6 @@ void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot)
static int insert_key_button_exec(bContext *C, wmOperator *op)
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ToolSettings *ts = scene->toolsettings;
@ -2436,7 +2434,6 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
}
success = insert_keyframe(bmain,
depsgraph,
op->reports,
ptr.id.data,
NULL,

View File

@ -1030,7 +1030,6 @@ static short keyingset_apply_keying_flags(const short base_flags,
int ANIM_apply_keyingset(
bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra)
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ReportList *reports = CTX_wm_reports(C);
@ -1125,7 +1124,6 @@ int ANIM_apply_keyingset(
/* action to take depends on mode */
if (mode == MODIFYKEY_MODE_INSERT) {
success += insert_keyframe(bmain,
depsgraph,
reports,
ksp->id,
act,

View File

@ -1217,7 +1217,7 @@ static int pose_clear_user_transforms_exec(bContext *C, wmOperator *op)
workob.adt = ob->adt;
workob.pose = dummyPose;
BKE_animsys_evaluate_animdata(NULL, scene, &workob.id, workob.adt, cframe, ADT_RECALC_ANIM);
BKE_animsys_evaluate_animdata(scene, &workob.id, workob.adt, cframe, ADT_RECALC_ANIM, false);
/* copy back values, but on selected bones only */
for (pchan = dummyPose->chanbase.first; pchan; pchan = pchan->next) {

View File

@ -85,8 +85,6 @@ typedef struct bAnimContext {
/** dopesheet data for editor (or which is being used) */
struct bDopeSheet *ads;
/** active dependency graph */
struct Depsgraph *depsgraph;
/** Current Main */
struct Main *bmain;
/** active scene */

View File

@ -129,7 +129,6 @@ bool insert_keyframe_direct(struct ReportList *reports,
* using the current value being keyframed, in the relevant place. Returns success.
*/
short insert_keyframe(struct Main *bmain,
struct Depsgraph *depsgraph,
struct ReportList *reports,
struct ID *id,
struct bAction *act,

View File

@ -318,7 +318,6 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
/* TODO: this should probably respect the keyingset only option for anim */
if (autokeyframe_cfra_can_key(scene, id)) {
Depsgraph *depsgraph = CTX_data_depsgraph(C);
ReportList *reports = CTX_wm_reports(C);
ToolSettings *ts = scene->toolsettings;
short flag = ANIM_get_keyframing_flags(scene, 1);
@ -330,7 +329,6 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
* E.g., color wheels (see T42567). */
BLI_assert((fcu->array_index == but->rnaindex) || (but->rnaindex == -1));
insert_keyframe(bmain,
depsgraph,
reports,
id,
action,

View File

@ -2316,8 +2316,9 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
for (f = omd->bakestart; f <= omd->bakeend; f++) {
/* For now only simple animation of time value is supported, nothing else.
* No drivers or other modifier parameters. */
BKE_animsys_evaluate_animdata(
CTX_data_depsgraph(C), scene, (ID *)ob, ob->adt, f, ADT_RECALC_ANIM);
/* TODO(sergey): This operates on an original data, so no flush is needed. However, baking
* usually should happen on an evaluated objects, so this seems to be deeper issue here. */
BKE_animsys_evaluate_animdata(scene, (ID *)ob, ob->adt, f, ADT_RECALC_ANIM, false);
och->time[i] = omd->time;
i++;

View File

@ -704,7 +704,6 @@ static void insert_action_keys(bAnimContext *ac, short mode)
bAnimListElem *ale;
int filter;
struct Depsgraph *depsgraph = ac->depsgraph;
ReportList *reports = ac->reports;
Scene *scene = ac->scene;
ToolSettings *ts = scene->toolsettings;
@ -741,7 +740,6 @@ static void insert_action_keys(bAnimContext *ac, short mode)
*/
if (ale->id && !ale->owner) {
insert_keyframe(ac->bmain,
depsgraph,
reports,
ale->id,
NULL,

View File

@ -604,7 +604,6 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
ReportList *reports = ac->reports;
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
struct Depsgraph *depsgraph = ac->depsgraph;
Scene *scene = ac->scene;
ToolSettings *ts = scene->toolsettings;
short flag = 0;
@ -696,7 +695,6 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
*/
if (ale->id && !ale->owner && !fcu->driver) {
insert_keyframe(ac->bmain,
depsgraph,
reports,
ale->id,
NULL,

View File

@ -6631,7 +6631,6 @@ void autokeyframe_object(bContext *C, Scene *scene, ViewLayer *view_layer, Objec
// TODO: this should probably be done per channel instead...
if (autokeyframe_cfra_can_key(scene, id)) {
Depsgraph *depsgraph = CTX_data_depsgraph(C);
ReportList *reports = CTX_wm_reports(C);
ToolSettings *ts = scene->toolsettings;
KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene);
@ -6662,7 +6661,6 @@ void autokeyframe_object(bContext *C, Scene *scene, ViewLayer *view_layer, Objec
for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) {
fcu->flag &= ~FCURVE_SELECTED;
insert_keyframe(bmain,
depsgraph,
reports,
id,
adt->action,
@ -6777,7 +6775,6 @@ void autokeyframe_pose(bContext *C, Scene *scene, Object *ob, int tmode, short t
// TODO: this should probably be done per channel instead...
if (autokeyframe_cfra_can_key(scene, id)) {
Depsgraph *depsgraph = CTX_data_depsgraph(C);
ReportList *reports = CTX_wm_reports(C);
ToolSettings *ts = scene->toolsettings;
KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene);
@ -6825,7 +6822,6 @@ void autokeyframe_pose(bContext *C, Scene *scene, Object *ob, int tmode, short t
*/
if (pchanName && STREQ(pchanName, pchan->name)) {
insert_keyframe(bmain,
depsgraph,
reports,
id,
act,

View File

@ -371,25 +371,14 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
}
else {
ID *id = self->ptr.id.data;
struct Depsgraph *depsgraph = CTX_data_depsgraph(BPy_GetContext());
ReportList reports;
short result;
BKE_reports_init(&reports, RPT_STORE);
BLI_assert(BKE_id_is_in_global_main(id));
result = insert_keyframe(G_MAIN,
depsgraph,
&reports,
id,
NULL,
group_name,
path_full,
index,
cfra,
keytype,
NULL,
options);
result = insert_keyframe(
G_MAIN, &reports, id, NULL, group_name, path_full, index, cfra, keytype, NULL, options);
MEM_freeN((void *)path_full);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {

View File

@ -2580,12 +2580,7 @@ void RE_RenderAnim(Render *re,
{
float ctime = BKE_scene_frame_get(scene);
AnimData *adt = BKE_animdata_from_id(&scene->id);
/* TODO(sergey): Currently depsgraph is only used to check whether it is an active
* edit window or not to deal with unkeyed changes. We don't have depsgraph here yet,
* but we also don't deal with unkeyed changes. But still nice to get proper depsgraph
* within the render pipeline, somehow.
*/
BKE_animsys_evaluate_animdata(NULL, scene, &scene->id, adt, ctime, ADT_RECALC_ALL);
BKE_animsys_evaluate_animdata(scene, &scene->id, adt, ctime, ADT_RECALC_ALL, false);
}
render_update_depsgraph(re);