86 for (con = lb->
first; con; con = con->
next) {
95 for (ct = targets.
first; ct; ct = ct->
next) {
96 if (ct->
tar == srcArm) {
120 &tarArm->
id,
data->act,
"pose.bones[", pchan->
name, curbone->
name, 0, 0,
false);
154 bool changed =
false;
157 if ((
id == src_id) && strstr(fcu->
rna_path,
"pose.bones[")) {
164 if (!
STREQ(old_name, new_name) && strstr(fcu->
rna_path, old_name)) {
166 id, fcu->
rna_path,
"pose.bones", old_name, new_name, 0, 0,
false);
188 if (dtar->id == src_id) {
197 if ((dtar->rna_path && strstr(dtar->rna_path,
"pose.bones[")) || (dtar->pchan_name[0])) {
203 if (!
STREQ(old_name, new_name)) {
204 if ((dtar->rna_path) && strstr(dtar->rna_path, old_name)) {
207 id, dtar->rna_path,
"pose.bones", old_name, new_name, 0, 0,
false);
210 if (
STREQ(dtar->pchan_name, old_name)) {
212 BLI_strncpy(dtar->pchan_name, new_name,
sizeof(dtar->pchan_name));
244 bmain, ob, tarArm, srcArm, pchan, curbone, &pchant->
constraints);
251 bmain, ob, tarArm, srcArm, pchan, curbone, &ob->
constraints);
282 float mat[4][4], oimat[4][4];
289 if (!arm || arm->
edbo) {
294 if (ob_iter == ob_active) {
315 pose = ob_active->
pose;
319 if ((ob_iter->type ==
OB_ARMATURE) && (ob_iter != ob_active)) {
336 opose = ob_iter->pose;
344 for (pchan = opose->chanbase.first; pchan; pchan = pchann) {
345 pchann = pchan->next;
377 curbone->roll -=
atan2f(difmat[2][0], difmat[2][2]);
384 BLI_strncpy(pchan->name, curbone->name,
sizeof(pchan->name));
478 for (ct = targets.
first; ct; ct = ct->
next) {
485 if (ct->
tar == origArm) {
490 else if (ct->
tar == newArm) {
517 for (ct = targets.
first; ct; ct = ct->
next) {
523 if (ct->
tar == origArm) {
528 else if (ct->
tar == newArm) {
573 pchann = pchan->
next;
581 if (ebo->parent == curbone) {
591 if (pchn->parent == pchan) {
594 if (pchn->bbone_next == pchan) {
595 pchn->bbone_next =
NULL;
597 if (pchn->bbone_prev == pchan) {
598 pchn->bbone_prev =
NULL;
633 for (
uint base_index = 0; base_index < bases_len; base_index++) {
634 Base *base_old = bases[base_index];
639 bool has_selected_bone =
false;
640 bool has_selected_any =
false;
644 has_selected_bone =
true;
648 has_selected_any =
true;
652 if (has_selected_bone ==
false) {
653 if (has_selected_any) {
725 ot->
name =
"Separate Bones";
726 ot->
idname =
"ARMATURE_OT_separate";
727 ot->
description =
"Isolate selected bones into a separate armature";
745 #define ARM_PAR_CONNECT 1
746 #define ARM_PAR_OFFSET 2
769 selbone->
parent = actbone;
772 for (ebone = actbone->
parent; ebone; ebone = ebone->
parent) {
773 if (ebone->
parent == selbone) {
790 for (ebone = edbo->
first; ebone; ebone = ebone->
next) {
794 if (par == selbone) {
823 if (actbone ==
NULL) {
836 if (actmirb ==
NULL) {
843 bool is_active_only_selected =
false;
845 is_active_only_selected =
true;
848 if (ebone != actbone) {
849 is_active_only_selected =
false;
856 if (is_active_only_selected) {
860 if (actbone->parent) {
880 if (ebone != actbone) {
887 if (ebone_mirror != actmirb) {
907 bool all_childbones =
false;
914 if (ebone != actbone) {
915 if (ebone->parent != actbone) {
916 all_childbones =
true;
928 if (all_childbones) {
942 ot->
idname =
"ARMATURE_OT_parent_set";
943 ot->
description =
"Set the active bone as the parent of the selected bones";
958 {1,
"CLEAR", 0,
"Clear Parent",
""},
959 {2,
"DISCONNECT", 0,
"Disconnect Bone",
""},
986 uint objects_len = 0;
989 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
990 Object *ob = objects[ob_index];
992 bool changed =
false;
1018 ot->
name =
"Clear Parent";
1019 ot->
idname =
"ARMATURE_OT_parent_clear";
1021 "Remove the parent-child relationship between selected bones and their parents";
1036 "What way to clear parenting");
Blender kernel action and pose functionality.
void BKE_pose_channels_hash_free(struct bPose *pose)
void BKE_pose_channel_free(struct bPoseChannel *pchan)
void BKE_animdata_merge_copy(struct Main *bmain, struct ID *dst_id, struct ID *src_id, eAnimData_MergeCopy_Modes action_mode, bool fix_drivers)
struct AnimData * BKE_animdata_copy(struct Main *bmain, struct AnimData *adt, const int flag)
void BKE_fcurves_main_cb(struct Main *bmain, ID_FCurve_Edit_Callback func, void *user_data)
char * BKE_animsys_fix_rna_path_rename(struct ID *owner_id, char *old_path, const char *prefix, const char *oldName, const char *newName, int oldSubscript, int newSubscript, bool verify_paths)
void BKE_action_fix_paths_rename(struct ID *owner_id, struct bAction *act, const char *prefix, const char *oldName, const char *newName, int oldSubscript, int newSubscript, bool verify_paths)
const bConstraintTypeInfo * BKE_constraint_typeinfo_get(struct bConstraint *con)
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 Object * CTX_data_active_object(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct EditBone * CTX_data_active_bone(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
#define DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
#define DRIVER_TARGETS_LOOPER_END
#define BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, v3d, r_len)
#define BKE_view_layer_array_from_bases_in_edit_mode_unique_data(view_layer, v3d, r_len)
void BKE_report(ReportList *reports, ReportType type, const char *message)
BLI_INLINE void * BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
BLI_INLINE void * BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
GHash * BLI_ghash_str_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
#define GHASH_ITER(gh_iter_, ghash_)
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void * BLI_findstring(const struct ListBase *listbase, const char *id, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void invert_m4_m4_safe_ortho(float Ainv[4][4], const float A[4][4])
void unit_m4(float m[4][4])
void copy_m4_m3(float m1[4][4], const float m2[3][3])
bool invert_m4_m4(float R[4][4], const float A[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
void mul_m4_m3m4(float R[4][4], const float A[3][3], const float B[4][4])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
void DEG_id_tag_update_ex(struct Main *bmain, struct ID *id, int flag)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_COPY_ON_WRITE
Object is a sort of wrapper for general info.
#define EBONE_VISIBLE(arm, ebone)
#define EBONE_EDITABLE(ebone)
struct Base * ED_object_add_duplicate(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, struct Base *base, const eDupli_ID_Flags dupflag)
void ED_object_base_free_and_unlink(struct Main *bmain, struct Scene *scene, struct Object *ob)
void ED_outliner_select_sync_from_object_tag(struct bContext *C)
bool ED_operator_editarmature(struct bContext *C)
Read Guarded memory(de)allocation.
struct uiLayout * UI_popup_menu_layout(uiPopupMenu *pup)
void uiItemEnumO(uiLayout *layout, const char *opname, const char *name, int icon, const char *propname, int value)
void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *pup)
uiPopupMenu * UI_popup_menu_begin(struct bContext *C, const char *title, int icon) ATTR_NONNULL()
void bone_free(struct bArmature *arm, struct EditBone *bone)
void ED_armature_ebone_unique_name(ListBase *ebones, char *name, EditBone *bone)
static void separate_armature_bones(Main *bmain, Object *ob, const bool is_select)
static void joined_armature_fix_links(Main *bmain, Object *tarArm, Object *srcArm, bPoseChannel *pchan, EditBone *curbone)
static const EnumPropertyItem prop_editarm_clear_parent_types[]
void ARMATURE_OT_parent_clear(wmOperatorType *ot)
static void joined_armature_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data)
static int armature_parent_set_exec(bContext *C, wmOperator *op)
static void joined_armature_fix_links_constraints(Main *bmain, Object *ob, Object *tarArm, Object *srcArm, bPoseChannel *pchan, EditBone *curbone, ListBase *lb)
static int separate_armature_exec(bContext *C, wmOperator *op)
static int armature_parent_clear_exec(bContext *C, wmOperator *op)
int ED_armature_join_objects_exec(bContext *C, wmOperator *op)
void ARMATURE_OT_parent_set(wmOperatorType *ot)
static void separated_armature_fix_links(Main *bmain, Object *origArm, Object *newArm)
static void bone_connect_to_new_parent(ListBase *edbo, EditBone *selbone, EditBone *actbone, short mode)
static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
void ARMATURE_OT_separate(wmOperatorType *ot)
static void editbone_clear_parent(EditBone *ebone, int mode)
static const EnumPropertyItem prop_editarm_make_parent_types[]
struct tJoinArmature_AdtFixData tJoinArmature_AdtFixData
static void bone_connect_to_existing_parent(EditBone *bone)
bool ED_armature_edit_deselect_all(Object *obedit)
void ED_armature_edit_refresh_layer_used(bArmature *arm)
void ED_armature_edit_sync_selection(ListBase *edbo)
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)
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)
void(* MEM_freeN)(void *vmemh)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
struct EditBone * act_edbone
struct bConstraintTarget * next
int(* get_constraint_targets)(struct bConstraint *con, struct ListBase *list)
void(* flush_constraint_targets)(struct bConstraint *con, struct ListBase *list, bool no_copy)
struct bConstraint * next
struct bPoseChannel * next
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_cursor_wait(bool val)
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))