Commit: a20d350dd50c731c880e5c8099f64396145d3d94
Author: Sergey Sharybin
Date:   Thu Nov 22 14:54:08 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBa20d350dd50c731c880e5c8099f64396145d3d94

Depsgraph: Cleanup, make it easier to create relations with flags

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

M       source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M       source/blender/depsgraph/intern/builder/deg_builder_relations.h
M       source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h
M       source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
M       source/blender/depsgraph/intern/depsgraph.cc
M       source/blender/depsgraph/intern/depsgraph.h

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index ab4acef6668..8f579216518 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -304,10 +304,12 @@ DepsRelation *DepsgraphRelationBuilder::add_time_relation(
         TimeSourceDepsNode *timesrc,
         DepsNode *node_to,
         const char *description,
-        bool check_unique)
+        bool check_unique,
+        int flags)
 {
        if (timesrc && node_to) {
-               return graph_->add_new_relation(timesrc, node_to, description, 
check_unique);
+               return graph_->add_new_relation(
+                       timesrc, node_to, description, check_unique, flags);
        }
        else {
                DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
@@ -323,13 +325,15 @@ DepsRelation 
*DepsgraphRelationBuilder::add_operation_relation(
         OperationDepsNode *node_from,
         OperationDepsNode *node_to,
         const char *description,
-        bool check_unique)
+        bool check_unique,
+        int flags)
 {
        if (node_from && node_to) {
                return graph_->add_new_relation(node_from,
                                                node_to,
                                                description,
-                                               check_unique);
+                                               check_unique,
+                                               flags);
        }
        else {
                DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
@@ -2499,10 +2503,10 @@ void 
DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node
                                OperationKey 
data_copy_on_write_key(object_data_id,
                                                                    
DEG_NODE_TYPE_COPY_ON_WRITE,
                                                                    
DEG_OPCODE_COPY_ON_WRITE);
-                               DepsRelation *rel = 
add_relation(data_copy_on_write_key,
-                                                                
copy_on_write_key,
-                                                                "Eval Order");
-                               rel->flag |= DEPSREL_FLAG_GODMODE;
+                               add_relation(data_copy_on_write_key,
+                                            copy_on_write_key,
+                                            "Eval Order",
+                                            DEPSREL_FLAG_GODMODE);
                        }
                }
                else {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 81f21f5bf77..c6db975c6c2 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -44,6 +44,7 @@
 #include "BLI_string.h"
 
 #include "intern/builder/deg_builder_map.h"
+#include "intern/depsgraph.h"
 #include "intern/nodes/deg_node.h"
 #include "intern/nodes/deg_node_component.h"
 #include "intern/nodes/deg_node_operation.h"
@@ -186,19 +187,28 @@ struct DepsgraphRelationBuilder
        DepsRelation *add_relation(const KeyFrom& key_from,
                                   const KeyTo& key_to,
                                   const char *description,
-                                  bool check_unique = false);
+                                  bool check_unique = false,
+                                  int flags = 0);
+
+       template <typename KeyFrom, typename KeyTo>
+       DepsRelation *add_relation(const KeyFrom& key_from,
+                                  const KeyTo& key_to,
+                                  const char *description,
+                                  eDepsRelation_Flag flag);
 
        template <typename KeyTo>
        DepsRelation *add_relation(const TimeSourceKey& key_from,
                                   const KeyTo& key_to,
                                   const char *description,
-                                  bool check_unique = false);
+                                  bool check_unique = false,
+                                  int flags = 0);
 
        template <typename KeyType>
        DepsRelation *add_node_handle_relation(const KeyType& key_from,
                                               const DepsNodeHandle *handle,
                                               const char *description,
-                                              bool check_unique = false);
+                                              bool check_unique = false,
+                                              int flags = 0);
 
        void add_customdata_mask(const ComponentKey &key, uint64_t mask);
        void add_special_eval_flag(ID *object, uint32_t flag);
@@ -306,11 +316,13 @@ protected:
        DepsRelation *add_time_relation(TimeSourceDepsNode *timesrc,
                                        DepsNode *node_to,
                                        const char *description,
-                                       bool check_unique = false);
+                                       bool check_unique = false,
+                                       int flags = 0);
        DepsRelation *add_operation_relation(OperationDepsNode *node_from,
                                             OperationDepsNode *node_to,
                                             const char *description,
-                                            bool check_unique = false);
+                                            bool check_unique = false,
+                                            int flags = 0);
 
        template <typename KeyType>
        DepsNodeHandle create_node_handle(const KeyType& key,
diff --git 
a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h 
b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h
index 894d4172c00..726393f39b9 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h
@@ -49,14 +49,16 @@ template <typename KeyFrom, typename KeyTo>
 DepsRelation *DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from,
                                                      const KeyTo &key_to,
                                                      const char *description,
-                                                     bool check_unique)
+                                                     bool check_unique,
+                                                     int flags)
 {
        DepsNode *node_from = get_node(key_from);
        DepsNode *node_to = get_node(key_to);
        OperationDepsNode *op_from = node_from ? 
node_from->get_exit_operation() : NULL;
        OperationDepsNode *op_to = node_to ? node_to->get_entry_operation() : 
NULL;
        if (op_from && op_to) {
-               return add_operation_relation(op_from, op_to, description, 
check_unique);
+               return add_operation_relation(
+                       op_from, op_to, description, check_unique, flags);
        }
        else {
                if (!op_from) {
@@ -81,18 +83,31 @@ DepsRelation *DepsgraphRelationBuilder::add_relation(const 
KeyFrom &key_from,
        return NULL;
 }
 
+template <typename KeyFrom, typename KeyTo>
+DepsRelation *DepsgraphRelationBuilder::add_relation(
+        const KeyFrom& key_from,
+        const KeyTo& key_to,
+        const char *description,
+        eDepsRelation_Flag flag)
+{
+       return add_relation(
+               key_from, key_to, description, false, static_cast<int>(flag));
+}
+
 template <typename KeyTo>
 DepsRelation *DepsgraphRelationBuilder::add_relation(
         const TimeSourceKey &key_from,
         const KeyTo &key_to,
         const char *description,
-        bool check_unique)
+        bool check_unique,
+        int flags)
 {
        TimeSourceDepsNode *time_from = get_node(key_from);
        DepsNode *node_to = get_node(key_to);
        OperationDepsNode *op_to = node_to ? node_to->get_entry_operation() : 
NULL;
        if (time_from != NULL && op_to != NULL) {
-               return add_time_relation(time_from, op_to, description, 
check_unique);
+               return add_time_relation(
+                       time_from, op_to, description, check_unique, flags);
        }
        return NULL;
 }
@@ -102,13 +117,15 @@ DepsRelation 
*DepsgraphRelationBuilder::add_node_handle_relation(
         const KeyType &key_from,
         const DepsNodeHandle *handle,
         const char *description,
-        bool check_unique)
+        bool check_unique,
+        int flags)
 {
        DepsNode *node_from = get_node(key_from);
        OperationDepsNode *op_from = node_from ? 
node_from->get_exit_operation() : NULL;
        OperationDepsNode *op_to = handle->node->get_entry_operation();
        if (op_from != NULL && op_to != NULL) {
-               return add_operation_relation(op_from, op_to, description, 
check_unique);
+               return add_operation_relation(
+                       op_from, op_to, description, check_unique, flags);
        }
        else {
                if (!op_from) {
diff --git 
a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
index d9f07955123..f95060ee6ec 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
@@ -341,8 +341,7 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
         * Unsolved Issues:
         * - Care is needed to ensure that multi-headed trees work out the same 
as
         *   in ik-tree building
-        * - Animated chain-lengths are a problem...
-        */
+        * - Animated chain-lengths are a problem. */
        RootPChanMap root_map;
        bool pose_depends_on_local_transform = false;
        LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
@@ -359,8 +358,7 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
                                        break;
 
                                /* Constraints which needs world's matrix for 
transform.
-                                * TODO(sergey): More constraints here?
-                                */
+                                * TODO(sergey): More constraints here? */
                                case CONSTRAINT_TYPE_ROTLIKE:
                                case CONSTRAINT_TYPE_SIZELIKE:
                                case CONSTRAINT_TYPE_LOCLIKE:
@@ -377,15 +375,13 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
        //root_map.print_debug();
        if (pose_depends_on_local_transform) {
                /* TODO(sergey): Once partial updates are possible use relation 
between
-                * object transform and solver itself in it's build function.
-                */
+                * object transform and solver itself in it's build function. */
                ComponentKey pose_key(&object->id, DEG_NODE_TYPE_EVAL_POSE);
                ComponentKey local_transform_key(&object->id, 
DEG_NODE_TYPE_TRANSFORM);
                add_relation(local_transform_key, pose_key, "Local Transforms");
        }
        /* Links between operations for each bone. */
        LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
-               DepsRelation *relation;
                OperationKey bone_local_key(&object->id,
                                

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to