Camera tracking integration
[blender.git] / source / blender / nodes / composite / node_composite_tree.c
index 2151176f907c1372fd05c4efc383faff86e469b3..d3f4a5b29991b6ab72fa38b6c10c49323bffd9f9 100644 (file)
@@ -45,6 +45,7 @@
 #include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_node.h"
 #include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_node.h"
+#include "BKE_tracking.h"
 #include "BKE_utildefines.h"
 
 #include "node_exec.h"
 #include "BKE_utildefines.h"
 
 #include "node_exec.h"
@@ -168,6 +169,17 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
                                        BKE_image_merge((Image *)lnode->new_node->id, (Image *)lnode->id);
                                }
                        }
                                        BKE_image_merge((Image *)lnode->new_node->id, (Image *)lnode->id);
                                }
                        }
+                       else if(lnode->type==CMP_NODE_MOVIEDISTORTION) {
+                               /* special case for distortion node: distortion context is allocating in exec function
+                                  and to achive much better performance on further calls this context should be
+                                  copied back to original node */
+                               if(lnode->storage) {
+                                       if(lnode->new_node->storage)
+                                               BKE_tracking_distortion_destroy(lnode->new_node->storage);
+
+                                       lnode->new_node->storage= BKE_tracking_distortion_copy(lnode->storage);
+                               }
+                       }
                        
                        for(lsock= lnode->outputs.first; lsock; lsock= lsock->next) {
                                if(ntreeOutputExists(lnode->new_node, lsock->new_sock)) {
                        
                        for(lsock= lnode->outputs.first; lsock; lsock= lsock->next) {
                                if(ntreeOutputExists(lnode->new_node, lsock->new_sock)) {
@@ -806,6 +818,10 @@ int ntreeCompositTagAnimated(bNodeTree *ntree)
                                nodeUpdate(ntree, node);
                        }
                }
                                nodeUpdate(ntree, node);
                        }
                }
+               else if(ELEM(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_TRANSFORM)) {
+                       nodeUpdate(ntree, node);
+                       tagged= 1;
+               }
        }
        
        return tagged;
        }
        
        return tagged;