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-13 11:57:10 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-06-13 11:57:10 +0300
commit67e8c1e1c7cfbb000de903c9c4e83874adba411f (patch)
tree79af3eb08fcb3f422e212ff88c3be2bc4eae4561 /source/blender/editors/gpencil/gpencil_data.c
parent27882024176a3015e36305d19a763571e1a8c731 (diff)
Cleanup: remove more G.main from BKE area.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_data.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c15
1 files changed, 10 insertions, 5 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);