Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastián Barschkis <sebbas@sebbas.org>2020-10-19 22:40:04 +0300
committerSebastián Barschkis <sebbas@sebbas.org>2020-10-19 22:40:17 +0300
commitc6c49257710c4c7976601de54bcddc45eb9ee206 (patch)
treeef7a6fb0e8c8f4509910248079eed78aa881abd6 /source/blender/makesrna/intern/rna_fluid.c
parentaa244a7a68db75111b4afc12b39c8d8c4297e528 (diff)
Fluid: Added domain check for new OpenVDB precision 'Mini' type
Precision 'Mini' should only be available for liquids domains.
Diffstat (limited to 'source/blender/makesrna/intern/rna_fluid.c')
-rw-r--r--source/blender/makesrna/intern/rna_fluid.c414
1 files changed, 214 insertions, 200 deletions
diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c
index ad117933764..84187786c46 100644
--- a/source/blender/makesrna/intern/rna_fluid.c
+++ b/source/blender/makesrna/intern/rna_fluid.c
@@ -665,12 +665,205 @@ static void rna_Fluid_cache_directory_set(struct PointerRNA *ptr, const char *va
// settings->cache_flag = 0;
}
+static const EnumPropertyItem *rna_Fluid_cobafield_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
+
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ int totitem = 0;
+
+ tmp.value = FLUID_DOMAIN_FIELD_FLAGS;
+ tmp.identifier = "FLAGS";
+ tmp.icon = 0;
+ tmp.name = "Flags";
+ tmp.description = "Flag grid of the fluid domain";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_PRESSURE;
+ tmp.identifier = "PRESSURE";
+ tmp.icon = 0;
+ tmp.name = "Pressure";
+ tmp.description = "Pressure field of the fluid domain";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_VELOCITY_X;
+ tmp.identifier = "VELOCITY_X";
+ tmp.icon = 0;
+ tmp.name = "X Velocity";
+ tmp.description = "X component of the velocity field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_VELOCITY_Y;
+ tmp.identifier = "VELOCITY_Y";
+ tmp.icon = 0;
+ tmp.name = "Y Velocity";
+ tmp.description = "Y component of the velocity field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_VELOCITY_Z;
+ tmp.identifier = "VELOCITY_Z";
+ tmp.icon = 0;
+ tmp.name = "Z Velocity";
+ tmp.description = "Z component of the velocity field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_FORCE_X;
+ tmp.identifier = "FORCE_X";
+ tmp.icon = 0;
+ tmp.name = "X Force";
+ tmp.description = "X component of the force field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_FORCE_Y;
+ tmp.identifier = "FORCE_Y";
+ tmp.icon = 0;
+ tmp.name = "Y Force";
+ tmp.description = "Y component of the force field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_FORCE_Z;
+ tmp.identifier = "FORCE_Z";
+ tmp.icon = 0;
+ tmp.name = "Z Force";
+ tmp.description = "Z component of the force field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ if (settings->type == FLUID_DOMAIN_TYPE_GAS) {
+ tmp.value = FLUID_DOMAIN_FIELD_COLOR_R;
+ tmp.identifier = "COLOR_R";
+ tmp.icon = 0;
+ tmp.name = "Red";
+ tmp.description = "Red component of the color field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_COLOR_G;
+ tmp.identifier = "COLOR_G";
+ tmp.icon = 0;
+ tmp.name = "Green";
+ tmp.description = "Green component of the color field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_COLOR_B;
+ tmp.identifier = "COLOR_B";
+ tmp.icon = 0;
+ tmp.name = "Blue";
+ tmp.description = "Blue component of the color field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_DENSITY;
+ tmp.identifier = "DENSITY";
+ tmp.icon = 0;
+ tmp.name = "Density";
+ tmp.description = "Quantity of soot in the fluid";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_FLAME;
+ tmp.identifier = "FLAME";
+ tmp.icon = 0;
+ tmp.name = "Flame";
+ tmp.description = "Flame field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_FUEL;
+ tmp.identifier = "FUEL";
+ tmp.icon = 0;
+ tmp.name = "Fuel";
+ tmp.description = "Fuel field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_HEAT;
+ tmp.identifier = "HEAT";
+ tmp.icon = 0;
+ tmp.name = "Heat";
+ tmp.description = "Temperature of the fluid";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ else if (settings->type == FLUID_DOMAIN_TYPE_LIQUID) {
+ tmp.value = FLUID_DOMAIN_FIELD_PHI;
+ tmp.identifier = "PHI";
+ tmp.icon = 0;
+ tmp.name = "Fluid Levelset";
+ tmp.description = "Levelset representation of the fluid";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_PHI_IN;
+ tmp.identifier = "PHI_IN";
+ tmp.icon = 0;
+ tmp.name = "Inflow Levelset";
+ tmp.description = "Levelset representation of the inflow";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_PHI_OUT;
+ tmp.identifier = "PHI_OUT";
+ tmp.icon = 0;
+ tmp.name = "Outflow Levelset";
+ tmp.description = "Levelset representation of the outflow";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_PHI_OBSTACLE;
+ tmp.identifier = "PHI_OBSTACLE";
+ tmp.icon = 0;
+ tmp.name = "Obstacle Levelset";
+ tmp.description = "Levelset representation of the obstacles";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
+}
+
+static const EnumPropertyItem *rna_Fluid_data_depth_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
+
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ int totitem = 0;
+
+ tmp.value = VDB_PRECISION_FULL_FLOAT;
+ tmp.identifier = "32";
+ tmp.icon = 0;
+ tmp.name = "Full";
+ tmp.description = "Full float (Use 32 bit for all data)";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = VDB_PRECISION_HALF_FLOAT;
+ tmp.identifier = "16";
+ tmp.icon = 0;
+ tmp.name = "Half";
+ tmp.description = "Half float (Use 16 bit for all data)";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ if (settings->type == FLUID_DOMAIN_TYPE_LIQUID) {
+ tmp.value = VDB_PRECISION_MINI_FLOAT;
+ tmp.identifier = "8";
+ tmp.icon = 0;
+ tmp.name = "Mini";
+ tmp.description = "Mini float (Use 8 bit where possible, otherwise use 16 bit)";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
+}
+
static void rna_Fluid_domaintype_set(struct PointerRNA *ptr, int value)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
Object *ob = (Object *)ptr->owner_id;
BKE_fluid_domain_type_set(ob, settings, value);
- BKE_fluid_coba_field_sanitize(settings);
+ BKE_fluid_fields_sanitize(settings);
}
static char *rna_FluidDomainSettings_path(PointerRNA *ptr)
@@ -1042,159 +1235,6 @@ static void rna_Fluid_flowtype_set(struct PointerRNA *ptr, int value)
}
}
-static const EnumPropertyItem *rna_Fluid_cobafield_itemf(bContext *UNUSED(C),
- PointerRNA *ptr,
- PropertyRNA *UNUSED(prop),
- bool *r_free)
-{
- FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
-
- EnumPropertyItem *item = NULL;
- EnumPropertyItem tmp = {0, "", 0, "", ""};
- int totitem = 0;
-
- tmp.value = FLUID_DOMAIN_FIELD_FLAGS;
- tmp.identifier = "FLAGS";
- tmp.icon = 0;
- tmp.name = "Flags";
- tmp.description = "Flag grid of the fluid domain";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_PRESSURE;
- tmp.identifier = "PRESSURE";
- tmp.icon = 0;
- tmp.name = "Pressure";
- tmp.description = "Pressure field of the fluid domain";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_VELOCITY_X;
- tmp.identifier = "VELOCITY_X";
- tmp.icon = 0;
- tmp.name = "X Velocity";
- tmp.description = "X component of the velocity field";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_VELOCITY_Y;
- tmp.identifier = "VELOCITY_Y";
- tmp.icon = 0;
- tmp.name = "Y Velocity";
- tmp.description = "Y component of the velocity field";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_VELOCITY_Z;
- tmp.identifier = "VELOCITY_Z";
- tmp.icon = 0;
- tmp.name = "Z Velocity";
- tmp.description = "Z component of the velocity field";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_FORCE_X;
- tmp.identifier = "FORCE_X";
- tmp.icon = 0;
- tmp.name = "X Force";
- tmp.description = "X component of the force field";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_FORCE_Y;
- tmp.identifier = "FORCE_Y";
- tmp.icon = 0;
- tmp.name = "Y Force";
- tmp.description = "Y component of the force field";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_FORCE_Z;
- tmp.identifier = "FORCE_Z";
- tmp.icon = 0;
- tmp.name = "Z Force";
- tmp.description = "Z component of the force field";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- if (settings->type == FLUID_DOMAIN_TYPE_GAS) {
- tmp.value = FLUID_DOMAIN_FIELD_COLOR_R;
- tmp.identifier = "COLOR_R";
- tmp.icon = 0;
- tmp.name = "Red";
- tmp.description = "Red component of the color field";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_COLOR_G;
- tmp.identifier = "COLOR_G";
- tmp.icon = 0;
- tmp.name = "Green";
- tmp.description = "Green component of the color field";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_COLOR_B;
- tmp.identifier = "COLOR_B";
- tmp.icon = 0;
- tmp.name = "Blue";
- tmp.description = "Blue component of the color field";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_DENSITY;
- tmp.identifier = "DENSITY";
- tmp.icon = 0;
- tmp.name = "Density";
- tmp.description = "Quantity of soot in the fluid";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_FLAME;
- tmp.identifier = "FLAME";
- tmp.icon = 0;
- tmp.name = "Flame";
- tmp.description = "Flame field";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_FUEL;
- tmp.identifier = "FUEL";
- tmp.icon = 0;
- tmp.name = "Fuel";
- tmp.description = "Fuel field";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_HEAT;
- tmp.identifier = "HEAT";
- tmp.icon = 0;
- tmp.name = "Heat";
- tmp.description = "Temperature of the fluid";
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
- else if (settings->type == FLUID_DOMAIN_TYPE_LIQUID) {
- tmp.value = FLUID_DOMAIN_FIELD_PHI;
- tmp.identifier = "PHI";
- tmp.icon = 0;
- tmp.name = "Fluid Levelset";
- tmp.description = "Levelset representation of the fluid";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_PHI_IN;
- tmp.identifier = "PHI_IN";
- tmp.icon = 0;
- tmp.name = "Inflow Levelset";
- tmp.description = "Levelset representation of the inflow";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_PHI_OUT;
- tmp.identifier = "PHI_OUT";
- tmp.icon = 0;
- tmp.name = "Outflow Levelset";
- tmp.description = "Levelset representation of the outflow";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = FLUID_DOMAIN_FIELD_PHI_OBSTACLE;
- tmp.identifier = "PHI_OBSTACLE";
- tmp.icon = 0;
- tmp.name = "Obstacle Levelset";
- tmp.description = "Levelset representation of the obstacles";
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
-}
-
#else
static void rna_def_fluid_mesh_vertices(BlenderRNA *brna)
@@ -1240,12 +1280,6 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
{VDB_COMPRESSION_NONE, "NONE", 0, "None", "Do not use any compression"},
{0, NULL, 0, NULL, NULL}};
- static const EnumPropertyItem cache_comp_items[] = {
- {SM_CACHE_LIGHT, "CACHELIGHT", 0, "Lite", "Fast but not so effective compression"},
- {SM_CACHE_HEAVY, "CACHEHEAVY", 0, "Heavy", "Effective but slow compression"},
- {0, NULL, 0, NULL, NULL},
- };
-
static const EnumPropertyItem smoke_highres_sampling_items[] = {
{SM_HRES_FULLSAMPLE, "FULLSAMPLE", 0, "Full Sample", ""},
{SM_HRES_LINEAR, "LINEAR", 0, "Linear", ""},
@@ -1263,14 +1297,9 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
{FLUID_DOMAIN_CACHE_ALL, "ALL", 0, "All", "Bake all simulation settings at once"},
{0, NULL, 0, NULL, NULL}};
- static const EnumPropertyItem fluid_data_depth_items[] = {
- {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)"},
+ /* OpenVDB data depth - generated dynamically based on domain type */
+ static EnumPropertyItem fluid_data_depth_items[] = {
+ {0, "NONE", 0, "", ""},
{0, NULL, 0, NULL, NULL},
};
@@ -2227,7 +2256,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_guidingcache_reset");
- /* cache options */
+ /* cache options */
prop = RNA_def_property(srna, "cache_frame_start", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "cache_frame_start");
@@ -2400,6 +2429,22 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset");
+ prop = RNA_def_property(srna, "openvdb_cache_compress_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "openvdb_compression");
+ RNA_def_property_enum_items(prop, prop_compression_items);
+ RNA_def_property_ui_text(prop, "Compression", "Compression method to be used");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset");
+
+ prop = RNA_def_property(srna, "openvdb_data_depth", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "openvdb_data_depth");
+ RNA_def_property_enum_items(prop, fluid_data_depth_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Fluid_data_depth_itemf");
+ 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, "rna_Fluid_domain_data_reset");
+
/* time options */
prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
@@ -2607,37 +2652,6 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
RNA_def_property_enum_items(prop, gridlines_cell_filter_items);
RNA_def_property_ui_text(prop, "Cell Type", "Cell type to be highlighted");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- /* -- Deprecated / unsed options (below)-- */
-
- /* pointcache options */
-
- prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "point_cache[0]");
- RNA_def_property_struct_type(prop, "PointCache");
- RNA_def_property_ui_text(prop, "Point Cache", "");
-
- prop = RNA_def_property(srna, "point_cache_compress_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "cache_comp");
- RNA_def_property_enum_items(prop, cache_comp_items);
- RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
-
- /* OpenVDB options */
-
- prop = RNA_def_property(srna, "openvdb_cache_compress_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "openvdb_compression");
- 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, "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 fluid particles and grids (lower bit values reduce file size)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
}
static void rna_def_fluid_flow_settings(BlenderRNA *brna)