Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Dec 2017 09:38:34 +0000 (10:38 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Dec 2017 09:38:34 +0000 (10:38 +0100)
1  2 
source/blender/depsgraph/CMakeLists.txt
source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.h
source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
source/blender/depsgraph/intern/depsgraph.cc
source/blender/depsgraph/intern/depsgraph.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_access.c

index 89ba6e27aed6be5cbc0c5c68cd0e93346cedaf58,9478ca306e9f37df0333001228d807a63f5ce95f..9495321a0ff77641703836f6a6313d4519323ff5
@@@ -80,9 -75,9 +80,10 @@@ set(SR
        intern/builder/deg_builder_nodes.h
        intern/builder/deg_builder_pchanmap.h
        intern/builder/deg_builder_relations.h
+       intern/builder/deg_builder_relations_impl.h
        intern/builder/deg_builder_transitive.h
        intern/eval/deg_eval.h
 +      intern/eval/deg_eval_copy_on_write.h
        intern/eval/deg_eval_flush.h
        intern/nodes/deg_node.h
        intern/nodes/deg_node_component.h
index dfe97d02ec606e6dca1002da6ea1092c9fbee0de,3ef1eb547b51cf400080235a0d19e244b45039f2..f6f2dcce4672c27a0df0f62fcc794268cc23643d
@@@ -331,39 -267,37 +331,48 @@@ void DepsgraphNodeBuilder::build_proxy_
        if (object->pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) {
                BKE_pose_update_constraint_flags(object->pose);
        }
 -
        op_node = add_operation_node(&object->id,
                                     DEG_NODE_TYPE_EVAL_POSE,
 -                                   function_bind(BKE_pose_eval_proxy_copy, _1, object),
 +                                   function_bind(BKE_pose_eval_proxy_copy,
 +                                                 _1,
 +                                                 object_cow),
                                     DEG_OPCODE_POSE_INIT);
        op_node->set_as_entry();
 -
        LINKLIST_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
 -              op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
 -                                           NULL, DEG_OPCODE_BONE_LOCAL);
 +              /* Local bone transform. */
 +              op_node = add_operation_node(&object->id,
 +                                           DEG_NODE_TYPE_BONE,
 +                                           pchan->name,
 +                                           NULL,
 +                                           DEG_OPCODE_BONE_LOCAL);
                op_node->set_as_entry();
 -
 -              add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
 -                                 NULL, DEG_OPCODE_BONE_READY);
 -
 -              op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
 -                                           NULL, DEG_OPCODE_BONE_DONE);
 +              /* Bone is ready for solvers. */
 +              add_operation_node(&object->id,
 +                                 DEG_NODE_TYPE_BONE,
 +                                 pchan->name,
 +                                 NULL,
 +                                 DEG_OPCODE_BONE_READY);
 +              /* Bone is fully evaluated. */
 +              op_node = add_operation_node(&object->id,
 +                                           DEG_NODE_TYPE_BONE,
 +                                           pchan->name,
 +                                           NULL,
 +                                           DEG_OPCODE_BONE_DONE);
                op_node->set_as_exit();
+               /* Custom properties. */
+               if (pchan->prop != NULL) {
+                       add_operation_node(&object->id,
+                                          DEG_NODE_TYPE_PARAMETERS,
+                                          NULL,
+                                          DEG_OPCODE_PARAMETERS_EVAL,
+                                          pchan->name);
+               }
        }
 -
 -      op_node = add_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE,
 -                                   NULL, DEG_OPCODE_POSE_DONE);
 +      op_node = add_operation_node(&object->id,
 +                                   DEG_NODE_TYPE_EVAL_POSE,
 +                                   NULL,
 +                                   DEG_OPCODE_POSE_DONE);
        op_node->set_as_exit();
  }
  
index aeb9f9ab93772f5faa6f42efeae57e0449c6710b,5b7b4d4b533d763eb5418cb29437f9f69b66c1a7..5c984535cb8035878a7791cd566303e758206054
@@@ -304,13 -305,25 +306,22 @@@ void DepsgraphRelationBuilder::add_oper
        }
  }
  
- void DepsgraphRelationBuilder::add_collision_relations(const OperationKey &key, Scene *scene, Object *object, Group *group, bool dupli, const char *name)
+ void DepsgraphRelationBuilder::add_collision_relations(
+         const OperationKey &key,
+         Scene *scene,
+         Object *object,
+         Group *group,
 -        int layer,
+         bool dupli,
+         const char *name)
  {
        unsigned int numcollobj;
-       Object **collobjs = get_collisionobjects_ext(scene, object, group, &numcollobj, eModifierType_Collision, dupli);
-       for (unsigned int i = 0; i < numcollobj; i++)
-       {
 -      Object **collobjs = get_collisionobjects_ext(
 -              scene,
 -              object,
 -              group,
 -              layer,
 -              &numcollobj,
 -              eModifierType_Collision,
 -              dupli);
++      Object **collobjs = get_collisionobjects_ext(scene,
++                                                   object,
++                                                   group,
++                                                   &numcollobj,
++                                                   eModifierType_Collision,
++                                                   dupli);
+       for (unsigned int i = 0; i < numcollobj; i++) {
                Object *ob1 = collobjs[i];
  
                ComponentKey trf_key(&ob1->id, DEG_NODE_TYPE_TRANSFORM);
                ComponentKey coll_key(&ob1->id, DEG_NODE_TYPE_GEOMETRY);
                add_relation(coll_key, key, name);
        }
-       if (collobjs)
+       if (collobjs != NULL) {
                MEM_freeN(collobjs);
+       }
  }
  
- void DepsgraphRelationBuilder::add_forcefield_relations(const OperationKey &key, Scene *scene, Object *object, ParticleSystem *psys, EffectorWeights *eff, bool add_absorption, const char *name)
+ void DepsgraphRelationBuilder::add_forcefield_relations(
+         const OperationKey &key,
+         Scene *scene,
+         Object *object,
+         ParticleSystem *psys,
+         EffectorWeights *eff,
+         bool add_absorption,
+         const char *name)
  {
 -      ListBase *effectors = pdInitEffectors(scene, object, psys, eff, false);
 +      ListBase *effectors = pdInitEffectors(NULL, scene, object, psys, eff, false);
-       if (effectors) {
-               for (EffectorCache *eff = (EffectorCache *)effectors->first; eff; eff = eff->next) {
+       if (effectors != NULL) {
+               LINKLIST_FOREACH(EffectorCache *, eff, effectors) {
                        if (eff->ob != object) {
                                ComponentKey eff_key(&eff->ob->id, DEG_NODE_TYPE_TRANSFORM);
                                add_relation(eff_key, key, name);
                                        add_relation(eff_key, key, name);
                                }
                        }
                        if (eff->pd->forcefield == PFIELD_SMOKEFLOW && eff->pd->f_source) {
-                               ComponentKey trf_key(&eff->pd->f_source->id, DEG_NODE_TYPE_TRANSFORM);
+                               ComponentKey trf_key(&eff->pd->f_source->id,
+                                                    DEG_NODE_TYPE_TRANSFORM);
                                add_relation(trf_key, key, "Smoke Force Domain");
  
-                               ComponentKey eff_key(&eff->pd->f_source->id, DEG_NODE_TYPE_GEOMETRY);
+                               ComponentKey eff_key(&eff->pd->f_source->id,
+                                                    DEG_NODE_TYPE_GEOMETRY);
                                add_relation(eff_key, key, "Smoke Force Domain");
                        }
                        if (add_absorption && (eff->pd->flag & PFIELD_VISIBILITY)) {
-                               add_collision_relations(key, scene, object, NULL, true, "Force Absorption");
+                               add_collision_relations(key,
+                                                       scene,
+                                                       object,
+                                                       NULL,
 -                                                      eff->ob->lay,
+                                                       true,
+                                                       "Force Absorption");
                        }
                }
        }
@@@ -1556,25 -1474,14 +1561,24 @@@ void DepsgraphRelationBuilder::build_ob
        /* link components to each other */
        add_relation(obdata_geom_key, geom_key, "Object Geometry Base Data");
  
 +      OperationKey obdata_ubereval_key(&object->id,
 +                                       DEG_NODE_TYPE_GEOMETRY,
 +                                       DEG_OPCODE_GEOMETRY_UBEREVAL);
 +
 +      /* Special case: modifiers and DerivedMesh creation queries scene for various
 +       * things like data mask to be used. We add relation here to ensure object is
 +       * never evaluated prior to Scene's CoW is ready.
 +       */
 +      OperationKey scene_key(&scene_->id,
 +                             DEG_NODE_TYPE_PARAMETERS,
 +                             DEG_OPCODE_PLACEHOLDER,
 +                             "Scene Eval");
 +      add_relation(scene_key, obdata_ubereval_key, "CoW Relation");
 +
        /* Modifiers */
        if (object->modifiers.first != NULL) {
 -              OperationKey obdata_ubereval_key(&object->id,
 -                                               DEG_NODE_TYPE_GEOMETRY,
 -                                               DEG_OPCODE_GEOMETRY_UBEREVAL);
 -
                LINKLIST_FOREACH (ModifierData *, md, &object->modifiers) {
                        const ModifierTypeInfo *mti = modifierType_getInfo((ModifierType)md->type);
                        if (mti->updateDepsgraph) {
                                DepsNodeHandle handle = create_node_handle(obdata_ubereval_key);
                                mti->updateDepsgraph(
@@@ -1755,22 -1631,11 +1736,17 @@@ void DepsgraphRelationBuilder::build_ca
                return;
        }
        camera_id->tag |= LIB_TAG_DOIT;
-       if (needs_animdata_node(camera_id)) {
-               ComponentKey animation_key(camera_id, DEG_NODE_TYPE_ANIMATION);
-               add_relation(animation_key, camera_parameters_key, "Camera Parameters");
-       }
 +
 +      ComponentKey object_parameters_key(&object->id, DEG_NODE_TYPE_PARAMETERS);
 +      ComponentKey camera_parameters_key(camera_id, DEG_NODE_TYPE_PARAMETERS);
 +
 +      add_relation(camera_parameters_key, object_parameters_key,
 +                   "Camera -> Object");
 +
        /* DOF */
 -      if (cam->dof_ob) {
 -              ComponentKey ob_param_key(&object->id, DEG_NODE_TYPE_PARAMETERS);
 +      if (cam->dof_ob != NULL) {
                ComponentKey dof_ob_key(&cam->dof_ob->id, DEG_NODE_TYPE_TRANSFORM);
 -              add_relation(dof_ob_key, ob_param_key, "Camera DOF");
 +              add_relation(dof_ob_key, object_parameters_key, "Camera DOF");
        }
  }
  
@@@ -1783,40 -1648,15 +1759,34 @@@ void DepsgraphRelationBuilder::build_la
                return;
        }
        lamp_id->tag |= LIB_TAG_DOIT;
-       if (needs_animdata_node(lamp_id)) {
-               ComponentKey animation_key(lamp_id, DEG_NODE_TYPE_ANIMATION);
-               add_relation(animation_key, lamp_parameters_key, "Lamp Parameters");
-       }
 +
 +      ComponentKey object_parameters_key(&object->id, DEG_NODE_TYPE_PARAMETERS);
 +      ComponentKey lamp_parameters_key(lamp_id, DEG_NODE_TYPE_PARAMETERS);
 +
 +      add_relation(lamp_parameters_key, object_parameters_key,
 +                   "Lamp -> Object");
 +
        /* lamp's nodetree */
-       if (la->nodetree) {
+       if (la->nodetree != NULL) {
                build_nodetree(la->nodetree);
 -              ComponentKey parameters_key(lamp_id, DEG_NODE_TYPE_PARAMETERS);
 -              ComponentKey nodetree_key(&la->nodetree->id, DEG_NODE_TYPE_PARAMETERS);
 -              add_relation(nodetree_key, parameters_key, "NTree->Lamp Parameters");
 +              ComponentKey nodetree_key(&la->nodetree->id, DEG_NODE_TYPE_SHADING);
 +              add_relation(nodetree_key, lamp_parameters_key, "NTree->Lamp Parameters");
        }
        /* textures */
        build_texture_stack(la->mtex);
 +
 +      if (DEG_depsgraph_use_copy_on_write()) {
 +              /* Make sure copy on write of lamp data is always properly updated for
 +               * visible lamps.
 +               */
 +              OperationKey ob_copy_on_write_key(&object->id,
 +                                                DEG_NODE_TYPE_COPY_ON_WRITE,
 +                                                DEG_OPCODE_COPY_ON_WRITE);
 +              OperationKey lamp_copy_on_write_key(lamp_id,
 +                                                  DEG_NODE_TYPE_COPY_ON_WRITE,
 +                                                  DEG_OPCODE_COPY_ON_WRITE);
 +              add_relation(lamp_copy_on_write_key, ob_copy_on_write_key, "Eval Order");
 +      }
  }
  
  void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
                        BLI_assert(!"Unknown ID type used for node");
                }
        }
-       if (needs_animdata_node(ntree_id)) {
-               ComponentKey animation_key(ntree_id, DEG_NODE_TYPE_ANIMATION);
-               add_relation(animation_key, shading_key, "NTree Parameters");
-       }
 +
 +      OperationKey shading_update_key(ntree_id,
 +                                      DEG_NODE_TYPE_SHADING,
 +                                      DEG_OPCODE_MATERIAL_UPDATE);
 +      OperationKey shading_parameters_key(ntree_id,
 +                                          DEG_NODE_TYPE_SHADING_PARAMETERS,
 +                                          DEG_OPCODE_MATERIAL_UPDATE);
 +      add_relation(shading_parameters_key, shading_update_key, "NTree Shading Parameters");
  }
  
  /* Recursively build graph for material */
index 569383fe479ba5060a2383dd65347d55eedc6c6d,9dd14b631af72e4b28c3b46a3672dacc6a93c62d..9f661b8e8254c5b8f41b1a8d6e1ef4acdf3f5106
@@@ -185,12 -186,12 +189,13 @@@ struct DepsgraphRelationBuilde
        template <typename KeyType>
        void add_node_handle_relation(const KeyType& key_from,
                                      const DepsNodeHandle *handle,
-                                     const char *description);
+                                     const char *description,
+                                     bool check_unique = false);
  
 -      void build_scene(Scene *scene);
 +      void build_view_layer(Scene *scene, ViewLayer *view_layer);
        void build_group(Object *object, Group *group);
 -      void build_object(Object *object);
 +      void build_object(Base *base, Object *object);
 +      void build_object_flags(Base *base, Object *object);
        void build_object_data(Object *object);
        void build_object_parent(Object *object);
        void build_constraints(ID *id,
Simple merge