[Bf-blender-cvs] [e9dfc5c1676] fluid-mantaflow: improved cache resume functionality

Sebastián Barschkis noreply at git.blender.org
Thu Aug 2 17:44:32 CEST 2018


Commit: e9dfc5c167634e3d8ab55faac52fcfc1ac947c53
Author: Sebastián Barschkis
Date:   Thu Aug 2 17:44:22 2018 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBe9dfc5c167634e3d8ab55faac52fcfc1ac947c53

improved cache resume functionality

it is now possible to resume an already completed bake

===================================================================

M	release/scripts/startup/bl_ui/properties_physics_smoke.py
M	source/blender/editors/physics/physics_fluid.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index 58fed20c2ea..071cdd0b70a 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -164,7 +164,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
                 col.prop(domain, "particle_randomness")
 
             split = layout.split()
-            bake_incomplete = domain.cache_frame_pause_data
+            bake_incomplete = (domain.cache_frame_pause_data < domain.cache_frame_end)
             if domain.cache_baked_data and not domain.cache_baking_data and bake_incomplete:
                 col = split.column()
                 col.operator("manta.bake_data", text="Resume")
@@ -416,7 +416,7 @@ class PHYSICS_PT_smoke_noise(PhysicButtonsPanel, Panel):
 
         split = layout.split()
         split.enabled = domain.cache_baked_data
-        bake_incomplete = domain.cache_frame_pause_noise
+        bake_incomplete = (domain.cache_frame_pause_noise < domain.cache_frame_end)
         if domain.cache_baked_noise and not domain.cache_baking_noise and bake_incomplete:
             col = split.column()
             col.operator("manta.bake_noise", text="Resume")
@@ -489,7 +489,7 @@ class PHYSICS_PT_smoke_mesh(PhysicButtonsPanel, Panel):
 
         split = layout.split()
         split.enabled = domain.cache_baked_data
-        bake_incomplete = domain.cache_frame_pause_mesh
+        bake_incomplete = (domain.cache_frame_pause_mesh < domain.cache_frame_end)
         if domain.cache_baked_mesh and not domain.cache_baking_mesh and bake_incomplete:
             col = split.column()
             col.operator("manta.bake_mesh", text="Resume")
@@ -564,7 +564,7 @@ class PHYSICS_PT_smoke_particles(PhysicButtonsPanel, Panel):
 
         split = layout.split()
         split.enabled = domain.cache_baked_data and (domain.use_drop_particles or domain.use_bubble_particles or domain.use_floater_particles or domain.use_tracer_particles)
-        bake_incomplete = domain.cache_frame_pause_particles
+        bake_incomplete = (domain.cache_frame_pause_particles < domain.cache_frame_end)
         if domain.cache_baked_particles and not domain.cache_baking_particles and bake_incomplete:
             col = split.column()
             col.operator("manta.bake_particles", text="Resume")
@@ -662,7 +662,7 @@ class PHYSICS_PT_smoke_guiding(PhysicButtonsPanel, Panel):
 
         if domain.guiding_source == "EFFECTOR":
             split = layout.split()
-            bake_incomplete = domain.cache_frame_pause_guiding
+            bake_incomplete = (domain.cache_frame_pause_guiding < domain.cache_frame_end)
             if domain.cache_baked_guiding and not domain.cache_baking_guiding and bake_incomplete:
                 col = split.column()
                 col.operator("manta.bake_guiding", text="Resume")
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 8580d492ac3..415ca8a7511 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -1218,10 +1218,11 @@ static void fluid_manta_bake_sequence(FluidMantaflowJob *job)
 	for ( ; frame <= sds->cache_frame_end; frame++) {
 		const float progress = (frame - sds->cache_frame_start) / (float)frames;
 
+		/* Keep track of pause frame - needed to init future loop */
+		(*pause_frame) = frame;
+
 		/* If user requested stop, quit baking */
 		if (G.is_break) {
-			/* Keep track of pause frame - needed to init future loop */
-			(*pause_frame) = frame;
 
 			job->success = 0;
 			return;
@@ -1238,9 +1239,6 @@ static void fluid_manta_bake_sequence(FluidMantaflowJob *job)
 		/* Update animation system */
 		ED_update_for_newframe(job->bmain, scene, 1);
 	}
-	/* Reset pause frame - bake is complete */
-	if (frame-1 == sds->cache_frame_end) // frame-1 because when loop stop, it already increased frame cnt by 1 (frame++)
-		(*pause_frame) = 0;
 
 	/* Restore frame position that we were on before bake */
 	scene->r.cfra = orig_frame;



More information about the Bf-blender-cvs mailing list