[Bf-blender-cvs] [6bb1879] alembic_basic_io: Use an enumeration for archive compression.

Kévin Dietrich noreply at git.blender.org
Fri May 6 01:30:29 CEST 2016


Commit: 6bb1879a6aaf35db25f91624c03dff6f8cd46b1a
Author: Kévin Dietrich
Date:   Fri May 6 01:09:14 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB6bb1879a6aaf35db25f91624c03dff6f8cd46b1a

Use an enumeration for archive compression.

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

M	source/blender/alembic/ABC_alembic.h
M	source/blender/alembic/intern/alembic_capi.cc
M	source/blender/editors/io/io_alembic.c
M	source/blender/makesrna/RNA_enum_types.h
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 65c2296..e26afdb78 100644
--- a/source/blender/alembic/ABC_alembic.h
+++ b/source/blender/alembic/ABC_alembic.h
@@ -30,6 +30,11 @@ extern "C" {
 struct bContext;
 struct Scene;
 
+enum {
+	ABC_ARCHIVE_OGAWA = 0,
+	ABC_ARCHIVE_HDF5  = 1,
+};
+
 #define BL_ABC_NO_ERR 0
 #define BL_ABC_UNKNOWN_ERROR 1
 
@@ -45,7 +50,7 @@ int ABC_export(struct Scene *sce, const char *filename,
                int custom_props_as_geodata,
                int vislayers, int renderable,
                int facesets, int matindices,
-               int geogroups, bool ogawa,
+               int geogroups, int compression,
                bool packuv, int to_forward, int to_up, float scale);
 
 void ABC_import(struct bContext *C, const char *filename, int from_forward, int from_up, float scale);
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc
index 35c26c3..e16a2bd 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -230,7 +230,7 @@ int ABC_export(Scene *sce, const char *filename,
                int custom_props_as_geodata,
                int vislayers, int renderable,
                int facesets, int matindices,
-               int use_subdiv_schema, bool ogawa, bool packuv,
+               int use_subdiv_schema, int compression, bool packuv,
                int to_forward, int to_up, float scale)
 {
 	try {
@@ -251,7 +251,7 @@ int ABC_export(Scene *sce, const char *filename,
 		opts.visible_layers_only = vislayers;
 		opts.renderable_only = renderable;
 		opts.use_subdiv_schema = use_subdiv_schema;
-		opts.export_ogawa = ogawa;
+		opts.export_ogawa = (compression == ABC_ARCHIVE_OGAWA);
 		opts.pack_uv = packuv;
 		opts.global_scale = scale;
 
diff --git a/source/blender/editors/io/io_alembic.c b/source/blender/editors/io/io_alembic.c
index cbacf4f..783e320 100644
--- a/source/blender/editors/io/io_alembic.c
+++ b/source/blender/editors/io/io_alembic.c
@@ -99,8 +99,8 @@ static int wm_alembic_export_exec(bContext *C, wmOperator *op)
 	bool facesets = RNA_boolean_get(op->ptr, "facesets");
 	bool matindices = RNA_boolean_get(op->ptr, "matindices");
 	bool subdiv_schem = RNA_boolean_get(op->ptr, "subdiv_schema");
-	bool ogawa = RNA_boolean_get(op->ptr, "ogawa");
 	bool packuv = RNA_boolean_get(op->ptr, "packuv");
+	const int compression = RNA_enum_get(op->ptr, "compression_type");
 	const int to_forward = RNA_enum_get(op->ptr, "to_forward");
 	const int to_up = RNA_enum_get(op->ptr, "to_up");
 	const float scale = RNA_float_get(op->ptr, "scale");
@@ -113,7 +113,7 @@ static int wm_alembic_export_exec(bContext *C, wmOperator *op)
 	                        selected, uvs, normals, vcolors,
 	                        forcemeshes, flatten, geoprops,
 	                        vislayers, renderable, facesets, matindices,
-	                        subdiv_schem, ogawa, packuv, to_forward, to_up, scale);
+	                        subdiv_schem, compression, packuv, to_forward, to_up, scale);
 
 	switch (result) {
 		case BL_ABC_UNKNOWN_ERROR:
@@ -128,10 +128,10 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
 {
 	uiLayout *box = uiLayoutBox(layout);
 	uiLayout *row = uiLayoutRow(box, false);
-	uiItemL(row, IFACE_("Archive Options:"), ICON_FILE_BLANK);
+	uiItemL(row, IFACE_("Archive Options:"), ICON_NONE);
 
 	row = uiLayoutRow(box, false);
-	uiItemR(row, imfptr, "ogawa", 0, NULL, ICON_NONE);
+	uiItemR(row, imfptr, "compression_type", 0, NULL, ICON_NONE);
 
 	box = uiLayoutBox(layout);
 	row = uiLayoutRow(box, false);
@@ -299,8 +299,8 @@ void WM_OT_alembic_export(wmOperatorType *ot)
 	                "Custom props as geom data",
 	                "Write custom properties as geometry properties (default to user data)");
 
-	RNA_def_boolean(ot->srna, "ogawa", 0, "Export Ogawa",
-	                "Export as Ogawa archive type");
+	RNA_def_enum(ot->srna, "compression_type", rna_enum_abc_compression_items,
+	             ABC_ARCHIVE_OGAWA, "Compression", "");
 
 	RNA_def_float(ot->srna, "scale", 1.0f, 0.0f, 1000.0f, "Scale", "", 0.0f, 1000.0f);
 }
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index b1048f7..14deca4 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -197,6 +197,8 @@ extern EnumPropertyItem rna_enum_dt_mix_mode_items[];
 extern EnumPropertyItem rna_enum_dt_layers_select_src_items[];
 extern EnumPropertyItem rna_enum_dt_layers_select_dst_items[];
 
+extern EnumPropertyItem rna_enum_abc_compression_items[];
+
 
 /* API calls */
 int rna_node_tree_type_to_enum(struct bNodeTreeType *typeinfo);
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 4169788..dd3c624 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -45,6 +45,16 @@
 
 #include "rna_internal.h"  /* own include */
 
+#ifdef WITH_ALEMBIC
+#	include "../../alembic/ABC_alembic.h"
+#endif
+
+EnumPropertyItem rna_enum_abc_compression_items[] = {
+	{ ABC_ARCHIVE_OGAWA, "OGAWA", 0, "Ogawa", "" },
+    { ABC_ARCHIVE_HDF5, "HDF5", 0, "HDF5", "" },
+	{ 0, NULL, 0, NULL, NULL }
+};
+
 #ifdef RNA_RUNTIME
 
 #include "BKE_animsys.h"
@@ -175,7 +185,6 @@ static void rna_Scene_ray_cast(
 }
 
 #ifdef WITH_ALEMBIC
-#include "../../alembic/ABC_alembic.h"
 
 static void rna_Scene_alembic_export(
         Scene *scene,
@@ -370,8 +379,8 @@ void RNA_api_scene(StructRNA *srna)
 	RNA_def_boolean(func, "renderable"	, 0, "Renderable objects only", "Export only objects marked renderable in the outliner");
 	RNA_def_boolean(func, "facesets"	, 0, "Facesets", "Export facesets");
 	RNA_def_boolean(func, "matindices"	, 0, "Material indices", "Export per face material indices");
-	RNA_def_boolean(func, "subdiv_schema"	, 0, "Use Alembic subdivision Schema", "Use Alembic subdivision Schema");
-	RNA_def_boolean(func, "ogawa"		, 0, "Export Ogawa", "Export as Ogawa format");
+	RNA_def_boolean(func, "subdiv_schema", 0, "Use Alembic subdivision Schema", "Use Alembic subdivision Schema");
+	RNA_def_enum(func, "compression_type", rna_enum_abc_compression_items, 0, "Compression", "");
 	RNA_def_boolean(func, "packuv"		, 0, "Export with packed UV islands", "Export with packed UV islands");
 	RNA_def_enum(func, "to_forward", rna_enum_object_axis_items, 0, "Forward Axis", "");
 	RNA_def_enum(func, "to_up", rna_enum_object_axis_items, 0, "Up Axis", "");




More information about the Bf-blender-cvs mailing list