Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
| Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
| #include "intern/node/deg_node.h" | #include "intern/node/deg_node.h" | ||||
| #include "intern/node/deg_node_component.h" | #include "intern/node/deg_node_component.h" | ||||
| #include "intern/node/deg_node_operation.h" | #include "intern/node/deg_node_operation.h" | ||||
| namespace blender::deg { | namespace blender::deg { | ||||
| void DepsgraphNodeBuilder::build_pose_constraints(Object *object, | void DepsgraphNodeBuilder::build_pose_constraints(Object *object, | ||||
| bPoseChannel *pchan, | bPoseChannel *pchan, | ||||
| int pchan_index, | int pchan_index) | ||||
| bool is_object_visible) | |||||
| { | { | ||||
| /* Pull indirect dependencies via constraints. */ | /* Pull indirect dependencies via constraints. */ | ||||
| BuilderWalkUserData data; | BuilderWalkUserData data; | ||||
| data.builder = this; | data.builder = this; | ||||
| data.is_parent_visible = is_object_visible; | |||||
| BKE_constraints_id_loop(&pchan->constraints, constraint_walk, &data); | BKE_constraints_id_loop(&pchan->constraints, constraint_walk, &data); | ||||
| /* Create node for constraint stack. */ | /* Create node for constraint stack. */ | ||||
| Scene *scene_cow = get_cow_datablock(scene_); | Scene *scene_cow = get_cow_datablock(scene_); | ||||
| Object *object_cow = get_cow_datablock(object); | Object *object_cow = get_cow_datablock(object); | ||||
| add_operation_node(&object->id, | add_operation_node(&object->id, | ||||
| NodeType::BONE, | NodeType::BONE, | ||||
| pchan->name, | pchan->name, | ||||
| ▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | add_operation_node(&object->id, | ||||
| OperationCode::POSE_SPLINE_IK_SOLVER, | OperationCode::POSE_SPLINE_IK_SOLVER, | ||||
| [scene_cow, object_cow, rootchan_index](::Depsgraph *depsgraph) { | [scene_cow, object_cow, rootchan_index](::Depsgraph *depsgraph) { | ||||
| BKE_pose_splineik_evaluate( | BKE_pose_splineik_evaluate( | ||||
| depsgraph, scene_cow, object_cow, rootchan_index); | depsgraph, scene_cow, object_cow, rootchan_index); | ||||
| }); | }); | ||||
| } | } | ||||
| /* Pose/Armature Bones Graph */ | /* Pose/Armature Bones Graph */ | ||||
| void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) | void DepsgraphNodeBuilder::build_rig(Object *object) | ||||
| { | { | ||||
| bArmature *armature = (bArmature *)object->data; | bArmature *armature = (bArmature *)object->data; | ||||
| Scene *scene_cow = get_cow_datablock(scene_); | Scene *scene_cow = get_cow_datablock(scene_); | ||||
| Object *object_cow = get_cow_datablock(object); | Object *object_cow = get_cow_datablock(object); | ||||
| OperationNode *op_node; | OperationNode *op_node; | ||||
| /* Animation and/or drivers linking pose-bones to base-armature used to define them. | /* Animation and/or drivers linking pose-bones to base-armature used to define them. | ||||
| * | * | ||||
| * NOTE: AnimData here is really used to control animated deform properties, | * NOTE: AnimData here is really used to control animated deform properties, | ||||
| ▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { | ||||
| /* Custom properties. */ | /* Custom properties. */ | ||||
| if (pchan->prop != nullptr) { | if (pchan->prop != nullptr) { | ||||
| build_idproperties(pchan->prop); | build_idproperties(pchan->prop); | ||||
| add_operation_node( | add_operation_node( | ||||
| &object->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL, nullptr, pchan->name); | &object->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL, nullptr, pchan->name); | ||||
| } | } | ||||
| /* Build constraints. */ | /* Build constraints. */ | ||||
| if (pchan->constraints.first != nullptr) { | if (pchan->constraints.first != nullptr) { | ||||
| build_pose_constraints(object, pchan, pchan_index, is_object_visible); | build_pose_constraints(object, pchan, pchan_index); | ||||
| } | } | ||||
| /** | /** | ||||
| * IK Solvers. | * IK Solvers. | ||||
| * | * | ||||
| * - These require separate processing steps are pose-level | * - These require separate processing steps are pose-level | ||||
| * to be executed between chains of bones (i.e. once the | * to be executed between chains of bones (i.e. once the | ||||
| * base transforms of a bunch of bones is done) | * base transforms of a bunch of bones is done) | ||||
| * | * | ||||
| Show All 12 Lines | LISTBASE_FOREACH (bConstraint *, con, &pchan->constraints) { | ||||
| break; | break; | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| /* Custom shape. */ | /* Custom shape. */ | ||||
| if (pchan->custom != nullptr) { | if (pchan->custom != nullptr) { | ||||
| /* TODO(sergey): Use own visibility. */ | /* NOTE: The relation builder will ensure visibility of the custom shape object. */ | ||||
| build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, is_object_visible); | build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, false); | ||||
| } | } | ||||
| pchan_index++; | pchan_index++; | ||||
| } | } | ||||
| } | } | ||||
| void DepsgraphNodeBuilder::build_proxy_rig(Object *object, bool is_object_visible) | void DepsgraphNodeBuilder::build_proxy_rig(Object *object) | ||||
| { | { | ||||
| bArmature *armature = (bArmature *)object->data; | bArmature *armature = (bArmature *)object->data; | ||||
| OperationNode *op_node; | OperationNode *op_node; | ||||
| Object *object_cow = get_cow_datablock(object); | Object *object_cow = get_cow_datablock(object); | ||||
| /* Sanity check. */ | /* Sanity check. */ | ||||
| BLI_assert(object->pose != nullptr); | BLI_assert(object->pose != nullptr); | ||||
| /* Armature. */ | /* Armature. */ | ||||
| build_armature(armature); | build_armature(armature); | ||||
| Show All 31 Lines | LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { | ||||
| if (pchan->prop != nullptr) { | if (pchan->prop != nullptr) { | ||||
| build_idproperties(pchan->prop); | build_idproperties(pchan->prop); | ||||
| add_operation_node( | add_operation_node( | ||||
| &object->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL, nullptr, pchan->name); | &object->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL, nullptr, pchan->name); | ||||
| } | } | ||||
| /* Custom shape. */ | /* Custom shape. */ | ||||
| if (pchan->custom != nullptr) { | if (pchan->custom != nullptr) { | ||||
| build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, is_object_visible); | /* NOTE: The relation builder will ensure visibility of the custom shape object. */ | ||||
| build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, false); | |||||
| } | } | ||||
| pchan_index++; | pchan_index++; | ||||
| } | } | ||||
| op_node = add_operation_node(&object->id, | op_node = add_operation_node(&object->id, | ||||
| NodeType::EVAL_POSE, | NodeType::EVAL_POSE, | ||||
| OperationCode::POSE_CLEANUP, | OperationCode::POSE_CLEANUP, | ||||
| [object_cow](::Depsgraph *depsgraph) { | [object_cow](::Depsgraph *depsgraph) { | ||||
| Show All 11 Lines | |||||