diff options
9 files changed, 45 insertions, 35 deletions
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 0e356c1557f..bc91ffeb504 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -164,16 +164,26 @@ typedef struct BBoneSplineParameters { float curveInX, curveInY, curveOutX, curveOutY; } BBoneSplineParameters; -void BKE_pchan_get_bbone_handles(struct bPoseChannel *pchan, struct bPoseChannel **r_prev, struct bPoseChannel **r_next); -void BKE_pchan_get_bbone_spline_parameters(struct bPoseChannel *pchan, const bool rest, struct BBoneSplineParameters *r_param); - -void b_bone_spline_setup(struct bPoseChannel *pchan, const bool rest, Mat4 result_array[MAX_BBONE_SUBDIV]); - -void BKE_compute_b_bone_handles(const BBoneSplineParameters *param, float h1[3], float *r_roll1, float h2[3], float *r_roll2, bool ease, bool offsets); -int BKE_compute_b_bone_spline(struct BBoneSplineParameters *param, Mat4 result_array[MAX_BBONE_SUBDIV]); - -void BKE_pchan_cache_bbone_segments(struct bPoseChannel *pchan); -void BKE_pchan_copy_bbone_segments_cache(struct bPoseChannel *pchan, struct bPoseChannel *pchan_from); +void BKE_pchan_bbone_handles_get( + struct bPoseChannel *pchan, struct bPoseChannel **r_prev, struct bPoseChannel **r_next); +void BKE_pchan_bbone_spline_params_get( + struct bPoseChannel *pchan, const bool rest, struct BBoneSplineParameters *r_param); + +void BKE_pchan_bbone_spline_setup( + struct bPoseChannel *pchan, const bool rest, Mat4 result_array[MAX_BBONE_SUBDIV]); + +void BKE_pchan_bbone_handles_compute( + const BBoneSplineParameters *param, + float h1[3], float *r_roll1, + float h2[3], float *r_roll2, + bool ease, bool offsets); +int BKE_pchan_bbone_spline_compute( + struct BBoneSplineParameters *param, Mat4 result_array[MAX_BBONE_SUBDIV]); + +void BKE_pchan_bbone_segments_cache_compute( + struct bPoseChannel *pchan); +void BKE_pchan_bbone_segments_cache_copy( + struct bPoseChannel *pchan, struct bPoseChannel *pchan_from); /* like EBONE_VISIBLE */ #define PBONE_VISIBLE(arm, bone) ( \ diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 9abd20679d8..8c32bed4a3b 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -436,7 +436,7 @@ static void equalize_bbone_bezier(float *data, int desired) } /* Get "next" and "prev" bones - these are used for handle calculations. */ -void BKE_pchan_get_bbone_handles(bPoseChannel *pchan, bPoseChannel **r_prev, bPoseChannel **r_next) +void BKE_pchan_bbone_handles_get(bPoseChannel *pchan, bPoseChannel **r_prev, bPoseChannel **r_next) { if (pchan->bone->bbone_prev_type == BBONE_HANDLE_AUTO) { /* Use connected parent. */ @@ -463,7 +463,7 @@ void BKE_pchan_get_bbone_handles(bPoseChannel *pchan, bPoseChannel **r_prev, bPo } /* Compute B-Bone spline parameters for the given channel. */ -void BKE_pchan_get_bbone_spline_parameters(struct bPoseChannel *pchan, const bool rest, struct BBoneSplineParameters *param) +void BKE_pchan_bbone_spline_params_get(struct bPoseChannel *pchan, const bool rest, struct BBoneSplineParameters *param) { bPoseChannel *next, *prev; Bone *bone = pchan->bone; @@ -487,7 +487,7 @@ void BKE_pchan_get_bbone_spline_parameters(struct bPoseChannel *pchan, const boo } } - BKE_pchan_get_bbone_handles(pchan, &prev, &next); + BKE_pchan_bbone_handles_get(pchan, &prev, &next); /* Find the handle points, since this is inside bone space, the * first point = (0, 0, 0) @@ -645,17 +645,17 @@ void BKE_pchan_get_bbone_spline_parameters(struct bPoseChannel *pchan, const boo /* Fills the array with the desired amount of bone->segments elements. * This calculation is done within unit bone space. */ -void b_bone_spline_setup(bPoseChannel *pchan, const bool rest, Mat4 result_array[MAX_BBONE_SUBDIV]) +void BKE_pchan_bbone_spline_setup(bPoseChannel *pchan, const bool rest, Mat4 result_array[MAX_BBONE_SUBDIV]) { BBoneSplineParameters param; - BKE_pchan_get_bbone_spline_parameters(pchan, rest, ¶m); + BKE_pchan_bbone_spline_params_get(pchan, rest, ¶m); - pchan->bone->segments = BKE_compute_b_bone_spline(¶m, result_array); + pchan->bone->segments = BKE_pchan_bbone_spline_compute(¶m, result_array); } /* Computes the bezier handle vectors and rolls coming from custom handles. */ -void BKE_compute_b_bone_handles(const BBoneSplineParameters *param, float h1[3], float *r_roll1, float h2[3], float *r_roll2, bool ease, bool offsets) +void BKE_pchan_bbone_handles_compute(const BBoneSplineParameters *param, float h1[3], float *r_roll1, float h2[3], float *r_roll2, bool ease, bool offsets) { float mat3[3][3]; float length = param->length; @@ -756,7 +756,7 @@ void BKE_compute_b_bone_handles(const BBoneSplineParameters *param, float h1[3], /* Fills the array with the desired amount of bone->segments elements. * This calculation is done within unit bone space. */ -int BKE_compute_b_bone_spline(BBoneSplineParameters *param, Mat4 result_array[MAX_BBONE_SUBDIV]) +int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param, Mat4 result_array[MAX_BBONE_SUBDIV]) { float scalemat[4][4], iscalemat[4][4]; float mat3[3][3]; @@ -772,7 +772,7 @@ int BKE_compute_b_bone_spline(BBoneSplineParameters *param, Mat4 result_array[MA length *= param->scale[1]; } - BKE_compute_b_bone_handles(param, h1, &roll1, h2, &roll2, true, true); + BKE_pchan_bbone_handles_compute(param, h1, &roll1, h2, &roll2, true, true); /* Make curve. */ CLAMP_MAX(param->segments, MAX_BBONE_SUBDIV); @@ -858,7 +858,7 @@ static void allocate_bbone_cache(bPoseChannel *pchan, int segments) } /** Compute and cache the B-Bone shape in the channel runtime struct. */ -void BKE_pchan_cache_bbone_segments(bPoseChannel *pchan) +void BKE_pchan_bbone_segments_cache_compute(bPoseChannel *pchan) { bPoseChannelRuntime *runtime = &pchan->runtime; Bone *bone = pchan->bone; @@ -876,8 +876,8 @@ void BKE_pchan_cache_bbone_segments(bPoseChannel *pchan) DualQuat *b_bone_dual_quats = runtime->bbone_dual_quats; int a; - b_bone_spline_setup(pchan, false, b_bone); - b_bone_spline_setup(pchan, true, b_bone_rest); + BKE_pchan_bbone_spline_setup(pchan, false, b_bone); + BKE_pchan_bbone_spline_setup(pchan, true, b_bone_rest); /* Compute deform matrices. */ /* first matrix is the inverse arm_mat, to bring points in local bone space @@ -901,7 +901,7 @@ void BKE_pchan_cache_bbone_segments(bPoseChannel *pchan) } /** Copy cached B-Bone segments from one channel to another */ -void BKE_pchan_copy_bbone_segments_cache(bPoseChannel *pchan, bPoseChannel *pchan_from) +void BKE_pchan_bbone_segments_cache_copy(bPoseChannel *pchan, bPoseChannel *pchan_from) { bPoseChannelRuntime *runtime = &pchan->runtime; bPoseChannelRuntime *runtime_from = &pchan_from->runtime; diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index f5519966ac2..1460a3cb205 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -728,10 +728,10 @@ void BKE_pose_eval_bbone_segments(struct Depsgraph *depsgraph, bPoseChannel *pchan = pose_pchan_get_indexed(ob, pchan_index); DEG_debug_print_eval(depsgraph, __func__, pchan->name, pchan); if (pchan->bone != NULL && pchan->bone->segments > 1) { - BKE_pchan_cache_bbone_segments(pchan); + BKE_pchan_bbone_segments_cache_compute(pchan); bArmature *arm = (bArmature *)ob->data; if (DEG_is_active(depsgraph) && arm->edbo == NULL) { - BKE_pchan_copy_bbone_segments_cache(pchan->orig_pchan, pchan); + BKE_pchan_bbone_segments_cache_copy(pchan->orig_pchan, pchan); } } } @@ -857,5 +857,5 @@ void BKE_pose_eval_proxy_copy_bone( BLI_assert(pchan != NULL); BLI_assert(pchan_from != NULL); BKE_pose_copyesult_pchan_result(pchan, pchan_from); - BKE_pchan_copy_bbone_segments_cache(pchan, pchan_from); + BKE_pchan_bbone_segments_cache_copy(pchan, pchan_from); } 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 1260ce013ea..ff8b13b4442 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -498,7 +498,7 @@ void DepsgraphRelationBuilder::build_rig(Object *object) add_relation(bone_done_key, bone_segments_key, "Done -> B-Bone Segments"); /* B-Bone shape depends on final position of handle bones. */ bPoseChannel *prev, *next; - BKE_pchan_get_bbone_handles(pchan, &prev, &next); + BKE_pchan_bbone_handles_get(pchan, &prev, &next); if (prev) { OperationKey prev_key(&object->id, DEG_NODE_TYPE_BONE, diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index aec25274ab1..b8b53fbbb78 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -940,7 +940,7 @@ static void edbo_compute_bbone_child(bArmature *arm) } } -/* A version of b_bone_spline_setup() for previewing editmode curve settings. */ +/* A version of BKE_pchan_bbone_spline_setup() for previewing editmode curve settings. */ static void ebone_spline_preview(EditBone *ebone, float result_array[MAX_BBONE_SUBDIV][4][4]) { BBoneSplineParameters param; @@ -1043,7 +1043,7 @@ static void ebone_spline_preview(EditBone *ebone, float result_array[MAX_BBONE_S param.curveOutX = ebone->curveOutX; param.curveOutY = ebone->curveOutY; - ebone->segments = BKE_compute_b_bone_spline(¶m, (Mat4 *)result_array); + ebone->segments = BKE_pchan_bbone_spline_compute(¶m, (Mat4 *)result_array); } static void draw_bone_update_disp_matrix_bbone(EditBone *eBone, bPoseChannel *pchan) @@ -1086,7 +1086,7 @@ static void draw_bone_update_disp_matrix_bbone(EditBone *eBone, bPoseChannel *pc memcpy(bbones_mat, pchan->runtime.bbone_pose_mats, sizeof(Mat4) * bbone_segments); } else { - b_bone_spline_setup(pchan, false, bbones_mat); + BKE_pchan_bbone_spline_setup(pchan, false, bbones_mat); } for (int i = bbone_segments; i--; bbones_mat++) { diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c index 06385ab0cee..462c17e9008 100644 --- a/source/blender/editors/armature/armature_skinning.c +++ b/source/blender/editors/armature/armature_skinning.c @@ -326,7 +326,7 @@ static void add_verts_to_dgroups( if ((par->pose) && (pchan = BKE_pose_channel_find_name(par->pose, bone->name))) { if (bone->segments > 1) { segments = bone->segments; - b_bone_spline_setup(pchan, true, bbone_array); + BKE_pchan_bbone_spline_setup(pchan, true, bbone_array); bbone = bbone_array; } } diff --git a/source/blender/editors/gpencil/gpencil_armature.c b/source/blender/editors/gpencil/gpencil_armature.c index d69f64f3eaf..d62984020cd 100644 --- a/source/blender/editors/gpencil/gpencil_armature.c +++ b/source/blender/editors/gpencil/gpencil_armature.c @@ -323,7 +323,7 @@ static void gpencil_add_verts_to_dgroups( { if (bone->segments > 1) { segments = bone->segments; - b_bone_spline_setup(pchan, true, bbone_array); + BKE_pchan_bbone_spline_setup(pchan, true, bbone_array); bbone = bbone_array; } } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_armature.c b/source/blender/editors/space_view3d/view3d_gizmo_armature.c index 4e91712491f..0a3d20979a0 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_armature.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_armature.c @@ -59,7 +59,7 @@ /* * TODO(campbell): Current conversion is a approximation (usable not correct), * we'll need to take the next/previous bones into account to get the tangent directions. - * First last matrices from 'b_bone_spline_setup' are close but also not quite accurate + * First last matrices from 'BKE_pchan_bbone_spline_setup' are close but also not quite accurate * since they're not at either end-points on the curve. * * Likely we'll need a function especially to get the first/last orientations. diff --git a/source/blender/makesrna/intern/rna_pose_api.c b/source/blender/makesrna/intern/rna_pose_api.c index f4463e0f7d8..6b7a8e4e2ff 100644 --- a/source/blender/makesrna/intern/rna_pose_api.c +++ b/source/blender/makesrna/intern/rna_pose_api.c @@ -95,8 +95,8 @@ static void rna_PoseBone_compute_bbone_handles( BBoneSplineParameters params; - BKE_pchan_get_bbone_spline_parameters(pchan, rest, ¶ms); - BKE_compute_b_bone_handles(¶ms, ret_h1, ret_roll1, ret_h2, ret_roll2, ease || offsets, offsets); + BKE_pchan_bbone_spline_params_get(pchan, rest, ¶ms); + BKE_pchan_bbone_handles_compute(¶ms, ret_h1, ret_roll1, ret_h2, ret_roll2, ease || offsets, offsets); } #else |