forked from bartvdbraak/blender
Fluid: Enabled OpenVDB precision argument
This way particles can be saved with the custom OpenVDB precision options that were introduced in the latest Mantaflow update.
This commit is contained in:
parent
2ec07dfa18
commit
3d1b5e35bd
@ -740,11 +740,13 @@ void MANTA::initializeRNAMap(FluidModifierData *fmd)
|
||||
else if (fds->openvdb_compression == VDB_COMPRESSION_BLOSC)
|
||||
vdbCompressionMethod = "Compression_Blosc";
|
||||
|
||||
string vdbPrecisionHalf = "True";
|
||||
if (fds->openvdb_data_depth == VDB_PRECISION_HALF_FLOAT)
|
||||
vdbPrecisionHalf = "True";
|
||||
else if (fds->openvdb_data_depth == VDB_PRECISION_FULL_FLOAT)
|
||||
vdbPrecisionHalf = "False";
|
||||
string vdbPrecisionHalf = "Precision_Half";
|
||||
if (fds->openvdb_data_depth == VDB_PRECISION_FULL_FLOAT)
|
||||
vdbPrecisionHalf = "Precision_Full";
|
||||
else if (fds->openvdb_data_depth == VDB_PRECISION_HALF_FLOAT)
|
||||
vdbPrecisionHalf = "Precision_Half";
|
||||
else if (fds->openvdb_data_depth == VDB_PRECISION_MINI_FLOAT)
|
||||
vdbPrecisionHalf = "Precision_Mini";
|
||||
|
||||
mRNAMap["USING_SMOKE"] = getBooleanString(fds->type == FLUID_DOMAIN_TYPE_GAS);
|
||||
mRNAMap["USING_LIQUID"] = getBooleanString(fds->type == FLUID_DOMAIN_TYPE_LIQUID);
|
||||
|
@ -165,7 +165,7 @@ gravity_s$ID$ *= scaleAcceleration_s$ID$ # scale from world acceleration to cell
|
||||
\n\
|
||||
# OpenVDB options\n\
|
||||
vdbCompression_s$ID$ = $COMPRESSION_OPENVDB$\n\
|
||||
vdbPrecisionHalf_s$ID$ = $PRECISION_OPENVDB$\n\
|
||||
vdbPrecision_s$ID$ = $PRECISION_OPENVDB$\n\
|
||||
\n\
|
||||
# Cache file names\n\
|
||||
file_data_s$ID$ = '$NAME_DATA$'\n\
|
||||
@ -718,7 +718,7 @@ def fluid_file_export_s$ID$(framenr, file_format, path, dict, file_name=None, mo
|
||||
file = os.path.join(path, file_name + '_' + framenr + file_format)\n\
|
||||
if not os.path.isfile(file) or mode_override:\n\
|
||||
if file_format == '.vdb':\n\
|
||||
saveCombined = save(name=file, objects=list(dict.values()), worldSize=domainSize_s$ID$, skipDeletedParts=True, compression=vdbCompression_s$ID$, precisionHalf=vdbPrecisionHalf_s$ID$)\n\
|
||||
saveCombined = save(name=file, objects=list(dict.values()), worldSize=domainSize_s$ID$, skipDeletedParts=True, compression=vdbCompression_s$ID$, precision=vdbPrecision_s$ID$)\n\
|
||||
elif file_format == '.bobj.gz' or file_format == '.obj':\n\
|
||||
for name, object in dict.items():\n\
|
||||
if not os.path.isfile(file) or mode_override:\n\
|
||||
|
@ -463,6 +463,7 @@ enum {
|
||||
enum {
|
||||
VDB_PRECISION_HALF_FLOAT = 0,
|
||||
VDB_PRECISION_FULL_FLOAT = 1,
|
||||
VDB_PRECISION_MINI_FLOAT = 2,
|
||||
};
|
||||
|
||||
/* Deprecated values (i.e. all defines and enums below this line up until typedefs). */
|
||||
|
@ -1264,8 +1264,13 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
static const EnumPropertyItem fluid_data_depth_items[] = {
|
||||
{VDB_PRECISION_HALF_FLOAT, "16", 0, "Half", "Half float (16 bit data)"},
|
||||
{VDB_PRECISION_FULL_FLOAT, "32", 0, "Full", "Full float (32 bit data)"},
|
||||
{VDB_PRECISION_MINI_FLOAT,
|
||||
"8",
|
||||
0,
|
||||
"Mini",
|
||||
"Mini float (Use 8 bit where possible, otherwise 16 bit)"},
|
||||
{VDB_PRECISION_HALF_FLOAT, "16", 0, "Half", "Half float (Use 16 bit for all data)"},
|
||||
{VDB_PRECISION_FULL_FLOAT, "32", 0, "Full", "Full float (Use 32 bit for all data)"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
@ -2628,10 +2633,10 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
|
||||
prop = RNA_def_property(srna, "openvdb_data_depth", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_bitflag_sdna(prop, NULL, "openvdb_data_depth");
|
||||
RNA_def_property_enum_items(prop, fluid_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_ui_text(
|
||||
prop,
|
||||
"Data Depth",
|
||||
"Bit depth for fluid particles and grids (lower bit values reduce file size)");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user