Camera tracking integration
[blender.git] / source / blender / blenkernel / intern / depsgraph.c
index 8415d6a632194eb0a84b6c47408b57921adbb2b6..b94891ced4996e4daeba0a90b4d8b0f5530ae951 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -38,6 +36,7 @@
 
 #include "BLI_winstuff.h"
 #include "BLI_utildefines.h"
+#include "BLI_listbase.h"
 #include "BLI_ghash.h"
 
 #include "DNA_anim_types.h"
@@ -649,7 +648,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
                        if(cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
                                bFollowTrackConstraint *data= (bFollowTrackConstraint *)con->data;
 
-                               if((data->clip || data->flag&FOLLOWTRACK_DEFAULTCLIP) && data->track[0]) {
+                               if((data->clip || data->flag&FOLLOWTRACK_ACTIVECLIP) && data->track[0]) {
                                        if(scene->camera) {
                                                node2 = dag_get_node(dag, scene->camera);
                                                dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, cti->name);
@@ -1982,7 +1981,7 @@ static void dag_tag_renderlayers(Scene *sce, unsigned int lay)
                        if(node->id==(ID *)sce) {
                                SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
                                if(srl && (srl->lay & lay_changed))
-                                       NodeTagChanged(sce->nodetree, node);
+                                       nodeUpdate(sce->nodetree, node);
                        }
                }
        }
@@ -2031,18 +2030,6 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
                                        flush_pointcache_reset(sce, itA->node, lasttime, 0);
                        }
                }
-
-               /* also all objects which are parented to tracking data should be re-calculated */
-               for(ob=bmain->object.first; ob; ob= ob->id.next){
-                       bConstraint *con;
-                       for (con = ob->constraints.first; con; con=con->next) {
-                               bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
-                               if(ELEM(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER)) {
-                                       ob->recalc |= OB_RECALC_OB;
-                                       break;
-                               }
-                       }
-               }
        }
        
        dag_tag_renderlayers(sce, lay);
@@ -2060,17 +2047,27 @@ static int object_modifiers_use_time(Object *ob)
        /* check whether any modifiers are animated */
        if (ob->adt) {
                AnimData *adt = ob->adt;
+               FCurve *fcu;
                
                /* action - check for F-Curves with paths containing 'modifiers[' */
                if (adt->action) {
-                       FCurve *fcu;
-                       
                        for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) {
                                if (fcu->rna_path && strstr(fcu->rna_path, "modifiers["))
                                        return 1;
                        }
                }
                
+               /* This here allows modifier properties to get driven and still update properly
+                *
+                * Workaround to get [#26764] (e.g. subsurf levels not updating when animated/driven)
+                * working, without the updating problems ([#28525] [#28690] [#28774] [#28777]) caused
+                * by the RNA updates cache introduced in r.38649
+                */
+               for (fcu = adt->drivers.first; fcu; fcu = fcu->next) {
+                       if (fcu->rna_path && strstr(fcu->rna_path, "modifiers["))
+                               return 1;
+               }
+               
                // XXX: also, should check NLA strips, though for now assume that nobody uses
                // that and we can omit that for performance reasons...
        }
@@ -2516,7 +2513,7 @@ static void dag_id_flush_update(Scene *sce, ID *id)
 
                                for(node= sce->nodetree->nodes.first; node; node= node->next) {
                                        if(node->id==id) {
-                                               NodeTagChanged(sce->nodetree, node);
+                                               nodeUpdate(sce->nodetree, node);
                                        }
                                }
                        }