[Bf-blender-cvs] [aebc04e] gooseberry: Smoke cache offset (start frame) feature.

Lukas Tönne noreply at git.blender.org
Wed Mar 25 15:59:06 CET 2015


Commit: aebc04ec1f818610f1cc43d210b072ea6227f689
Author: Lukas Tönne
Date:   Wed Mar 25 15:56:05 2015 +0100
Branches: gooseberry
https://developer.blender.org/rBaebc04ec1f818610f1cc43d210b072ea6227f689

Smoke cache offset (start frame) feature.

This lets users set a start frame at which a cached smoke simulation
starts. This offset is simply subtracted from the current scene frame
for evaluating the cache.

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

M	release/scripts/startup/bl_ui/properties_physics_smoke.py
M	source/blender/blenkernel/intern/smoke.c
M	source/blender/makesdna/DNA_smoke_types.h
M	source/blender/makesrna/intern/rna_smoke.c

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

diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index 63268bc..b2f7962 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -309,6 +309,7 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel):
 
         layout.label(text="Compression:")
         layout.prop(md, "point_cache_compress_type", expand=True)
+        layout.prop(md, "point_cache_offset", text="Start Frame")
 
         point_cache_ui(self, context, cache, (cache.is_baked is False), 'SMOKE')
 
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index aa8649b..54e9b8c 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -2671,7 +2671,7 @@ static void smokeModifier_process(SmokeModifierData *smd, Scene *scene, Object *
 		int startframe, endframe, framenr;
 		float timescale;
 
-		framenr = scene->r.cfra;
+		framenr = scene->r.cfra - sds->point_cache_offset;
 
 		//printf("time: %d\n", scene->r.cfra);
 
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index 25c98b4..c774e40 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -137,6 +137,8 @@ typedef struct SmokeDomainSettings {
 	/* Smoke uses only one cache from now on (index [0]), but keeping the array for now for reading old files. */
 	struct PointCache *point_cache[2];	/* definition is in DNA_object_force.h */
 	struct ListBase ptcaches[2];
+	int point_cache_offset;
+	int pad;
 	struct EffectorWeights *effector_weights;
 	int border_collisions;	/* How domain border collisions are handled */
 	float time_scale;
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index 55262a9..ed6bfef 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -414,6 +414,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 	RNA_def_property_enum_items(prop, smoke_cache_comp_items);
 	RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
 
+	prop = RNA_def_property(srna, "point_cache_offset", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "point_cache_offset");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_range(prop, -10000, 10000);
+	RNA_def_property_ui_range(prop, -10000, 10000, 1, -1);
+	RNA_def_property_ui_text(prop, "Point Cache Offset", "Offset to add to cached frames");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+
 	prop = RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "border_collisions");
 	RNA_def_property_enum_items(prop, smoke_domain_colli_items);




More information about the Bf-blender-cvs mailing list