Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-06-07 13:47:00 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-06-07 13:48:29 +0300
commitb3a7a75a266de6765d8c04953c0dabce3c30c359 (patch)
tree98d27c5eb1d6573235c42e6e4b14137a8cee5c49 /source/blender/editors/armature
parent16017178b24c9c84df5c1114fae8dce4796c6c26 (diff)
Cleanup: remove moar G.main usages.
Notes: * Really need to address RNA setters case, end up adding way too much G.main here these days... :/ * Added Main pointer into bAnimContext, helps a lot in anim code ;)
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/armature_naming.c20
-rw-r--r--source/blender/editors/armature/armature_relations.c6
-rw-r--r--source/blender/editors/armature/pose_edit.c7
-rw-r--r--source/blender/editors/armature/pose_lib.c15
-rw-r--r--source/blender/editors/armature/pose_transform.c6
5 files changed, 31 insertions, 23 deletions
diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c
index c49e9a2b820..419160e02c0 100644
--- a/source/blender/editors/armature/armature_naming.c
+++ b/source/blender/editors/armature/armature_naming.c
@@ -136,7 +136,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];
@@ -175,7 +175,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 */
@@ -205,7 +205,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) {
@@ -278,7 +278,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) {
@@ -315,7 +315,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;
@@ -331,7 +331,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));
@@ -345,7 +345,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);
}
}
@@ -354,6 +354,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;
@@ -373,7 +374,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);
@@ -412,6 +413,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];
@@ -427,7 +429,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 c9fe6a5758b..3506b8a8a60 100644
--- a/source/blender/editors/armature/armature_relations.c
+++ b/source/blender/editors/armature/armature_relations.c
@@ -408,7 +408,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;
@@ -420,7 +420,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) {
@@ -620,7 +620,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);
DAG_id_tag_update(&oldob->id, OB_RECALC_DATA); /* this is the original one */
DAG_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 da328ee485f..8f0812e6034 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -44,6 +44,7 @@
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_depsgraph.h"
+#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_report.h"
@@ -604,6 +605,7 @@ static void pose_copy_menu(Scene *scene)
static int pose_flip_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;
@@ -623,7 +625,7 @@ static int pose_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);
@@ -659,6 +661,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];
@@ -674,7 +677,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 fd5db84873b..62c37e5d3fa 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -49,6 +49,7 @@
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
+#include "BKE_main.h"
#include "BKE_library.h"
#include "BKE_object.h"
@@ -190,7 +191,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))
@@ -200,19 +201,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;
}
@@ -222,6 +223,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 */
@@ -229,7 +231,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);
@@ -457,8 +459,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;
diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c
index c726b4db7bf..712001c55dd 100644
--- a/source/blender/editors/armature/pose_transform.c
+++ b/source/blender/editors/armature/pose_transform.c
@@ -70,12 +70,12 @@
/* Pose Apply */
/* helper for apply_armature_pose2bones - fixes parenting of objects that are bone-parented to armature */
-static void applyarmature_fix_boneparents(Scene *scene, Object *armob)
+static void applyarmature_fix_boneparents(Main *bmain, Scene *scene, Object *armob)
{
Object workob, *ob;
/* 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) {
/* if parent is bone in this armature, apply corrections */
if ((ob->parent == armob) && (ob->partype == PARBONE)) {
/* apply current transform from parent (not yet destroyed),
@@ -193,7 +193,7 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
BKE_pose_where_is(scene, ob);
/* fix parenting of objects which are bone-parented */
- applyarmature_fix_boneparents(scene, ob);
+ applyarmature_fix_boneparents(bmain, scene, ob);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);