diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index 114d74f1060..363b0f20428 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -85,6 +85,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel): col.label() col.prop(fluid, "use_speed_vectors") col.prop(fluid, "use_reverse_frames") + col.prop(fluid, "frame_offset", text="Offset") layout.prop(fluid, "filepath", text="") diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h index 90e6e97bc15..0651f076096 100644 --- a/source/blender/makesdna/DNA_object_fluidsim.h +++ b/source/blender/makesdna/DNA_object_fluidsim.h @@ -74,6 +74,9 @@ typedef struct FluidsimSettings { float animStart, animEnd; /* bake start end time (in blender frames) */ int bakeStart, bakeEnd; + /* offset for baked frames */ + int frameOffset; + int pad; /* g star param (LBM compressibility) */ float gstar; /* activate refinement? */ diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index 99a84fc8b39..c17f23bb3a0 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -335,6 +335,11 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna) RNA_def_property_range(prop, 0, 100); RNA_def_property_ui_text(prop, "End Time", "Simulation time of the last blender frame (in seconds)"); + prop= RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "frameOffset"); + RNA_def_property_ui_text(prop, "Cache Offset", "Offset when reading baked cache"); + RNA_def_property_update(prop, NC_OBJECT, "rna_fluid_update"); + prop= RNA_def_property(srna, "simulation_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "realsize"); RNA_def_property_range(prop, 0.001, 10); diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index b62a497a10c..38909a2671a 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -475,6 +475,9 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim break; } + /* offset baked frame */ + curFrame += fss->frameOffset; + BLI_path_abs(targetFile, modifier_path_relbase(ob)); BLI_path_frame(targetFile, curFrame, 0); // fixed #frame-no