100 ebone->
dist *= scale;
122 Main *bmain,
Object *ob,
const float cursor[3],
int centermode,
int around)
130 if (is_editmode ==
false) {
135 if (centermode == 2) {
171 if (is_editmode ==
false) {
177 if (centermode && (is_editmode ==
false)) {
193 const float align_axis[3],
194 const bool axis_only)
196 float mat[3][3],
nor[3];
197 float vec[3], align_axis_proj[3], roll = 0.0f;
256 {0,
"", 0,
N_(
"Positive"),
""},
264 {0,
"", 0,
N_(
"Negative"),
""},
273 {0,
"", 0,
N_(
"Other"),
""},
292 uint objects_len = 0;
295 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
296 Object *ob = objects[ob_index];
298 bool changed =
false;
313 float cursor_local[3];
342 if (is_edit || is_edit_parent) {
363 }
while ((is_vec_zero = (
normalize_v3(vec) < 0.00001f)) &&
364 (ebone_other = ebone_other->
parent));
377 if (is_edit_parent) {
380 ebone->
parent, vec, axis_only);
390 float vec[3] = {0.0f, 0.0f, 0.0f};
421 vec[
type - 2] = -1.0f;
466 ot->
name =
"Recalculate Roll";
467 ot->
idname =
"ARMATURE_OT_calculate_roll";
468 ot->
description =
"Automatically fix alignment of select bones' axes";
485 "Ignore the axis direction, use the shortest rotation to align");
493 uint objects_len = 0;
496 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
497 Object *ob = objects[ob_index];
499 bool changed =
false;
514 ebone->roll = -ebone_mirr->
roll;
536 ot->
idname =
"ARMATURE_OT_roll_clear";
581 for (curBone = edbo->
first; curBone; curBone = curBone->
next) {
585 for (ld = list->
first; ld; ld = ld->
next) {
586 for (ebo = ld->
data; ebo; ebo = ebo->
parent) {
587 if (ebo == curBone) {
605 for (ld = list->
first; ld; ld = ld->
next) {
606 if (ld->
data == ebo) {
648 for (ebp = points->
first; ebp; ebp = ebp->
next) {
694 bool mixed_object_error =
false;
710 if (arm && (arm != arm_iter)) {
711 mixed_object_error =
true;
730 if (mixed_object_error) {
740 if (ob_iter->data == arm) {
762 else if (
count == 2) {
764 float head[3], tail[3];
790 float dist_sq_a, dist_sq_b;
801 headtail = (dist_sq_a < dist_sq_b) ? 2 : 1;
816 else if (headtail == 1) {
877 ot->
name =
"Fill Between Joints";
879 ot->
description =
"Add bone between selected joint(s) and/or 3D cursor";
912 uint objects_len = 0;
916 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
917 Object *ob = objects[ob_index];
939 for (chain = chains.
first; chain; chain = chain->
next) {
943 for (ebo = chain->
data; ebo; ebo = parent) {
1015 ot->
name =
"Switch Direction";
1016 ot->
idname =
"ARMATURE_OT_switch_direction";
1017 ot->
description =
"Change the direction that a chain of bones points in (head and tail swap)";
1054 for (selbone = edbo->
first; selbone; selbone = selbone->
next) {
1064 float selboneaxis[3], actboneaxis[3],
length;
1088 int num_selected_bones;
1091 if (actbone ==
NULL) {
1105 if (actmirb ==
NULL) {
1114 if (num_selected_bones <= 1) {
1118 if (actbone->parent) {
1139 if (
ELEM(ebone, actbone, actmirb) == 0) {
1151 op->
reports,
RPT_INFO,
"%d bones aligned to bone '%s'", num_selected_bones, actbone->name);
1164 ot->
name =
"Align Bones";
1166 ot->
description =
"Align selected bones to the active bone (or to their parent)";
1186 uint objects_len = 0;
1189 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1190 Object *ob = objects[ob_index];
1195 bone->parent =
NULL;
1216 ot->
description =
"Split off selected bones from connected unselected bones";
1246 bool changed_multi =
false;
1254 uint objects_len = 0;
1257 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1258 Object *obedit = objects[ob_index];
1260 bool changed =
false;
1266 for (curBone = arm->
edbo->
first; curBone; curBone = ebone_next) {
1267 ebone_next = curBone->
next;
1280 changed_multi =
true;
1292 if (!changed_multi) {
1302 ot->
name =
"Delete Selected Bone(s)";
1304 ot->
description =
"Remove selected bones from the armature";
1328 bool changed_multi =
false;
1330 uint objects_len = 0;
1333 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1334 Object *obedit = objects[ob_index];
1336 bool changed =
false;
1342 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1352 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1357 val.flag = ebone->
flag;
1369 val_p->flag = ebone->
flag & ~val_p->flag;
1373 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1390 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1396 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1411 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1420 for (ebone = arm->
edbo->
first; ebone; ebone = ebone_next) {
1421 ebone_next = ebone->
next;
1434 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1441 for (ebone = arm->
edbo->
first; ebone; ebone = ebone->
next) {
1446 if (val_p && val_p->flag) {
1447 ebone->
flag &= ~val_p->flag;
1458 changed_multi =
true;
1468 if (!changed_multi) {
1478 ot->
name =
"Dissolve Selected Bone(s)";
1479 ot->
idname =
"ARMATURE_OT_dissolve";
1480 ot->
description =
"Dissolve selected bones from the armature";
1506 uint objects_len = 0;
1509 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1510 Object *obedit = objects[ob_index];
1512 bool changed =
false;
1540 ot->
name =
"Hide Selected";
1542 ot->
description =
"Tag selected bones to not be visible in Edit Mode";
1565 uint objects_len = 0;
1568 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1569 Object *obedit = objects[ob_index];
1571 bool changed =
false;
1574 if (arm->
layer & ebone->layer) {
1600 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], const 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], const 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_report(ReportList *reports, ReportType type, const char *message)
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
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_)
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)
GHash * BLI_ghash_ptr_new_ex(const char *info, const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
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.
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, const 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)
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
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)
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
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
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))