[Bf-blender-cvs] [67e8c1e1c7c] master: Cleanup: remove more G.main from BKE area.
Bastien Montagne
noreply at git.blender.org
Wed Jun 13 10:57:29 CEST 2018
Commit: 67e8c1e1c7cfbb000de903c9c4e83874adba411f
Author: Bastien Montagne
Date: Wed Jun 13 10:57:10 2018 +0200
Branches: master
https://developer.blender.org/rB67e8c1e1c7cfbb000de903c9c4e83874adba411f
Cleanup: remove more G.main from BKE area.
===================================================================
M source/blender/blenkernel/BKE_gpencil.h
M source/blender/blenkernel/BKE_particle.h
M source/blender/blenkernel/BKE_pointcache.h
M source/blender/blenkernel/intern/blender.c
M source/blender/blenkernel/intern/blendfile.c
M source/blender/blenkernel/intern/customdata.c
M source/blender/blenkernel/intern/gpencil.c
M source/blender/blenkernel/intern/ipo.c
M source/blender/blenkernel/intern/node.c
M source/blender/blenkernel/intern/particle.c
M source/blender/blenkernel/intern/pointcache.c
M source/blender/editors/gpencil/gpencil_data.c
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/editors/object/object_modifier.c
M source/blender/editors/physics/particle_object.c
M source/blender/editors/physics/physics_pointcache.c
M source/blender/editors/space_view3d/view3d_ruler.c
M source/blender/makesrna/intern/rna_main_api.c
M source/blender/render/intern/source/pipeline.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index b6de922c245..c7ea73463e3 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -56,7 +56,7 @@ void BKE_gpencil_stroke_sync_selection(struct bGPDstroke *gps);
struct bGPDframe *BKE_gpencil_frame_addnew(struct bGPDlayer *gpl, int cframe);
struct bGPDframe *BKE_gpencil_frame_addcopy(struct bGPDlayer *gpl, int cframe);
struct bGPDlayer *BKE_gpencil_layer_addnew(struct bGPdata *gpd, const char *name, bool setactive);
-struct bGPdata *BKE_gpencil_data_addnew(const char name[]);
+struct bGPdata *BKE_gpencil_data_addnew(struct Main *bmain, const char name[]);
struct bGPDframe *BKE_gpencil_frame_duplicate(const struct bGPDframe *gpf_src);
struct bGPDlayer *BKE_gpencil_layer_duplicate(const struct bGPDlayer *gpl_src);
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index 8eee749ef70..cba92eabb0b 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -326,9 +326,10 @@ void psys_particle_on_emitter(struct ParticleSystemModifierData *psmd, int distr
float utan[3], float vtan[3], float orco[3], float ornor[3]);
struct ParticleSystemModifierData *psys_get_modifier(struct Object *ob, struct ParticleSystem *psys);
-struct ModifierData *object_add_particle_system(struct Scene *scene, struct Object *ob, const char *name);
-void object_remove_particle_system(struct Scene *scene, struct Object *ob);
-struct ParticleSettings *BKE_particlesettings_add(struct Main *main, const char *name);
+struct ModifierData *object_add_particle_system(
+ struct Main *bmain, struct Scene *scene, struct Object *ob, const char *name);
+void object_remove_particle_system(struct Main *bmain, struct Scene *scene, struct Object *ob);
+struct ParticleSettings *BKE_particlesettings_add(struct Main *bmain, const char *name);
void BKE_particlesettings_copy_data(
struct Main *bmain, struct ParticleSettings *part_dst, const struct ParticleSettings *part_src,
const int flag);
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index cc60df1b2d6..cb2438ec1f2 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -184,7 +184,7 @@ typedef struct PTCacheID {
} PTCacheID;
typedef struct PTCacheBaker {
- struct Main *main;
+ struct Main *bmain;
struct Scene *scene;
int bake;
int render;
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 55b2d5b9c0d..68bca5d11b9 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -79,9 +79,9 @@ char versionstr[48] = "";
/* only to be called on exit blender */
void BKE_blender_free(void)
{
- /* samples are in a global list..., also sets G.main->sound->sample NULL */
- BKE_main_free(G.main);
- G.main = NULL;
+ /* samples are in a global list..., also sets G_MAIN->sound->sample NULL */
+ BKE_main_free(G_MAIN);
+ G_MAIN = NULL;
if (G.log.file != NULL) {
fclose(G.log.file);
@@ -123,7 +123,7 @@ void BKE_blender_globals_init(void)
U.savetime = 1;
- G.main = BKE_main_new();
+ G_MAIN = BKE_main_new();
strcpy(G.ima, "//");
@@ -140,9 +140,9 @@ void BKE_blender_globals_init(void)
void BKE_blender_globals_clear(void)
{
- BKE_main_free(G.main); /* free all lib data */
+ BKE_main_free(G_MAIN); /* free all lib data */
- G.main = NULL;
+ G_MAIN = NULL;
}
/***/
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index 935000e3b8e..aa5530704c6 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -113,7 +113,7 @@ static void setup_app_data(
bContext *C, BlendFileData *bfd,
const char *filepath, ReportList *reports)
{
- Main *bmain = G.main; /* Valid usage */
+ Main *bmain = G_MAIN;
Scene *curscene = NULL;
const bool is_startup = (bfd->filename[0] == '\0');
const bool recover = (G.fileflags & G_FILE_RECOVER) != 0;
@@ -198,7 +198,7 @@ static void setup_app_data(
}
}
- /* BKE_blender_globals_clear will free G.main, here we can still restore pointers */
+ /* BKE_blender_globals_clear will free G_MAIN, here we can still restore pointers */
blo_lib_link_screen_restore(bfd->main, curscreen, curscene);
/* curscreen might not be set when loading without ui (see T44217) so only re-assign if available */
if (curscreen) {
@@ -215,14 +215,14 @@ static void setup_app_data(
}
}
- /* free G.main Main database */
+ /* free G_MAIN Main database */
// CTX_wm_manager_set(C, NULL);
BKE_blender_globals_clear();
/* clear old property update cache, in case some old references are left dangling */
RNA_property_update_cache_free();
- bmain = G.main = bfd->main;
+ bmain = G_MAIN = bfd->main;
CTX_data_main_set(C, bmain);
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index cf86963cf60..023cf76796d 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -3499,7 +3499,7 @@ bool CustomData_verify_versions(struct CustomData *data, int index)
static void customdata_external_filename(char filename[FILE_MAX], ID *id, CustomDataExternal *external)
{
BLI_strncpy(filename, external->filename, FILE_MAX);
- BLI_path_abs(filename, ID_BLEND_PATH(G.main, id));
+ BLI_path_abs(filename, ID_BLEND_PATH_FROM_GLOBAL(id));
}
void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask mask, int totelem)
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index ee0d0b41898..9b79415f006 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -622,12 +622,12 @@ bGPDpalettecolor *BKE_gpencil_palettecolor_addnew(bGPDpalette *palette, const ch
}
/* add a new gp-datablock */
-bGPdata *BKE_gpencil_data_addnew(const char name[])
+bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[])
{
bGPdata *gpd;
/* allocate memory for a new block */
- gpd = BKE_libblock_alloc(G.main, ID_GD, name, 0);
+ gpd = BKE_libblock_alloc(bmain, ID_GD, name, 0);
/* initial settings */
gpd->flag = (GP_DATA_DISPINFO | GP_DATA_EXPAND);
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index fe6778e8e56..611c1e3bafb 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -1524,7 +1524,7 @@ static void action_to_animato(ID *id, bAction *act, ListBase *groups, ListBase *
* This assumes that AnimData has been added already. Separation of drivers
* from animation data is accomplished here too...
*/
-static void ipo_to_animdata(ID *id, Ipo *ipo, char actname[], char constname[], Sequence *seq)
+static void ipo_to_animdata(Main *bmain, ID *id, Ipo *ipo, char actname[], char constname[], Sequence *seq)
{
AnimData *adt = BKE_animdata_from_id(id);
ListBase anim = {NULL, NULL};
@@ -1559,7 +1559,7 @@ static void ipo_to_animdata(ID *id, Ipo *ipo, char actname[], char constname[],
BLI_snprintf(nameBuf, sizeof(nameBuf), "CDA:%s", ipo->id.name + 2);
- adt->action = BKE_action_add(G.main, nameBuf);
+ adt->action = BKE_action_add(bmain, nameBuf);
if (G.debug & G_DEBUG) printf("\t\tadded new action - '%s'\n", nameBuf);
}
@@ -1695,19 +1695,19 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips)
* clear which datablocks have yet to be converted, and also prevent freeing errors when we exit.
*/
// XXX currently done after all file reading...
-void do_versions_ipos_to_animato(Main *main)
+void do_versions_ipos_to_animato(Main *bmain)
{
ListBase drivers = {NULL, NULL};
ID *id;
- if (main == NULL) {
+ if (bmain == NULL) {
printf("Argh! Main is NULL in do_versions_ipos_to_animato()\n");
return;
}
/* only convert if version is right */
- if (main->versionfile >= 250) {
- printf("WARNING: Animation data too new to convert (Version %d)\n", main->versionfile);
+ if (bmain->versionfile >= 250) {
+ printf("WARNING: Animation data too new to convert (Version %d)\n", bmain->versionfile);
return;
}
else if (G.debug & G_DEBUG)
@@ -1716,7 +1716,7 @@ void do_versions_ipos_to_animato(Main *main)
/* ----------- Animation Attached to Data -------------- */
/* objects */
- for (id = main->object.first; id; id = id->next) {
+ for (id = bmain->object.first; id; id = id->next) {
Object *ob = (Object *)id;
bPoseChannel *pchan;
bConstraint *con;
@@ -1731,7 +1731,7 @@ void do_versions_ipos_to_animato(Main *main)
/* IPO first to take into any non-NLA'd Object Animation */
if (ob->ipo) {
- ipo_to_animdata(id, ob->ipo, NULL, NULL, NULL);
+ ipo_to_animdata(bmain, id, ob->ipo, NULL, NULL, NULL);
id_us_min(&ob->ipo->id);
ob->ipo = NULL;
@@ -1765,7 +1765,7 @@ void do_versions_ipos_to_animato(Main *main)
/* IPO second... */
if (ob->ipo) {
- ipo_to_animdata(id, ob->ipo, NULL, NULL, NULL);
+ ipo_to_animdata(bmain, id, ob->ipo, NULL, NULL, NULL);
id_us_min(&ob->ipo->id);
ob->ipo = NULL;
@@ -1802,7 +1802,7 @@ void do_versions_ipos_to_animato(Main *main)
/* although this was the constraint's local IPO, we still need to provide pchan + con
* so that drivers can be added properly...
*/
- ipo_to_animdata(id, con->ipo, pchan->name, con->name, NULL);
+ ipo_to_animdata(bmain, id, con->ipo, pchan->name, con->name, NULL);
id_us_min(&con->ipo->id);
con->ipo = NULL;
}
@@ -1822,7 +1822,7 @@ void do_versions_ipos_to_animato(Main *main)
/* although this was the constraint's local IPO, we still need to provide con
* so that drivers can be added properly...
*/
- ipo_to_animdata(id, con->ipo, NULL, con->name, NULL);
+ ipo_to_animdata(bmain, id, con->ipo, NULL, con->name, NULL);
id_us_mi
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list