[Bf-blender-cvs] [63bf07f] alembic_basic_io: Cleanup: move ExportSettings to abc_exporter.h.
Kévin Dietrich
noreply at git.blender.org
Fri Jun 24 22:29:25 CEST 2016
Commit: 63bf07f245d30149ab42fb3e19b86cb7c3ee35a5
Author: Kévin Dietrich
Date: Fri Jun 24 15:16:03 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB63bf07f245d30149ab42fb3e19b86cb7c3ee35a5
Cleanup: move ExportSettings to abc_exporter.h.
===================================================================
M source/blender/alembic/CMakeLists.txt
D source/blender/alembic/intern/abc_export_options.cc
D source/blender/alembic/intern/abc_export_options.h
M source/blender/alembic/intern/abc_exporter.cc
M source/blender/alembic/intern/abc_exporter.h
M source/blender/alembic/intern/abc_object.h
M source/blender/alembic/intern/alembic_capi.cc
===================================================================
diff --git a/source/blender/alembic/CMakeLists.txt b/source/blender/alembic/CMakeLists.txt
index 03a6f50..cf574eb 100644
--- a/source/blender/alembic/CMakeLists.txt
+++ b/source/blender/alembic/CMakeLists.txt
@@ -46,7 +46,6 @@ set(SRC
intern/abc_customdata.cc
intern/abc_curves.cc
intern/abc_exporter.cc
- intern/abc_export_options.cc
intern/abc_hair.cc
intern/abc_mesh.cc
intern/abc_nurbs.cc
@@ -61,7 +60,6 @@ set(SRC
intern/abc_customdata.h
intern/abc_curves.h
intern/abc_exporter.h
- intern/abc_export_options.h
intern/abc_hair.h
intern/abc_mesh.h
intern/abc_nurbs.h
diff --git a/source/blender/alembic/intern/abc_export_options.cc b/source/blender/alembic/intern/abc_export_options.cc
deleted file mode 100644
index 14ea3ec..0000000
--- a/source/blender/alembic/intern/abc_export_options.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "abc_export_options.h"
-
-#include <string>
-
-#include "abc_util.h"
-
-extern "C" {
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-
-#include "BKE_idprop.h"
-}
-
-ExportSettings::ExportSettings()
- : selected_only(false)
- , visible_layers_only(false)
- , renderable_only(false)
- , startframe(1)
- , endframe(1)
- , xform_frame_step(1)
- , shape_frame_step(1)
- , shutter_open(0.0)
- , shutter_close(1.0)
- , global_scale(1.0f)
- , flatten_hierarchy(false)
- , export_normals(false)
- , export_uvs(false)
- , export_vcols(false)
- , export_face_sets(false)
- , export_vweigths(false)
- , apply_subdiv(false)
- , use_subdiv_schema(false)
- , export_child_hairs(true)
- , export_ogawa(true)
- , pack_uv(false)
- , do_convert_axis(false)
- , scene(NULL)
-{}
-
-bool ExportSettings::exportObject(Object *obj) const
-{
- if (selected_only && !parent_selected(obj)) {
- return false;
- }
-
- if (visible_layers_only && !(scene->lay & obj->lay)) {
- return false;
- }
-
- if (renderable_only && (obj->restrictflag & 4)) {
- return false;
- }
-
- return true;
-}
diff --git a/source/blender/alembic/intern/abc_export_options.h b/source/blender/alembic/intern/abc_export_options.h
deleted file mode 100644
index a867340..0000000
--- a/source/blender/alembic/intern/abc_export_options.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#pragma once
-
-struct Object;
-struct Scene;
-
-struct ExportSettings {
- ExportSettings();
-
- bool exportObject(Object *obj) const;
-
- bool selected_only;
- bool visible_layers_only;
- bool renderable_only;
-
- double startframe, endframe;
- double xform_frame_step;
- double shape_frame_step;
- double shutter_open;
- double shutter_close;
- float global_scale;
-
- bool flatten_hierarchy;
-
- bool export_normals;
- bool export_uvs;
- bool export_vcols;
- bool export_face_sets;
- bool export_vweigths;
-
- bool apply_subdiv;
- bool use_subdiv_schema;
- bool export_child_hairs;
- bool export_ogawa;
- bool pack_uv;
-
- bool do_convert_axis;
- float convert_matrix[3][3];
-
- Scene *scene;
-};
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc
index 71331e6..1225d91 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -33,6 +33,7 @@
#include "abc_mesh.h"
#include "abc_nurbs.h"
#include "abc_points.h"
+#include "abc_transform.h"
#include "abc_util.h"
extern "C" {
@@ -64,6 +65,32 @@ using Alembic::Abc::OBox3dProperty;
/* ************************************************************************** */
+ExportSettings::ExportSettings()
+ : scene(NULL)
+ , selected_only(false)
+ , visible_layers_only(false)
+ , renderable_only(false)
+ , startframe(1)
+ , endframe(1)
+ , xform_frame_step(1)
+ , shape_frame_step(1)
+ , shutter_open(0.0)
+ , shutter_close(1.0)
+ , global_scale(1.0f)
+ , flatten_hierarchy(false)
+ , export_normals(false)
+ , export_uvs(false)
+ , export_vcols(false)
+ , export_face_sets(false)
+ , export_vweigths(false)
+ , apply_subdiv(false)
+ , use_subdiv_schema(false)
+ , export_child_hairs(true)
+ , export_ogawa(true)
+ , pack_uv(false)
+ , do_convert_axis(false)
+{}
+
static bool object_is_smoke_sim(Object *ob)
{
ModifierData *md = modifiers_findByType(ob, eModifierType_Smoke);
@@ -95,6 +122,23 @@ static bool object_is_shape(Object *ob)
}
}
+static bool export_object(const ExportSettings * const settings, Object *ob)
+{
+ if (settings->selected_only && !parent_selected(ob)) {
+ return false;
+ }
+
+ if (settings->visible_layers_only && !(settings->scene->lay & ob->lay)) {
+ return false;
+ }
+
+ if (settings->renderable_only && (ob->restrictflag & 4)) {
+ return false;
+ }
+
+ return true;
+}
+
/* ************************************************************************** */
AbcExporter::AbcExporter(Scene *scene, const char *filename, ExportSettings &settings)
@@ -305,7 +349,7 @@ void AbcExporter::createTransformWritersHierarchy(EvaluationContext *eval_ctx)
while (base) {
Object *ob = base->object;
- if (m_settings.exportObject(ob)) {
+ if (export_object(&m_settings, ob)) {
switch(ob->type) {
case OB_LAMP:
case OB_LATTICE:
@@ -330,7 +374,7 @@ void AbcExporter::createTransformWritersFlat()
while (base) {
Object *ob = base->object;
- if (m_settings.exportObject(ob) && object_is_shape(ob)) {
+ if (export_object(&m_settings, ob) && object_is_shape(ob)) {
std::string name = get_id_name(ob);
m_xforms[name] = new AbcTransformWriter(ob, m_archive.getTop(), 0, m_trans_sampling_index, m_settings);
}
@@ -441,7 +485,7 @@ void AbcExporter::createShapeWriter(Object *ob, Object *dupliObParent)
return;
}
- if (!m_settings.exportObject(ob)) {
+ if (!export_object(&m_settings, ob)) {
return;
}
diff --git a/source/blender/alembic/intern/abc_exporter.h b/source/blender/alembic/intern/abc_exporter.h
index 253e853..828c858 100644
--- a/source/blender/alembic/intern/abc_exporter.h
+++ b/source/blender/alembic/intern/abc_exporter.h
@@ -22,13 +22,52 @@
#pragma once
+#include <Alembic/Abc/All.h>
#include <map>
+#include <set>
#include <vector>
-#include "abc_object.h"
-#include "abc_transform.h"
+class AbcObjectWriter;
+class AbcTransformWriter;
-class EvaluationContext;
+struct EvaluationContext;
+struct Main;
+struct Object;
+struct Scene;
+
+struct ExportSettings {
+ ExportSettings();
+
+ Scene *scene;
+
+ bool selected_only;
+ bool visible_layers_only;
+ bool renderable_only;
+
+ double startframe, endframe;
+ double xform_frame_step;
+ double shape_frame_step;
+ double shutter_open;
+ double shutter_close;
+ float global_scale;
+
+ bool flatten_hierarchy;
+
+ bool export_normals;
+ bool export_uvs;
+ bool export_vcols;
+ bool export_face_sets;
+ bool export_vweigths;
+
+ bool apply_subdiv;
+ bool use_subdiv_schema;
+ bool export_child_hairs;
+ bool export_ogawa;
+ bool pack_uv;
+
+ bool do_convert_axis;
+ float convert_matrix[3][3];
+};
class AbcExporter {
ExportSettings &m_settings;
diff --git a/source/blender/alembic/intern/abc_object.h b/source/blender/alembic/intern/abc_object.h
index 5283bc9..e53a415 100644
--- a/source/blender/alembic/intern/abc_object.h
+++ b/source/blender/alembic/intern/abc_object.h
@@ -25,7 +25,7 @@
#include <Alembic/Abc/All.h>
#include <Alembic/AbcGeom/All.h>
-#include "abc_export_options.h"
+#include "abc_exporter.h"
extern "C" {
#include "DNA_ID.h"
@@ -34,6 +34,7 @@ extern "C" {
class AbcTransformWriter;
struct Main;
+struct Object;
/* ************************************************************************** */
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc
index e8e2d2b..56ea2ae 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -26,13 +26,13 @@
#include <Alembic/AbcCoreOgawa/All.h>
#include <Alembic/AbcMaterial/IMaterial.h>
-#include "abc_exporter.h"
#include "abc_camera.h"
#include "abc_curves.h"
#include "abc_hair.h"
#include "abc_mesh.h"
#include "abc_nurbs.h"
#include "abc_points.h"
+#include "abc_transform.h"
#include "abc_util.h"
extern "C" {
More information about the Bf-blender-cvs
mailing list