Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2018-10-14 19:59:27 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2018-10-14 20:48:39 +0300
commitcd48d4576bab3bf8d78c686433975cfee944f292 (patch)
tree5f8e443721807efdecb0c975ff7428864881cacd /source/blender/depsgraph
parent9a38a91f411b721eb8f61401fdc86521933aec87 (diff)
Depsgraph: Add proper API functions for CustomDataMask dependencies.
There were a few copies of the same few lines in depsgraph build code, so it seems to be logical to introduce a function for it, and make it accessible from C code for completeness. As an example, register the mask needs of the Data Transfer modifier.
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_build.h7
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc21
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.h2
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc10
-rw-r--r--source/blender/depsgraph/intern/depsgraph_build.cc17
5 files changed, 41 insertions, 16 deletions
diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h
index 24850c45d3a..4975f18f4ce 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -53,6 +53,8 @@ struct ViewLayer;
extern "C" {
#endif
+#include "BLI_sys_types.h"
+
/* Graph Building -------------------------------- */
/* Build depsgraph for the given scene, and dump results in given
@@ -139,6 +141,11 @@ void DEG_add_object_relation(struct DepsNodeHandle *node,
struct Object *object,
eDepsObjectComponentType component,
const char *description);
+void DEG_add_object_customdata_relation(struct DepsNodeHandle *node,
+ struct Object *object,
+ eDepsObjectComponentType component,
+ uint64_t customdata_mask,
+ const char *description);
void DEG_add_bone_relation(struct DepsNodeHandle *handle,
struct Object *object,
const char *bone_name,
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 65c9cabe9ef..56c2f32b387 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -274,6 +274,17 @@ bool DepsgraphRelationBuilder::has_node(const OperationKey &key) const
return find_node(key) != NULL;
}
+void DepsgraphRelationBuilder::add_customdata_mask(const ComponentKey &key, uint64_t mask)
+{
+ if (mask != 0) {
+ OperationDepsNode *node = find_operation_node(key);
+
+ if (node != NULL) {
+ node->customdata_mask |= mask;
+ }
+ }
+}
+
DepsRelation *DepsgraphRelationBuilder::add_time_relation(
TimeSourceDepsNode *timesrc,
DepsNode *node_to,
@@ -760,10 +771,7 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object)
add_relation(parent_key, ob_key, "Vertex Parent");
/* XXX not sure what this is for or how you could be done properly - lukas */
- OperationDepsNode *parent_node = find_operation_node(parent_key);
- if (parent_node != NULL) {
- parent_node->customdata_mask |= CD_MASK_ORIGINDEX;
- }
+ add_customdata_mask(parent_key, CD_MASK_ORIGINDEX);
ComponentKey transform_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM);
add_relation(transform_key, ob_key, "Vertex Parent TFM");
@@ -974,10 +982,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
ComponentKey target_key(&ct->tar->id, DEG_NODE_TYPE_GEOMETRY);
add_relation(target_key, constraint_op_key, cti->name);
if (ct->tar->type == OB_MESH) {
- OperationDepsNode *node2 = find_operation_node(target_key);
- if (node2 != NULL) {
- node2->customdata_mask |= CD_MASK_MDEFORMVERT;
- }
+ add_customdata_mask(target_key, CD_MASK_MDEFORMVERT);
}
}
else if (con->type == CONSTRAINT_TYPE_SHRINKWRAP) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 5d283c25c7c..d3c7b0ebfaf 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -200,6 +200,8 @@ struct DepsgraphRelationBuilder
const char *description,
bool check_unique = false);
+ void add_customdata_mask(const ComponentKey &key, uint64_t mask);
+
void build_id(ID *id);
void build_layer_collections(ListBase *lb);
void build_view_layer(Scene *scene, ViewLayer *view_layer);
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 c57962a8ed1..90df53d438f 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
@@ -129,10 +129,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
add_relation(target_key, solver_key, con->name);
if (data->tar->type == OB_MESH) {
- OperationDepsNode *node2 = find_operation_node(target_key);
- if (node2 != NULL) {
- node2->customdata_mask |= CD_MASK_MDEFORMVERT;
- }
+ add_customdata_mask(target_key, CD_MASK_MDEFORMVERT);
}
}
else {
@@ -164,10 +161,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
add_relation(target_key, solver_key, con->name);
if (data->poletar->type == OB_MESH) {
- OperationDepsNode *node2 = find_operation_node(target_key);
- if (node2 != NULL) {
- node2->customdata_mask |= CD_MASK_MDEFORMVERT;
- }
+ add_customdata_mask(target_key, CD_MASK_MDEFORMVERT);
}
}
else {
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index 1425c1bc453..957ca1a4275 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -131,6 +131,23 @@ void DEG_add_object_relation(DepsNodeHandle *handle,
description);
}
+void DEG_add_object_customdata_relation(DepsNodeHandle *handle,
+ Object *object,
+ eDepsObjectComponentType component,
+ uint64_t customdata_mask,
+ const char *description)
+{
+ DEG::eDepsNode_Type type = deg_build_object_component_type(component);
+ DEG::ComponentKey comp_key(&object->id, type);
+ DEG::DepsNodeHandle *deg_handle = get_handle(handle);
+ deg_handle->builder->add_node_handle_relation(comp_key,
+ deg_handle,
+ description);
+ if (object->type == OB_MESH) {
+ deg_handle->builder->add_customdata_mask(comp_key, customdata_mask);
+ }
+}
+
void DEG_add_object_cache_relation(DepsNodeHandle *handle,
CacheFile *cache_file,
eDepsObjectComponentType component,