[Bf-blender-cvs] [35852e4] alembic_basic_io: Exporter: remove AbcShapeWriter class.
Kévin Dietrich
noreply at git.blender.org
Fri Jun 3 13:30:02 CEST 2016
Commit: 35852e448d8aa76cf0a4213903e0ea910441d713
Author: Kévin Dietrich
Date: Fri Jun 3 13:14:31 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB35852e448d8aa76cf0a4213903e0ea910441d713
Exporter: remove AbcShapeWriter class.
It was only used to compute the bbox of the object, and added some
unecessary code complexity.
===================================================================
M source/blender/alembic/CMakeLists.txt
M source/blender/alembic/intern/abc_camera.cc
M source/blender/alembic/intern/abc_camera.h
M source/blender/alembic/intern/abc_hair.cc
M source/blender/alembic/intern/abc_hair.h
M source/blender/alembic/intern/abc_mesh.cc
M source/blender/alembic/intern/abc_mesh.h
M source/blender/alembic/intern/abc_nurbs.cc
M source/blender/alembic/intern/abc_nurbs.h
M source/blender/alembic/intern/abc_object.cc
M source/blender/alembic/intern/abc_object.h
M source/blender/alembic/intern/abc_points.cc
M source/blender/alembic/intern/abc_points.h
D source/blender/alembic/intern/abc_shape.cc
D source/blender/alembic/intern/abc_shape.h
M source/blender/alembic/intern/abc_transform.cc
M source/blender/alembic/intern/abc_transform.h
===================================================================
diff --git a/source/blender/alembic/CMakeLists.txt b/source/blender/alembic/CMakeLists.txt
index 59264c7..6060234 100644
--- a/source/blender/alembic/CMakeLists.txt
+++ b/source/blender/alembic/CMakeLists.txt
@@ -54,7 +54,6 @@ set(SRC
intern/abc_nurbs.cc
intern/abc_object.cc
intern/abc_points.cc
- intern/abc_shape.cc
intern/abc_transform.cc
intern/abc_util.cc
intern/alembic_capi.cc
@@ -68,7 +67,6 @@ set(SRC
intern/abc_nurbs.h
intern/abc_object.h
intern/abc_points.h
- intern/abc_shape.h
intern/abc_transform.h
intern/abc_util.h
)
diff --git a/source/blender/alembic/intern/abc_camera.cc b/source/blender/alembic/intern/abc_camera.cc
index 1d532c6..8a3a8d6 100644
--- a/source/blender/alembic/intern/abc_camera.cc
+++ b/source/blender/alembic/intern/abc_camera.cc
@@ -56,9 +56,9 @@ using Alembic::AbcGeom::kWrapExisting;
AbcCameraWriter::AbcCameraWriter(Scene *scene,
Object *ob,
AbcTransformWriter *parent,
- uint32_t timeSampling,
+ uint32_t sampling_time,
ExportSettings &settings)
- : AbcShapeWriter(scene, ob, parent, timeSampling, settings)
+ : AbcObjectWriter(scene, ob, sampling_time, settings, parent)
{
OCamera camera(parent->alembicXform(), m_name, m_time_sampling);
m_camera_schema = camera.getSchema();
diff --git a/source/blender/alembic/intern/abc_camera.h b/source/blender/alembic/intern/abc_camera.h
index 5ed59de..398984e 100644
--- a/source/blender/alembic/intern/abc_camera.h
+++ b/source/blender/alembic/intern/abc_camera.h
@@ -22,11 +22,11 @@
#pragma once
-#include "abc_shape.h"
+#include "abc_object.h"
/* ************************************************************************** */
-class AbcCameraWriter : public AbcShapeWriter {
+class AbcCameraWriter : public AbcObjectWriter {
Alembic::AbcGeom::OCameraSchema m_camera_schema;
Alembic::AbcGeom::CameraSample m_camera_sample;
Alembic::AbcGeom::OCompoundProperty m_custom_data_container;
@@ -37,7 +37,7 @@ public:
AbcCameraWriter(Scene *scene,
Object *ob,
AbcTransformWriter *parent,
- uint32_t timeSampling,
+ uint32_t sampling_time,
ExportSettings &settings);
private:
diff --git a/source/blender/alembic/intern/abc_hair.cc b/source/blender/alembic/intern/abc_hair.cc
index 723a3dd..c525804 100644
--- a/source/blender/alembic/intern/abc_hair.cc
+++ b/source/blender/alembic/intern/abc_hair.cc
@@ -65,10 +65,10 @@ static const float nscale = 1.0f / 32767.0f;
AbcHairWriter::AbcHairWriter(Scene *scene,
Object *ob,
AbcTransformWriter *parent,
- uint32_t timeSampling,
+ uint32_t sampling_time,
ExportSettings &settings,
ParticleSystem *psys)
- : AbcShapeWriter(scene, ob, parent, timeSampling, settings)
+ : AbcObjectWriter(scene, ob, sampling_time, settings, parent)
{
m_psys = psys;
diff --git a/source/blender/alembic/intern/abc_hair.h b/source/blender/alembic/intern/abc_hair.h
index 3470548..9340a89 100644
--- a/source/blender/alembic/intern/abc_hair.h
+++ b/source/blender/alembic/intern/abc_hair.h
@@ -23,7 +23,6 @@
#pragma once
#include "abc_object.h"
-#include "abc_shape.h"
struct DerivedMesh;
struct ParticleSettings;
@@ -31,7 +30,7 @@ struct ParticleSystem;
/* ************************************************************************** */
-class AbcHairWriter : public AbcShapeWriter {
+class AbcHairWriter : public AbcObjectWriter {
ParticleSystem *m_psys;
Alembic::AbcGeom::OCurvesSchema m_schema;
@@ -41,7 +40,7 @@ public:
AbcHairWriter(Scene *scene,
Object *ob,
AbcTransformWriter *parent,
- uint32_t timeSampling,
+ uint32_t sampling_time,
ExportSettings &settings,
ParticleSystem *psys);
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index c658c99..7ef30a3 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -97,9 +97,9 @@ using Alembic::AbcGeom::UInt32ArraySample;
AbcMeshWriter::AbcMeshWriter(Scene *scene,
Object *ob,
AbcTransformWriter *parent,
- uint32_t timeSampling,
+ uint32_t sampling_time,
ExportSettings &settings)
- : AbcShapeWriter(scene, ob, parent, timeSampling, settings)
+ : AbcObjectWriter(scene, ob, sampling_time, settings, parent)
{
m_is_animated = isAnimated();
m_subsurf_mod = NULL;
@@ -109,7 +109,7 @@ AbcMeshWriter::AbcMeshWriter(Scene *scene,
/* if the object is static, use the default static time sampling */
if (!m_is_animated) {
- timeSampling = 0;
+ sampling_time = 0;
}
if (!m_settings.export_subsurfs_as_meshes) {
diff --git a/source/blender/alembic/intern/abc_mesh.h b/source/blender/alembic/intern/abc_mesh.h
index 58cd11c..386950f 100644
--- a/source/blender/alembic/intern/abc_mesh.h
+++ b/source/blender/alembic/intern/abc_mesh.h
@@ -22,7 +22,7 @@
#pragma once
-#include "abc_shape.h"
+#include "abc_object.h"
struct DerivedMesh;
struct Mesh;
@@ -30,7 +30,7 @@ struct ModifierData;
/* ************************************************************************** */
-class AbcMeshWriter : public AbcShapeWriter {
+class AbcMeshWriter : public AbcObjectWriter {
Alembic::AbcGeom::OPolyMeshSchema m_mesh_schema;
Alembic::AbcGeom::OPolyMeshSchema::Sample m_mesh_sample;
@@ -60,7 +60,7 @@ public:
AbcMeshWriter(Scene *scene,
Object *ob,
AbcTransformWriter *parent,
- uint32_t timeSampling,
+ uint32_t sampling_time,
ExportSettings &settings);
~AbcMeshWriter();
diff --git a/source/blender/alembic/intern/abc_nurbs.cc b/source/blender/alembic/intern/abc_nurbs.cc
index a58bd5c..0a2ecb2 100644
--- a/source/blender/alembic/intern/abc_nurbs.cc
+++ b/source/blender/alembic/intern/abc_nurbs.cc
@@ -67,15 +67,15 @@ using Alembic::AbcGeom::ONuPatchSchema;
AbcNurbsWriter::AbcNurbsWriter(Scene *scene,
Object *ob,
AbcTransformWriter *parent,
- uint32_t timeSampling,
+ uint32_t sampling_time,
ExportSettings &settings)
- : AbcShapeWriter(scene, ob, parent, timeSampling, settings)
+ : AbcObjectWriter(scene, ob, sampling_time, settings, parent)
{
m_is_animated = isAnimated();
/* if the object is static, use the default static time sampling */
if (!m_is_animated) {
- timeSampling = 0;
+ sampling_time = 0;
}
Curve *curve = static_cast<Curve *>(m_object->data);
diff --git a/source/blender/alembic/intern/abc_nurbs.h b/source/blender/alembic/intern/abc_nurbs.h
index 2a57c71..32d0f58 100644
--- a/source/blender/alembic/intern/abc_nurbs.h
+++ b/source/blender/alembic/intern/abc_nurbs.h
@@ -22,11 +22,11 @@
#pragma once
-#include "abc_shape.h"
+#include "abc_object.h"
/* ************************************************************************** */
-class AbcNurbsWriter : public AbcShapeWriter {
+class AbcNurbsWriter : public AbcObjectWriter {
std::vector<Alembic::AbcGeom::ONuPatchSchema> m_nurbs_schema;
bool m_is_animated;
@@ -34,7 +34,7 @@ public:
AbcNurbsWriter(Scene *scene,
Object *ob,
AbcTransformWriter *parent,
- uint32_t timeSampling,
+ uint32_t sampling_time,
ExportSettings &settings);
private:
diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index 7014ae6..15110fa 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -60,12 +60,22 @@ using Alembic::AbcGeom::OStringProperty;
/* ************************************************************************** */
-AbcObjectWriter::AbcObjectWriter(Object *ob, ExportSettings &settings)
+AbcObjectWriter::AbcObjectWriter::AbcObjectWriter(Scene *scene,
+ Object *ob,
+ uint32_t sampling_time,
+ ExportSettings &settings,
+ AbcObjectWriter *parent)
: m_object(ob)
, m_settings(settings)
+ , m_scene(scene)
+ , m_time_sampling(sampling_time)
, m_first_frame(true)
{
m_name = get_id_name(m_object) + "Shape";
+
+ if (parent) {
+ parent->addChild(this);
+ }
}
AbcObjectWriter::~AbcObjectWriter()
@@ -76,9 +86,20 @@ void AbcObjectWriter::addChild(AbcObjectWriter *child)
m_children.push_back(child);
}
-Imath::Box3d AbcObjectWriter::bounds() const
+Imath::Box3d AbcObjectWriter::bounds()
{
- return m_bounds;
+ BoundBox *bb = BKE_object_boundbox_get(this->m_object);
+
+ /* Convert Z-up to Y-up. */
+ this->m_bounds.min.x = bb->vec[0][0];
+ this->m_bounds.min.y = bb->vec[0][2];
+ this->m_bounds.min.z = -bb->vec[0][1];
+
+ this->m_bounds.max.x = bb->vec[6][0];
+ this->m_bounds.max.y = bb->vec[6][2];
+ this->m_bounds.max.z = -bb->vec[6][1];
+
+ return this->m_bounds;
}
void AbcObjectWriter::write()
diff --git a/source/blender/alembic/intern/abc_object.h b/source/blender/alembic/intern/abc_object.h
index 983f4bc..e242d4e 100644
--- a/source/blender/alembic/intern/abc_object.h
+++ b/source/blender/alembic/intern/abc_object.h
@@ -23,6 +23,7 @@
#pragma once
#include <Alembic/Abc/All.h>
+#include <Alembic/AbcGeom/All.h>
#include "abc_export_options.h"
@@ -30,6 +31,8 @@ extern "C" {
#include "DNA_ID.h"
}
+class AbcTransformWriter;
+
struct Main;
/* ************************************************************************** */
@@ -39,6 +42,9 @@ protected:
Object *m_object;
ExportSettings &m_s
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list