[Bf-blender-cvs] [07ff9e92bbc] master: Depsgraph: Add utility function for transform dependency
Sergey Sharybin
noreply at git.blender.org
Tue Feb 12 12:59:13 CET 2019
Commit: 07ff9e92bbcb6c293cffba9c9428926f6fa72160
Author: Sergey Sharybin
Date: Tue Feb 12 12:01:17 2019 +0100
Branches: master
https://developer.blender.org/rB07ff9e92bbcb6c293cffba9c9428926f6fa72160
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.
===================================================================
M source/blender/depsgraph/DEG_depsgraph_build.h
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/depsgraph_build.cc
M source/blender/modifiers/intern/MOD_armature.c
M source/blender/modifiers/intern/MOD_array.c
M source/blender/modifiers/intern/MOD_boolean.c
M source/blender/modifiers/intern/MOD_cast.c
M source/blender/modifiers/intern/MOD_cloth.c
M source/blender/modifiers/intern/MOD_curve.c
M source/blender/modifiers/intern/MOD_datatransfer.c
M source/blender/modifiers/intern/MOD_displace.c
M source/blender/modifiers/intern/MOD_hook.c
M source/blender/modifiers/intern/MOD_lattice.c
M source/blender/modifiers/intern/MOD_mask.c
M source/blender/modifiers/intern/MOD_mirror.c
M source/blender/modifiers/intern/MOD_normal_edit.c
M source/blender/modifiers/intern/MOD_screw.c
M source/blender/modifiers/intern/MOD_shrinkwrap.c
M source/blender/modifiers/intern/MOD_simpledeform.c
M source/blender/modifiers/intern/MOD_uvproject.c
M source/blender/modifiers/intern/MOD_uvwarp.c
M source/blender/modifiers/intern/MOD_warp.c
M source/blender/modifiers/intern/MOD_wave.c
M source/blender/modifiers/intern/MOD_weightvgedit.c
M source/blender/modifiers/intern/MOD_weightvgmix.c
M source/blender/modifiers/intern/MOD_weightvgproximity.c
===================================================================
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)
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index 6781081d5ca..282cec480ac 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -97,7 +97,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_object_relation(ctx->node, amd->object, DEG_OB_COMP_EVAL_POSE, "Armature Modifier");
DEG_add_object_relation(ctx->node, amd->object, DEG_OB_COMP_TRANSFORM, "Armature Modifier");
}
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Armature Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Armature Modifier");
}
static void deformVerts(
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index e0ae1cc3500..269e1b05466 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -95,7 +95,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
if (amd->offset_ob != NULL) {
DEG_add_object_relation(ctx->node, amd->offset_ob, DEG_OB_COMP_TRANSFORM, "Array Modifier Offset");
}
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Array Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Array Modifier");
}
BLI_INLINE float sum_v3(const float v[3])
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index d7fca5c12f3..1a2c448d49d 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -89,7 +89,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_object_relation(ctx->node, bmd->object, DEG_OB_COMP_GEOMETRY, "Boolean Modifier");
}
/* We need own transformation as well. */
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Boolean Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Boolean Modifier");
}
static Mesh *get_quick_mesh(
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index c3aa839ab23..4113656b929 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -90,7 +90,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
CastModifierData *cmd = (CastModifierData *)md;
if (cmd->object != NULL) {
DEG_add_object_relation(ctx->node, cmd->object, DEG_OB_COMP_TRANSFORM, "Cast Modifier");
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Cast Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Cast Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index 1cf126d99d6..8b9a28f0a3f 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -122,7 +122,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_collision_relations(ctx->node, ctx->object, clmd->coll_parms->group, eModifierType_Collision, NULL, "Cloth Collision");
DEG_add_forcefield_relations(ctx->node, ctx->object, clmd->sim_parms->effector_weights, true, 0, "Cloth Field");
}
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Cloth Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Cloth Modifier");
}
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c
index 8a0ee54ce58..d4e56f928e1 100644
--- a/source/blender/modifiers/intern/MOD_curve.c
+++ b/source/blender/modifiers/intern/MOD_curve.c
@@ -91,7 +91,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_special_eval_flag(ctx->node, &cmd->object->id, DAG_EVAL_NEED_CURVE_PATH);
}
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Curve Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Curve Modifier");
}
static void deformVerts(
diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c b/source/blender/modifiers/intern/MOD_datatransfer.c
index 2d189747833..d9f73c4088b 100644
--- a/source/blender/modifiers/intern/MOD_datatransfer.c
+++ b/source/blender/modifiers/intern/MOD_datatransfer.c
@@ -128,7 +128,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
if (dtmd->flags & MOD_DATATRANSFER_OBSRC_TRANSFORM) {
DEG_add_object_relation(ctx->node, dtmd->ob_source, DEG_OB_COMP_TRANSFORM, "DataTransfer Modifier");
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "DataTransfer Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "DataTransfer Modifier");
}
}
}
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 3a9f25cdec8..45d09c99e71 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -136,14 +136,14 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
{
DisplaceModifierData *dmd = (DisplaceModifierData *)md;
if (dmd->map_object != NULL && dmd->texmapping == MOD_DISP_MAP_OBJECT) {
- DEG_add_object_relation(ctx->node, ctx->object, DEG
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list