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
path: root/source
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
parent27882024176a3015e36305d19a763571e1a8c731 (diff)
Cleanup: remove more G.main from BKE area.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_gpencil.h2
-rw-r--r--source/blender/blenkernel/BKE_particle.h7
-rw-r--r--source/blender/blenkernel/BKE_pointcache.h2
-rw-r--r--source/blender/blenkernel/intern/blender.c12
-rw-r--r--source/blender/blenkernel/intern/blendfile.c8
-rw-r--r--source/blender/blenkernel/intern/customdata.c2
-rw-r--r--source/blender/blenkernel/intern/gpencil.c4
-rw-r--r--source/blender/blenkernel/intern/ipo.c62
-rw-r--r--source/blender/blenkernel/intern/node.c2
-rw-r--r--source/blender/blenkernel/intern/particle.c17
-rw-r--r--source/blender/blenkernel/intern/pointcache.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c15
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c3
-rw-r--r--source/blender/editors/object/object_modifier.c2
-rw-r--r--source/blender/editors/physics/particle_object.c6
-rw-r--r--source/blender/editors/physics/physics_pointcache.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_ruler.c6
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c2
-rw-r--r--source/blender/render/intern/source/pipeline.c2
19 files changed, 84 insertions, 76 deletions
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_min(&con->ipo->id);
con->ipo = NULL;
}
@@ -1842,7 +1842,7 @@ void do_versions_ipos_to_animato(Main *main)
/* convert Constraint Channel's IPO data */
if (conchan->ipo) {
- ipo_to_animdata(id, conchan->ipo, NULL, conchan->name, NULL);
+ ipo_to_animdata(bmain, id, conchan->ipo, NULL, conchan->name, NULL);
id_us_min(&conchan->ipo->id);
conchan->ipo = NULL;
}
@@ -1861,7 +1861,7 @@ void do_versions_ipos_to_animato(Main *main)
}
/* shapekeys */
- for (id = main->key.first; id; id = id->next) {
+ for (id = bmain->key.first; id; id = id->next) {
Key *key = (Key *)id;
if (G.debug & G_DEBUG) printf("\tconverting key %s\n", id->name + 2);
@@ -1875,7 +1875,7 @@ void do_versions_ipos_to_animato(Main *main)
AnimData *adt = BKE_animdata_add_id(id);
/* Convert Shapekey data... */
- ipo_to_animdata(id, key->ipo, NULL, NULL, NULL);
+ ipo_to_animdata(bmain, id, key->ipo, NULL, NULL, NULL);
if (adt->action)
adt->action->idroot = key->ipo->blocktype;
@@ -1886,7 +1886,7 @@ void do_versions_ipos_to_animato(Main *main)
}
/* materials */
- for (id = main->mat.first; id; id = id->next) {
+ for (id = bmain->mat.first; id; id = id->next) {
Material *ma = (Material *)id;
if (G.debug & G_DEBUG) printf("\tconverting material %s\n", id->name + 2);
@@ -1897,7 +1897,7 @@ void do_versions_ipos_to_animato(Main *main)
AnimData *adt = BKE_animdata_add_id(id);
/* Convert Material data... */
- ipo_to_animdata(id, ma->ipo, NULL, NULL, NULL);
+ ipo_to_animdata(bmain, id, ma->ipo, NULL, NULL, NULL);
if (adt->action)
adt->action->idroot = ma->ipo->blocktype;
@@ -1908,7 +1908,7 @@ void do_versions_ipos_to_animato(Main *main)
}
/* worlds */
- for (id = main->world.first; id; id = id->next) {
+ for (id = bmain->world.first; id; id = id->next) {
World *wo = (World *)id;
if (G.debug & G_DEBUG) printf("\tconverting world %s\n", id->name + 2);
@@ -1919,7 +1919,7 @@ void do_versions_ipos_to_animato(Main *main)
AnimData *adt = BKE_animdata_add_id(id);
/* Convert World data... */
- ipo_to_animdata(id, wo->ipo, NULL, NULL, NULL);
+ ipo_to_animdata(bmain, id, wo->ipo, NULL, NULL, NULL);
if (adt->action)
adt->action->idroot = wo->ipo->blocktype;
@@ -1930,7 +1930,7 @@ void do_versions_ipos_to_animato(Main *main)
}
/* sequence strips */
- for (id = main->scene.first; id; id = id->next) {
+ for (id = bmain->scene.first; id; id = id->next) {
Scene *scene = (Scene *)id;
Editing *ed = scene->ed;
if (ed && ed->seqbasep) {
@@ -1970,7 +1970,7 @@ void do_versions_ipos_to_animato(Main *main)
icu->adrcode = adrcode;
/* convert IPO */
- ipo_to_animdata((ID *)scene, seq->ipo, NULL, NULL, seq);
+ ipo_to_animdata(bmain, (ID *)scene, seq->ipo, NULL, NULL, seq);
if (adt->action)
adt->action->idroot = ID_SCE; /* scene-rooted */
@@ -1984,7 +1984,7 @@ void do_versions_ipos_to_animato(Main *main)
/* textures */
- for (id = main->tex.first; id; id = id->next) {
+ for (id = bmain->tex.first; id; id = id->next) {
Tex *te = (Tex *)id;
if (G.debug & G_DEBUG) printf("\tconverting texture %s\n", id->name + 2);
@@ -1995,7 +1995,7 @@ void do_versions_ipos_to_animato(Main *main)
AnimData *adt = BKE_animdata_add_id(id);
/* Convert Texture data... */
- ipo_to_animdata(id, te->ipo, NULL, NULL, NULL);
+ ipo_to_animdata(bmain, id, te->ipo, NULL, NULL, NULL);
if (adt->action)
adt->action->idroot = te->ipo->blocktype;
@@ -2006,7 +2006,7 @@ void do_versions_ipos_to_animato(Main *main)
}
/* cameras */
- for (id = main->camera.first; id; id = id->next) {
+ for (id = bmain->camera.first; id; id = id->next) {
Camera *ca = (Camera *)id;
if (G.debug & G_DEBUG) printf("\tconverting camera %s\n", id->name + 2);
@@ -2017,7 +2017,7 @@ void do_versions_ipos_to_animato(Main *main)
AnimData *adt = BKE_animdata_add_id(id);
/* Convert Camera data... */
- ipo_to_animdata(id, ca->ipo, NULL, NULL, NULL);
+ ipo_to_animdata(bmain, id, ca->ipo, NULL, NULL, NULL);
if (adt->action)
adt->action->idroot = ca->ipo->blocktype;
@@ -2028,7 +2028,7 @@ void do_versions_ipos_to_animato(Main *main)
}
/* lamps */
- for (id = main->lamp.first; id; id = id->next) {
+ for (id = bmain->lamp.first; id; id = id->next) {
Lamp *la = (Lamp *)id;
if (G.debug & G_DEBUG) printf("\tconverting lamp %s\n", id->name + 2);
@@ -2039,7 +2039,7 @@ void do_versions_ipos_to_animato(Main *main)
AnimData *adt = BKE_animdata_add_id(id);
/* Convert Lamp data... */
- ipo_to_animdata(id, la->ipo, NULL, NULL, NULL);
+ ipo_to_animdata(bmain, id, la->ipo, NULL, NULL, NULL);
if (adt->action)
adt->action->idroot = la->ipo->blocktype;
@@ -2050,7 +2050,7 @@ void do_versions_ipos_to_animato(Main *main)
}
/* curves */
- for (id = main->curve.first; id; id = id->next) {
+ for (id = bmain->curve.first; id; id = id->next) {
Curve *cu = (Curve *)id;
if (G.debug & G_DEBUG) printf("\tconverting curve %s\n", id->name + 2);
@@ -2061,7 +2061,7 @@ void do_versions_ipos_to_animato(Main *main)
AnimData *adt = BKE_animdata_add_id(id);
/* Convert Curve data... */
- ipo_to_animdata(id, cu->ipo, NULL, NULL, NULL);
+ ipo_to_animdata(bmain, id, cu->ipo, NULL, NULL, NULL);
if (adt->action)
adt->action->idroot = cu->ipo->blocktype;
@@ -2083,7 +2083,7 @@ void do_versions_ipos_to_animato(Main *main)
*/
/* actions */
- for (id = main->action.first; id; id = id->next) {
+ for (id = bmain->action.first; id; id = id->next) {
bAction *act = (bAction *)id;
if (G.debug & G_DEBUG) printf("\tconverting action %s\n", id->name + 2);
@@ -2097,7 +2097,7 @@ void do_versions_ipos_to_animato(Main *main)
}
/* ipo's */
- for (id = main->ipo.first; id; id = id->next) {
+ for (id = bmain->ipo.first; id; id = id->next) {
Ipo *ipo = (Ipo *)id;
if (G.debug & G_DEBUG) printf("\tconverting ipo %s\n", id->name + 2);
@@ -2107,7 +2107,7 @@ void do_versions_ipos_to_animato(Main *main)
bAction *new_act;
/* add a new action for this, and convert all data into that action */
- new_act = BKE_action_add(main, id->name + 2);
+ new_act = BKE_action_add(bmain, id->name + 2);
ipo_to_animato(NULL, ipo, NULL, NULL, NULL, NULL, &new_act->curves, &drivers);
new_act->idroot = ipo->blocktype;
}
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index d03c11c7b2a..2bebdff10a6 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -2014,7 +2014,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
/* Make full copy outside of Main database.
* Note: previews are not copied here.
*/
- BKE_id_copy_ex(G.main, (ID *)ntree, (ID **)&ltree,
+ BKE_id_copy_ex(NULL, (ID *)ntree, (ID **)&ltree,
LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_COPY_NO_PREVIEW, false);
ltree->flag |= NTREE_IS_LOCALIZED;
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 7602523b97c..c064f2e5f71 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3146,7 +3146,7 @@ void psys_mat_hair_to_global(Object *ob, DerivedMesh *dm, short from, ParticleDa
/************************************************/
/* ParticleSettings handling */
/************************************************/
-ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *name)
+ModifierData *object_add_particle_system(Main *bmain, Scene *scene, Object *ob, const char *name)
{
ParticleSystem *psys;
ModifierData *md;
@@ -3163,7 +3163,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
BLI_addtail(&ob->particlesystem, psys);
- psys->part = BKE_particlesettings_add(NULL, DATA_("ParticleSettings"));
+ psys->part = BKE_particlesettings_add(bmain, DATA_("ParticleSettings"));
if (BLI_listbase_count_at_most(&ob->particlesystem, 2) > 1)
BLI_snprintf(psys->name, sizeof(psys->name), DATA_("ParticleSystem %i"), BLI_listbase_count(&ob->particlesystem));
@@ -3186,12 +3186,12 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
psys->flag = PSYS_CURRENT;
psys->cfra = BKE_scene_frame_get_from_ctime(scene, CFRA + 1);
- DAG_relations_tag_update(G.main);
+ DAG_relations_tag_update(bmain);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
return md;
}
-void object_remove_particle_system(Scene *UNUSED(scene), Object *ob)
+void object_remove_particle_system(Main *bmain, Scene *UNUSED(scene), Object *ob)
{
ParticleSystem *psys = psys_get_current(ob);
ParticleSystemModifierData *psmd;
@@ -3232,7 +3232,7 @@ void object_remove_particle_system(Scene *UNUSED(scene), Object *ob)
else
ob->mode &= ~OB_MODE_PARTICLE_EDIT;
- DAG_relations_tag_update(G.main);
+ DAG_relations_tag_update(bmain);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
@@ -3321,14 +3321,11 @@ static void default_particle_settings(ParticleSettings *part)
}
-ParticleSettings *BKE_particlesettings_add(Main *main, const char *name)
+ParticleSettings *BKE_particlesettings_add(Main *bmain, const char *name)
{
ParticleSettings *part;
- if (main == NULL)
- main = G.main;
-
- part = BKE_libblock_alloc(main, ID_PA, name, 0);
+ part = BKE_libblock_alloc(bmain, ID_PA, name, 0);
default_particle_settings(part);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 61971456df3..8d550e09b25 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -3516,7 +3516,7 @@ void BKE_ptcache_quick_cache_all(Main *bmain, Scene *scene)
PTCacheBaker baker;
memset(&baker, 0, sizeof(baker));
- baker.main = bmain;
+ baker.bmain = bmain;
baker.scene = scene;
baker.bake = 0;
baker.render = 0;
@@ -3541,7 +3541,7 @@ static void ptcache_dt_to_str(char *str, double dtime)
/* if bake is not given run simulations to current frame */
void BKE_ptcache_bake(PTCacheBaker *baker)
{
- Main *bmain = baker->main;
+ Main *bmain = baker->bmain;
Scene *scene = baker->scene;
Scene *sce_iter; /* SETLOOPER macro only */
Base *base;
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;
}
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 824a26fe60e..9dbb724c9f7 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -115,7 +115,7 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
/* don't need to worry about the new modifier's name, since that is set to the number
* of particle systems which shouldn't have too many duplicates
*/
- new_md = object_add_particle_system(scene, ob, name);
+ new_md = object_add_particle_system(bmain, scene, ob, name);
}
else {
/* get new modifier data to add */
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 8a363276c28..66c62d47340 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -77,13 +77,14 @@ static float I[4][4] = {{1.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f, 0.0f}, {0.0
static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Main *bmain = CTX_data_main(C);
Object *ob= ED_object_context(C);
Scene *scene = CTX_data_scene(C);
if (!scene || !ob)
return OPERATOR_CANCELLED;
- object_add_particle_system(scene, ob, NULL);
+ object_add_particle_system(bmain, scene, ob, NULL);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
@@ -108,6 +109,7 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot)
static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Main *bmain = CTX_data_main(C);
Object *ob = ED_object_context(C);
Scene *scene = CTX_data_scene(C);
int mode_orig;
@@ -116,7 +118,7 @@ static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
mode_orig = ob->mode;
- object_remove_particle_system(scene, ob);
+ object_remove_particle_system(bmain, scene, ob);
/* possible this isn't the active object
* object_remove_particle_system() clears the mode on the last psys
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index dadd086a774..fc2f7e40645 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -163,7 +163,7 @@ static PTCacheBaker *ptcache_baker_create(bContext *C, wmOperator *op, bool all)
{
PTCacheBaker *baker = MEM_callocN(sizeof(PTCacheBaker), "PTCacheBaker");
- baker->main = CTX_data_main(C);
+ baker->bmain = CTX_data_main(C);
baker->scene = CTX_data_scene(C);
baker->bake = RNA_boolean_get(op->ptr, "bake");
baker->render = 0;
diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c
index bcd4da94257..012f71c10ba 100644
--- a/source/blender/editors/space_view3d/view3d_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_ruler.c
@@ -38,8 +38,9 @@
#include "BLT_translation.h"
#include "BKE_context.h"
-#include "BKE_unit.h"
#include "BKE_gpencil.h"
+#include "BKE_main.h"
+#include "BKE_unit.h"
#include "BIF_gl.h"
@@ -292,6 +293,7 @@ static void ruler_state_set(bContext *C, RulerInfo *ruler_info, int state)
#define RULER_ID "RulerData3D"
static bool view3d_ruler_to_gpencil(bContext *C, RulerInfo *ruler_info)
{
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
bGPDlayer *gpl;
bGPDframe *gpf;
@@ -303,7 +305,7 @@ static bool view3d_ruler_to_gpencil(bContext *C, RulerInfo *ruler_info)
bool changed = false;
if (scene->gpd == NULL) {
- scene->gpd = BKE_gpencil_data_addnew("GPencil");
+ scene->gpd = BKE_gpencil_data_addnew(bmain, "GPencil");
}
gpl = BLI_findstring(&scene->gpd->layers, ruler_name, offsetof(bGPDlayer, info));
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 6d5ec5f508e..f00b308e36b 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -1773,7 +1773,7 @@ void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "new", "BKE_gpencil_data_addnew");
- RNA_def_function_flag(func, FUNC_NO_SELF);
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_MAIN);
parm = RNA_def_string(func, "name", "GreasePencil", 0, "", "New name for the data-block");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
/* return type */
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 45e45e4b3d3..96eda640ee3 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -3190,7 +3190,7 @@ static void update_physics_cache(Render *re, Scene *scene, int UNUSED(anim_init)
PTCacheBaker baker;
memset(&baker, 0, sizeof(baker));
- baker.main = re->main;
+ baker.bmain = re->main;
baker.scene = scene;
baker.bake = 0;
baker.render = 1;