[Bf-blender-cvs] [2ebe4da8260] greasepencil-object: Remove G.Main from RNA code

Antonio Vazquez noreply at git.blender.org
Mon Oct 23 12:10:18 CEST 2017


Commit: 2ebe4da826046cb748969c49994d0797c98b5624
Author: Antonio Vazquez
Date:   Mon Oct 23 12:09:55 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB2ebe4da826046cb748969c49994d0797c98b5624

Remove G.Main from RNA code

Remove the use of global main in RNA functions

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

M	source/blender/blenkernel/BKE_gpencil.h
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/makesrna/intern/rna_palette.c
M	source/blender/makesrna/intern/rna_scene.c
M	source/blender/makesrna/intern/rna_sculpt_paint.c

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

diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index 1b2c01d4561..77cbecb12eb 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -74,6 +74,7 @@ void BKE_gpencil_free(struct bGPdata *gpd, bool free_all);
 void BKE_gpencil_batch_cache_dirty(struct bGPdata *gpd);
 void BKE_gpencil_batch_cache_free(struct bGPdata *gpd);
 void BKE_gpencil_batch_cache_alldirty(void);
+void BKE_gpencil_batch_cache_alldirty_main(struct Main *bmain);
 
 void BKE_gpencil_stroke_sync_selection(struct bGPDstroke *gps);
 
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 14fa67c4fb6..2152470df81 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -94,6 +94,16 @@ void BKE_gpencil_batch_cache_alldirty()
 	}
 }
 
+/* Change draw manager status in all gpd datablocks */
+void BKE_gpencil_batch_cache_alldirty_main(Main *bmain)
+{
+	bGPdata *gpd;
+
+	for (gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
+		BKE_gpencil_batch_cache_dirty(gpd);
+	}
+}
+
 /* ************************************************** */
 /* Memory Management */
 
diff --git a/source/blender/makesrna/intern/rna_palette.c b/source/blender/makesrna/intern/rna_palette.c
index 24439d07b98..8a89e79d5f6 100644
--- a/source/blender/makesrna/intern/rna_palette.c
+++ b/source/blender/makesrna/intern/rna_palette.c
@@ -51,9 +51,9 @@
 #include "BKE_gpencil.h"
 #include "BKE_library.h"
 
-static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_GPencil_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
 {
-	BKE_gpencil_batch_cache_alldirty();
+	BKE_gpencil_batch_cache_alldirty_main(bmain);
 	WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
 }
 
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 6e5d80f1cfc..4cc528981f1 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -504,9 +504,9 @@ const EnumPropertyItem rna_enum_layer_collection_mode_settings_type_items[] = {
 #endif
 
 /* Grease Pencil update cache */
-static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_GPencil_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
 {
-	BKE_gpencil_batch_cache_alldirty();
+	BKE_gpencil_batch_cache_alldirty_main(bmain);
 	WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
 }
 
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index ff31c3da28b..cf57d148e3e 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -118,9 +118,9 @@ const EnumPropertyItem rna_enum_symmetrize_direction_items[] = {
 
 #include "ED_particle.h"
 
-static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_GPencil_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
 {
-	BKE_gpencil_batch_cache_alldirty();
+	BKE_gpencil_batch_cache_alldirty_main(bmain);
 	WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
 }



More information about the Bf-blender-cvs mailing list