diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-07 13:47:00 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-07 13:48:29 +0300 |
commit | b3a7a75a266de6765d8c04953c0dabce3c30c359 (patch) | |
tree | 98d27c5eb1d6573235c42e6e4b14137a8cee5c49 /source/blender/editors/armature/pose_lib.c | |
parent | 16017178b24c9c84df5c1114fae8dce4796c6c26 (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/pose_lib.c')
-rw-r--r-- | source/blender/editors/armature/pose_lib.c | 15 |
1 files changed, 9 insertions, 6 deletions
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; |