101 Main *bmain,
Object *ob,
const float cursor[3],
int centermode,
int around)
109 if (is_editmode ==
false) {
114 if (centermode == 2) {
150 if (is_editmode ==
false) {
156 if (centermode && (is_editmode ==
false)) {
169 const float align_axis[3],
170 const bool axis_only)
172 float mat[3][3],
nor[3];
173 float vec[3], align_axis_proj[3], roll = 0.0f;
268 uint objects_len = 0;
271 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
272 Object *ob = objects[ob_index];
274 bool changed =
false;
289 float cursor_local[3];
318 if (is_edit || is_edit_parent) {
339 }
while ((is_vec_zero = (
normalize_v3(vec) < 0.00001f)) &&
340 (ebone_other = ebone_other->
parent));
353 if (is_edit_parent) {
356 ebone->
parent, vec, axis_only);
366 float vec[3] = {0.0f, 0.0f, 0.0f};
397 vec[
type - 2] = -1.0f;
442 ot->
name =
"Recalculate Roll";
443 ot->
idname =
"ARMATURE_OT_calculate_roll";
444 ot->
description =
"Automatically fix alignment of select bones' axes";
461 "Ignore the axis direction, use the shortest rotation to align");
469 uint objects_len = 0;
472 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
473 Object *ob = objects[ob_index];
475 bool changed =
false;
490 ebone->roll = -ebone_mirr->
roll;
512 ot->
idname =
"ARMATURE_OT_roll_clear";
557 for (curBone = edbo->
first; curBone; curBone = curBone->
next) {
561 for (ld = list->
first; ld; ld = ld->
next) {
562 for (ebo = ld->
data; ebo; ebo = ebo->
parent) {
563 if (ebo == curBone) {
581 for (ld = list->
first; ld; ld = ld->
next) {
582 if (ld->
data == ebo) {
624 for (ebp = points->
first; ebp; ebp = ebp->
next) {
670 bool mixed_object_error =
false;
686 if (arm && (arm != arm_iter)) {
687 mixed_object_error =
true;
706 if (mixed_object_error) {
716 if (ob_iter->data == arm) {
738 else if (
count == 2) {
740 float head[3], tail[3];
766 float dist_sq_a, dist_sq_b;
777 headtail = (dist_sq_a < dist_sq_b) ? 2 : 1;
792 else if (headtail == 1) {
853 ot->
name =
"Fill Between Joints";
855 ot->
description =
"Add bone between selected joint(s) and/or 3D cursor";
888 uint objects_len = 0;
892 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
893 Object *ob = objects[ob_index];
915 for (chain = chains.
first; chain; chain = chain->
next) {
919 for (ebo = chain->
data; ebo; ebo = parent) {
991 ot->
name =
"Switch Direction";
992 ot->
idname =
"ARMATURE_OT_switch_direction";
993 ot->
description =
"Change the direction that a chain of bones points in (head and tail swap)";
1030 for (selbone = edbo->
first; selbone; selbone = selbone->
next) {
1040 float selboneaxis[3], actboneaxis[3],
length;
1064 int num_selected_bones;
1067 if (actbone ==
NULL) {
1081 if (actmirb ==
NULL) {
1090 if (num_selected_bones <= 1) {
1094 if (actbone->parent) {
1115 if (
ELEM(ebone, actbone, actmirb) == 0) {
1127 op->
reports,
RPT_INFO,
"%d bones aligned to bone '%s'", num_selected_bones, actbone->name);
1140 ot->
name =
"Align Bones";
1142 ot->
description =
"Align selected bones to the active bone (or to their parent)";
1162 uint objects_len = 0;
1165 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1166 Object *ob = objects[ob_index];
1171 bone->parent =
NULL;
1192 ot->
description =
"Split off selected bones from connected unselected bones";
1222 bool changed_multi =
false;
1230 uint objects_len = 0;
1233 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1234 Object *obedit = objects[ob_index];
1236 bool changed =
false;
1242 for (curBone = arm->
edbo->
first; curBone; curBone = ebone_next) {
1243 ebone_next = curBone->
next;
1256 changed_multi =
true;
1268 if (!changed_multi) {
1278 ot->
name =
"Delete Selected Bone(s)";
1280 ot->
description =
"Remove selected bones from the armature";
1304 bool changed_multi =
false;
1306 uint objects_len = 0;
1309 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1310 Object *obedit = objects[ob_index];
1312 bool changed =
false;
1318 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1328 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1333 val.flag = ebone->
flag;
1345 val_p->flag = ebone->
flag & ~val_p->flag;
1349 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1366 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1372 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1387 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1396 for (ebone = arm->
edbo->
first; ebone; ebone = ebone_next) {
1397 ebone_next = ebone->
next;
1410 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1417 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1422 if (val_p && val_p->flag) {
1423 ebone->
flag &= ~val_p->flag;
1434 changed_multi =
true;
1444 if (!changed_multi) {
1454 ot->
name =
"Dissolve Selected Bone(s)";
1455 ot->
idname =
"ARMATURE_OT_dissolve";
1456 ot->
description =
"Dissolve selected bones from the armature";
1482 uint objects_len = 0;
1485 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1486 Object *obedit = objects[ob_index];
1488 bool changed =
false;
1516 ot->
name =
"Hide Selected";
1518 ot->
description =
"Tag selected bones to not be visible in Edit Mode";
1541 uint objects_len = 0;
1544 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1545 Object *obedit = objects[ob_index];
1547 bool changed =
false;
1550 if (arm->
layer & ebone->layer) {
1576 ot->
name =
"Reveal Hidden";
Blender kernel action and pose functionality.
void BKE_pose_channels_remove(struct Object *ob, bool(*filter_fn)(const char *bone_name, void *user_data), void *user_data)
void BKE_pose_tag_recalc(struct Main *bmain, struct bPose *pose)
void BKE_armature_transform(struct bArmature *arm, const float mat[4][4], bool do_props)
void mat3_to_vec_roll(const float mat[3][3], float r_vec[3], float *r_roll)
void vec_roll_to_mat3_normalized(const float nor[3], float roll, float r_mat[3][3])
#define CTX_DATA_BEGIN_WITH_ID(C, Type, instance, member, Type_id, instance_id)
struct Scene * CTX_data_scene(const bContext *C)
struct Object * CTX_data_edit_object(const bContext *C)
#define CTX_DATA_BEGIN(C, Type, instance, member)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct EditBone * CTX_data_active_bone(const bContext *C)
#define CTX_DATA_COUNT(C, member)
struct Main * CTX_data_main(const bContext *C)
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
#define BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, v3d, r_len)
#define FOREACH_OBJECT_IN_MODE_END
#define FOREACH_OBJECT_IN_EDIT_MODE_BEGIN(_view_layer, _v3d, _instance)
General operations, lookup, etc. for blender objects.
bool BKE_object_is_in_editmode(const struct Object *ob)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
BLI_INLINE void * BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
BLI_INLINE void ** BLI_ghashIterator_getValue_p(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
#define GHASH_ITER(gh_iter_, ghash_)
GHash * BLI_ghash_ptr_new_ex(const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void ** BLI_ghash_lookup_p(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define BLI_ASSERT_UNIT_V3(v)
void mul_m3_v3(const float M[3][3], float r[3])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
void mul_mat3_m4_v3(const float M[4][4], float r[3])
bool invert_m4_m4(float R[4][4], const float A[4][4])
void normalize_m3(float R[3][3]) ATTR_NONNULL()
void mul_m4_v3(const float M[4][4], float r[3])
float mat4_to_scale(const float M[4][4])
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
bool invert_m3(float R[3][3])
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
float angle_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void project_v3_v3v3_normalized(float out[3], const float p[3], const float v_proj[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void negate_v3(float r[3])
MINLINE bool equals_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void swap_v3_v3(float a[3], float b[3])
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
#define INIT_MINMAX(min, max)
#define SET_FLAG_FROM_TEST(value, test, flag)
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_COPY_ON_WRITE
Object is a sort of wrapper for general info.
@ V3D_AROUND_CENTER_BOUNDS
#define EBONE_VISIBLE(arm, ebone)
#define EBONE_EDITABLE(ebone)
void ED_outliner_select_sync_from_edit_bone_tag(struct bContext *C)
bool ED_operator_editarmature(struct bContext *C)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
#define RNA_ENUM_ITEM_HEADING(name, description)
EditBone * add_points_bone(Object *obedit, float head[3], float tail[3])
void ARMATURE_OT_hide(wmOperatorType *ot)
void ARMATURE_OT_delete(wmOperatorType *ot)
static void armature_clear_swap_done_flags(bArmature *arm)
static int armature_roll_clear_exec(bContext *C, wmOperator *op)
static bool armature_delete_ebone_cb(const char *bone_name, void *arm_p)
static int armature_dissolve_selected_exec(bContext *C, wmOperator *UNUSED(op))
static void fix_editbone_connected_children(ListBase *edbo, EditBone *ebone)
static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
void ARMATURE_OT_roll_clear(wmOperatorType *ot)
void ARMATURE_OT_fill(wmOperatorType *ot)
static void fix_connected_bone(EditBone *ebone)
static int armature_align_bones_exec(bContext *C, wmOperator *op)
static void chains_find_tips(ListBase *edbo, ListBase *list)
static int armature_split_exec(bContext *C, wmOperator *UNUSED(op))
static void bone_align_to_bone(ListBase *edbo, EditBone *selbone, EditBone *actbone)
float ED_armature_ebone_roll_to_vector(const EditBone *bone, const float align_axis[3], const bool axis_only)
static int armature_reveal_exec(bContext *C, wmOperator *op)
static int armature_hide_exec(bContext *C, wmOperator *op)
void ARMATURE_OT_align(wmOperatorType *ot)
static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op))
static void fill_add_joint(EditBone *ebo, short eb_tail, ListBase *points)
static const EnumPropertyItem prop_calc_roll_types[]
void ARMATURE_OT_calculate_roll(wmOperatorType *ot)
static int armature_calc_roll_exec(bContext *C, wmOperator *op)
void ED_armature_origin_set(Main *bmain, Object *ob, const float cursor[3], int centermode, int around)
void ED_armature_transform(bArmature *arm, const float mat[4][4], const bool do_props)
void ARMATURE_OT_switch_direction(wmOperatorType *ot)
void ED_armature_edit_transform(bArmature *arm, const float mat[4][4], const bool do_props)
void ARMATURE_OT_dissolve(wmOperatorType *ot)
void ARMATURE_OT_reveal(wmOperatorType *ot)
static bool armature_dissolve_ebone_cb(const char *bone_name, void *arm_p)
static int armature_fill_bones_exec(bContext *C, wmOperator *op)
struct EditBonePoint EditBonePoint
void ARMATURE_OT_split(wmOperatorType *ot)
void armature_tag_unselect(struct bArmature *arm)
void armature_select_mirrored(struct bArmature *arm)
void armature_select_mirrored_ex(struct bArmature *arm, int flag)
void armature_tag_select_mirrored(struct bArmature *arm)
bool ED_armature_edit_deselect_all(Object *obedit)
void ED_armature_edit_refresh_layer_used(bArmature *arm)
void ED_armature_ebone_remove_ex(bArmature *arm, EditBone *exBone, bool clear_connected)
void ED_armature_edit_sync_selection(ListBase *edbo)
int ED_armature_ebone_selectflag_get(const EditBone *ebone)
void ED_armature_ebone_select_set(EditBone *ebone, bool select)
void ED_armature_edit_validate_active(struct bArmature *arm)
void ED_armature_ebone_to_mat3(EditBone *ebone, float r_mat[3][3])
void ED_armature_edit_free(struct bArmature *arm)
void ED_armature_from_edit(Main *bmain, bArmature *arm)
void ED_armature_ebone_remove(bArmature *arm, EditBone *exBone)
EditBone * ED_armature_ebone_find_name(const ListBase *edbo, const char *name)
void ED_armature_to_edit(bArmature *arm)
EditBone * ED_armature_ebone_get_mirrored(const ListBase *edbo, EditBone *ebo)
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
T length(const vec_base< T, Size > &a)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
struct EditBonePoint * next
struct EditBonePoint * prev
struct EditBone * act_edbone
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_operator_confirm(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))