From 6e67d8e3bb392f26bcd99d39763e8b25e72d118f Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 30 Apr 2018 18:46:52 +0200 Subject: Cleanup: Move FOREACH_PCHAN_*_IN_OBJECT_*() macros to BKE_armature.h This reduces the number of headers we need to import (and/or dependencies on the order of them), as these depend on PBONE_VISIBLE(), which is already in BKE_armature.h --- source/blender/blenkernel/BKE_action.h | 15 ------- source/blender/blenkernel/BKE_armature.h | 71 ++++++++++++++++++++------------ 2 files changed, 44 insertions(+), 42 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index e42a37cd444..72a8ffd7a26 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -208,21 +208,6 @@ void BKE_pose_rest(struct bPose *pose); /* Tag pose for recalc. Also tag all related data to be recalc. */ void BKE_pose_tag_recalc(struct Main *bmain, struct bPose *pose); -/* context.selected_pose_bones */ -#define FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN(_ob, _pchan) \ - for (bPoseChannel *_pchan = (_ob)->pose->chanbase.first; _pchan; _pchan = _pchan->next) { \ - if (PBONE_VISIBLE(((bArmature *)(_ob)->data), (_pchan)->bone) && ((_pchan)->bone->flag & BONE_SELECTED)) { -#define FOREACH_PCHAN_SELECTED_IN_OBJECT_END \ - } \ - } ((void)0) -/* context.visible_pose_bones */ -#define FOREACH_PCHAN_VISIBLE_IN_OBJECT_BEGIN(_ob, _pchan) \ - for (bPoseChannel *_pchan = (_ob)->pose->chanbase.first; _pchan; _pchan = _pchan->next) { \ - if (PBONE_VISIBLE(((bArmature *)(_ob)->data), (_pchan)->bone)) { -#define FOREACH_PCHAN_VISIBLE_IN_OBJECT_END \ - } \ - } ((void)0) - #ifdef __cplusplus }; diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index e286c1248c0..2ecab73ac79 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -152,61 +152,78 @@ void b_bone_spline_setup(struct bPoseChannel *pchan, int rest, Mat4 result_array #define PBONE_SELECTABLE(arm, bone) \ (PBONE_VISIBLE(arm, bone) && !((bone)->flag & BONE_UNSELECTABLE)) + +/* context.selected_pose_bones */ +#define FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN(_ob, _pchan) \ + for (bPoseChannel *_pchan = (_ob)->pose->chanbase.first; _pchan; _pchan = _pchan->next) { \ + if (PBONE_VISIBLE(((bArmature *)(_ob)->data), (_pchan)->bone) && ((_pchan)->bone->flag & BONE_SELECTED)) { +#define FOREACH_PCHAN_SELECTED_IN_OBJECT_END \ + } \ + } ((void)0) +/* context.visible_pose_bones */ +#define FOREACH_PCHAN_VISIBLE_IN_OBJECT_BEGIN(_ob, _pchan) \ + for (bPoseChannel *_pchan = (_ob)->pose->chanbase.first; _pchan; _pchan = _pchan->next) { \ + if (PBONE_VISIBLE(((bArmature *)(_ob)->data), (_pchan)->bone)) { +#define FOREACH_PCHAN_VISIBLE_IN_OBJECT_END \ + } \ + } ((void)0) + + /* Evaluation helpers */ struct bKinematicConstraint; struct bPose; struct bSplineIKConstraint; struct bPoseChannel *BKE_armature_ik_solver_find_root( - struct bPoseChannel *pchan, - struct bKinematicConstraint *data); + struct bPoseChannel *pchan, + struct bKinematicConstraint *data); struct bPoseChannel *BKE_armature_splineik_solver_find_root( - struct bPoseChannel *pchan, - struct bSplineIKConstraint *data); + struct bPoseChannel *pchan, + struct bSplineIKConstraint *data); void BKE_pose_splineik_init_tree(struct Scene *scene, struct Object *ob, float ctime); void BKE_splineik_execute_tree( - struct Depsgraph *depsgraph, struct Scene *scene, - struct Object *ob, struct bPoseChannel *pchan_root, float ctime); + struct Depsgraph *depsgraph, struct Scene *scene, + struct Object *ob, struct bPoseChannel *pchan_root, float ctime); void BKE_pose_eval_init(struct Depsgraph *depsgraph, - struct Scene *scene, - struct Object *ob); + struct Scene *scene, + struct Object *ob); void BKE_pose_eval_init_ik(struct Depsgraph *depsgraph, - struct Scene *scene, - struct Object *ob); + struct Scene *scene, + struct Object *ob); void BKE_pose_eval_bone(struct Depsgraph *depsgraph, - struct Scene *scene, - struct Object *ob, - int pchan_index); + struct Scene *scene, + struct Object *ob, + int pchan_index); void BKE_pose_constraints_evaluate(struct Depsgraph *depsgraph, - struct Scene *scene, - struct Object *ob, - int pchan_index); + struct Scene *scene, + struct Object *ob, + int pchan_index); void BKE_pose_bone_done(struct Depsgraph *depsgraph, - struct Object *ob, - int pchan_index); + struct Object *ob, + int pchan_index); void BKE_pose_iktree_evaluate(struct Depsgraph *depsgraph, - struct Scene *scene, - struct Object *ob, - int rootchan_index); + struct Scene *scene, + struct Object *ob, + int rootchan_index); void BKE_pose_splineik_evaluate(struct Depsgraph *depsgraph, - struct Scene *scene, - struct Object *ob, - int rootchan_index); + struct Scene *scene, + struct Object *ob, + int rootchan_index); void BKE_pose_eval_flush(struct Depsgraph *depsgraph, - struct Scene *scene, - struct Object *ob); + struct Scene *scene, + struct Object *ob); void BKE_pose_eval_proxy_copy(struct Depsgraph *depsgraph, - struct Object *ob); + struct Object *ob); #ifdef __cplusplus } -- cgit v1.2.3