Merge branch 'master' into blender2.8
[blender.git] / source / blender / blenkernel / intern / anim_sys.c
index 21fb29ff06d5518c842153a22d4b174ecacd7ed4..58b476d3da5d63ab4a900edea0eda53d81dc4287 100644 (file)
@@ -60,7 +60,6 @@
 #include "BKE_animsys.h"
 #include "BKE_action.h"
 #include "BKE_context.h"
-#include "BKE_depsgraph.h"
 #include "BKE_fcurve.h"
 #include "BKE_nla.h"
 #include "BKE_global.h"
@@ -70,6 +69,8 @@
 #include "BKE_report.h"
 #include "BKE_texture.h"
 
+#include "DEG_depsgraph.h"
+
 #include "RNA_access.h"
 
 #include "nla_private.h"
@@ -95,6 +96,7 @@ bool id_type_can_have_animdata(const short id_type)
                case ID_MA: case ID_TE: case ID_NT:
                case ID_LA: case ID_CA: case ID_WO:
                case ID_LS:
+               case ID_LP:
                case ID_SPK:
                case ID_SCE:
                case ID_MC:
@@ -1563,12 +1565,6 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val
        /* caller must ensure this is animatable */
        BLI_assert(RNA_property_animateable(ptr, prop) || ptr->id.data == NULL);
 
-       /* set value for animatable numerical values only
-        * HACK: some local F-Curves (e.g. those on NLA Strips) are evaluated
-        *       without an ID provided, which causes the animateable test to fail!
-        */
-       bool written = false;
-
        switch (RNA_property_type(prop)) {
                case PROP_BOOLEAN:
                {
@@ -1576,13 +1572,11 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val
                        if (array_index != -1) {
                                if (RNA_property_boolean_get_index(ptr, prop, array_index) != value_coerce) {
                                        RNA_property_boolean_set_index(ptr, prop, array_index, value_coerce);
-                                       written = true;
                                }
                        }
                        else {
                                if (RNA_property_boolean_get(ptr, prop) != value_coerce) {
                                        RNA_property_boolean_set(ptr, prop, value_coerce);
-                                       written = true;
                                }
                        }
                        break;
@@ -1594,13 +1588,11 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val
                        if (array_index != -1) {
                                if (RNA_property_int_get_index(ptr, prop, array_index) != value_coerce) {
                                        RNA_property_int_set_index(ptr, prop, array_index, value_coerce);
-                                       written = true;
                                }
                        }
                        else {
                                if (RNA_property_int_get(ptr, prop) != value_coerce) {
                                        RNA_property_int_set(ptr, prop, value_coerce);
-                                       written = true;
                                }
                        }
                        break;
@@ -1612,13 +1604,11 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val
                        if (array_index != -1) {
                                if (RNA_property_float_get_index(ptr, prop, array_index) != value_coerce) {
                                        RNA_property_float_set_index(ptr, prop, array_index, value_coerce);
-                                       written = true;
                                }
                        }
                        else {
                                if (RNA_property_float_get(ptr, prop) != value_coerce) {
                                        RNA_property_float_set(ptr, prop, value_coerce);
-                                       written = true;
                                }
                        }
                        break;
@@ -1628,7 +1618,6 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val
                        const int value_coerce = (int)value;
                        if (RNA_property_enum_get(ptr, prop) != value_coerce) {
                                RNA_property_enum_set(ptr, prop, value_coerce);
-                               written = true;
                        }
                        break;
                }
@@ -1657,23 +1646,6 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val
        }
 #endif
 
-       /* as long as we don't do property update, we still tag datablock
-        * as having been updated. this flag does not cause any updates to
-        * be run, it's for e.g. render engines to synchronize data */
-       if (written && ptr->id.data) {
-               ID *id = ptr->id.data;
-
-               /* for cases like duplifarmes it's only a temporary so don't
-                * notify anyone of updates */
-               if (!(id->recalc & ID_RECALC_SKIP_ANIM_TAG)) {
-                       /* NOTE: This is a bit annoying to use atomic API here, but this
-                        * code is at it's EOL and removed already in 2.8 branch.
-                        */
-                       atomic_fetch_and_or_int32(&id->recalc, ID_RECALC);
-                       DAG_id_type_tag(G.main, GS(id->name));
-               }
-       }
-
        /* successful */
        return true;
 }
@@ -2617,17 +2589,6 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
                
        /* 3. free temporary evaluation data that's not used elsewhere */
        BLI_freelistN(&estrips);
-
-       /* Tag ID as updated so render engines will recognize changes in data
-        * which is animated but doesn't have actions.
-        */
-       if (ptr->id.data != NULL) {
-               ID *id = ptr->id.data;
-               if (!(id->recalc & ID_RECALC_SKIP_ANIM_TAG)) {
-                       id->recalc |= ID_RECALC;
-                       DAG_id_type_tag(G.main, GS(id->name));
-               }
-       }
 }
 
 /* NLA Evaluation function (mostly for use through do_animdata) 
@@ -2920,7 +2881,7 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
 
 #define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH) printf
 
-void BKE_animsys_eval_animdata(EvaluationContext *eval_ctx, ID *id)
+void BKE_animsys_eval_animdata(const EvaluationContext *eval_ctx, ID *id)
 {
        AnimData *adt = BKE_animdata_from_id(id);
        Scene *scene = NULL; /* XXX: this is only needed for flushing RNA updates,
@@ -2930,7 +2891,7 @@ void BKE_animsys_eval_animdata(EvaluationContext *eval_ctx, ID *id)
        BKE_animsys_evaluate_animdata(scene, id, adt, eval_ctx->ctime, ADT_RECALC_ANIM);
 }
 
-void BKE_animsys_eval_driver(EvaluationContext *eval_ctx,
+void BKE_animsys_eval_driver(const EvaluationContext *eval_ctx,
                              ID *id,
                              FCurve *fcu)
 {