diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-13 11:57:10 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-13 11:57:10 +0300 |
commit | 67e8c1e1c7cfbb000de903c9c4e83874adba411f (patch) | |
tree | 79af3eb08fcb3f422e212ff88c3be2bc4eae4561 /source/blender/editors/gpencil | |
parent | 27882024176a3015e36305d19a763571e1a8c731 (diff) |
Cleanup: remove more G.main from BKE area.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_data.c | 15 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 3 |
2 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 2e8e48b2f15..9f437f28f0f 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -52,14 +52,15 @@ #include "DNA_view3d_types.h" #include "DNA_gpencil_types.h" +#include "BKE_colortools.h" #include "BKE_context.h" #include "BKE_gpencil.h" #include "BKE_library.h" +#include "BKE_main.h" #include "BKE_object.h" #include "BKE_report.h" #include "BKE_scene.h" #include "BKE_screen.h" -#include "BKE_colortools.h" #include "UI_interface.h" #include "UI_resources.h" @@ -83,6 +84,7 @@ /* add new datablock - wrapper around API */ static int gp_data_add_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL); ToolSettings *ts = CTX_data_tool_settings(C); @@ -95,7 +97,7 @@ static int gp_data_add_exec(bContext *C, wmOperator *op) bGPdata *gpd = (*gpd_ptr); id_us_min(&gpd->id); - *gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil")); + *gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("GPencil")); /* if not exist brushes, create a new set */ if (ts) { @@ -183,6 +185,7 @@ void GPENCIL_OT_data_unlink(wmOperatorType *ot) /* add new layer - wrapper around API */ static int gp_layer_add_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL); ToolSettings *ts = CTX_data_tool_settings(C); @@ -192,7 +195,7 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } if (*gpd_ptr == NULL) - *gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil")); + *gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("GPencil")); /* if not exist brushes, create a new set */ if (ts) { @@ -1376,6 +1379,7 @@ void GPENCIL_OT_brush_select(wmOperatorType *ot) /* add new palette - wrapper around API */ static int gp_palette_add_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL); /* if there's no existing Grease-Pencil data there, add some */ @@ -1384,7 +1388,7 @@ static int gp_palette_add_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } if (*gpd_ptr == NULL) - *gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil")); + *gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("GPencil")); /* add new palette now */ BKE_gpencil_palette_addnew(*gpd_ptr, DATA_("GP_Palette"), true); @@ -1588,6 +1592,7 @@ void GPENCIL_OT_palette_lock_layer(wmOperatorType *ot) /* add new palette - wrapper around API */ static int gp_palettecolor_add_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL); /* if there's no existing Grease-Pencil data there, add some */ @@ -1596,7 +1601,7 @@ static int gp_palettecolor_add_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } if (*gpd_ptr == NULL) - *gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil")); + *gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("GPencil")); /* verify palette */ bGPDpalette *palette = BKE_gpencil_palette_getactive(*gpd_ptr); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 0d4c8e383de..2471ba76ae2 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1381,6 +1381,7 @@ static void gp_init_palette(tGPsdata *p) /* (re)init new painting data */ static bool gp_session_initdata(bContext *C, tGPsdata *p) { + Main *bmain = CTX_data_main(C); bGPdata **gpd_ptr = NULL; ScrArea *curarea = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); @@ -1530,7 +1531,7 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p) else { /* if no existing GPencil block exists, add one */ if (*gpd_ptr == NULL) - *gpd_ptr = BKE_gpencil_data_addnew("GPencil"); + *gpd_ptr = BKE_gpencil_data_addnew(bmain, "GPencil"); p->gpd = *gpd_ptr; } |