Commit: db695688e9dd6f335ec3b72e77f12bda59cf853d
Author: Kévin Dietrich
Date:   Wed Jun 3 19:43:18 2015 +0200
Branches: openvdb
https://developer.blender.org/rBdb695688e9dd6f335ec3b72e77f12bda59cf853d

Quick fix for openvdb::ArithmeticError being thrown on frame 1.

Issue is that the smoke simulator stores a zero'd object matrix on frame
1 which makes OpenVDB throw because the matrix is then non-affine.

Patch by @lukastoenne.

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

M       source/blender/blenkernel/intern/smoke.c

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

diff --git a/source/blender/blenkernel/intern/smoke.c 
b/source/blender/blenkernel/intern/smoke.c
index d922bc8..b8cf5aa 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -3340,6 +3340,20 @@ void smokeModifier_OpenVDB_export(SmokeModifierData 
*smd, Scene *scene, Object *
                cache_filename(filename, cache->path, cache->name, relbase, fr);
 
                smokeModifier_process(smd, scene, ob, dm, false);
+
+               /* XXX hack: for some reason the smoke sim stores zero matrix 
for frame 1 */
+               {
+                       PTCacheID pid;
+                       int ptcache_start, ptcache_end;
+                       float ptcache_timescale;
+                       BKE_ptcache_id_from_smoke(&pid, ob, smd);
+                       BKE_ptcache_id_time(&pid, scene, fr, &ptcache_start, 
&ptcache_end, &ptcache_timescale);
+
+                       if (fr == ptcache_start) {
+                               unit_m4(sds->obmat);
+                       }
+               }
+
                OpenVDB_write_fluid_settings(sds, cache->writer);
                OpenVDB_export_smoke(sds, cache->writer);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to