diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-05-31 16:37:15 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-05-31 16:37:15 +0300 |
commit | b809340960693a3e9808e59de4d1e029226fb492 (patch) | |
tree | a2f75c291b8ac4d3ffa4abdb3b9fe013f1506dc4 /source | |
parent | 3248ac5e83307d623b18ccaed4c0b496121802e5 (diff) | |
parent | b53d358261a26652d510d62565f1b43035a55e67 (diff) |
Merge branch 'master' into blender2.8
Conflicts:
intern/cycles/blender/blender_curves.cpp
source/blender/blenkernel/BKE_particle.h
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/object_update.c
source/blender/blenkernel/intern/particle_system.c
source/blender/editors/object/object_modifier.c
source/blender/editors/physics/physics_fluid.c
source/blender/makesrna/intern/rna_particle.c
source/blender/modifiers/intern/MOD_particlesystem.c
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_modifier.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 8 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 10 | ||||
-rw-r--r-- | source/blender/editors/physics/physics_fluid.c | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fluidsim.c | 6 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_fluidsim_util.c | 7 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_ocean.c | 8 |
8 files changed, 33 insertions, 24 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index a7b491527f5..b5d3e67b970 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -467,7 +467,7 @@ void test_object_modifiers(struct Object *ob); void modifier_mdef_compact_influences(struct ModifierData *md); void modifier_path_init(char *path, int path_maxlen, const char *name); -const char *modifier_path_relbase(struct Object *ob); +const char *modifier_path_relbase(struct Main *bmain, struct Object *ob); /* wrappers for modifier callbacks that ensure valid normals */ diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 86563ab797d..1358951e240 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -61,6 +61,7 @@ #include "BKE_appdir.h" #include "BKE_cdderivedmesh.h" #include "BKE_editmesh.h" +#include "BKE_global.h" #include "BKE_idcode.h" #include "BKE_key.h" #include "BKE_library.h" @@ -71,7 +72,6 @@ #include "BKE_DerivedMesh.h" /* may move these, only for modifier_path_relbase */ -#include "BKE_global.h" /* ugh, G.main->name only */ #include "BKE_main.h" /* end */ @@ -797,10 +797,10 @@ void test_object_modifiers(Object *ob) * - else if the file has been saved return the blend file path. * - else if the file isn't saved and the ID isn't from a library, return the temp dir. */ -const char *modifier_path_relbase(Object *ob) +const char *modifier_path_relbase(Main *bmain, Object *ob) { if (G.relbase_valid || ID_IS_LINKED(ob)) { - return ID_BLEND_PATH(G.main, &ob->id); + return ID_BLEND_PATH(bmain, &ob->id); } else { /* last resort, better then using "" which resolves to the current diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 94abfe72b34..88dd3de7fc4 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -74,8 +74,10 @@ #include "BKE_collision.h" #include "BKE_colortools.h" #include "BKE_effect.h" +#include "BKE_global.h" #include "BKE_library.h" #include "BKE_library_query.h" +#include "BKE_main.h" #include "BKE_particle.h" #include "BKE_collection.h" @@ -3805,7 +3807,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra, const bool use_ } } -static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra), const bool use_render_params) +static void particles_fluid_step(Main *bmain, ParticleSimulationData *sim, int UNUSED(cfra), const bool use_render_params) { ParticleSystem *psys = sim->psys; if (psys->particles) { @@ -3836,7 +3838,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra), // ok, start loading BLI_join_dirfile(filename, sizeof(filename), fss->surfdataPath, OB_FLUIDSIM_SURF_PARTICLES_FNAME); - BLI_path_abs(filename, modifier_path_relbase(sim->ob)); + BLI_path_abs(filename, modifier_path_relbase(bmain, sim->ob)); BLI_path_frame(filename, curFrame, 0); // fixed #frame-no @@ -4308,7 +4310,7 @@ void particle_system_update(struct Depsgraph *depsgraph, Scene *scene, Object *o } case PART_FLUID: { - particles_fluid_step(&sim, (int)cfra, use_render_params); + particles_fluid_step(G.main /* Yuck :/ */, &sim, (int)cfra, use_render_params); break; } default: diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 43cd65c55cd..14bd8859ac2 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1314,6 +1314,7 @@ void OBJECT_OT_multires_reshape(wmOperatorType *ot) static int multires_external_save_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Object *ob = ED_object_active_context(C); Mesh *me = (ob) ? ob->data : op->customdata; char path[FILE_MAX]; @@ -1328,7 +1329,7 @@ static int multires_external_save_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", path); if (relative) - BLI_path_rel(path, G.main->name); + BLI_path_rel(path, bmain->name); CustomData_external_add(&me->ldata, &me->id, CD_MDISPS, me->totloop, path); CustomData_external_write(&me->ldata, &me->id, CD_MASK_MESH, me->totloop, 0); @@ -2153,6 +2154,7 @@ static void oceanbake_endjob(void *customdata) static int ocean_bake_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Object *ob = ED_object_active_context(C); OceanModifierData *omd = (OceanModifierData *)edit_modifier_property_get(op, ob, eModifierType_Ocean); Scene *scene = CTX_data_scene(C); @@ -2174,7 +2176,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - och = BKE_ocean_init_cache(omd->cachepath, modifier_path_relbase(ob), + och = BKE_ocean_init_cache(omd->cachepath, modifier_path_relbase(bmain, ob), omd->bakestart, omd->bakeend, omd->wave_scale, omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution); @@ -2188,7 +2190,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op) * * XXX: This can't be used due to an anim sys optimization that ignores recalc object animation, * leaving it for the depgraph (this ignores object animation such as modifier properties though... :/ ) - * --> BKE_animsys_evaluate_all_animation(G.main, eval_time); + * --> BKE_animsys_evaluate_all_animation(bmain, eval_time); * This doesn't work with drivers: * --> BKE_animsys_evaluate_animdata(&fsDomain->id, fsDomain->adt, eval_time, ADT_RECALC_ALL); */ @@ -2197,7 +2199,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op) * this part of the process before a threaded job is created */ //scene->r.cfra = f; - //ED_update_for_newframe(CTX_data_main(C), scene); + //ED_update_for_newframe(bmain, scene); /* ok, this doesn't work with drivers, but is way faster. * let's use this for now and hope nobody wants to drive the time value... */ diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 541242fdc09..df8b4432e8b 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -48,6 +48,7 @@ #include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_fluidsim.h" +#include "BKE_main.h" #include "BKE_modifier.h" #include "BKE_object.h" #include "BKE_report.h" @@ -637,13 +638,13 @@ static int fluid_validate_scene(ReportList *reports, ViewLayer *view_layer, Obje #define FLUID_SUFFIX_SURFACE "fluidsurface" static bool fluid_init_filepaths( - ReportList *reports, FluidsimSettings *domainSettings, Object *fsDomain, + Main *bmain, ReportList *reports, FluidsimSettings *domainSettings, Object *fsDomain, char *targetDir, char *targetFile) { const char *suffixConfigTmp = FLUID_SUFFIX_CONFIG_TMP; /* prepare names... */ - const char *relbase = modifier_path_relbase(fsDomain); + const char *relbase = modifier_path_relbase(bmain, fsDomain); /* We do not accept empty paths, they can end in random places silently, see T51176. */ if (domainSettings->surfdataPath[0] == '\0') { @@ -840,6 +841,7 @@ static void fluidsim_delete_until_lastframe(FluidsimSettings *fss, const char *r static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, short do_job) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); Depsgraph *depsgraph = CTX_data_depsgraph(C); @@ -849,7 +851,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor char debugStrBuffer[256]; int gridlevels = 0; - const char *relbase= modifier_path_relbase(fsDomain); + const char *relbase= modifier_path_relbase(bmain, fsDomain); const char *strEnvName = "BLENDER_ELBEEMDEBUG"; // from blendercall.cpp const char *suffixConfigTmp = FLUID_SUFFIX_CONFIG_TMP; const char *suffixSurface = FLUID_SUFFIX_SURFACE; @@ -941,7 +943,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor /* ******** prepare output file paths ******** */ - if (!fluid_init_filepaths(reports, domainSettings, fsDomain, targetDir, targetFile)) { + if (!fluid_init_filepaths(bmain, reports, domainSettings, fsDomain, targetDir, targetFile)) { fluidbake_free_data(channels, fobjects, fsset, fb); return false; } diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index a75aceb6f7e..16b672ada49 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -87,14 +87,14 @@ static void rna_fluid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob); } -static int fluidsim_find_lastframe(Object *ob, FluidsimSettings *fss) +static int fluidsim_find_lastframe(Main *bmain, Object *ob, FluidsimSettings *fss) { char targetFileTest[FILE_MAX]; char targetFile[FILE_MAX]; int curFrame = 1; BLI_join_dirfile(targetFile, sizeof(targetFile), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME); - BLI_path_abs(targetFile, modifier_path_relbase(ob)); + BLI_path_abs(targetFile, modifier_path_relbase(bmain, ob)); do { BLI_strncpy(targetFileTest, targetFile, sizeof(targetFileTest)); @@ -110,7 +110,7 @@ static void rna_fluid_find_enframe(Main *bmain, Scene *scene, PointerRNA *ptr) FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim); if (fluidmd->fss->flag & OB_FLUIDSIM_REVERSE) { - fluidmd->fss->lastgoodframe = fluidsim_find_lastframe(ob, fluidmd->fss); + fluidmd->fss->lastgoodframe = fluidsim_find_lastframe(bmain, ob, fluidmd->fss); } else { fluidmd->fss->lastgoodframe = -1; diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 5f7cd1e0d60..f4b39f1eab9 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -48,6 +48,7 @@ #include "BKE_fluidsim.h" /* ensure definitions here match */ #include "BKE_cdderivedmesh.h" +#include "BKE_main.h" #ifdef WITH_MOD_FLUID # include "BKE_global.h" #endif @@ -430,7 +431,7 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * } static DerivedMesh *fluidsim_read_cache( - Object *ob, DerivedMesh *orgdm, + Main *bmain, Object *ob, DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) { int curFrame = framenr /* - 1 */ /*scene->r.sfra*/; /* start with 0 at start frame */ @@ -465,7 +466,7 @@ static DerivedMesh *fluidsim_read_cache( /* offset baked frame */ curFrame += fss->frameOffset; - BLI_path_abs(targetFile, modifier_path_relbase(ob)); + BLI_path_abs(targetFile, modifier_path_relbase(bmain, ob)); BLI_path_frame(targetFile, curFrame, 0); // fixed #frame-no /* assign material + flags to new dm @@ -551,7 +552,7 @@ DerivedMesh *fluidsimModifier_do( /* try to read from cache */ /* if the frame is there, fine, otherwise don't do anything */ - if ((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams))) + if ((result = fluidsim_read_cache(G.main, ob, dm, fluidmd, framenr, useRenderParams))) return result; return dm; diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 728802882a9..921677ce1b1 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -41,15 +41,17 @@ #include "BLI_utildefines.h" #include "BKE_cdderivedmesh.h" +#include "BKE_global.h" +#include "BKE_main.h" #include "BKE_modifier.h" #include "BKE_ocean.h" #include "MOD_modifiertypes.h" #ifdef WITH_OCEANSIM -static void init_cache_data(Object *ob, struct OceanModifierData *omd) +static void init_cache_data(Main *bmain, Object *ob, struct OceanModifierData *omd) { - const char *relbase = modifier_path_relbase(ob); + const char *relbase = modifier_path_relbase(bmain, ob); omd->oceancache = BKE_ocean_init_cache(omd->cachepath, relbase, omd->bakestart, omd->bakeend, omd->wave_scale, @@ -446,7 +448,7 @@ static DerivedMesh *doOcean( /* do ocean simulation */ if (omd->cached == true) { if (!omd->oceancache) { - init_cache_data(ob, omd); + init_cache_data(G.main, ob, omd); } BKE_ocean_simulate_cache(omd->oceancache, md->scene->r.cfra); } |