diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-02-12 14:01:17 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-02-12 14:07:59 +0300 |
commit | 07ff9e92bbcb6c293cffba9c9428926f6fa72160 (patch) | |
tree | a5b90a7f60f28bb26a4909b60a2aad6482ba1a8b /source/blender/depsgraph/intern/builder | |
parent | d3870471edd775777f774dba4e66a3c87b632509 (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/intern/builder')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 19 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.h | 6 |
2 files changed, 25 insertions, 0 deletions
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); |