[Bf-blender-cvs] [0e9ef15] alembic_basic_io: WIP work on setting up object transformations.

Kévin Dietrich noreply at git.blender.org
Tue May 24 11:23:41 CEST 2016


Commit: 0e9ef15c78a71b7b741c1ec46abaae9196f669fe
Author: Kévin Dietrich
Date:   Tue May 24 10:13:44 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB0e9ef15c78a71b7b741c1ec46abaae9196f669fe

WIP work on setting up object transformations.

Still a few issues, might need to setup transform depending on the
object's type.

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

M	source/blender/alembic/intern/abc_object.cc
M	source/blender/alembic/intern/abc_object.h

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

diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index 8bb5b55..e14b395 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -1,4 +1,4 @@
-/*
+/*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -28,6 +28,7 @@
 
 extern "C" {
 #include "BKE_idprop.h"
+#include "BKE_object.h"
 
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
@@ -339,7 +340,7 @@ Object *AbcObjectReader::object() const
 	return m_object;
 }
 
-void AbcObjectReader::readObjectMatrix(const float time, const float scale) const
+void AbcObjectReader::readObjectMatrix(const float time, const float scale)
 {
 	const Alembic::AbcGeom::MetaData &md = m_iobject.getParent().getMetaData();
 
@@ -355,19 +356,35 @@ void AbcObjectReader::readObjectMatrix(const float time, const float scale) cons
 		Alembic::AbcGeom::XformSample xs;
 		schema.get(xs, xform_sample);
 
+		float loc[3];
 		for (int i = 0; i < 3; ++i) {
-			m_object->loc[i] = xs.getTranslation()[i];
-			m_object->size[i] = xs.getScale()[i] * scale;
+			loc[i] = xs.getTranslation()[i];
+			m_object->size[i] = xs.getScale()[i];
 		}
 
-		m_object->rot[0] = xs.getXRotation();
-		m_object->rot[1] = xs.getYRotation();
-		m_object->rot[2] = xs.getZRotation();
+		m_object->rot[0] = xs.getXRotation() * M_PI / 180;
+		m_object->rot[1] = xs.getYRotation() * M_PI / 180;
+		m_object->rot[2] = xs.getZRotation() * M_PI / 180;
 
-		for (int i = 0; i < 3; ++i) {
-			m_object->rot[i] *= M_PI / 180.0f;
+		if (m_do_convert_mat) {
+			mul_v3_m3v3(m_object->loc, m_conversion_mat, loc);
+		}
+		else {
+			copy_v3_v3(m_object->loc, loc);
 		}
 
 		DAG_id_tag_update(&(m_object->id), OB_RECALC_OB);
+
+//		float global_mat[4][4];
+//		scale_m4_fl(global_mat, scale);
+
+//		if (m_do_convert_mat) {
+//			mul_m4_m4m3(global_mat, global_mat, m_conversion_mat);
+//		}
+
+//		translate_m4(global_mat, 1.0f, 1.0f, 1.0f);
+//		mul_m4_m4m4(m_object->obmat, m_object->obmat, global_mat);
+
+//		BKE_object_apply_mat4(m_object, m_object->obmat, false,  false);
 	}
 }
diff --git a/source/blender/alembic/intern/abc_object.h b/source/blender/alembic/intern/abc_object.h
index 2ad88a8..8b6747e 100644
--- a/source/blender/alembic/intern/abc_object.h
+++ b/source/blender/alembic/intern/abc_object.h
@@ -101,7 +101,7 @@ public:
 
 	virtual void readObjectData(Main *bmain, Scene *scene, float time) = 0;
 
-	void readObjectMatrix(const float time, const float scale) const;
+	void readObjectMatrix(const float time, const float scale);
 };
 
 #endif




More information about the Bf-blender-cvs mailing list