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>2018-06-06 12:41:56 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-06-06 13:36:51 +0300
commit695747aad121eca605d3bafde43a644a0988a677 (patch)
tree6770f105c96649e07354f68ee80f0028e3aae97c
parent5a14af62d023e7bf173aca2b6d1022a754306478 (diff)
Depsgraph: Object data separation, armature
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc14
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.h2
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc31
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc8
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.h2
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc44
6 files changed, 55 insertions, 46 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 02e5c3cdbab..037d441269f 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -1159,6 +1159,20 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata)
DEG_OPCODE_GEOMETRY_SELECT_UPDATE);
}
+void DepsgraphNodeBuilder::build_armature(bArmature *armature)
+{
+ if (built_map_.checkIsBuiltAndTag(armature)) {
+ return;
+ }
+ build_animdata(&armature->id);
+ /* Make sure pose is up-to-date with armature updates. */
+ add_operation_node(&armature->id,
+ DEG_NODE_TYPE_PARAMETERS,
+ NULL,
+ DEG_OPCODE_PLACEHOLDER,
+ "Armature Eval");
+}
+
void DepsgraphNodeBuilder::build_camera(Camera *camera)
{
if (built_map_.checkIsBuiltAndTag(camera)) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index b265ed09f1e..d3b7cd63148 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@ -36,6 +36,7 @@
#include "DEG_depsgraph.h"
struct Base;
+struct bArmature;
struct CacheFile;
struct Camera;
struct bGPdata;
@@ -192,6 +193,7 @@ struct DepsgraphNodeBuilder {
bConstraint *con);
void build_rig(Object *object);
void build_proxy_rig(Object *object);
+ void build_armature(bArmature *armature);
void build_shapekeys(Key *key);
void build_camera(Camera *camera);
void build_lamp(Lamp *lamp);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
index d3c4ce01674..00d7a5da455 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
@@ -148,7 +148,6 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
Scene *scene_cow = get_cow_datablock(scene_);
Object *object_cow = get_cow_datablock(object);
OperationDepsNode *op_node;
-
/* Animation and/or drivers linking posebones to base-armature used to
* define them.
*
@@ -158,16 +157,8 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
* mechanism in-between here to ensure that we can use same rig
* multiple times in same scene.
*/
- if (!built_map_.checkIsBuiltAndTag(armature)) {
- build_animdata(&armature->id);
- /* Make sure pose is up-to-date with armature updates. */
- add_operation_node(&armature->id,
- DEG_NODE_TYPE_PARAMETERS,
- NULL,
- DEG_OPCODE_PLACEHOLDER,
- "Armature Eval");
- }
-
+ /* Armature. */
+ build_armature(armature);
/* Rebuild pose if not up to date. */
if (object->pose == NULL || (object->pose->flag & POSE_RECALC)) {
BKE_pose_rebuild(object, armature);
@@ -179,15 +170,13 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
object->adt->recalc |= ADT_RECALC_ANIM;
}
}
-
- /* speed optimization for animation lookups */
+ /* Speed optimization for animation lookups. */
if (object->pose != NULL) {
BKE_pose_channels_hash_make(object->pose);
if (object->pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) {
BKE_pose_update_constraint_flags(object->pose);
}
}
-
/**
* Pose Rig Graph
* ==============
@@ -209,8 +198,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
* only so that we can redirect those to point at either the the post-IK/
* post-constraint/post-matrix steps, as needed.
*/
-
- /* pose eval context */
+ /* Pose eval context. */
op_node = add_operation_node(&object->id,
DEG_NODE_TYPE_EVAL_POSE,
function_bind(BKE_pose_eval_init,
@@ -236,8 +224,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
object_cow),
DEG_OPCODE_POSE_DONE);
op_node->set_as_exit();
-
- /* bones */
+ /* Bones. */
int pchan_index = 0;
LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
/* Node for bone evaluation. */
@@ -302,25 +289,23 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
break;
}
}
-
/* Custom shape. */
if (pchan->custom != NULL) {
build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY);
}
-
pchan_index++;
}
}
void DepsgraphNodeBuilder::build_proxy_rig(Object *object)
{
- bArmature *arm = (bArmature *)object->data;
+ bArmature *armature = (bArmature *)object->data;
OperationDepsNode *op_node;
Object *object_cow = get_cow_datablock(object);
/* Sanity check. */
BLI_assert(object->pose != NULL);
- /* Animation. */
- build_animdata(&arm->id);
+ /* Armature. */
+ build_armature(armature);
/* speed optimization for animation lookups */
BKE_pose_channels_hash_make(object->pose);
if (object->pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 830d811c4c1..9afde9945ac 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1881,6 +1881,14 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata)
}
}
+void DepsgraphRelationBuilder::build_armature(bArmature *armature)
+{
+ if (built_map_.checkIsBuiltAndTag(armature)) {
+ return;
+ }
+ build_animdata(&armature->id);
+}
+
void DepsgraphRelationBuilder::build_camera(Camera *camera)
{
if (built_map_.checkIsBuiltAndTag(camera)) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 1dc8d79d36d..e61fe40d93e 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -49,6 +49,7 @@
#include "intern/nodes/deg_node_operation.h"
struct Base;
+struct bArmature;
struct bGPdata;
struct CacheFile;
struct Camera;
@@ -248,6 +249,7 @@ struct DepsgraphRelationBuilder
void build_rig(Object *object);
void build_proxy_rig(Object *object);
void build_shapekeys(ID *obdata, Key *key);
+ void build_armature(bArmature *armature);
void build_camera(Camera *camera);
void build_lamp(Lamp *lamp);
void build_nodetree(bNodeTree *ntree);
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 a9895eb3af1..49c107c988f 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
@@ -304,27 +304,21 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object,
void DepsgraphRelationBuilder::build_rig(Object *object)
{
/* Armature-Data */
- bArmature *arm = (bArmature *)object->data;
-
+ bArmature *armature = (bArmature *)object->data;
// TODO: selection status?
-
- /* attach links between pose operations */
+ /* Attach links between pose operations. */
OperationKey init_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT);
OperationKey init_ik_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT_IK);
OperationKey flush_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_DONE);
-
add_relation(init_key, init_ik_key, "Pose Init -> Pose Init IK");
add_relation(init_ik_key, flush_key, "Pose Init IK -> Pose Cleanup");
-
/* Make sure pose is up-to-date with armature updates. */
- if (!built_map_.checkIsBuiltAndTag(arm)) {
- OperationKey armature_key(&arm->id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_PLACEHOLDER,
- "Armature Eval");
- add_relation(armature_key, init_key, "Data dependency");
- }
-
+ build_armature(armature);
+ OperationKey armature_key(&armature->id,
+ DEG_NODE_TYPE_PARAMETERS,
+ DEG_OPCODE_PLACEHOLDER,
+ "Armature Eval");
+ add_relation(armature_key, init_key, "Data dependency");
/* IK Solvers...
* - These require separate processing steps are pose-level
* to be executed between chains of bones (i.e. once the
@@ -337,7 +331,8 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
* references, or with bones being parented to IK'd bones)
*
* Unsolved Issues:
- * - Care is needed to ensure that multi-headed trees work out the same as in ik-tree building
+ * - Care is needed to ensure that multi-headed trees work out the same as
+ * in ik-tree building
* - Animated chain-lengths are a problem...
*/
RootPChanMap root_map;
@@ -372,7 +367,6 @@ 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.
@@ -381,8 +375,7 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
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 */
+ /* Links between operations for each bone. */
LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
OperationKey bone_local_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_LOCAL);
OperationKey bone_pose_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_POSE_PARENT);
@@ -397,7 +390,9 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
if (pchan->parent != NULL) {
eDepsOperation_Code parent_key_opcode;
- /* NOTE: this difference in handling allows us to prevent lockups while ensuring correct poses for separate chains */
+ /* NOTE: this difference in handling allows us to prevent lockups
+ * while ensuring correct poses for separate chains.
+ */
if (root_map.has_common_root(pchan->name, pchan->parent->name)) {
parent_key_opcode = DEG_OPCODE_BONE_READY;
}
@@ -433,14 +428,15 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
/* bone ready -> done
* NOTE: For bones without IK, this is all that's needed.
- * For IK chains however, an additional rel is created from IK to done,
- * with transitive reduction removing this one...
+ * For IK chains however, an additional rel is created from IK
+ * to done, with transitive reduction removing this one..
*/
add_relation(bone_ready_key, bone_done_key, "Ready -> Done");
- /* assume that all bones must be done for the pose to be ready (for deformers) */
+ /* assume that all bones must be done for the pose to be ready
+ * (for deformers)
+ */
add_relation(bone_done_key, flush_key, "PoseEval Result-Bone Link");
-
/* Custom shape. */
if (pchan->custom != NULL) {
build_object(NULL, pchan->custom);
@@ -450,7 +446,9 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
void DepsgraphRelationBuilder::build_proxy_rig(Object *object)
{
+ bArmature *armature = (bArmature *)object->data;
Object *proxy_from = object->proxy_from;
+ build_armature(armature);
OperationKey pose_init_key(&object->id,
DEG_NODE_TYPE_EVAL_POSE,
DEG_OPCODE_POSE_INIT);