Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 25 Oct 2017 09:48:20 +0000 (11:48 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 25 Oct 2017 09:48:20 +0000 (11:48 +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/builder/deg_builder_relations.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 a4c3c11d9224e37230e670575a7d02c49d14481a..d7ef1c19c612409df88b629934d0974a85b6ac90 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"
@@ -841,17 +842,17 @@ void DepsgraphNodeBuilder::build_cloth(Scene *scene, Object *object)
                                         _1,
                                         scene_cow,
                                         object_cow),
-                          DEG_OPCODE_PLACEHOLDER,
-                          "Cloth Modifier");
+                          DEG_OPCODE_GEOMETRY_CLOTH_MODIFIER);
 }
 
 /* Shapekeys */
 void DepsgraphNodeBuilder::build_shapekeys(Key *key)
 {
        build_animdata(&key->id);
-
-       add_operation_node(&key->id, DEG_NODE_TYPE_GEOMETRY, NULL,
-                          DEG_OPCODE_PLACEHOLDER, "Shapekey Eval");
+       add_operation_node(&key->id,
+                          DEG_NODE_TYPE_GEOMETRY,
+                          NULL,
+                          DEG_OPCODE_GEOMETRY_SHAPEKEY);
 }
 
 /* ObData Geometry Evaluation */
@@ -1211,8 +1212,6 @@ void DepsgraphNodeBuilder::build_image(Image *image) {
                return;
        }
        image_id->tag |= LIB_TAG_DOIT;
-       /* Image ID node itself. */
-       add_id_node(image_id);
        /* Placeholder so we can add relations and tag ID node for update. */
        add_operation_node(image_id,
                           DEG_NODE_TYPE_PARAMETERS,
@@ -1237,12 +1236,12 @@ void DepsgraphNodeBuilder::build_gpencil(bGPdata *gpd)
 {
        ID *gpd_id = &gpd->id;
 
-       /* gpencil itself */
-       // XXX: what about multiple users of same datablock? This should only get added once
-       add_id_node(gpd_id);
+       /* TODO(sergey): what about multiple users of same datablock? This should
+        * only get added once.
+        */
 
-       /* The main reason Grease Pencil is included here is because the animation (and drivers)
-        * need to be hosted somewhere...
+       /* The main reason Grease Pencil is included here is because the animation
+        * (and drivers) need to be hosted somewhere.
         */
        build_animdata(gpd_id);
 }
@@ -1250,20 +1249,18 @@ void DepsgraphNodeBuilder::build_gpencil(bGPdata *gpd)
 void DepsgraphNodeBuilder::build_cachefile(CacheFile *cache_file)
 {
        ID *cache_file_id = &cache_file->id;
-
+       /* Animation, */
+       build_animdata(cache_file_id);
+       /* Cache evaluation itself. */
        add_component_node(cache_file_id, DEG_NODE_TYPE_CACHE);
        add_operation_node(cache_file_id, DEG_NODE_TYPE_CACHE, NULL,
                           DEG_OPCODE_PLACEHOLDER, "Cache File Update");
-
-       add_id_node(cache_file_id);
-       build_animdata(cache_file_id);
 }
 
 void DepsgraphNodeBuilder::build_mask(Mask *mask)
 {
        ID *mask_id = &mask->id;
-       add_id_node(mask_id);
-       /* F-Curve based animation/ */
+       /* F-Curve based animation. */
        build_animdata(mask_id);
        /* Animation based on mask's shapes. */
        add_operation_node(mask_id,
@@ -1280,8 +1277,13 @@ void DepsgraphNodeBuilder::build_mask(Mask *mask)
 void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip)
 {
        ID *clip_id = &clip->id;
-       add_id_node(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);
 }
 
 void DepsgraphNodeBuilder::build_lightprobe(Object *object)
index 10c4c44d14e62ac0ccda4487ea9a16aea19ce033..2879501a27989085bc6a8e62136b067a2c79fca8 100644 (file)
@@ -1494,8 +1494,7 @@ void DepsgraphRelationBuilder::build_cloth(Scene * /*scene*/,
 {
        OperationKey cache_key(&object->id,
                               DEG_NODE_TYPE_CACHE,
-                              DEG_OPCODE_PLACEHOLDER,
-                              "Cloth Modifier");
+                              DEG_OPCODE_GEOMETRY_CLOTH_MODIFIER);
        /* Cache component affects on modifier. */
        OperationKey modifier_key(&object->id,
                                  DEG_NODE_TYPE_GEOMETRY,
index 0d42acf382ac3c65c7d69546e73c713f6dfe498b..6dfe1565bb195d00c8b7fcdbc081ee5b4c952f9a 100644 (file)
@@ -117,6 +117,8 @@ static const char *stringify_opcode(eDepsOperation_Code opcode)
                STRINGIFY_OPCODE(RIGIDBODY_TRANSFORM_COPY);
                /* Geometry. */
                STRINGIFY_OPCODE(GEOMETRY_UBEREVAL);
+               STRINGIFY_OPCODE(GEOMETRY_CLOTH_MODIFIER);
+               STRINGIFY_OPCODE(GEOMETRY_SHAPEKEY);
                /* Pose. */
                STRINGIFY_OPCODE(POSE_INIT);
                STRINGIFY_OPCODE(POSE_INIT_IK);
@@ -147,6 +149,8 @@ static const char *stringify_opcode(eDepsOperation_Code opcode)
                STRINGIFY_OPCODE(SHADING);
                STRINGIFY_OPCODE(MATERIAL_UPDATE);
                STRINGIFY_OPCODE(WORLD_UPDATE);
+               /* Movie clip. */
+               STRINGIFY_OPCODE(MOVIECLIP_EVAL);
 
                case DEG_NUM_OPCODES: return "SpecialCase";
 #undef STRINGIFY_OPCODE
index abdedd8adb6006b0f0def0c352d9fe52af0b6078..6f5eeff43dff4282afaa77a53df6826729d38ecb 100644 (file)
@@ -176,6 +176,8 @@ typedef enum eDepsOperation_Code {
        /* Geometry. ---------------------------------------- */
        /* Evaluate the whole geometry, including modifiers. */
        DEG_OPCODE_GEOMETRY_UBEREVAL,
+       DEG_OPCODE_GEOMETRY_CLOTH_MODIFIER,
+       DEG_OPCODE_GEOMETRY_SHAPEKEY,
 
        /* Pose. -------------------------------------------- */
        /* Init pose, clear flags, etc. */
@@ -229,10 +231,13 @@ typedef enum eDepsOperation_Code {
        DEG_OPCODE_MATERIAL_UPDATE,
        DEG_OPCODE_WORLD_UPDATE,
 
-       /* Masks ------------------------------------------- */
+       /* Masks------------------------------------------ */
        DEG_OPCODE_MASK_ANIMATION,
        DEG_OPCODE_MASK_EVAL,
 
+       /* Movie clips. ------------------------------------ */
+       DEG_OPCODE_MOVIECLIP_EVAL,
+
        DEG_NUM_OPCODES,
 } eDepsOperation_Code;