diff options
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/armature_naming.c | 20 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_relations.c | 6 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 7 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_lib.c | 15 |
4 files changed, 28 insertions, 20 deletions
diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index 1a5e9e38099..a73e64af0ee 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -137,7 +137,7 @@ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, const char * /* called by UI for renaming a bone */ /* warning: make sure the original bone was not renamed yet! */ /* seems messy, but thats what you get with not using pointers but channel names :) */ -void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *newnamep) +void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep, const char *newnamep) { Object *ob; char newname[MAXBONENAME]; @@ -176,7 +176,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n } /* do entire dbase - objects */ - for (ob = G.main->object.first; ob; ob = ob->id.next) { + for (ob = bmain->object.first; ob; ob = ob->id.next) { ModifierData *md; /* we have the object using the armature */ @@ -206,7 +206,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n } /* Update any object constraints to use the new bone name */ - for (cob = G.main->object.first; cob; cob = cob->id.next) { + for (cob = bmain->object.first; cob; cob = cob->id.next) { if (cob->constraints.first) constraint_bone_name_fix(ob, &cob->constraints, oldname, newname); if (cob->pose) { @@ -279,7 +279,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n /* correct view locking */ { bScreen *screen; - for (screen = G.main->screen.first; screen; screen = screen->id.next) { + for (screen = bmain->screen.first; screen; screen = screen->id.next) { ScrArea *sa; /* add regions */ for (sa = screen->areabase.first; sa; sa = sa->next) { @@ -316,7 +316,7 @@ typedef struct BoneFlipNameData { * \param bones_names: List of BoneConflict elems. * \param do_strip_numbers: if set, try to get rid of dot-numbers at end of bone names. */ -void ED_armature_bones_flip_names(bArmature *arm, ListBase *bones_names, const bool do_strip_numbers) +void ED_armature_bones_flip_names(Main *bmain, bArmature *arm, ListBase *bones_names, const bool do_strip_numbers) { ListBase bones_names_conflicts = {NULL}; BoneFlipNameData *bfn; @@ -332,7 +332,7 @@ void ED_armature_bones_flip_names(bArmature *arm, ListBase *bones_names, const b * Bone.R, Bone.R.001, Bone.R.002, etc. */ BLI_string_flip_side_name(name_flip, name, do_strip_numbers, sizeof(name_flip)); - ED_armature_bone_rename(arm, name, name_flip); + ED_armature_bone_rename(bmain, arm, name, name_flip); if (!STREQ(name, name_flip)) { bfn = alloca(sizeof(BoneFlipNameData)); @@ -346,7 +346,7 @@ void ED_armature_bones_flip_names(bArmature *arm, ListBase *bones_names, const b * Note that if the other bone was not selected, its name was not flipped, so conflict remains and that second * rename simply generates a new numbered alternative name. */ for (bfn = bones_names_conflicts.first; bfn; bfn = bfn->next) { - ED_armature_bone_rename(arm, bfn->name, bfn->name_flip); + ED_armature_bone_rename(bmain, arm, bfn->name, bfn->name_flip); } } @@ -355,6 +355,7 @@ void ED_armature_bones_flip_names(bArmature *arm, ListBase *bones_names, const b static int armature_flip_names_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Object *ob = CTX_data_edit_object(C); bArmature *arm; @@ -374,7 +375,7 @@ static int armature_flip_names_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - ED_armature_bones_flip_names(arm, &bones_names, do_strip_numbers); + ED_armature_bones_flip_names(bmain, arm, &bones_names, do_strip_numbers); BLI_freelistN(&bones_names); @@ -413,6 +414,7 @@ void ARMATURE_OT_flip_names(wmOperatorType *ot) static int armature_autoside_names_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Object *ob = CTX_data_edit_object(C); bArmature *arm; char newname[MAXBONENAME]; @@ -428,7 +430,7 @@ static int armature_autoside_names_exec(bContext *C, wmOperator *op) { BLI_strncpy(newname, ebone->name, sizeof(newname)); if (bone_autoside_name(newname, 1, axis, ebone->head[axis], ebone->tail[axis])) - ED_armature_bone_rename(arm, ebone->name, newname); + ED_armature_bone_rename(bmain, arm, ebone->name, newname); } CTX_DATA_END; diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index ee20c38cf69..9282148e857 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -411,7 +411,7 @@ int join_armature_exec(bContext *C, wmOperator *op) /* *********************************** Separate *********************************************** */ /* Helper function for armature separating - link fixing */ -static void separated_armature_fix_links(Object *origArm, Object *newArm) +static void separated_armature_fix_links(Main *bmain, Object *origArm, Object *newArm) { Object *ob; bPoseChannel *pchan; @@ -423,7 +423,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm) npchans = &newArm->pose->chanbase; /* let's go through all objects in database */ - for (ob = G.main->object.first; ob; ob = ob->id.next) { + for (ob = bmain->object.first; ob; ob = ob->id.next) { /* do some object-type specific things */ if (ob->type == OB_ARMATURE) { for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { @@ -628,7 +628,7 @@ static int separate_armature_exec(bContext *C, wmOperator *op) /* 4) fix links before depsgraph flushes */ // err... or after? - separated_armature_fix_links(oldob, newob); + separated_armature_fix_links(bmain, oldob, newob); DEG_id_tag_update(&oldob->id, OB_RECALC_DATA); /* this is the original one */ DEG_id_tag_update(&newob->id, OB_RECALC_DATA); /* this is the separated one */ diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index fa9927419a0..ffe64cc24b0 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -46,6 +46,7 @@ #include "BKE_armature.h" #include "BKE_context.h" #include "BKE_deform.h" +#include "BKE_main.h" #include "BKE_object.h" #include "BKE_report.h" #include "BKE_layer.h" @@ -622,6 +623,7 @@ static void pose_copy_menu(Scene *scene) static int pose_flip_names_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); ViewLayer *view_layer = CTX_data_view_layer(C); const bool do_strip_numbers = RNA_boolean_get(op->ptr, "do_strip_numbers"); @@ -636,7 +638,7 @@ static int pose_flip_names_exec(bContext *C, wmOperator *op) } FOREACH_PCHAN_SELECTED_IN_OBJECT_END; - ED_armature_bones_flip_names(arm, &bones_names, do_strip_numbers); + ED_armature_bones_flip_names(bmain, arm, &bones_names, do_strip_numbers); BLI_freelistN(&bones_names); @@ -674,6 +676,7 @@ void POSE_OT_flip_names(wmOperatorType *ot) static int pose_autoside_names_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); bArmature *arm; char newname[MAXBONENAME]; @@ -689,7 +692,7 @@ static int pose_autoside_names_exec(bContext *C, wmOperator *op) { BLI_strncpy(newname, pchan->name, sizeof(newname)); if (bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis])) - ED_armature_bone_rename(arm, pchan->name, newname); + ED_armature_bone_rename(bmain, arm, pchan->name, newname); } CTX_DATA_END; diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 02a1e22dbba..b9c4584ff15 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -48,6 +48,7 @@ #include "BKE_armature.h" #include "BKE_global.h" #include "BKE_idprop.h" +#include "BKE_main.h" #include "BKE_library.h" #include "BKE_object.h" @@ -191,7 +192,7 @@ static int has_poselib_pose_data_for_editing_poll(bContext *C) /* ----------------------------------- */ /* Initialize a new poselib (whether it is needed or not) */ -static bAction *poselib_init_new(Object *ob) +static bAction *poselib_init_new(Main *bmain, Object *ob) { /* sanity checks - only for armatures */ if (ELEM(NULL, ob, ob->pose)) @@ -201,19 +202,19 @@ static bAction *poselib_init_new(Object *ob) if (ob->poselib) id_us_min(&ob->poselib->id); - ob->poselib = BKE_action_add(G.main, "PoseLib"); + ob->poselib = BKE_action_add(bmain, "PoseLib"); ob->poselib->idroot = ID_OB; return ob->poselib; } /* Initialize a new poselib (checks if that needs to happen) */ -static bAction *poselib_validate(Object *ob) +static bAction *poselib_validate(Main *bmain, Object *ob) { if (ELEM(NULL, ob, ob->pose)) return NULL; else if (ob->poselib == NULL) - return poselib_init_new(ob); + return poselib_init_new(bmain, ob); else return ob->poselib; } @@ -223,6 +224,7 @@ static bAction *poselib_validate(Object *ob) static int poselib_new_exec(bContext *C, wmOperator *UNUSED(op)) { + Main *bmain = CTX_data_main(C); Object *ob = get_poselib_object(C); /* sanity checks */ @@ -230,7 +232,7 @@ static int poselib_new_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; /* new method here deals with the rest... */ - poselib_init_new(ob); + poselib_init_new(bmain, ob); /* notifier here might evolve? */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); @@ -458,8 +460,9 @@ static int poselib_add_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U static int poselib_add_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Object *ob = get_poselib_object(C); - bAction *act = poselib_validate(ob); + bAction *act = poselib_validate(bmain, ob); bPose *pose = (ob) ? ob->pose : NULL; TimeMarker *marker; KeyingSet *ks; |