[Bf-blender-cvs] [cfce8623a80] master: Alembic export: prevent rounding error buildup in frame sample time

Sybren A. Stüvel noreply at git.blender.org
Tue May 30 13:48:15 CEST 2017


Commit: cfce8623a808d04904e00ac93d7d90d369a569e8
Author: Sybren A. Stüvel
Date:   Fri May 26 12:55:07 2017 +0200
Branches: master
https://developer.blender.org/rBcfce8623a808d04904e00ac93d7d90d369a569e8

Alembic export: prevent rounding error buildup in frame sample time

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

M	source/blender/alembic/intern/abc_exporter.cc

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

diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc
index 1fb59357f5d..ced58e4964e 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -209,8 +209,10 @@ void AbcExporter::getShutterSamples(double step, bool time_relative,
 		const int nsamples = static_cast<int>(std::max((1.0 / step) - 1.0, 1.0));
 		const double time_inc = (shutter_close - shutter_open) / nsamples;
 
-		for (double t = shutter_open; t <= shutter_close; t += time_inc) {
-			samples.push_back((t + m_settings.frame_start) / time_factor);
+		for (int sample=0; sample < nsamples; ++sample) {
+			double sample_time = shutter_open + time_inc * sample;
+			double time = (m_settings.frame_start + sample_time) / time_factor;
+			samples.push_back(time);
 		}
 	}
 }




More information about the Bf-blender-cvs mailing list