From c12d9760209e104c89b3978443679356a57f89b1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 15 Apr 2018 11:45:51 +0200 Subject: Cleanup: ED_armature naming - Wasn't clear which functions handle edit-bones. - Mixed both ebone and edit_bone in names. - Didn't use ED_armature_* prefix for public API. See P655 to apply to branches. --- source/blender/editors/armature/armature_add.c | 54 +++++++++++----------- source/blender/editors/armature/armature_edit.c | 44 +++++++++--------- source/blender/editors/armature/armature_naming.c | 8 ++-- .../blender/editors/armature/armature_relations.c | 12 ++--- source/blender/editors/armature/armature_select.c | 32 ++++++------- .../blender/editors/armature/armature_skinning.c | 2 +- source/blender/editors/armature/armature_utils.c | 30 ++++++------ .../editors/armature/editarmature_generate.c | 6 +-- .../editors/armature/editarmature_retarget.c | 14 +++--- .../blender/editors/armature/editarmature_sketch.c | 2 +- source/blender/editors/armature/meshlaplacian.c | 2 +- source/blender/editors/armature/meshlaplacian.h | 2 +- source/blender/editors/armature/pose_select.c | 6 +-- source/blender/editors/armature/pose_transform.c | 2 +- 14 files changed, 108 insertions(+), 108 deletions(-) (limited to 'source/blender/editors/armature') diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index bd3ddfe93c6..cb072bee345 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -63,12 +63,12 @@ /* default bone add, returns it selected, but without tail set */ /* XXX should be used everywhere, now it mallocs bones still locally in functions */ -EditBone *ED_armature_edit_bone_add(bArmature *arm, const char *name) +EditBone *ED_armature_ebone_add(bArmature *arm, const char *name) { EditBone *bone = MEM_callocN(sizeof(EditBone), "eBone"); BLI_strncpy(bone->name, name, sizeof(bone->name)); - unique_editbone_name(arm->edbo, bone->name, NULL); + ED_armature_ebone_unique_name(arm->edbo, bone->name, NULL); BLI_addtail(arm->edbo, bone); @@ -97,15 +97,15 @@ EditBone *ED_armature_edit_bone_add(bArmature *arm, const char *name) return bone; } -EditBone *ED_armature_edit_bone_add_primitive(Object *obedit_arm, float length, bool view_aligned) +EditBone *ED_armature_ebone_add_primitive(Object *obedit_arm, float length, bool view_aligned) { bArmature *arm = obedit_arm->data; EditBone *bone; - ED_armature_deselect_all(obedit_arm); + ED_armature_edit_deselect_all(obedit_arm); /* Create a bone */ - bone = ED_armature_edit_bone_add(arm, "Bone"); + bone = ED_armature_ebone_add(arm, "Bone"); arm->act_edbone = bone; @@ -157,12 +157,12 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op)) to_root = 1; } - ED_armature_deselect_all(obedit); + ED_armature_edit_deselect_all(obedit); /* we re-use code for mirror editing... */ flipbone = NULL; if (arm->flag & ARM_MIRROR_EDIT) - flipbone = ED_armature_bone_get_mirrored(arm->edbo, ebone); + flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone); for (a = 0; a < 2; a++) { if (a == 1) { @@ -173,7 +173,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op)) } } - newbone = ED_armature_edit_bone_add(arm, ebone->name); + newbone = ED_armature_ebone_add(arm, ebone->name); arm->act_edbone = newbone; if (to_root) { @@ -205,7 +205,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op)) } - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); @@ -268,7 +268,7 @@ EditBone *add_points_bone(Object *obedit, float head[3], float tail[3]) { EditBone *ebo; - ebo = ED_armature_edit_bone_add(obedit->data, "Bone"); + ebo = ED_armature_ebone_add(obedit->data, "Bone"); copy_v3_v3(ebo->head, head); copy_v3_v3(ebo->tail, tail); @@ -333,7 +333,7 @@ void postEditBoneDuplicate(struct ListBase *editbones, Object *ob) for (EditBone *ebone_src = editbones->first; ebone_src; ebone_src = ebone_src->next) { EditBone *ebone_dst = ebone_src->temp.ebone; if (!ebone_dst) { - ebone_dst = ED_armature_bone_get_mirrored(editbones, ebone_src); + ebone_dst = ED_armature_ebone_get_mirrored(editbones, ebone_src); } if (ebone_dst) { BLI_ghash_insert(name_map, ebone_src->name, ebone_dst->name); @@ -438,7 +438,7 @@ EditBone *duplicateEditBoneObjects(EditBone *curBone, const char *name, ListBase BLI_strncpy(eBone->name, name, sizeof(eBone->name)); } - unique_editbone_name(editbones, eBone->name, NULL); + ED_armature_ebone_unique_name(editbones, eBone->name, NULL); BLI_addtail(editbones, eBone); /* copy the ID property */ @@ -487,7 +487,7 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op) const bool do_flip_names = RNA_boolean_get(op->ptr, "do_flip_names"); - ED_armature_sync_selection(arm->edbo); // XXX why is this needed? + ED_armature_edit_sync_selection(arm->edbo); // XXX why is this needed? preEditBoneDuplicate(arm->edbo); @@ -499,7 +499,7 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op) { EditBone *ebone; - ebone = ED_armature_bone_get_mirrored(arm->edbo, ebone_iter); + ebone = ED_armature_ebone_get_mirrored(arm->edbo, ebone_iter); if (ebone) { ebone->flag |= BONE_SELECTED; } @@ -522,7 +522,7 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op) /* Only use flipped name if not yet in use. Otherwise we'd get again inconsistent namings * (different numbers), better keep default behavior in this case. */ - if (ED_armature_bone_find_name(arm->edbo, new_bone_name_buff) == NULL) { + if (ED_armature_ebone_find_name(arm->edbo, new_bone_name_buff) == NULL) { new_bone_name = new_bone_name_buff; } } @@ -583,7 +583,7 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op) postEditBoneDuplicate(arm->edbo, obedit); - ED_armature_validate_active(arm); + ED_armature_edit_validate_active(arm); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); @@ -630,7 +630,7 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op) if (CTX_DATA_COUNT(C, selected_bones) == 0) return OPERATOR_CANCELLED; - ED_armature_sync_selection(arm->edbo); // XXX why is this needed? + ED_armature_edit_sync_selection(arm->edbo); // XXX why is this needed? preEditBoneDuplicate(arm->edbo); @@ -648,7 +648,7 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op) ebone_iter->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); } else { - EditBone *ebone = ED_armature_bone_find_name(arm->edbo, name_flip); + EditBone *ebone = ED_armature_ebone_find_name(arm->edbo, name_flip); if (ebone) { if ((ebone->flag & BONE_SELECTED) == 0) { @@ -738,7 +738,7 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op) /* the parent may have been duplicated, if not lookup the mirror parent */ EditBone *ebone_parent = (ebone_iter->parent->temp.ebone ? - ebone_iter->parent->temp.ebone : ED_armature_bone_get_mirrored(arm->edbo, ebone_iter->parent)); + ebone_iter->parent->temp.ebone : ED_armature_ebone_get_mirrored(arm->edbo, ebone_iter->parent)); if (ebone_parent == NULL) { /* If the mirror lookup failed, (but the current bone has a parent) @@ -759,7 +759,7 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op) } } - transform_armature_mirror_update(obedit); + ED_armature_edit_transform_mirror_update(obedit); /* Selected bones now have their 'temp' pointer set, * so we don't need this anymore */ @@ -786,7 +786,7 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op) postEditBoneDuplicate(arm->edbo, obedit); - ED_armature_validate_active(arm); + ED_armature_edit_validate_active(arm); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); @@ -870,7 +870,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op) /* we re-use code for mirror editing... */ flipbone = NULL; if (arm->flag & ARM_MIRROR_EDIT) { - flipbone = ED_armature_bone_get_mirrored(arm->edbo, ebone); + flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone); if (flipbone) { forked = 0; // we extrude 2 different bones if (flipbone->flag & (BONE_TIPSEL | BONE_ROOTSEL | BONE_SELECTED)) @@ -944,7 +944,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op) else strcat(newbone->name, "_R"); } } - unique_editbone_name(arm->edbo, newbone->name, NULL); + ED_armature_ebone_unique_name(arm->edbo, newbone->name, NULL); /* Add the new bone to the list */ BLI_addtail(arm->edbo, newbone); @@ -974,7 +974,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op) } /* Transform the endpoints */ - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); @@ -1027,10 +1027,10 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op) mul_m3_m3m3(totmat, obmat, viewmat); invert_m3_m3(imat, totmat); - ED_armature_deselect_all(obedit); + ED_armature_edit_deselect_all(obedit); /* Create a bone */ - bone = ED_armature_edit_bone_add(obedit->data, name); + bone = ED_armature_ebone_add(obedit->data, name); copy_v3_v3(bone->head, curs); @@ -1118,7 +1118,7 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op) newbone->prop = NULL; - unique_editbone_name(arm->edbo, newbone->name, NULL); + ED_armature_ebone_unique_name(arm->edbo, newbone->name, NULL); /* correct parent bones */ for (tbone = arm->edbo->first; tbone; tbone = tbone->next) { diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index 9a4a0eecfcd..3879d67964c 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -66,7 +66,7 @@ /* ************************** Object Tools Exports ******************************* */ /* NOTE: these functions are exported to the Object module to be called from the tools there */ -void ED_armature_apply_transform(Object *ob, float mat[4][4], const bool do_props) +void ED_armature_transform_apply(Object *ob, float mat[4][4], const bool do_props) { bArmature *arm = ob->data; @@ -205,7 +205,7 @@ void ED_armature_origin_set(Scene *scene, Object *ob, float cursor[3], int cente /* adjust bone roll to align Z axis with vector * vec is in local space and is normalized */ -float ED_rollBoneToVector(EditBone *bone, const float align_axis[3], const bool axis_only) +float ED_armature_ebone_roll_to_vector(EditBone *bone, const float align_axis[3], const bool axis_only) { float mat[3][3], nor[3]; float vec[3], align_axis_proj[3], roll = 0.0f; @@ -331,7 +331,7 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op) sub_v3_v3v3(cursor_rel, cursor_local, ebone->head); if (axis_flip) negate_v3(cursor_rel); if (normalize_v3(cursor_rel) != 0.0f) { - ebone->roll = ED_rollBoneToVector(ebone, cursor_rel, axis_only); + ebone->roll = ED_armature_ebone_roll_to_vector(ebone, cursor_rel, axis_only); } } } @@ -370,13 +370,13 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op) if (axis_flip) negate_v3(vec); if (is_edit) { - ebone->roll = ED_rollBoneToVector(ebone, vec, axis_only); + ebone->roll = ED_armature_ebone_roll_to_vector(ebone, vec, axis_only); } /* parentless bones use cross product with child */ if (is_edit_parent) { if (ebone->parent->parent == NULL) { - ebone->parent->roll = ED_rollBoneToVector(ebone->parent, vec, axis_only); + ebone->parent->roll = ED_armature_ebone_roll_to_vector(ebone->parent, vec, axis_only); } } } @@ -420,7 +420,7 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op) for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { if (EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) { /* roll func is a callback which assumes that all is well */ - ebone->roll = ED_rollBoneToVector(ebone, vec, axis_only); + ebone->roll = ED_armature_ebone_roll_to_vector(ebone, vec, axis_only); } } } @@ -428,7 +428,7 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op) if (arm->flag & ARM_MIRROR_EDIT) { for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { if ((EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) == 0) { - EditBone *ebone_mirr = ED_armature_bone_get_mirrored(arm->edbo, ebone); + EditBone *ebone_mirr = ED_armature_ebone_get_mirrored(arm->edbo, ebone); if (ebone_mirr && (EBONE_VISIBLE(arm, ebone_mirr) && EBONE_EDITABLE(ebone_mirr))) { ebone->roll = -ebone_mirr->roll; } @@ -482,7 +482,7 @@ static int armature_roll_clear_exec(bContext *C, wmOperator *op) if (arm->flag & ARM_MIRROR_EDIT) { for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { if ((EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) == 0) { - EditBone *ebone_mirr = ED_armature_bone_get_mirrored(arm->edbo, ebone); + EditBone *ebone_mirr = ED_armature_ebone_get_mirrored(arm->edbo, ebone); if (ebone_mirr && (EBONE_VISIBLE(arm, ebone_mirr) && EBONE_EDITABLE(ebone_mirr))) { ebone->roll = -ebone_mirr->roll; } @@ -771,7 +771,7 @@ static int armature_fill_bones_exec(bContext *C, wmOperator *op) } if (newbone) { - ED_armature_deselect_all(obedit); + ED_armature_edit_deselect_all(obedit); arm->act_edbone = newbone; newbone->flag |= BONE_TIPSEL; } @@ -883,7 +883,7 @@ static void bones_merge(Object *obedit, EditBone *start, EditBone *end, EditBone } newbone->flag |= (BONE_ROOTSEL | BONE_TIPSEL | BONE_SELECTED); - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); } @@ -959,7 +959,7 @@ static int armature_merge_exec(bContext *C, wmOperator *op) } /* updates */ - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, obedit); return OPERATOR_FINISHED; @@ -1181,7 +1181,7 @@ static int armature_align_bones_exec(bContext *C, wmOperator *op) * - if there's no mirrored copy of actbone (i.e. actbone = "parent.C" or "parent") * then just use actbone. Useful when doing upper arm to spine. */ - actmirb = ED_armature_bone_get_mirrored(arm->edbo, actbone); + actmirb = ED_armature_ebone_get_mirrored(arm->edbo, actbone); if (actmirb == NULL) actmirb = actbone; } @@ -1293,7 +1293,7 @@ static bool armature_delete_ebone_cb(const char *bone_name, void *arm_p) bArmature *arm = arm_p; EditBone *ebone; - ebone = ED_armature_bone_find_name(arm->edbo, bone_name); + ebone = ED_armature_ebone_find_name(arm->edbo, bone_name); return (ebone && (ebone->flag & BONE_SELECTED) && (arm->layer & ebone->layer)); } @@ -1320,7 +1320,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op)) if (arm->layer & curBone->layer) { if (curBone->flag & BONE_SELECTED) { if (curBone == arm->act_edbone) arm->act_edbone = NULL; - ED_armature_edit_bone_remove(arm, curBone); + ED_armature_ebone_remove(arm, curBone); changed = true; } } @@ -1329,7 +1329,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op)) if (!changed) return OPERATOR_CANCELLED; - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); BKE_pose_tag_recalc(CTX_data_main(C), obedit->pose); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); @@ -1358,7 +1358,7 @@ static bool armature_dissolve_ebone_cb(const char *bone_name, void *arm_p) bArmature *arm = arm_p; EditBone *ebone; - ebone = ED_armature_bone_find_name(arm->edbo, bone_name); + ebone = ED_armature_ebone_find_name(arm->edbo, bone_name); return (ebone && (ebone->flag & BONE_DONE)); } @@ -1460,7 +1460,7 @@ static int armature_dissolve_selected_exec(bContext *C, wmOperator *UNUSED(op)) ebone->parent->rad_tail = ebone->rad_tail; SET_FLAG_FROM_TEST(ebone->parent->flag, ebone->flag & BONE_TIPSEL, BONE_TIPSEL); - ED_armature_edit_bone_remove_ex(arm, ebone, false); + ED_armature_ebone_remove_ex(arm, ebone, false); changed = true; } } @@ -1493,7 +1493,7 @@ static int armature_dissolve_selected_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; } - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); @@ -1538,8 +1538,8 @@ static int armature_hide_exec(bContext *C, wmOperator *op) } } } - ED_armature_validate_active(arm); - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_validate_active(arm); + ED_armature_edit_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); @@ -1581,8 +1581,8 @@ static int armature_reveal_exec(bContext *C, wmOperator *op) } } } - ED_armature_validate_active(arm); - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_validate_active(arm); + ED_armature_edit_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index 32635541a35..d5ed1380a7e 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -73,11 +73,11 @@ static bool editbone_unique_check(void *arg, const char *name) { struct {ListBase *lb; void *bone; } *data = arg; - EditBone *dupli = ED_armature_bone_find_name(data->lb, name); + EditBone *dupli = ED_armature_ebone_find_name(data->lb, name); return dupli && dupli != data->bone; } -void unique_editbone_name(ListBase *edbo, char *name, EditBone *bone) +void ED_armature_ebone_unique_name(ListBase *edbo, char *name, EditBone *bone) { struct {ListBase *lb; void *bone; } data; data.lb = edbo; @@ -152,10 +152,10 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n /* now check if we're in editmode, we need to find the unique name */ if (arm->edbo) { - EditBone *eBone = ED_armature_bone_find_name(arm->edbo, oldname); + EditBone *eBone = ED_armature_ebone_find_name(arm->edbo, oldname); if (eBone) { - unique_editbone_name(arm->edbo, newname, NULL); + ED_armature_ebone_unique_name(arm->edbo, newname, NULL); BLI_strncpy(eBone->name, newname, MAXBONENAME); } else { diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index dfe7876175f..3c272d52d1c 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -309,10 +309,10 @@ int join_armature_exec(bContext *C, wmOperator *op) /* Copy bones and posechannels from the object to the edit armature */ for (pchan = opose->chanbase.first; pchan; pchan = pchann) { pchann = pchan->next; - curbone = ED_armature_bone_find_name(curarm->edbo, pchan->name); + curbone = ED_armature_ebone_find_name(curarm->edbo, pchan->name); /* Get new name */ - unique_editbone_name(arm->edbo, curbone->name, NULL); + ED_armature_ebone_unique_name(arm->edbo, curbone->name, NULL); BLI_ghash_insert(afd.names_map, BLI_strdup(pchan->name), curbone->name); /* Transform the bone */ @@ -525,7 +525,7 @@ static void separate_armature_bones(Object *ob, short sel) /* go through pose-channels, checking if a bone should be removed */ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchann) { pchann = pchan->next; - curbone = ED_armature_bone_find_name(arm->edbo, pchan->name); + curbone = ED_armature_ebone_find_name(arm->edbo, pchan->name); /* check if bone needs to be removed */ if ( (sel && (curbone->flag & BONE_SELECTED)) || @@ -632,7 +632,7 @@ static int separate_armature_exec(bContext *C, wmOperator *op) ED_armature_to_edit(obedit->data); /* parents tips remain selected when connected children are removed. */ - ED_armature_deselect_all(obedit); + ED_armature_edit_deselect_all(obedit); BKE_report(op->reports, RPT_INFO, "Separated bones"); @@ -752,7 +752,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op) * - if there's no mirrored copy of actbone (i.e. actbone = "parent.C" or "parent") * then just use actbone. Useful when doing upper arm to spine. */ - actmirb = ED_armature_bone_get_mirrored(arm->edbo, actbone); + actmirb = ED_armature_ebone_get_mirrored(arm->edbo, actbone); if (actmirb == NULL) actmirb = actbone; } @@ -875,7 +875,7 @@ static int armature_parent_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob); diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index 2e2c184e43d..d81e557dbfd 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -62,7 +62,7 @@ /* **************** PoseMode & EditMode Selection Buffer Queries *************************** */ /* only for opengl selection indices */ -Bone *get_indexed_bone(Object *ob, int index) +Bone *ED_armature_bone_find_index(Object *ob, int index) { bPoseChannel *pchan; if (ob->pose == NULL) return NULL; @@ -99,7 +99,7 @@ void *get_bone_from_selectbuffer( if (obedit == NULL || base->object != obedit) { /* no singular posemode, so check for correct object */ if (base->selcol == (hitresult & 0xFFFF)) { - bone = get_indexed_bone(base->object, hitresult); + bone = ED_armature_bone_find_index(base->object, hitresult); if (findunsel) sel = (bone->flag & BONE_SELECTED); @@ -244,7 +244,7 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, const wmEv bone = NULL; } - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); @@ -441,7 +441,7 @@ cache_end: return NULL; } -void ED_armature_deselect_all(Object *obedit) +void ED_armature_edit_deselect_all(Object *obedit) { bArmature *arm = obedit->data; EditBone *ebone; @@ -451,7 +451,7 @@ void ED_armature_deselect_all(Object *obedit) } } -void ED_armature_deselect_all_visible(Object *obedit) +void ED_armature_edit_deselect_all_visible(Object *obedit) { bArmature *arm = obedit->data; EditBone *ebone; @@ -463,7 +463,7 @@ void ED_armature_deselect_all_visible(Object *obedit) } } - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); } /* accounts for connected parents */ @@ -478,7 +478,7 @@ static int ebone_select_flag(EditBone *ebone) } /* context: editmode armature in view3d */ -bool ED_armature_select_pick(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle) +bool ED_armature_edit_select_pick(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle) { Object *obedit = CTX_data_edit_object(C); bArmature *arm = obedit->data; @@ -496,7 +496,7 @@ bool ED_armature_select_pick(bContext *C, const int mval[2], bool extend, bool d if (nearBone) { if (!extend && !deselect && !toggle) { - ED_armature_deselect_all(obedit); + ED_armature_edit_deselect_all(obedit); } /* by definition the non-root connected bones have no root point drawn, @@ -567,7 +567,7 @@ bool ED_armature_select_pick(bContext *C, const int mval[2], bool extend, bool d nearBone->flag |= selmask; } - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); if (nearBone) { /* then now check for active status */ @@ -711,7 +711,7 @@ static void armature_select_more_less(Object *ob, bool more) EditBone *ebone; /* XXX, eventually we shouldn't need this - campbell */ - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); /* count bones & store selection state */ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { @@ -741,7 +741,7 @@ static void armature_select_more_less(Object *ob, bool more) ebone->temp.p = NULL; } - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); } static int armature_de_select_more_exec(bContext *C, wmOperator *UNUSED(op)) @@ -1146,7 +1146,7 @@ static int armature_select_hierarchy_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob); @@ -1202,7 +1202,7 @@ static int armature_select_mirror_exec(bContext *C, wmOperator *op) EditBone *ebone_mirror; int flag_new = extend ? EBONE_PREV_FLAG_GET(ebone) : 0; - if ((ebone_mirror = ED_armature_bone_get_mirrored(arm->edbo, ebone)) && + if ((ebone_mirror = ED_armature_ebone_get_mirrored(arm->edbo, ebone)) && (EBONE_VISIBLE(arm, ebone_mirror))) { const int flag_mirror = EBONE_PREV_FLAG_GET(ebone_mirror); @@ -1226,7 +1226,7 @@ static int armature_select_mirror_exec(bContext *C, wmOperator *op) arm->act_edbone = ebone_mirror_act; } - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); @@ -1311,7 +1311,7 @@ static int armature_shortest_path_pick_invoke(bContext *C, wmOperator *op, const else if (ED_armature_ebone_is_child_recursive(ebone_dst, ebone_src)) { SWAP(EditBone *, ebone_src, ebone_dst); } - else if ((ebone_isect_parent = ED_armature_bone_find_shared_parent(ebone_isect_child, 2))) { + else if ((ebone_isect_parent = ED_armature_ebone_find_shared_parent(ebone_isect_child, 2))) { /* pass */ } else { @@ -1346,7 +1346,7 @@ static int armature_shortest_path_pick_invoke(bContext *C, wmOperator *op, const if (changed) { arm->act_edbone = ebone_dst; - ED_armature_sync_selection(arm->edbo); + ED_armature_edit_sync_selection(arm->edbo); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); return OPERATOR_FINISHED; diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c index e8d41f722d7..0458fc4ed1b 100644 --- a/source/blender/editors/armature/armature_skinning.c +++ b/source/blender/editors/armature/armature_skinning.c @@ -424,7 +424,7 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, MEM_freeN(verts); } -void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, Object *par, +void ED_object_vgroup_calc_from_armature(ReportList *reports, Scene *scene, Object *ob, Object *par, const int mode, const bool mirror) { /* Lets try to create some vertex groups diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index 03d1c5e3d4d..8867189baef 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -53,7 +53,7 @@ /* Validation */ /* Sync selection to parent for connected children */ -void ED_armature_sync_selection(ListBase *edbo) +void ED_armature_edit_sync_selection(ListBase *edbo) { EditBone *ebo; @@ -75,7 +75,7 @@ void ED_armature_sync_selection(ListBase *edbo) } } -void ED_armature_validate_active(struct bArmature *arm) +void ED_armature_edit_validate_active(struct bArmature *arm) { EditBone *ebone = arm->act_edbone; @@ -136,7 +136,7 @@ void bone_free(bArmature *arm, EditBone *bone) /** * \param clear_connected: When false caller is responsible for keeping the flag in a valid state. */ -void ED_armature_edit_bone_remove_ex(bArmature *arm, EditBone *exBone, bool clear_connected) +void ED_armature_ebone_remove_ex(bArmature *arm, EditBone *exBone, bool clear_connected) { EditBone *curBone; @@ -153,9 +153,9 @@ void ED_armature_edit_bone_remove_ex(bArmature *arm, EditBone *exBone, bool clea bone_free(arm, exBone); } -void ED_armature_edit_bone_remove(bArmature *arm, EditBone *exBone) +void ED_armature_ebone_remove(bArmature *arm, EditBone *exBone) { - ED_armature_edit_bone_remove_ex(arm, exBone, true); + ED_armature_ebone_remove_ex(arm, exBone, true); } bool ED_armature_ebone_is_child_recursive(EditBone *ebone_parent, EditBone *ebone_child) @@ -174,7 +174,7 @@ bool ED_armature_ebone_is_child_recursive(EditBone *ebone_parent, EditBone *ebon * \param ebone_child_tot Size of the ebone_child array * \return The shared parent or NULL. */ -EditBone *ED_armature_bone_find_shared_parent(EditBone *ebone_child[], const unsigned int ebone_child_tot) +EditBone *ED_armature_ebone_find_shared_parent(EditBone *ebone_child[], const unsigned int ebone_child_tot) { unsigned int i; EditBone *ebone_iter; @@ -254,7 +254,7 @@ void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4]) /** * Return a pointer to the bone of the given name */ -EditBone *ED_armature_bone_find_name(const ListBase *edbo, const char *name) +EditBone *ED_armature_ebone_find_name(const ListBase *edbo, const char *name) { return BLI_findstring(edbo, name, offsetof(EditBone, name)); } @@ -266,7 +266,7 @@ EditBone *ED_armature_bone_find_name(const ListBase *edbo, const char *name) /** * \see #BKE_pose_channel_get_mirrored (pose-mode, matching function) */ -EditBone *ED_armature_bone_get_mirrored(const ListBase *edbo, EditBone *ebo) +EditBone *ED_armature_ebone_get_mirrored(const ListBase *edbo, EditBone *ebo) { char name_flip[MAXBONENAME]; @@ -276,7 +276,7 @@ EditBone *ED_armature_bone_get_mirrored(const ListBase *edbo, EditBone *ebo) BLI_string_flip_side_name(name_flip, ebo->name, false, sizeof(name_flip)); if (!STREQ(name_flip, ebo->name)) { - return ED_armature_bone_find_name(edbo, name_flip); + return ED_armature_ebone_find_name(edbo, name_flip); } return NULL; @@ -296,7 +296,7 @@ void armature_select_mirrored_ex(bArmature *arm, const int flag) for (curBone = arm->edbo->first; curBone; curBone = curBone->next) { if (arm->layer & curBone->layer) { if (curBone->flag & flag) { - ebone_mirr = ED_armature_bone_get_mirrored(arm->edbo, curBone); + ebone_mirr = ED_armature_ebone_get_mirrored(arm->edbo, curBone); if (ebone_mirr) ebone_mirr->flag |= (curBone->flag & flag); } @@ -325,7 +325,7 @@ void armature_tag_select_mirrored(bArmature *arm) for (curBone = arm->edbo->first; curBone; curBone = curBone->next) { if (arm->layer & curBone->layer) { if (curBone->flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL)) { - EditBone *ebone_mirr = ED_armature_bone_get_mirrored(arm->edbo, curBone); + EditBone *ebone_mirr = ED_armature_ebone_get_mirrored(arm->edbo, curBone); if (ebone_mirr && (ebone_mirr->flag & BONE_SELECTED) == 0) { ebone_mirr->flag |= BONE_DONE; } @@ -335,7 +335,7 @@ void armature_tag_select_mirrored(bArmature *arm) for (curBone = arm->edbo->first; curBone; curBone = curBone->next) { if (curBone->flag & BONE_DONE) { - EditBone *ebone_mirr = ED_armature_bone_get_mirrored(arm->edbo, curBone); + EditBone *ebone_mirr = ED_armature_ebone_get_mirrored(arm->edbo, curBone); curBone->flag |= ebone_mirr->flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL); } } @@ -358,7 +358,7 @@ void armature_tag_unselect(bArmature *arm) /* if editbone (partial) selected, copy data */ /* context; editmode armature, with mirror editing enabled */ -void transform_armature_mirror_update(Object *obedit) +void ED_armature_edit_transform_mirror_update(Object *obedit) { bArmature *arm = obedit->data; EditBone *ebo, *eboflip; @@ -366,7 +366,7 @@ void transform_armature_mirror_update(Object *obedit) for (ebo = arm->edbo->first; ebo; ebo = ebo->next) { /* no layer check, correct mirror is more important */ if (ebo->flag & (BONE_TIPSEL | BONE_ROOTSEL)) { - eboflip = ED_armature_bone_get_mirrored(arm->edbo, ebo); + eboflip = ED_armature_ebone_get_mirrored(arm->edbo, ebo); if (eboflip) { /* we assume X-axis flipping for now */ @@ -436,7 +436,7 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone eBone = MEM_callocN(sizeof(EditBone), "make_editbone"); /* Copy relevant data from bone to eBone - * Keep selection logic in sync with ED_armature_sync_selection. + * Keep selection logic in sync with ED_armature_edit_sync_selection. */ eBone->parent = parent; BLI_strncpy(eBone->name, curBone->name, sizeof(eBone->name)); diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c index 4eb9e3ecc79..57843265496 100644 --- a/source/blender/editors/armature/editarmature_generate.c +++ b/source/blender/editors/armature/editarmature_generate.c @@ -39,7 +39,7 @@ void setBoneRollFromNormal(EditBone *bone, const float no[3], float UNUSED(invma copy_v3_v3(normal, no); mul_m3_v3(tmat, normal); - bone->roll = ED_rollBoneToVector(bone, normal, false); + bone->roll = ED_armature_ebone_roll_to_vector(bone, normal, false); } } @@ -252,7 +252,7 @@ EditBone *subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *U IT_head(iter); - parent = ED_armature_edit_bone_add(arm, "Bone"); + parent = ED_armature_ebone_add(arm, "Bone"); copy_v3_v3(parent->head, iter->p); if (iter->size > FLT_EPSILON) { @@ -265,7 +265,7 @@ EditBone *subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *U while (index != -1) { IT_peek(iter, index); - child = ED_armature_edit_bone_add(arm, "Bone"); + child = ED_armature_ebone_add(arm, "Bone"); copy_v3_v3(child->head, parent->tail); child->parent = parent; child->flag |= BONE_CONNECTED; diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index 3dd41f25e09..bf6126658af 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -158,11 +158,11 @@ static float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float q if (angle_normalized_v3v3(x_axis, new_up_axis) < angle_normalized_v3v3(z_axis, new_up_axis)) { rotation_between_vecs_to_quat(qroll, new_up_axis, x_axis); /* set roll rotation quat */ - return ED_rollBoneToVector(bone, x_axis, false); + return ED_armature_ebone_roll_to_vector(bone, x_axis, false); } else { rotation_between_vecs_to_quat(qroll, new_up_axis, z_axis); /* set roll rotation quat */ - return ED_rollBoneToVector(bone, z_axis, false); + return ED_armature_ebone_roll_to_vector(bone, z_axis, false); } } @@ -207,7 +207,7 @@ static float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4] /* real qroll between normal and up_axis */ rotation_between_vecs_to_quat(qroll, new_up_axis, normal); - return ED_rollBoneToVector(edge->bone, normal, false); + return ED_armature_ebone_roll_to_vector(edge->bone, normal, false); } } @@ -218,7 +218,7 @@ float rollBoneByQuat(EditBone *bone, float old_up_axis[3], float qrot[4]) copy_v3_v3(new_up_axis, old_up_axis); mul_qt_v3(qrot, new_up_axis); - return ED_rollBoneToVector(bone, new_up_axis, false); + return ED_armature_ebone_roll_to_vector(bone, new_up_axis, false); } /************************************ DESTRUCTORS ******************************************************/ @@ -424,7 +424,7 @@ static void renameTemplateBone(char *name, char *template_name, ListBase *editbo name[j] = '\0'; - unique_editbone_name(editbones, name, NULL); + ED_armature_ebone_unique_name(editbones, name, NULL); } static RigControl *cloneControl(RigGraph *rg, RigGraph *src_rg, RigControl *src_ctrl, GHash *ptr_hash, char *side_string, char *num_string) @@ -1435,7 +1435,7 @@ static EditBone *add_editbonetolist(char *name, ListBase *list) EditBone *bone = MEM_callocN(sizeof(EditBone), "eBone"); BLI_strncpy(bone->name, name, sizeof(bone->name)); - unique_editbone_name(list, bone->name, NULL); + ED_armature_ebone_unique_name(list, bone->name, NULL); BLI_addtail(list, bone); @@ -2626,7 +2626,7 @@ void BIF_retargetArc(bContext *C, ReebArc *earc, RigGraph *template_rigg) } RIG_freeRigGraph((BGraph *)rigg); - ED_armature_validate_active(armedit); + ED_armature_edit_validate_active(armedit); // XXX // allqueue(REDRAWVIEW3D, 0); diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 79b538b4f4a..a08898a37f6 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -1334,7 +1334,7 @@ static void sk_convertStroke(bContext *C, SK_Stroke *stk) } if (bone == NULL) { - bone = ED_armature_edit_bone_add(arm, "Bone"); + bone = ED_armature_ebone_add(arm, "Bone"); copy_v3_v3(bone->head, head->p); copy_v3_v3(bone->tail, pt->p); diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 9500fd59b8b..3c0bb4fe609 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -1633,7 +1633,7 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa free_bvhtree_from_mesh(&mdb->bvhdata); } -void mesh_deform_bind( +void ED_mesh_deform_bind_callback( Scene *scene, MeshDeformModifierData *mmd, DerivedMesh *cagedm, float *vertexcos, int totvert, float cagemat[4][4]) { diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h index bba8c739abf..202ac8e9b70 100644 --- a/source/blender/editors/armature/meshlaplacian.h +++ b/source/blender/editors/armature/meshlaplacian.h @@ -67,7 +67,7 @@ void rigid_deform_end(int cancel); /* Harmonic Coordinates */ -/* mesh_deform_bind(...) defined in ED_armature.h */ +/* ED_mesh_deform_bind_callback(...) defined in ED_armature.h */ #endif diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index 281f0428d19..4b62fd15c04 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -132,7 +132,7 @@ void ED_pose_bone_select(Object *ob, bPoseChannel *pchan, bool select) /* called from editview.c, for mode-less pose selection */ /* assumes scene obact and basact is still on old situation */ -bool ED_do_pose_selectbuffer( +bool ED_armature_pose_select_pick_with_buffer( Scene *scene, Base *base, const unsigned int *buffer, short hits, bool extend, bool deselect, bool toggle, bool do_nearest) { @@ -163,7 +163,7 @@ bool ED_do_pose_selectbuffer( } if (!extend && !deselect && !toggle) { - ED_pose_de_selectall(ob, SEL_DESELECT, true); + ED_pose_deselect_all(ob, SEL_DESELECT, true); nearBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); arm->act_bone = nearBone; } @@ -217,7 +217,7 @@ bool ED_do_pose_selectbuffer( /* 'select_mode' is usual SEL_SELECT/SEL_DESELECT/SEL_TOGGLE/SEL_INVERT. * When true, 'ignore_visibility' makes this func also affect invisible bones (hidden or on hidden layers). */ -void ED_pose_de_selectall(Object *ob, int select_mode, const bool ignore_visibility) +void ED_pose_deselect_all(Object *ob, int select_mode, const bool ignore_visibility) { bArmature *arm = ob->data; bPoseChannel *pchan; diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index a44accd1cea..446bab00b70 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -121,7 +121,7 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op) pose = ob->pose; for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { - curbone = ED_armature_bone_find_name(arm->edbo, pchan->name); + curbone = ED_armature_ebone_find_name(arm->edbo, pchan->name); /* simply copy the head/tail values from pchan over to curbone */ copy_v3_v3(curbone->head, pchan->pose_head); -- cgit v1.2.3 From 0f2efce6c50718d7745a6dc1613acf62a186cc05 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 15 Apr 2018 11:57:49 +0200 Subject: Cleanup: remove bad casts --- source/blender/editors/armature/armature_edit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/armature') diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index 3879d67964c..ccbb2e95fc1 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -205,7 +205,7 @@ void ED_armature_origin_set(Scene *scene, Object *ob, float cursor[3], int cente /* adjust bone roll to align Z axis with vector * vec is in local space and is normalized */ -float ED_armature_ebone_roll_to_vector(EditBone *bone, const float align_axis[3], const bool axis_only) +float ED_armature_ebone_roll_to_vector(const EditBone *bone, const float align_axis[3], const bool axis_only) { float mat[3][3], nor[3]; float vec[3], align_axis_proj[3], roll = 0.0f; -- cgit v1.2.3