Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/depsgraph.c')
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c77
1 files changed, 67 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 51edee9ea71..79930fdd8bf 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -50,6 +50,7 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
+#include "DNA_movieclip_types.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
@@ -639,7 +640,26 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
- if (cti && cti->get_constraint_targets) {
+ if(!cti)
+ continue;
+
+ /* special case for camera tracking -- it doesn't use targets to define relations */
+ if(ELEM(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER)) {
+ if(cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
+ bFollowTrackConstraint *data= (bFollowTrackConstraint *)con->data;
+
+ 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);
+ }
+ }
+ }
+
+ dag_add_relation(dag,scenenode,node,DAG_RL_SCENE, "Scene Relation");
+ addtoroot = 0;
+ }
+ else if (cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
for (ct= targets.first; ct; ct= ct->next) {
@@ -2127,18 +2147,25 @@ static void dag_object_time_update_flags(Object *ob)
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
- if (cti && cti->get_constraint_targets) {
- cti->get_constraint_targets(con, &targets);
-
- for (ct= targets.first; ct; ct= ct->next) {
- if (ct->tar) {
- ob->recalc |= OB_RECALC_OB;
- break;
+ if (cti) {
+ /* special case for camera tracking -- it doesn't use targets to define relations */
+ if(ELEM(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER)) {
+ ob->recalc |= OB_RECALC_OB;
+ }
+ else if (cti->get_constraint_targets) {
+ cti->get_constraint_targets(con, &targets);
+
+ for (ct= targets.first; ct; ct= ct->next) {
+ if (ct->tar) {
+ ob->recalc |= OB_RECALC_OB;
+ break;
+ }
}
+
+ if (cti->flush_constraint_targets)
+ cti->flush_constraint_targets(con, &targets, 1);
}
- if (cti->flush_constraint_targets)
- cti->flush_constraint_targets(con, &targets, 1);
}
}
}
@@ -2511,6 +2538,36 @@ static void dag_id_flush_update(Scene *sce, ID *id)
BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH);
}
+ if(idtype == ID_MC) {
+ for(obt=bmain->object.first; obt; obt= obt->id.next){
+ bConstraint *con;
+ for (con = obt->constraints.first; con; con=con->next) {
+ bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+ if(ELEM(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER)) {
+ obt->recalc |= OB_RECALC_OB;
+ break;
+ }
+ }
+ }
+
+ if(sce->nodetree) {
+ bNode *node;
+
+ for(node= sce->nodetree->nodes.first; node; node= node->next) {
+ if(node->id==id) {
+ nodeUpdate(sce->nodetree, node);
+ }
+ }
+ }
+ }
+
+ /* camera's matrix is used to orient reconstructed stuff,
+ so it should happen tracking-related constraints recalculation
+ when camera is changing (sergey) */
+ if(sce->camera && &sce->camera->id == id && object_get_movieclip(sce, sce->camera, 1)) {
+ dag_id_flush_update(sce, &sce->clip->id);
+ }
+
/* update editors */
dag_editors_update(bmain, id);
}