[Bf-blender-cvs] [b0967e9d42a] master: Alembic: allow copy_{z, y}up_from_{y, z}up() to be called with yup=zup

Sybren A. Stüvel noreply at git.blender.org
Thu Apr 6 16:51:51 CEST 2017


Commit: b0967e9d42abeb90ea9e5a7f2b3a61dfc355b39e
Author: Sybren A. Stüvel
Date:   Wed Feb 15 15:13:24 2017 +0100
Branches: master
https://developer.blender.org/rBb0967e9d42abeb90ea9e5a7f2b3a61dfc355b39e

Alembic: allow copy_{z,y}up_from_{y,z}up() to be called with yup=zup

This allows in-place conversion between z-up and y-up, by passing the
same variable to both arguments.

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

M	source/blender/alembic/intern/abc_util.h

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

diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h
index 5aa74d232f7..8c9a8fac812 100644
--- a/source/blender/alembic/intern/abc_util.h
+++ b/source/blender/alembic/intern/abc_util.h
@@ -118,32 +118,36 @@ AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSe
 
 ABC_INLINE void copy_zup_from_yup(float zup[3], const float yup[3])
 {
+	const float old_yup1 = yup[1];  /* in case zup == yup */
 	zup[0] = yup[0];
 	zup[1] = -yup[2];
-	zup[2] = yup[1];
+	zup[2] = old_yup1;
 }
 
 ABC_INLINE void copy_zup_from_yup(short zup[3], const short yup[3])
 {
+	const short old_yup1 = yup[1];  /* in case zup == yup */
 	zup[0] = yup[0];
 	zup[1] = -yup[2];
-	zup[2] = yup[1];
+	zup[2] = old_yup1;
 }
 
 /* Copy from Z-up to Y-up. */
 
 ABC_INLINE void copy_yup_from_zup(float yup[3], const float zup[3])
 {
+	const float old_zup1 = zup[1];  /* in case yup == zup */
 	yup[0] = zup[0];
 	yup[1] = zup[2];
-	yup[2] = -zup[1];
+	yup[2] = -old_zup1;
 }
 
 ABC_INLINE void copy_yup_from_zup(short yup[3], const short zup[3])
 {
+	const short old_zup1 = zup[1];  /* in case yup == zup */
 	yup[0] = zup[0];
 	yup[1] = zup[2];
-	yup[2] = -zup[1];
+	yup[2] = -old_zup1;
 }
 
 /* *************************** */




More information about the Bf-blender-cvs mailing list