Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/physics/physics_fluid.c
| Show First 20 Lines • Show All 335 Lines • ▼ Show 20 Lines | |||||
| static void fluid_init_all_channels(bContext *C, | static void fluid_init_all_channels(bContext *C, | ||||
| Object *UNUSED(fsDomain), | Object *UNUSED(fsDomain), | ||||
| FluidsimSettings *domainSettings, | FluidsimSettings *domainSettings, | ||||
| FluidAnimChannels *channels, | FluidAnimChannels *channels, | ||||
| ListBase *fobjects) | ListBase *fobjects) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
brecht: Make the depsgraph a parameter to this function and ensure evaluated at the start of the… | |||||
| Base *base; | Base *base; | ||||
| int i; | int i; | ||||
| int length = channels->length; | int length = channels->length; | ||||
| float eval_time; | float eval_time; | ||||
| /* init time values (assuming that time moves at a constant speed; may be overridden later) */ | /* init time values (assuming that time moves at a constant speed; may be overridden later) */ | ||||
| init_time(domainSettings, channels); | init_time(domainSettings, channels); | ||||
| ▲ Show 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | for (fobj = fobjects->first; fobj; fobj = fobj->next) { | ||||
| set_vertex_channel(depsgraph, fobj->VertexCache, timeAtFrame, scene, fobj, i); | set_vertex_channel(depsgraph, fobj->VertexCache, timeAtFrame, scene, fobj, i); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void export_fluid_objects(const bContext *C, ListBase *fobjects, Scene *scene, int length) | static void export_fluid_objects(const bContext *C, ListBase *fobjects, Scene *scene, int length) | ||||
| { | { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
brechtUnsubmitted Done Inline ActionsSame comment. brecht: Same comment. | |||||
| FluidObject *fobj; | FluidObject *fobj; | ||||
| for (fobj = fobjects->first; fobj; fobj = fobj->next) { | for (fobj = fobjects->first; fobj; fobj = fobj->next) { | ||||
| Object *ob = fobj->object; | Object *ob = fobj->object; | ||||
| FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType( | FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType( | ||||
| ob, eModifierType_Fluidsim); | ob, eModifierType_Fluidsim); | ||||
| int modifierIndex = BLI_findindex(&ob->modifiers, fluidmd); | int modifierIndex = BLI_findindex(&ob->modifiers, fluidmd); | ||||
| ▲ Show 20 Lines • Show All 389 Lines • ▼ Show 20 Lines | static void fluidsim_delete_until_lastframe(FluidsimSettings *fss, const char *relbase) | ||||
| return; | return; | ||||
| } | } | ||||
| static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, short do_job) | static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, short do_job) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | |||||
| int i; | int i; | ||||
| FluidsimSettings *domainSettings; | FluidsimSettings *domainSettings; | ||||
| char debugStrBuffer[256]; | char debugStrBuffer[256]; | ||||
| int gridlevels = 0; | int gridlevels = 0; | ||||
| const char *relbase = modifier_path_relbase(bmain, fsDomain); | const char *relbase = modifier_path_relbase(bmain, fsDomain); | ||||
| const char *strEnvName = "BLENDER_ELBEEMDEBUG"; // from blendercall.cpp | const char *strEnvName = "BLENDER_ELBEEMDEBUG"; // from blendercall.cpp | ||||
| ▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | channels->aniFrameTime = (double)((double)domainSettings->animEnd - | ||||
| (double)domainSettings->animStart) / | (double)domainSettings->animStart) / | ||||
| (double)noFrames; | (double)noFrames; | ||||
| /* ******** initialize and allocate animation channels ******** */ | /* ******** initialize and allocate animation channels ******** */ | ||||
| fluid_init_all_channels(C, fsDomain, domainSettings, channels, fobjects); | fluid_init_all_channels(C, fsDomain, domainSettings, channels, fobjects); | ||||
| /* reset to original current frame */ | /* reset to original current frame */ | ||||
| scene->r.cfra = origFrame; | scene->r.cfra = origFrame; | ||||
| ED_update_for_newframe(CTX_data_main(C), depsgraph); | ED_update_for_newframe(CTX_data_main(C), CTX_data_depsgraph_pointer(C)); | ||||
| /* ******** init domain object's matrix ******** */ | /* ******** init domain object's matrix ******** */ | ||||
| copy_m4_m4(domainMat, fsDomain->obmat); | copy_m4_m4(domainMat, fsDomain->obmat); | ||||
| if (!invert_m4_m4(invDomMat, domainMat)) { | if (!invert_m4_m4(invDomMat, domainMat)) { | ||||
| BLI_snprintf( | BLI_snprintf( | ||||
| debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::error - Invalid obj matrix?\n"); | debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::error - Invalid obj matrix?\n"); | ||||
| elbeemDebugOut(debugStrBuffer); | elbeemDebugOut(debugStrBuffer); | ||||
| BKE_report(reports, RPT_ERROR, "Invalid object matrix"); | BKE_report(reports, RPT_ERROR, "Invalid object matrix"); | ||||
| ▲ Show 20 Lines • Show All 181 Lines • Show Last 20 Lines | |||||
Make the depsgraph a parameter to this function and ensure evaluated at the start of the operator, it's not obvious what happens between this and when it starts executing the operator.