Commit: c327cf489c4d145407786552e4d9027295754985
Author: Sergey Sharybin
Date:   Fri Mar 2 16:42:27 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBc327cf489c4d145407786552e4d9027295754985

Merge branch 'master' into blender2.8

===================================================================



===================================================================

diff --cc source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index d115111b7e8,0f21c152192..e7a9b4b5a69
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@@ -693,37 -532,54 +709,57 @@@ void DepsgraphNodeBuilder::build_animda
   * \param id: ID-Block that driver is attached to
   * \param fcu: Driver-FCurve
   */
- OperationDepsNode *DepsgraphNodeBuilder::build_driver(ID *id, FCurve *fcu)
+ void DepsgraphNodeBuilder::build_driver(ID *id, FCurve *fcurve)
  {
 +      ID *id_cow = get_cow_id(id);
 +
        /* Create data node for this driver */
-       /* TODO(sergey): Avoid creating same operation multiple times,
-        * in the future we need to avoid lookup of the operation as well
-        * and use some tagging magic instead.
-        */
-       OperationDepsNode *driver_op = find_operation_node(
-               id,
-               DEG_NODE_TYPE_PARAMETERS,
-               DEG_OPCODE_DRIVER,
-               fcu->rna_path ? fcu->rna_path : "",
-               fcu->array_index);
- 
-       if (driver_op == NULL) {
-               /* TODO(sergey): Shall we use COW of fcu itself here? */
-               driver_op = add_operation_node(id,
-                                              DEG_NODE_TYPE_PARAMETERS,
-                                              
function_bind(BKE_animsys_eval_driver,
-                                                            _1,
-                                                            id_cow,
-                                                            fcu),
-                                              DEG_OPCODE_DRIVER,
-                                              fcu->rna_path ? fcu->rna_path : 
"",
-                                              fcu->array_index);
-       }
- 
-       /* return driver node created */
-       return driver_op;
++      /* TODO(sergey): Shall we use COW of fcu itself here? */
+       ensure_operation_node(id,
+                             DEG_NODE_TYPE_PARAMETERS,
 -                            function_bind(BKE_animsys_eval_driver, _1, id, 
fcurve),
++                            function_bind(BKE_animsys_eval_driver, _1, 
id_cow, fcurve),
+                             DEG_OPCODE_DRIVER,
+                             fcurve->rna_path ? fcurve->rna_path : "",
+                             fcurve->array_index);
+       build_driver_variables(id, fcurve);
+ }
+ 
+ void DepsgraphNodeBuilder::build_driver_variables(ID * id, FCurve *fcurve)
+ {
+       build_driver_id_property(id, fcurve->rna_path);
+       LISTBASE_FOREACH (DriverVar *, dvar, &fcurve->driver->variables) {
+               DRIVER_TARGETS_USED_LOOPER(dvar)
+               {
+                       build_driver_id_property(dtar->id, dtar->rna_path);
+               }
+               DRIVER_TARGETS_LOOPER_END
+       }
+ }
+ 
+ void DepsgraphNodeBuilder::build_driver_id_property(ID *id,
+                                                     const char *rna_path)
+ {
+       if (id == NULL || rna_path == NULL) {
+               return;
+       }
+       PointerRNA id_ptr, ptr;
+       PropertyRNA *prop;
+       RNA_id_pointer_create(id, &id_ptr);
+       if (!RNA_path_resolve_full(&id_ptr, rna_path, &ptr, &prop, NULL)) {
+               return;
+       }
+       if (prop == NULL) {
+               return;
+       }
+       if (!RNA_property_is_idprop(prop)) {
+               return;
+       }
+       const char *prop_identifier = RNA_property_identifier((PropertyRNA 
*)prop);
+       ensure_operation_node(id,
+                             DEG_NODE_TYPE_PARAMETERS,
+                             NULL,
+                             DEG_OPCODE_ID_PROPERTY,
+                             prop_identifier);
  }
  
  /* Recursively build graph for world */
diff --cc source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index ce0ad1e2037,9d47dc6bced..49cccb60843
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@@ -176,10 -135,11 +183,12 @@@ struct DepsgraphNodeBuilder 
        void build_pose_constraints(Object *object, bPoseChannel *pchan);
        void build_rigidbody(Scene *scene);
        void build_particles(Object *object);
 +      void build_particle_settings(ParticleSettings *part);
        void build_cloth(Object *object);
        void build_animdata(ID *id);
-       OperationDepsNode *build_driver(ID *id, FCurve *fcurve);
+       void build_driver(ID *id, FCurve *fcurve);
+       void build_driver_variables(ID *id, FCurve *fcurve);
+       void build_driver_id_property(ID *id, const char *rna_path);
        void build_ik_pose(Object *object,
                           bPoseChannel *pchan,
                           bConstraint *con);
diff --cc source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index f9d0349a5dc,40db9d1b5f1..ddb0f809a53
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@@ -1158,26 -1126,26 +1158,46 @@@ void DepsgraphRelationBuilder::build_dr
        }
        else {
                RNAPathKey target_key(id, rna_path);
 +              add_relation(driver_key, target_key, "Driver -> Target");
 +              /* Similar to the case with f-curves, driver might drive a 
nested
 +               * datablock, which means driver execution should wait for that
 +               * datablock to be copied.
 +               */
 +              if (DEG_depsgraph_use_copy_on_write()) {
 +                      PointerRNA id_ptr;
 +                      PointerRNA ptr;
 +                      RNA_id_pointer_create(id, &id_ptr);
 +                      if (RNA_path_resolve_full(&id_ptr, fcu->rna_path, &ptr, 
NULL, NULL)) {
 +                              if (id_ptr.id.data != ptr.id.data) {
 +                                      ComponentKey cow_key((ID *)ptr.id.data,
 +                                                           
DEG_NODE_TYPE_COPY_ON_WRITE);
 +                                      add_relation(cow_key,
 +                                                   driver_key,
 +                                                   "Target CoW -> Driver",
 +                                                   true);
 +                              }
 +                      }
 +              }
+               if (RNA_pointer_is_null(&target_key.ptr)) {
+                       /* TODO(sergey): This would only mean that driver is 
broken.
+                        * so we can't create relation anyway. However, we need 
to avoid
+                        * adding drivers which are known to be buggy to a 
dependency
+                        * graph, in order to save computational power.
+                        */
+               }
+               else {
+                       if (target_key.prop != NULL &&
+                           RNA_property_is_idprop(target_key.prop))
+                       {
+                               OperationKey parameters_key(id,
+                                                           
DEG_NODE_TYPE_PARAMETERS,
+                                                           
DEG_OPCODE_PARAMETERS_EVAL);
+                               add_relation(target_key,
+                                            parameters_key,
+                                            "Driver Target -> Properties");
+                       }
+                       add_relation(driver_key, target_key, "Driver -> 
Target");
+               }
        }
  }
  
diff --cc source/blender/depsgraph/intern/depsgraph.cc
index 987a0654cca,2e87786639c..ee4ffee772e
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@@ -224,16 -212,20 +224,24 @@@ static bool pointer_to_component_node_c
                *subdata = seq->name; // xxx?
                return true;
        }
 +      else if (RNA_struct_is_a(ptr->type, &RNA_NodeSocket)) {
 +              *type = DEG_NODE_TYPE_SHADING;
 +              return true;
 +      }
        if (prop != NULL) {
                /* All unknown data effectively falls under "parameter 
evaluation". */
-               *type = DEG_NODE_TYPE_PARAMETERS;
-               *operation_code = DEG_OPCODE_PARAMETERS_EVAL;
-               *operation_name = "";
-               *operation_name_tag = -1;
+               if (RNA_property_is_idprop(prop)) {
+                       *type = DEG_NODE_TYPE_PARAMETERS;
+                       *operation_code = DEG_OPCODE_ID_PROPERTY;
+                       *operation_name = RNA_property_identifier((PropertyRNA 
*)prop);
+                       *operation_name_tag = -1;
+               }
+               else {
+                       *type = DEG_NODE_TYPE_PARAMETERS;
+                       *operation_code = DEG_OPCODE_PARAMETERS_EVAL;
+                       *operation_name = "";
+                       *operation_name_tag = -1;
+               }
                return true;
        }
        return false;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to