diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_gpencil.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_particle.h | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_pointcache.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blendfile.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/customdata.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/ipo.c | 62 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 4 |
10 files changed, 59 insertions, 61 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 734eb8cfa09..0a5bac267ac 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -331,9 +331,10 @@ void psys_particle_on_emitter(struct ParticleSystemModifierData *psmd, int distr float utan[3], float vtan[3], float orco[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 89f1aa5eadd..501c9964aa3 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -185,7 +185,7 @@ typedef struct PTCacheID { } PTCacheID; typedef struct PTCacheBaker { - struct Main *main; + struct Main *bmain; struct Scene *scene; struct ViewLayer *view_layer; struct Depsgraph *depsgraph; diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 3f78b096115..1ec5b347168 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -81,9 +81,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); @@ -125,7 +125,7 @@ void BKE_blender_globals_init(void) U.savetime = 1; - G.main = BKE_main_new(); + G_MAIN = BKE_main_new(); strcpy(G.ima, "//"); @@ -142,9 +142,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 597c69408b5..27b5089b092 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -116,7 +116,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; @@ -207,7 +207,7 @@ static void setup_app_data( win->scene = curscene; } - /* 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_restore(bfd->main, CTX_wm_manager(C), curscene, cur_view_layer); if (win) { curscene = win->scene; @@ -230,14 +230,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 aa67eafaa98..2f33ca3210d 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -3483,7 +3483,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 82178096b46..f3f690b92da 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1509,7 +1509,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}; @@ -1544,7 +1544,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); } @@ -1680,19 +1680,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) @@ -1701,7 +1701,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; @@ -1716,7 +1716,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; @@ -1750,7 +1750,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; } @@ -1770,7 +1770,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; } @@ -1790,7 +1790,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; } @@ -1810,7 +1810,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; } @@ -1829,7 +1829,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); @@ -1843,7 +1843,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; @@ -1854,7 +1854,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); @@ -1865,7 +1865,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; @@ -1876,7 +1876,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); @@ -1887,7 +1887,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; @@ -1898,7 +1898,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) { @@ -1938,7 +1938,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 */ @@ -1952,7 +1952,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); @@ -1963,7 +1963,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; @@ -1974,7 +1974,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); @@ -1985,7 +1985,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; @@ -1996,7 +1996,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); @@ -2007,7 +2007,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; @@ -2018,7 +2018,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); @@ -2029,7 +2029,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; @@ -2051,7 +2051,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); @@ -2065,7 +2065,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); @@ -2075,7 +2075,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/particle.c b/source/blender/blenkernel/intern/particle.c index 2bba32ff592..127ef840027 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2975,7 +2975,7 @@ void psys_mat_hair_to_global(Object *ob, Mesh *mesh, short from, ParticleData *p /************************************************/ /* 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; @@ -2992,7 +2992,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)); @@ -3015,12 +3015,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); - DEG_relations_tag_update(G.main); + DEG_relations_tag_update(bmain); DEG_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; @@ -3061,7 +3061,7 @@ void object_remove_particle_system(Scene *UNUSED(scene), Object *ob) else ob->mode &= ~OB_MODE_PARTICLE_EDIT; - DEG_relations_tag_update(G.main); + DEG_relations_tag_update(bmain); DEG_id_tag_update(&ob->id, OB_RECALC_DATA); /* Flush object mode. */ @@ -3155,14 +3155,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 8d55a1d2690..10050e5e083 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -3536,7 +3536,7 @@ void BKE_ptcache_quick_cache_all(Main *bmain, Scene *scene, ViewLayer *view_laye PTCacheBaker baker; memset(&baker, 0, sizeof(baker)); - baker.main = bmain; + baker.bmain = bmain; baker.scene = scene; baker.view_layer = view_layer; baker.bake = 0; @@ -3562,7 +3562,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; ViewLayer *view_layer = baker->view_layer; struct Depsgraph *depsgraph = baker->depsgraph; |