[Bf-blender-cvs] [e975a50] alembic_basic_io: Cleanup: export options.
Kévin Dietrich
noreply at git.blender.org
Fri Jun 24 22:29:23 CEST 2016
Commit: e975a50833b24e99cf3d7cebe7934c913fdc9078
Author: Kévin Dietrich
Date: Fri Jun 24 14:48:51 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rBe975a50833b24e99cf3d7cebe7934c913fdc9078
Cleanup: export options.
===================================================================
M source/blender/alembic/ABC_alembic.h
M source/blender/alembic/intern/abc_export_options.cc
M source/blender/alembic/intern/abc_export_options.h
M source/blender/alembic/intern/abc_mesh.cc
M source/blender/alembic/intern/alembic_capi.cc
M source/blender/editors/io/io_alembic.c
M source/blender/makesrna/intern/rna_scene_api.c
===================================================================
diff --git a/source/blender/alembic/ABC_alembic.h b/source/blender/alembic/ABC_alembic.h
index dabccdd..adf86b9 100644
--- a/source/blender/alembic/ABC_alembic.h
+++ b/source/blender/alembic/ABC_alembic.h
@@ -32,45 +32,72 @@ struct DerivedMesh;
struct Object;
struct Scene;
+typedef struct AbcArchiveHandle AbcArchiveHandle;
+
enum {
ABC_ARCHIVE_OGAWA = 0,
ABC_ARCHIVE_HDF5 = 1,
};
-#define BL_ABC_NO_ERR 0
-#define BL_ABC_UNKNOWN_ERROR 1
-
-typedef struct AbcArchiveHandle AbcArchiveHandle;
-
int ABC_get_version(void);
-int ABC_export(struct Scene *scene, struct bContext *C, const char *filepath,
- double start, double end,
- double xformstep, double geomstep,
- double shutter_open, double shutter_close,
- int selected_only,
- int uvs, int normals,
- int vcolors,
- int force_meshes,
- int flatten_hierarchy,
- int vislayers, int renderable,
- int facesets, int matindices,
- int geogroups, int compression,
- bool packuv, float scale);
-
-void ABC_import(struct bContext *C, const char *filepath, float scale, bool is_sequence, bool set_frame_range, int sequence_len, int offset);
-
-void ABC_get_vertex_cache(const char *filepath, float time, void *verts, int max_verts, const char *object_path, int is_mvert);
-
-int ABC_check_subobject_valid(const char *filename, const char *object_path);
+void ABC_export(
+ struct Scene *scene,
+ struct bContext *C,
+ const char *filepath,
+ const double start,
+ const double end,
+ const double xformstep,
+ const double geomstep,
+ const double shutter_open,
+ const double shutter_close,
+ const bool selected_only,
+ const bool uvs,
+ const bool normals,
+ const bool vcolors,
+ const bool apply_subdiv,
+ const bool flatten_hierarchy,
+ const bool vislayers,
+ const bool renderable,
+ const bool facesets,
+ const bool use_subdiv_schema,
+ const bool compression,
+ const bool packuv,
+ const float global_scale);
+
+void ABC_import(struct bContext *C,
+ const char *filepath,
+ float scale,
+ bool is_sequence,
+ bool set_frame_range,
+ int sequence_len,
+ int offset);
+
+void ABC_get_vertex_cache(const char *filepath,
+ float time,
+ void *verts,
+ int max_verts,
+ const char *object_path,
+ int is_mvert);
+
+bool ABC_check_subobject_valid(const char *filename,
+ const char *object_path);
AbcArchiveHandle *ABC_create_handle(const char *filename);
void ABC_free_handle(AbcArchiveHandle *handle);
-void ABC_get_transform(AbcArchiveHandle *handle, struct Object *ob, const char *object_path, float r_mat[4][4], float time, float scale);
-
-struct DerivedMesh *ABC_read_mesh(AbcArchiveHandle *handle, struct DerivedMesh *dm, const char *object_path, const float time);
+void ABC_get_transform(AbcArchiveHandle *handle,
+ struct Object *ob,
+ const char *object_path,
+ float r_mat[4][4],
+ float time,
+ float scale);
+
+struct DerivedMesh *ABC_read_mesh(AbcArchiveHandle *handle,
+ struct DerivedMesh *dm,
+ const char *object_path,
+ const float time);
#ifdef __cplusplus
}
diff --git a/source/blender/alembic/intern/abc_export_options.cc b/source/blender/alembic/intern/abc_export_options.cc
index 8c74972..14ea3ec 100644
--- a/source/blender/alembic/intern/abc_export_options.cc
+++ b/source/blender/alembic/intern/abc_export_options.cc
@@ -49,9 +49,8 @@ ExportSettings::ExportSettings()
, export_uvs(false)
, export_vcols(false)
, export_face_sets(false)
- , export_mat_indices(false)
, export_vweigths(false)
- , export_subsurfs_as_meshes(false)
+ , apply_subdiv(false)
, use_subdiv_schema(false)
, export_child_hairs(true)
, export_ogawa(true)
diff --git a/source/blender/alembic/intern/abc_export_options.h b/source/blender/alembic/intern/abc_export_options.h
index 4d4af01..a867340 100644
--- a/source/blender/alembic/intern/abc_export_options.h
+++ b/source/blender/alembic/intern/abc_export_options.h
@@ -47,10 +47,9 @@ struct ExportSettings {
bool export_uvs;
bool export_vcols;
bool export_face_sets;
- bool export_mat_indices;
bool export_vweigths;
- bool export_subsurfs_as_meshes;
+ bool apply_subdiv;
bool use_subdiv_schema;
bool export_child_hairs;
bool export_ogawa;
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index 8dbc241..9ebb23a 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -316,7 +316,7 @@ AbcMeshWriter::AbcMeshWriter(Scene *scene,
time_sampling = 0;
}
- if (!m_settings.export_subsurfs_as_meshes) {
+ if (!m_settings.apply_subdiv) {
m_subsurf_mod = get_subsurf_modifier(m_scene, m_object);
m_is_subd = (m_subsurf_mod != NULL);
}
@@ -572,24 +572,15 @@ void AbcMeshWriter::writeArbGeoParams(DerivedMesh *dm)
}
if (m_first_frame && m_has_per_face_materials) {
- std::vector<int32_t> faceVals;
-
- if (m_settings.export_face_sets || m_settings.export_mat_indices) {
- get_material_indices(dm, faceVals);
- }
+ std::vector<int32_t> material_indices;
if (m_settings.export_face_sets) {
+ get_material_indices(dm, material_indices);
+
OFaceSetSchema::Sample samp;
- samp.setFaces(Int32ArraySample(faceVals));
+ samp.setFaces(Int32ArraySample(material_indices));
m_face_set.getSchema().set(samp);
}
-
- if (m_settings.export_mat_indices) {
- Alembic::AbcCoreAbstract::ArraySample samp(&(faceVals.front()),
- m_mat_indices.getDataType(),
- Alembic::Util::Dimensions(dm->getNumTessFaces(dm)));
- m_mat_indices.set(samp);
- }
}
}
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc
index 8a25a42..e8e2d2b 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -260,7 +260,7 @@ void ABC_get_vertex_cache(const char *filepath, float time, void *verts,
delete archive;
}
-int ABC_check_subobject_valid(const char *filename, const char *object_path)
+bool ABC_check_subobject_valid(const char *filename, const char *object_path)
{
IArchive *archive = open_archive(filename);
@@ -343,18 +343,29 @@ static void export_endjob(void *customdata)
BKE_spacedata_draw_locks(false);
}
-int ABC_export(Scene *scene, bContext *C, const char *filepath,
- double start, double end,
- double xformstep, double geomstep,
- double shutter_open, double shutter_close,
- int selected_only,
- int uvs, int normals,
- int vcolors,
- int force_meshes,
- int flatten_hierarchy,
- int vislayers, int renderable,
- int facesets, int matindices,
- int use_subdiv_schema, int compression, bool packuv, float scale)
+void ABC_export(
+ Scene *scene,
+ bContext *C,
+ const char *filepath,
+ const double start,
+ const double end,
+ const double xformstep,
+ const double geomstep,
+ const double shutter_open,
+ const double shutter_close,
+ const bool selected_only,
+ const bool uvs,
+ const bool normals,
+ const bool vcolors,
+ const bool apply_subdiv,
+ const bool flatten_hierarchy,
+ const bool vislayers,
+ const bool renderable,
+ const bool facesets,
+ const bool use_subdiv_schema,
+ const bool compression,
+ const bool packuv,
+ const float global_scale)
{
ExportJobData *job = static_cast<ExportJobData *>(MEM_mallocN(sizeof(ExportJobData), "ExportJobData"));
job->scene = scene;
@@ -369,21 +380,18 @@ int ABC_export(Scene *scene, bContext *C, const char *filepath,
job->settings.shutter_open = shutter_open;
job->settings.shutter_close = shutter_close;
job->settings.selected_only = selected_only;
- job->settings.export_uvs = uvs;
+ job->settings.export_face_sets = facesets;
job->settings.export_normals = normals;
+ job->settings.export_uvs = uvs;
job->settings.export_vcols = vcolors;
- job->settings.export_subsurfs_as_meshes = force_meshes;
+ job->settings.apply_subdiv = apply_subdiv;
job->settings.flatten_hierarchy = flatten_hierarchy;
job->settings.visible_layers_only = vislayers;
job->settings.renderable_only = renderable;
job->settings.use_subdiv_schema = use_subdiv_schema;
job->settings.export_ogawa = (compression == ABC_ARCHIVE_OGAWA);
job->settings.pack_uv = packuv;
- job->settings.global_scale = scale;
-
- // Deprecated
- job->settings.export_face_sets = facesets;
- job->settings.export_mat_indices = matindices;
+ job->settings.global_scale = global_scale;
if (job->settings.startframe > job->settings.endframe) {
std::swap(job->settings.startframe, job->settings.endframe);
@@ -402,8 +410,6 @@ int ABC_export(Scene *scene, bContext *C, const char *filepath,
WM_jobs_callbacks(wm_job, export_startjob, NULL, NULL, export_endjob);
WM_jobs_start(CTX_wm_manager(C), wm_job);
-
- return BL_ABC_NO_ERR;
}
/* ********************** Import file ********************** */
diff --git a/source/blender/editors/io/io_alembic.c b/source/blender/editors/io/io_alembic.c
index 552833b..3eeb9e6 100644
--- a/source/blender/editors/io/io_alembic.c
+++ b/source/blender/editors/io/io_alembic.c
@@ -90,43 +90,48 @@ static int wm_alembic_export_exec(bContext *C, wmOperator *op)
char filename[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filename);
- int start = RNA_int_get(op->ptr, "st
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list