Discussion:
[Bf-blender-cvs] [a7b4e8a] openvdb: Merge branch 'master' into openvdb
Kévin Dietrich
2015-08-02 17:07:52 UTC
Permalink
Commit: a7b4e8a75c0c6f2d111cf4f753dccbce6614e504
Author: Kévin Dietrich
Date: Tue Jul 28 15:48:46 2015 +0200
Branches: openvdb
https://developer.blender.org/rBa7b4e8a75c0c6f2d111cf4f753dccbce6614e504

Merge branch 'master' into openvdb

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



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

diff --cc source/blender/nodes/CMakeLists.txt
index 2be79bc,13dede8..2c91807
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@@ -289,12 -288,8 +289,16 @@@ if(WITH_FREESTYLE
add_definitions(-DWITH_FREESTYLE)
endif()

+ if(WITH_CYCLES AND WITH_CYCLES_DEBUG)
+ add_definitions(-DWITH_CYCLES_DEBUG)
+ endif()
+
+if(WITH_OPENVDB)
+ add_definitions(-DWITH_OPENVDB)
+ add_definitions(-DOPENVDB_USE_BLOSC)
+ list(APPEND INC
+ ../../../intern/openvdb
+ )
+endif()
+
blender_add_lib(bf_nodes "${SRC}" "${INC}" "${INC_SYS}")
diff --cc source/blender/nodes/SConscript
index a41be4b,9c2cc82..7a3ed4e
--- a/source/blender/nodes/SConscript
+++ b/source/blender/nodes/SConscript
@@@ -75,10 -75,9 +75,13 @@@ if env['WITH_BF_COMPOSITOR']
if env['WITH_BF_FREESTYLE']:
defs.append('WITH_FREESTYLE')

+ if env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_DEBUG']:
+ defs.append('WITH_CYCLES_DEBUG')
+
+if env['WITH_BF_OPENVDB']:
+ defs.append('WITH_OPENVDB')
+ incs += ' #/intern/openvdb'
+
env.BlenderLib ( libname = 'bf_nodes', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [190,105] )
env.BlenderLib ( libname = 'bf_cmpnodes', sources = cmpsources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [175,101] )
env.BlenderLib ( libname = 'bf_shdnodes', sources = shdsources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [175,101] )
Kévin Dietrich
2015-08-02 17:07:55 UTC
Permalink
Commit: df67565ae00361dce89c192da7dc4d285388fab8
Author: Kévin Dietrich
Date: Sun Aug 2 19:08:55 2015 +0200
Branches: openvdb
https://developer.blender.org/rBdf67565ae00361dce89c192da7dc4d285388fab8

User feedback: merge pointcache and openvdb cache panel together so it's
easier to work with, and avoids potential issues between vdb and point
caches.

Also finally separate the pointcache and openvdb cache code for the
smokeModifier_process function.

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

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 e6cb674..8e0ffb1 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -291,28 +291,6 @@ class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel):
col.prop(domain, "collision_group", text="")


-class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel):
- bl_label = "Smoke Cache"
- bl_options = {'DEFAULT_CLOSED'}
-
- @classmethod
- def poll(cls, context):
- md = context.smoke
- rd = context.scene.render
- return md and (md.smoke_type == 'DOMAIN') and (not rd.use_game_engine)
-
- def draw(self, context):
- layout = self.layout
-
- md = context.smoke.domain_settings
- cache = md.point_cache
-
- layout.label(text="Compression:")
- layout.prop(md, "point_cache_compress_type", expand=True)
-
- point_cache_ui(self, context, cache, (cache.is_baked is False), 'SMOKE')
-
-
class DATA_UL_openvdb_caches(UIList):
def draw_items(self, context, layout, item, icon, active_data, active_propname, index):
if self.layout_type in {'DEFAULT', 'COMPACT'}:
@@ -322,8 +300,8 @@ class DATA_UL_openvdb_caches(UIList):
layout.label(text="", icon_value=icon)


-class PHYSICS_PT_smoke_openvdb(PhysicButtonsPanel, Panel):
- bl_label = "OpenVDB export"
+class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel):
+ bl_label = "Smoke Cache"
bl_options = {'DEFAULT_CLOSED'}

@classmethod
@@ -332,46 +310,50 @@ class PHYSICS_PT_smoke_openvdb(PhysicButtonsPanel, Panel):
rd = context.scene.render
return md and (md.smoke_type == 'DOMAIN') and (not rd.use_game_engine)

- def draw_header(self, context):
+ def draw(self, context):
layout = self.layout
+
domain = context.smoke.domain_settings
- layout.prop(domain, "use_openvdb", text="")
+ cache_type = domain.cache_type

- def draw(self, context):
- layout = self.layout
+ layout.prop(domain, "cache_type")

- if not bpy.app.build_options.openvdb:
- layout.label("Build without OpenVDB support.")
- return
+ if cache_type in {'POINTCACHE'}:
+ cache = domain.point_cache

- domain = context.smoke.domain_settings
- layout.active = domain.use_openvdb
-
- row = layout.row()
- row.template_list("DATA_UL_openvdb_caches", "", domain, "cache", domain, "active_openvdb_cache_index", rows=3)
-
- col = row.column()
- sub = col.row()
- subsub = sub.column(align=True)
- subsub.operator("object.openvdb_cache_add", icon='ZOOMIN', text="")
- subsub.operator("object.openvdb_cache_remove", icon='ZOOMOUT', text="")
- sub = col.row()
- subsub = sub.column(align=True)
- subsub.operator("object.openvdb_cache_move", icon='MOVE_UP_VEC', text="").direction = 'UP'
- subsub.operator("object.openvdb_cache_move", icon='MOVE_DOWN_VEC', text="").direction = 'DOWN'
-
- cache = domain.active_openvdb_cache
-
- if cache:
- layout.prop(cache, "filepath")
- layout.prop(cache, "compression")
- row = layout.row(align=True)
- row.prop(cache, "frame_start")
- row.prop(cache, "frame_end")
- row = layout.row()
- row.prop(cache, "save_as_half")
+ layout.label(text="Compression:")
+ layout.prop(domain, "point_cache_compress_type", expand=True)
+
+ point_cache_ui(self, context, cache, (cache.is_baked is False), 'SMOKE')
+ elif cache_type in {'OPENVDB'}:
+ if not bpy.app.build_options.openvdb:
+ layout.label("Build without OpenVDB support.")
+ return

- layout.operator("object.smoke_vdb_export")
+ row = layout.row()
+ row.template_list("DATA_UL_openvdb_caches", "", domain, "cache", domain, "active_openvdb_cache_index", rows=3)
+
+ col = row.column()
+ sub = col.row()
+ subsub = sub.column(align=True)
+ subsub.operator("object.openvdb_cache_add", icon='ZOOMIN', text="")
+ subsub.operator("object.openvdb_cache_remove", icon='ZOOMOUT', text="")
+ sub = col.row()
+ subsub = sub.column(align=True)
+ subsub.operator("object.openvdb_cache_move", icon='MOVE_UP_VEC', text="").direction = 'UP'
+ subsub.operator("object.openvdb_cache_move", icon='MOVE_DOWN_VEC', text="").direction = 'DOWN'
+
+ cache = domain.active_openvdb_cache
+
+ if cache:
+ layout.prop(cache, "filepath")
+ layout.prop(cache, "compression")
+ row = layout.row(align=True)
+ row.prop(cache, "frame_start")
+ row.prop(cache, "frame_end")
+ row = layout.row()
+ row.prop(cache, "save_as_half")
+ layout.operator("object.smoke_vdb_export", text="Bake")


class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, Panel):
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 55089f0..90c17aa 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -579,7 +579,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
smd->domain->viewsettings = MOD_SMOKE_VIEW_SHOWBIG;
smd->domain->effector_weights = BKE_add_effector_weights(NULL);

- smd->domain->use_openvdb = false;
+ smd->domain->cache_type = SMOKE_CACHE_POINTCACHE;
}
else if (smd->type & MOD_SMOKE_TYPE_FLOW)
{
@@ -2657,6 +2657,168 @@ static DerivedMesh *createDomainGeometry(SmokeDomainSettings *sds, Object *ob)
return result;
}

+/* simulate the actual smoke (c++ code in intern/smoke) */
+static void smokeModifier_step_simulation(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm, bool for_render, const int framenr, const int startframe)
+{
+ SmokeDomainSettings *sds = smd->domain;
+
+ /* DG: interesting commenting this + deactivating loading of noise files */
+ if (framenr != startframe){
+ if (sds->flags & MOD_SMOKE_DISSOLVE) {
+ /* low res dissolve */
+ smoke_dissolve(sds->fluid, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG);
+ /* high res dissolve */
+ if (sds->wt) {
+ smoke_dissolve_wavelet(sds->wt, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG);
+ }
+ }
+
+ step(scene, ob, smd, dm, scene->r.frs_sec / scene->r.frs_sec_base, for_render);
+ }
+
+ /* create shadows before writing cache so they get stored */
+ smoke_calc_transparency(sds, scene);
+
+ if (sds->wt) {
+ smoke_turbulence_step(sds->wt, sds->fluid);
+ }
+}
+
+static void smokeModifier_process_pointcache(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm, bool for_render)
+{
+ SmokeDomainSettings *sds = smd->domain;
+ PointCache *cache = NULL;
+ PTCacheID pid;
+ int startframe, endframe, framenr;
+ float timescale;
+
+ framenr = scene->r.cfra;
+
+ //printf("time: %d\n", scene->r.cfra);
+
+ cache = sds->point_cache[0];
+ BKE_ptcache_id_from_smoke(&pid, ob, smd);
+ BKE_ptcache_id_time(&pid, scene, framenr, &startframe, &endframe, &timescale);
+
+ if (!smd->domain->fluid || framenr == startframe)
+ {
+ BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
+ smokeModifier_reset_ex(smd, false);
+ BKE_ptcache_validate(cache, framenr);
+ cache->flag &= ~PTCACHE_REDO_NEEDED;
+ }
+
+ if (!smd->domain->fluid && (framenr != startframe) && (smd->domain->flags & MOD_SMOKE_FILE_LOAD) == 0 && (cache->flag & PTCACHE_BAKED) == 0)
+ return;
+
+ smd->domain->flags &= ~MOD_SMOKE_FILE_LOAD;
+ CLAMP(framenr, startframe, endframe);
+
+ /* If already viewing a pre/after frame, no need to reload */
+ if ((smd->time == framenr) && (framenr != scene->r.cfra))
+ return;
+
+ if (smokeModifier_init(smd, ob, scene, dm) == 0)
+ {
+ printf("bad smokeModifier_init\n");
+ return;
+ }
+
+ /* try to read from cache */
+ if ((BKE_ptcache_read(&pid, (float)framenr) == PTCACHE_READ_EXACT)) {
+ BKE_ptcache_validate(cache, framenr);
+ smd->time = framenr;
+ return;
+ }
+
+ /* only calculate something when we advanced a single frame */
+ if (framenr != (int)smd->time + 1)
+ return;
+
+ /* don't simulate if viewing start frame, but scene frame is not real start frame */
+ if (framenr != scene->r.cfra)
+ return;
+
+ tstart();
+
+ /* if on second frame, write cache for first frame */
+ if ((int)smd->time == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact == 0)) {
+ BKE_ptcache_write(&pid, startframe);
+ }
+
+ // set new time
+ smd->time = scene->r.cfra;
+
+ /* do simulation */
+ smokeModifier_step_simulation(smd, scene, ob, dm, for_render, framenr, startframe);
+
+ BKE_ptcache_validate(cache, framenr);
+ if (framenr != startframe)
+ BKE_ptcache_write(&pid, framenr);
+
+ tend();
+ // printf ( "Frame: %d, Time: %f\n\n", (int)smd->time, (float) tval() );
+}
+
+static void smokeModifier_process_openvdb(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm, bool for_render)
+{
+ SmokeDomainSettings *sds = smd->domain;
+ OpenVDBCache *cache = cache = BKE_openvdb_get_current_cache(sds);
+ int startframe, endframe, framenr;
+
+ framenr = scene->r.cfra;
+
+ if (cache) {
+ startframe = cache->startframe;
+ endframe = cache->endframe;
+ }
+ else {
+ startframe = scene->r.sfra;
+ endframe = scene->r.efra;
+ }
+
+ if (!smd->domain->fluid || framenr == startframe) {
+ smokeModifier_reset_ex(smd, false);
+ }
+
+ if (!smd->domain->fluid && (framenr != startframe) && (smd->domain->flags & MOD_SMOKE_FILE_LOAD) == 0)
+ return;
+
+ smd->domain->flags &= ~MOD_SMOKE_FILE_LOAD;
+ CLAMP(framenr, startframe, endframe);
+
+ /* If already viewing a pre/after frame, no need to reload */
+ if ((smd->time == framenr) && (framenr != scene->r.cfra))
+ return;
+
+ if (smokeModifier_init(smd, ob, scene, dm) == 0) {
+ printf("bad smokeModifier_init\n");
+ return;
+ }
+
+ /* try to read from cache */
+ if (cache != NULL) {
+ if (smokeModifier_OpenVDB_import(smd, scene, ob

@@ Diff output truncated at 10240 characters. @@
Kévin Dietrich
2015-08-02 17:07:53 UTC
Permalink
Commit: 024d59ca31129aeb1ba815c1cb59ce1882e03080
Author: Kévin Dietrich
Date: Sun Aug 2 17:16:41 2015 +0200
Branches: openvdb
https://developer.blender.org/rB024d59ca31129aeb1ba815c1cb59ce1882e03080

Merge branch 'master' into openvdb

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



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

diff --cc CMakeLists.txt
index 6f2a5db,198f6a3..799c68d
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -230,10 -230,9 +230,12 @@@ option(WITH_COMPOSITOR_WERROR "Treat w
mark_as_advanced(WITH_COMPOSITOR_WERROR)

option(WITH_OPENSUBDIV "Enable OpenSubdiv for surface subdivision" OFF)
+ option(WITH_SUBSURF_WERROR "Treat warnings as errors in subsurf code" OFF)
+ mark_as_advanced(WITH_COMPOSITOR_WERROR)

+option(WITH_OPENVDB "Enable features relying on OpenVDB" ON)
+option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enble if OpenVDB was built with blosc support" OFF)
+
# GHOST Windowing Library Options
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
mark_as_advanced(WITH_GHOST_DEBUG)
diff --cc source/blender/blenkernel/CMakeLists.txt
index 1b023fd,5a3fb49..cfddce8
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@@ -505,16 -505,18 +505,26 @@@ if(WITH_OPENSUBDIV
../../../intern/opensubdiv
${OPENSUBDIV_INCLUDE_DIRS}
)
+ if(WITH_SUBSURF_WERROR)
+ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+ set_source_files_properties(intern/CCGSubSurf.c
+ intern/CCGSubSurf_legacy.c
+ intern/CCGSubSurf_opensubdiv.c
+ intern/CCGSubSurf_opensubdiv_converter.c
+ intern/CCGSubSurf_util.c
+ PROPERTIES COMPILE_FLAGS -Werror)
+ endif()
+ endif()
endif()

+if(WITH_OPENVDB)
+ add_definitions(-DWITH_OPENVDB)
+ add_definitions(-DOPENVDB_USE_BLOSC)
+ list(APPEND INC
+ ../../../intern/openvdb
+ )
+endif()
+
## Warnings as errors, this is too strict!
#if(MSVC)
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")

Loading...