[Bf-blender-cvs] [1153496] temp-openvdb: Use depth enum for spoke depth (matches EXR setting)

Campbell Barton noreply at git.blender.org
Sat Jan 23 07:12:18 CET 2016


Commit: 1153496366ab2533ab86fc7b5cd292c43fe804fe
Author: Campbell Barton
Date:   Sat Jan 23 17:04:19 2016 +1100
Branches: temp-openvdb
https://developer.blender.org/rB1153496366ab2533ab86fc7b5cd292c43fe804fe

Use depth enum for spoke depth (matches EXR setting)

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

M	release/scripts/startup/bl_ui/properties_physics_smoke.py
M	source/blender/blenkernel/intern/pointcache.c
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 b543689..32d5b28 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -319,7 +319,9 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel):
 
             layout.label(text="Compression:")
             layout.prop(domain, "openvdb_cache_compress_type", expand=True)
-            layout.prop(domain, "save_as_half")
+            row = layout.row()
+            row.label("Data Depth:")
+            row.prop(domain, "data_depth", expand=True, text="Data Depth")
 
         cache = domain.point_cache
         point_cache_ui(self, context, cache, (cache.is_baked is False), 'SMOKE')
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 268a76d..95944c3 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -946,7 +946,7 @@ static int ptcache_smoke_openvdb_write(struct OpenVDBWriter *writer, void *smoke
 	SmokeModifierData *smd = (SmokeModifierData *)smoke_v;
 	SmokeDomainSettings *sds = smd->domain;
 
-	OpenVDBWriter_set_flags(writer, sds->openvdb_comp, sds->save_as_half);
+	OpenVDBWriter_set_flags(writer, sds->openvdb_comp, (sds->data_depth == 16));
 
 	OpenVDBWriter_add_meta_int(writer, "blender/smoke/active_fields", sds->active_fields);
 	OpenVDBWriter_add_meta_v3_int(writer, "blender/smoke/resolution", sds->res);
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 0d03035..d08cef6 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -529,7 +529,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
 			smd->domain->effector_weights = BKE_add_effector_weights(NULL);
 
 			smd->domain->openvdb_comp = VDB_COMPRESSION_BLOSC;
-			smd->domain->save_as_half = 0;
+			smd->domain->data_depth = 0;
 			smd->domain->cache_file_format = PTCACHE_FILE_PTCACHE;
 		}
 		else if (smd->type & MOD_SMOKE_TYPE_FLOW)
@@ -622,7 +622,7 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData
 		MEM_freeN(tsmd->domain->effector_weights);
 		tsmd->domain->effector_weights = MEM_dupallocN(smd->domain->effector_weights);
 		tsmd->domain->openvdb_comp = smd->domain->openvdb_comp;
-		tsmd->domain->save_as_half = smd->domain->save_as_half;
+		tsmd->domain->data_depth = smd->domain->data_depth;
 		tsmd->domain->cache_file_format = smd->domain->cache_file_format;
 	}
 	else if (tsmd->flow) {
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index f558faa..76de844 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -142,7 +142,9 @@ typedef struct SmokeDomainSettings {
 	int cache_high_comp;
 	/* OpenVDB cache options */
 	int openvdb_comp;
-	short cache_file_format, save_as_half;
+	char cache_file_format;
+	char data_depth;
+	char pad[2];
 
 	/* 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 */
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index f45efde..f682dc1 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -355,6 +355,12 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
+	static EnumPropertyItem smoke_data_depth_items[] = {
+		{16, "16", 0, "Float (Half)", "Half float (16 bit data)"},
+		{0,  "32", 0, "Float (Full)", "Full float (32 bit data)"},  /* default */
+		{0, NULL, 0, NULL, NULL},
+	};
+
 	static EnumPropertyItem smoke_domain_colli_items[] = {
 		{SM_BORDER_OPEN, "BORDEROPEN", 0, "Open", "Smoke doesn't collide with any border"},
 		{SM_BORDER_VERTICAL, "BORDERVERTICAL", 0, "Vertically Open",
@@ -486,10 +492,12 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 	RNA_def_property_enum_items(prop, prop_compression_items);
 	RNA_def_property_ui_text(prop, "Compression", "Compression method to be used");
 
-	prop = RNA_def_property(srna, "save_as_half", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "save_as_half", 0);
-	RNA_def_property_ui_text(prop, "Save as Half Float",
-	                         "Write all scalar (including vector) grids to the file as 16-bit half floats to reduce file size");
+	prop = RNA_def_property(srna, "data_depth", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_bitflag_sdna(prop, NULL, "data_depth");
+	RNA_def_property_enum_items(prop, smoke_data_depth_items);
+	RNA_def_property_ui_text(prop, "Data Depth",
+	                         "Bit depth for writing all scalar (including vector) "
+	                         "lower values reduce file size");
 	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
 
 	prop = RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE);




More information about the Bf-blender-cvs mailing list