From e9452f909cdba368f54637cd0b15ff14d1c60cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Sat, 23 Jan 2016 08:39:29 +0100 Subject: Implementation of OpenVDB as a possible cache format for smoke simulations. This commits implements OpenVDB as an extra cache format in the Point Cache system for smoke simulations. Compilation with the library is turned off by default for now, and shall be enabled when the library is present. A documentation of its doings is available here: http:// wiki.blender.org/index.php/User:Kevindietrich/OpenVDBSmokeExport. A guide to compile OpenVDB can be found here (Linux): http:// wiki.blender.org/index.php?title=Dev:Doc/Building_Blender/Linux/ Dependencies_From_Source#OpenVDB Reviewers: sergey, lukastoenne, brecht, campbellbarton Reviewed By: brecht, campbellbarton Subscribers: galenb, Blendify, robocyte, Lapineige, bliblubli, jtheninja, lukasstockner97, dingto, brecht Differential Revision: https://developer.blender.org/D1721 --- source/blender/makesrna/intern/rna_smoke.c | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'source/blender/makesrna/intern/rna_smoke.c') diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 539f3c192be..ba3198a4843 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -35,6 +35,7 @@ #include "BKE_modifier.h" #include "BKE_smoke.h" +#include "BKE_pointcache.h" #include "BLI_threads.h" @@ -332,6 +333,15 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem prop_compression_items[] = { + { VDB_COMPRESSION_ZIP, "ZIP", 0, "Zip", "Effective but slow compression" }, +#ifdef WITH_OPENVDB_BLOSC + { VDB_COMPRESSION_BLOSC, "BLOSC", 0, "Blosc", "Multithreaded compression, similar in size and quality as 'Zip'" }, +#endif + { VDB_COMPRESSION_NONE, "NONE", 0, "None", "Do not use any compression" }, + { 0, NULL, 0, NULL, NULL } + }; + static EnumPropertyItem smoke_cache_comp_items[] = { {SM_CACHE_LIGHT, "CACHELIGHT", 0, "Light", "Fast but not so effective compression"}, {SM_CACHE_HEAVY, "CACHEHEAVY", 0, "Heavy", "Effective but slow compression"}, @@ -345,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", @@ -353,6 +369,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem cache_file_type_items[] = { + {PTCACHE_FILE_PTCACHE, "POINTCACHE", 0, "Point Cache", "Blender specific point cache file format"}, +#ifdef WITH_OPENVDB + {PTCACHE_FILE_OPENVDB, "OPENVDB", 0, "OpenVDB", "OpenVDB file format"}, +#endif + {0, NULL, 0, NULL, NULL} + }; + srna = RNA_def_struct(brna, "SmokeDomainSettings", NULL); RNA_def_struct_ui_text(srna, "Domain Settings", "Smoke domain settings"); RNA_def_struct_sdna(srna, "SmokeDomainSettings"); @@ -463,6 +487,19 @@ 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, "openvdb_cache_compress_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "openvdb_comp"); + 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, "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); RNA_def_property_enum_sdna(prop, NULL, "border_collisions"); RNA_def_property_enum_items(prop, smoke_domain_colli_items); @@ -601,6 +638,12 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Threshold", "Maximum amount of fluid cell can contain before it is considered empty"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); + + prop = RNA_def_property(srna, "cache_file_format", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "cache_file_format"); + RNA_def_property_enum_items(prop, cache_file_type_items); + RNA_def_property_ui_text(prop, "File Format", "Select the file format to be used for caching"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); } static void rna_def_smoke_flow_settings(BlenderRNA *brna) -- cgit v1.2.3