Depsgraph: Add missing movie clip dopesheet invalidation
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 25 Oct 2017 09:45:31 +0000 (11:45 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 25 Oct 2017 09:45:31 +0000 (11:45 +0200)
source/blender/blenkernel/BKE_movieclip.h
source/blender/blenkernel/intern/movieclip.c
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/depsgraph_type_defines.cc
source/blender/depsgraph/intern/depsgraph_types.h

index 3ddf75f204e97c18884616eb087e67009eb731ac..0bdff3eb795a569a538abf35cc1a20e7eea7aa32 100644 (file)
@@ -32,6 +32,7 @@
  *  \author Sergey Sharybin
  */
 
+struct EvaluationContext;
 struct ImBuf;
 struct Main;
 struct MovieClip;
@@ -82,6 +83,9 @@ struct ImBuf *BKE_movieclip_anim_ibuf_for_frame(struct MovieClip *clip, struct M
 bool BKE_movieclip_has_cached_frame(struct MovieClip *clip, struct MovieClipUser *user);
 bool BKE_movieclip_put_frame_if_possible(struct MovieClip *clip, struct MovieClipUser *user, struct ImBuf *ibuf);
 
+/* Evaluaiton. */
+void BKE_movieclip_eval_update(struct EvaluationContext *eval_ctx, struct MovieClip *clip);
+
 /* cacheing flags */
 #define MOVIECLIP_CACHE_SKIP        (1 << 0)
 
index 16d597e25fad615a8aed4762ab87aa7372df0d24..db05939b1cc5c8463b0937809a46b24d009e80b1 100644 (file)
@@ -77,6 +77,8 @@
 #  include "intern/openexr/openexr_multi.h"
 #endif
 
+#define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH) printf
+
 /*********************** movieclip buffer loaders *************************/
 
 static int sequence_guess_offset(const char *full_name, int head_len, unsigned short numlen)
@@ -1589,3 +1591,9 @@ bool BKE_movieclip_put_frame_if_possible(MovieClip *clip,
 
        return result;
 }
+
+void BKE_movieclip_eval_update(struct EvaluationContext *UNUSED(eval_ctx), MovieClip *clip)
+{
+       DEBUG_PRINT("%s on %s (%p)\n", __func__, clip->id.name, clip);
+       BKE_tracking_dopesheet_tag_update(&clip->tracking);
+}
index 77f4e5b2dd125021dab32ccc0df0442f1e1779ca..0228e619f5491888608a84169a7c2eb47d3cc78e 100644 (file)
@@ -86,6 +86,7 @@ extern "C" {
 #include "BKE_mesh.h"
 #include "BKE_mball.h"
 #include "BKE_modifier.h"
+#include "BKE_movieclip.h"
 #include "BKE_node.h"
 #include "BKE_object.h"
 #include "BKE_particle.h"
@@ -1112,6 +1113,11 @@ void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) {
        ID *clip_id = &clip->id;
        /* Animation. */
        build_animdata(clip_id);
+       /* Movie clip evaluation. */
+       add_operation_node(clip_id,
+                          DEG_NODE_TYPE_PARAMETERS,
+                          function_bind(BKE_movieclip_eval_update, _1, clip),
+                          DEG_OPCODE_MOVIECLIP_EVAL);
 }
 
 }  // namespace DEG
index 96d68f4e024c38d4cf59ff4bbee3b8b561662772..e5bdaf793662fc90b041e76790b9b402ee485774 100644 (file)
@@ -139,6 +139,8 @@ static const char *stringify_opcode(eDepsOperation_Code opcode)
                STRINGIFY_OPCODE(MASK_EVAL);
                /* Shading. */
                STRINGIFY_OPCODE(SHADING);
+               /* Movie clip. */
+               STRINGIFY_OPCODE(MOVIECLIP_EVAL);
 
                case DEG_NUM_OPCODES: return "SpecialCase";
 #undef STRINGIFY_OPCODE
index e43b79a0361cb0837c66bf5f76918f2232cf20f0..03d98c85148d90ef2799f07017733ffa187360a8 100644 (file)
@@ -210,10 +210,13 @@ typedef enum eDepsOperation_Code {
        /* Shading. ------------------------------------------- */
        DEG_OPCODE_SHADING,
 
-       /* Masks ------------------------------------------- */
+       /* Masks------------------------------------------ */
        DEG_OPCODE_MASK_ANIMATION,
        DEG_OPCODE_MASK_EVAL,
 
+       /* Movie clips. ------------------------------------ */
+       DEG_OPCODE_MOVIECLIP_EVAL,
+
        DEG_NUM_OPCODES,
 } eDepsOperation_Code;