[Bf-blender-cvs] [294b075] master: Fix T49081: Alembic sampling times are not taking start frame into account.

Kévin Dietrich noreply at git.blender.org
Wed Aug 17 22:27:25 CEST 2016


Commit: 294b0756b441ac7a41d861ea6fd1088a8a6fd8ba
Author: Kévin Dietrich
Date:   Wed Aug 17 22:06:05 2016 +0200
Branches: master
https://developer.blender.org/rB294b0756b441ac7a41d861ea6fd1088a8a6fd8ba

Fix T49081: Alembic sampling times are not taking start frame into
account.

This resulted in animations always starting at frame 0.

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

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 127e885..f71d78b 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -175,7 +175,7 @@ void AbcExporter::getShutterSamples(double step, bool time_relative,
 	/* sample all frame */
 	if (shutter_open == 0.0 && shutter_close == 1.0) {
 		for (double t = 0; t < 1.0; t += step) {
-			samples.push_back(t / time_factor);
+			samples.push_back((t + m_settings.frame_start) / time_factor);
 		}
 	}
 	else {
@@ -184,7 +184,7 @@ void AbcExporter::getShutterSamples(double step, bool time_relative,
 		const double time_inc = (shutter_close - shutter_open) / nsamples;
 
 		for (double t = shutter_open; t <= shutter_close; t += time_inc) {
-			samples.push_back(t / time_factor);
+			samples.push_back((t + m_settings.frame_start) / time_factor);
 		}
 	}
 }
@@ -325,16 +325,18 @@ void AbcExporter::operator()(Main *bmain, float &progress, bool &was_canceled)
 			break;
 		}
 
-		double f = *begin;
-		setCurrentFrame(bmain, f);
+		const double frame = *begin;
 
-		if (shape_frames.count(f) != 0) {
+		/* 'frame' is offset by start frame, so need to cancel the offset. */
+		setCurrentFrame(bmain, frame - m_settings.frame_start);
+
+		if (shape_frames.count(frame) != 0) {
 			for (int i = 0, e = m_shapes.size(); i != e; ++i) {
 				m_shapes[i]->write();
 			}
 		}
 
-		if (xform_frames.count(f) == 0) {
+		if (xform_frames.count(frame) == 0) {
 			continue;
 		}




More information about the Bf-blender-cvs mailing list