[Bf-blender-cvs] [36260889262] greasepencil-object: Cleanup: Remove some uses of G.main

Antonio Vazquez noreply at git.blender.org
Fri Jul 21 17:25:17 CEST 2017


Commit: 36260889262b0bca720b0cdb773500db4e59fd37
Author: Antonio Vazquez
Date:   Fri Jul 21 17:24:47 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB36260889262b0bca720b0cdb773500db4e59fd37

Cleanup: Remove some uses of G.main

===================================================================

M	source/blender/blenkernel/BKE_gpencil.h
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/editors/gpencil/gpencil_data.c
M	source/blender/editors/sculpt_paint/paint_ops.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index f26ea602791..c4d134472ef 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -89,7 +89,7 @@ struct bGPDbrush *BKE_gpencil_brush_duplicate(const struct bGPDbrush *brush_src)
 void BKE_gpencil_brush_init_presets(struct ToolSettings *ts);
 
 /* conversion of animation data from bGPDpalette to Palette */
-void BKE_gpencil_move_animdata_to_palettes(struct bGPdata *gpd);
+void BKE_gpencil_move_animdata_to_palettes(struct bContext *C, struct bGPdata *gpd);
 
 /* Stroke and Fill - Alpha Visibility Threshold */
 #define GPENCIL_ALPHA_OPACITY_THRESH 0.001f
@@ -133,7 +133,7 @@ void BKE_gpencil_palettecolor_delete(struct bGPDpalette *palette, struct bGPDpal
 struct bGPDpalettecolor *BKE_gpencil_palettecolor_getbyname(struct bGPDpalette *palette, char *name);
 void BKE_gpencil_palettecolor_allnames(struct PaletteColor *palcolor, const char *newname);
 void BKE_gpencil_palettecolor_changename(struct PaletteColor *palcolor, struct bGPdata *gpd, const char *newname);
-void BKE_gpencil_palettecolor_delete_allstrokes(struct PaletteColor *palcolor);
+void BKE_gpencil_palettecolor_delete_allstrokes(struct bContext *C, struct PaletteColor *palcolor);
 
 /* object boundbox */
 struct BoundBox *BKE_gpencil_boundbox_get(struct Object *ob);
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 591910ab33e..6fe7b74e20e 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -51,6 +51,7 @@
 #include "DNA_object_types.h"
 #include "DNA_modifier_types.h"
 
+#include "BKE_context.h"
 #include "BKE_action.h"
 #include "BKE_animsys.h"
 #include "BKE_global.h"
@@ -1400,14 +1401,14 @@ void BKE_gpencil_palettecolor_changename(PaletteColor *palcolor, bGPdata *gpd, c
 }
 
 /* Delete all strokes of the color for all gpd datablocks */
-void BKE_gpencil_palettecolor_delete_allstrokes(PaletteColor *palcolor)
+void BKE_gpencil_palettecolor_delete_allstrokes(bContext *C, PaletteColor *palcolor)
 {
 	bGPdata *gpd;
 	bGPDlayer *gpl;
 	bGPDframe *gpf;
 	bGPDstroke *gps, *gpsn;
 
-	Main *bmain = G.main;
+	Main *bmain = CTX_data_main(C);
 
 	for (gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
 		for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
@@ -1472,9 +1473,9 @@ static bool UNUSED_FUNCTION(gp_animpath_matches_basepath)(const char path[], con
 }
 
 /* Transfer the animation data from bGPDpalette to Palette */
-void BKE_gpencil_move_animdata_to_palettes(bGPdata *gpd)
+void BKE_gpencil_move_animdata_to_palettes(bContext *C, bGPdata *gpd)
 {
-	Main *bmain = G.main;
+	Main *bmain = CTX_data_main(C);
 	Palette *palette = NULL;
 	AnimData *srcAdt = NULL, *dstAdt = NULL;
 	FCurve *fcu = NULL;
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index c5d2e0c75f6..d0d8ea9ca6a 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1493,7 +1493,7 @@ static int gp_convert_old_palettes_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	Main *bmain = CTX_data_main(C);
 	for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
-		BKE_gpencil_move_animdata_to_palettes(gpd);
+		BKE_gpencil_move_animdata_to_palettes(C, gpd);
 	}
 	/* notifiers */
 	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index ad1b515b3c4..41b04654fbf 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -355,7 +355,7 @@ static int palette_color_delete_exec(bContext *C, wmOperator *UNUSED(op))
 
 	if (color) {
 		/* delete the gp strokes */
-		BKE_gpencil_palettecolor_delete_allstrokes(color);
+		BKE_gpencil_palettecolor_delete_allstrokes(C, color);
 
 		BKE_palette_color_remove(palette, color);
 	}




More information about the Bf-blender-cvs mailing list