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:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-02-12 14:01:17 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-02-12 14:07:59 +0300
commit07ff9e92bbcb6c293cffba9c9428926f6fa72160 (patch)
treea5b90a7f60f28bb26a4909b60a2aad6482ba1a8b /source/blender/depsgraph
parentd3870471edd775777f774dba4e66a3c87b632509 (diff)
Depsgraph: Add utility function for transform dependency
This is what modifiers are to use to indicate that they depend on a transformation of the object itself. Currently should be no functional changes, but in the future this will allow to easily change transform operation depending on whether there is a simulation associated with the object.
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_build.h13
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc19
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.h6
-rw-r--r--source/blender/depsgraph/intern/depsgraph_build.cc10
4 files changed, 46 insertions, 2 deletions
diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h
index 0d90f64a37b..fe18193aac7 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -142,9 +142,18 @@ void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle,
struct ID *id,
const char *description);
+/* Special function which is used from modifiers' updateDepsgraph() callback
+ * to indicate that the modifietr needs to know transformation of the object
+ * which that modifier belongs to.
+ * This function will take care of checking which operation is required to
+ * have transformation for the modifier, taking into account possible simulation
+ * solvers. */
+void DEG_add_modifier_to_transform_relation(
+ struct DepsNodeHandle *node_handle,
+ const char *description);
+
/* Adds relations from the given component of a given object to the given node
- * handle AND the component to the point cache component of the node's ID.
- */
+ * handle AND the component to the point cache component of the node's ID. */
void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle,
struct Object *object,
eDepsObjectComponentType component,
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index c62fc604f94..0888105c248 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -278,6 +278,25 @@ bool DepsgraphRelationBuilder::has_node(const OperationKey &key) const
return find_node(key) != NULL;
}
+void DepsgraphRelationBuilder::add_modifier_to_transform_relation(
+ const DepsNodeHandle *handle,
+ const char *description)
+{
+ /* Geometry operation, this is where relation will be wired to. */
+ OperationNode *geometry_operation_node =
+ handle->node->get_entry_operation();
+ BLI_assert(geometry_operation_node->owner->type == NodeType::GEOMETRY);
+ /* Transform operation, the source of the relation. */
+ ID *id = geometry_operation_node->owner->owner->id_orig;
+ ComponentKey transform_component_key(id, NodeType::TRANSFORM);
+ Node *transform_node = get_node(transform_component_key);
+ OperationNode *transform_operation_node =
+ transform_node->get_exit_operation();
+ /* Wire up the actual relation. */
+ add_operation_relation(
+ transform_operation_node, geometry_operation_node, description);
+}
+
void DepsgraphRelationBuilder::add_customdata_mask(Object *object, uint64_t mask)
{
if (mask != 0 && object != NULL && object->type == OB_MESH) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 8765a8a5eb4..de39f624290 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -194,6 +194,12 @@ struct DepsgraphRelationBuilder
const char *description,
int flags = 0);
+ /* Adds relation from proper transformation opertation to the modifier.
+ * Takes care of checking for possible physics solvers modifying position
+ * of this object. */
+ void add_modifier_to_transform_relation(const DepsNodeHandle *handle,
+ const char *description);
+
void add_customdata_mask(Object *object, uint64_t mask);
void add_special_eval_flag(ID *object, uint32_t flag);
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index e44a98518d1..8720e407681 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -190,6 +190,16 @@ void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle,
description);
}
+void DEG_add_modifier_to_transform_relation(
+ struct DepsNodeHandle *node_handle,
+ const char *description)
+{
+ DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
+ deg_node_handle->builder->add_modifier_to_transform_relation(
+ deg_node_handle,
+ description);
+}
+
void DEG_add_special_eval_flag(struct DepsNodeHandle *node_handle,
ID *id,
uint32_t flag)