diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-01-31 14:56:40 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-01-31 16:31:41 +0300 |
commit | c1da8e3b28f95188f9e9152383856c95f29586b4 (patch) | |
tree | 611acd206bfb126f076e78caa047b14bcd3673b6 /source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc | |
parent | 7ccef23c4d010d4b4f83efe2cd6c82ff26824a10 (diff) |
Depsgraph: Comb code to a better state all over
Some summary of changes:
- Don't use DEG prefix for types and enumerator values:
the code is already inside DEG namespace.
- Put code where it locally belongs to: avoid having one
single header file with all sort of definitions in it.
- Take advantage of modern C++11 enabled by default.
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc | 110 |
1 files changed, 52 insertions, 58 deletions
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 083153185dd..4fcf825eaa0 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -58,12 +58,10 @@ extern "C" { #include "intern/builder/deg_builder.h" #include "intern/eval/deg_eval_copy_on_write.h" -#include "intern/nodes/deg_node.h" -#include "intern/nodes/deg_node_component.h" -#include "intern/nodes/deg_node_operation.h" -#include "intern/depsgraph_types.h" -#include "intern/depsgraph_intern.h" -#include "util/deg_util_foreach.h" +#include "intern/node/deg_node.h" +#include "intern/node/deg_node_component.h" +#include "intern/node/deg_node_operation.h" +#include "intern/depsgraph_type.h" namespace DEG { @@ -79,13 +77,13 @@ void DepsgraphNodeBuilder::build_pose_constraints( data.is_parent_visible = is_object_visible; BKE_constraints_id_loop(&pchan->constraints, constraint_walk, &data); /* Create node for constraint stack. */ - add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, + add_operation_node(&object->id, NodeType::BONE, pchan->name, function_bind(BKE_pose_constraints_evaluate, _1, get_cow_datablock(scene_), get_cow_datablock(object), pchan_index), - DEG_OPCODE_BONE_CONSTRAINTS); + OperationCode::BONE_CONSTRAINTS); } /* IK Solver Eval Steps */ @@ -101,8 +99,8 @@ void DepsgraphNodeBuilder::build_ik_pose(Object *object, return; } - if (has_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE, rootchan->name, - DEG_OPCODE_POSE_IK_SOLVER)) + if (has_operation_node(&object->id, NodeType::EVAL_POSE, rootchan->name, + OperationCode::POSE_IK_SOLVER)) { return; } @@ -110,13 +108,13 @@ void DepsgraphNodeBuilder::build_ik_pose(Object *object, int rootchan_index = BLI_findindex(&object->pose->chanbase, rootchan); BLI_assert(rootchan_index != -1); /* Operation node for evaluating/running IK Solver. */ - add_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE, rootchan->name, + add_operation_node(&object->id, NodeType::EVAL_POSE, rootchan->name, function_bind(BKE_pose_iktree_evaluate, _1, get_cow_datablock(scene_), get_cow_datablock(object), rootchan_index), - DEG_OPCODE_POSE_IK_SOLVER); + OperationCode::POSE_IK_SOLVER); } /* Spline IK Eval Steps */ @@ -131,17 +129,16 @@ void DepsgraphNodeBuilder::build_splineik_pose(Object *object, /* Operation node for evaluating/running Spline IK Solver. * Store the "root bone" of this chain in the solver, so it knows where to - * start. - */ + * start. */ int rootchan_index = BLI_findindex(&object->pose->chanbase, rootchan); BLI_assert(rootchan_index != -1); - add_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE, rootchan->name, + add_operation_node(&object->id, NodeType::EVAL_POSE, rootchan->name, function_bind(BKE_pose_splineik_evaluate, _1, get_cow_datablock(scene_), get_cow_datablock(object), rootchan_index), - DEG_OPCODE_POSE_SPLINE_IK_SOLVER); + OperationCode::POSE_SPLINE_IK_SOLVER); } /* Pose/Armature Bones Graph */ @@ -150,7 +147,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) bArmature *armature = (bArmature *)object->data; Scene *scene_cow = get_cow_datablock(scene_); Object *object_cow = get_cow_datablock(object); - OperationDepsNode *op_node; + OperationNode *op_node; /* Animation and/or drivers linking posebones to base-armature used to * define them. * @@ -158,8 +155,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) * which ideally should be able to be unique across different * instances. Eventually, we need some type of proxy/isolation * mechanism in-between here to ensure that we can use same rig - * multiple times in same scene. - */ + * multiple times in same scene. */ /* Armature. */ build_armature(armature); /* Rebuild pose if not up to date. */ @@ -193,75 +189,74 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) * and constraint stack) so that they can be easily found. * - Everything else which depends on bone-results hook up to the component * only so that we can redirect those to point at either the the post-IK/ - * post-constraint/post-matrix steps, as needed. - */ + * post-constraint/post-matrix steps, as needed. */ /* Pose eval context. */ op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_init, _1, scene_cow, object_cow), - DEG_OPCODE_POSE_INIT); + OperationCode::POSE_INIT); op_node->set_as_entry(); op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_init_ik, _1, scene_cow, object_cow), - DEG_OPCODE_POSE_INIT_IK); + OperationCode::POSE_INIT_IK); add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_cleanup, _1, scene_cow, object_cow), - DEG_OPCODE_POSE_CLEANUP); + OperationCode::POSE_CLEANUP); op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_done, _1, object_cow), - DEG_OPCODE_POSE_DONE); + OperationCode::POSE_DONE); op_node->set_as_exit(); /* Bones. */ int pchan_index = 0; LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { /* Node for bone evaluation. */ - op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, NULL, - DEG_OPCODE_BONE_LOCAL); + op_node = add_operation_node(&object->id, NodeType::BONE, pchan->name, NULL, + OperationCode::BONE_LOCAL); op_node->set_as_entry(); - add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, + add_operation_node(&object->id, NodeType::BONE, pchan->name, function_bind(BKE_pose_eval_bone, _1, scene_cow, object_cow, pchan_index), - DEG_OPCODE_BONE_POSE_PARENT); + OperationCode::BONE_POSE_PARENT); /* NOTE: Dedicated noop for easier relationship construction. */ - add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, + add_operation_node(&object->id, NodeType::BONE, pchan->name, NULL, - DEG_OPCODE_BONE_READY); + OperationCode::BONE_READY); - op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, + op_node = add_operation_node(&object->id, NodeType::BONE, pchan->name, function_bind(BKE_pose_bone_done, _1, object_cow, pchan_index), - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); /* B-Bone shape computation - the real last step if present. */ if (pchan->bone != NULL && pchan->bone->segments > 1) { - op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, + op_node = add_operation_node(&object->id, NodeType::BONE, pchan->name, function_bind(BKE_pose_eval_bbone_segments, _1, object_cow, pchan_index), - DEG_OPCODE_BONE_SEGMENTS); + OperationCode::BONE_SEGMENTS); } op_node->set_as_exit(); @@ -269,9 +264,9 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) /* Custom properties. */ if (pchan->prop != NULL) { add_operation_node(&object->id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_PARAMETERS_EVAL, + OperationCode::PARAMETERS_EVAL, pchan->name); } /* Build constraints. */ @@ -289,8 +284,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) * Unsolved Issues: * - Care is needed to ensure that multi-headed trees work out the same * as in ik-tree building - * - Animated chain-lengths are a problem. - */ + * - Animated chain-lengths are a problem. */ LISTBASE_FOREACH (bConstraint *, con, &pchan->constraints) { switch (con->type) { case CONSTRAINT_TYPE_KINEMATIC: @@ -321,7 +315,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) void DepsgraphNodeBuilder::build_proxy_rig(Object *object) { bArmature *armature = (bArmature *)object->data; - OperationDepsNode *op_node; + OperationNode *op_node; Object *object_cow = get_cow_datablock(object); /* Sanity check. */ BLI_assert(object->pose != NULL); @@ -333,62 +327,62 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object) BKE_pose_update_constraint_flags(object->pose); } op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_proxy_init, _1, object_cow), - DEG_OPCODE_POSE_INIT); + OperationCode::POSE_INIT); op_node->set_as_entry(); int pchan_index = 0; LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, NULL, - DEG_OPCODE_BONE_LOCAL); + OperationCode::BONE_LOCAL); op_node->set_as_entry(); /* Bone is ready for solvers. */ add_operation_node(&object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, NULL, - DEG_OPCODE_BONE_READY); + OperationCode::BONE_READY); /* Bone is fully evaluated. */ op_node = add_operation_node( &object->id, - DEG_NODE_TYPE_BONE, + NodeType::BONE, pchan->name, function_bind(BKE_pose_eval_proxy_copy_bone, _1, object_cow, pchan_index), - DEG_OPCODE_BONE_DONE); + OperationCode::BONE_DONE); op_node->set_as_exit(); /* Custom properties. */ if (pchan->prop != NULL) { add_operation_node(&object->id, - DEG_NODE_TYPE_PARAMETERS, + NodeType::PARAMETERS, NULL, - DEG_OPCODE_PARAMETERS_EVAL, + OperationCode::PARAMETERS_EVAL, pchan->name); } pchan_index++; } op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_proxy_cleanup, _1, object_cow), - DEG_OPCODE_POSE_CLEANUP); + OperationCode::POSE_CLEANUP); op_node = add_operation_node(&object->id, - DEG_NODE_TYPE_EVAL_POSE, + NodeType::EVAL_POSE, function_bind(BKE_pose_eval_proxy_done, _1, object_cow), - DEG_OPCODE_POSE_DONE); + OperationCode::POSE_DONE); op_node->set_as_exit(); } |