[Bf-blender-cvs] [64e029ea920] master: Animation: Remove depsgraph argument from a lot of API

Sergey Sharybin noreply at git.blender.org
Wed Jul 31 15:16:14 CEST 2019


Commit: 64e029ea92071870b5004baaf6401fcf4b370fd8
Author: Sergey Sharybin
Date:   Wed Jul 31 14:56:17 2019 +0200
Branches: master
https://developer.blender.org/rB64e029ea92071870b5004baaf6401fcf4b370fd8

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

===================================================================

M	source/blender/blenkernel/BKE_animsys.h
M	source/blender/blenkernel/intern/action.c
M	source/blender/blenkernel/intern/anim_sys.c
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenkernel/intern/particle_system.c
M	source/blender/blenkernel/intern/sequencer.c
M	source/blender/blenkernel/nla_private.h
M	source/blender/draw/engines/eevee/eevee_motion_blur.c
M	source/blender/editors/animation/anim_channels_defines.c
M	source/blender/editors/animation/anim_filter.c
M	source/blender/editors/animation/keyframing.c
M	source/blender/editors/animation/keyingsets.c
M	source/blender/editors/armature/pose_transform.c
M	source/blender/editors/include/ED_anim_api.h
M	source/blender/editors/include/ED_keyframing.h
M	source/blender/editors/interface/interface_anim.c
M	source/blender/editors/object/object_modifier.c
M	source/blender/editors/space_action/action_edit.c
M	source/blender/editors/space_graph/graph_edit.c
M	source/blender/editors/transform/transform_conversions.c
M	source/blender/python/intern/bpy_rna_anim.c
M	source/blender/render/intern/source/pipeline.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h
index 64a8c78cfef..fa8e294bdc1 100644
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@ -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,
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index a7159f85dc2..984de700ce7 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -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);
   }
 }
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 08faae9874b..309112d4e72 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -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(De

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list