[Bf-blender-cvs] [0c61f82] alembic_basic_io: Expose reading flags to the UI.
Kévin Dietrich
noreply at git.blender.org
Thu Jul 28 21:12:30 CEST 2016
Commit: 0c61f82e7c2830a44b98ed8b2da593addf5aa80f
Author: Kévin Dietrich
Date: Thu Jul 28 20:39:12 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB0c61f82e7c2830a44b98ed8b2da593addf5aa80f
Expose reading flags to the UI.
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/alembic/ABC_alembic.h
M source/blender/alembic/intern/abc_object.h
M source/blender/alembic/intern/alembic_capi.cc
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/modifiers/intern/MOD_meshsequencecache.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 3b20a85..f855076 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -223,13 +223,19 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
box.template_cache_file(md, "cache_file")
cache_file = md.cache_file
-
+
layout.label(text="Modifier Properties:")
box = layout.box()
-
+
if cache_file is not None:
box.prop_search(md, "abc_object_path", cache_file, "object_paths")
+ if ob.type == 'MESH':
+ box.prop(md, "read_verts")
+ box.prop(md, "read_faces")
+ box.prop(md, "read_uvs")
+ box.prop(md, "read_mcols")
+
def CAST(self, layout, ob, md):
split = layout.split(percentage=0.25)
diff --git a/source/blender/alembic/ABC_alembic.h b/source/blender/alembic/ABC_alembic.h
index 1d642bb..c596905 100644
--- a/source/blender/alembic/ABC_alembic.h
+++ b/source/blender/alembic/ABC_alembic.h
@@ -100,7 +100,8 @@ struct DerivedMesh *ABC_read_mesh(AbcArchiveHandle *handle,
struct DerivedMesh *dm,
const char *object_path,
const float time,
- const char **err_str);
+ const char **err_str,
+ int flags);
bool ABC_has_velocity_cache(AbcArchiveHandle *handle, const char *object_path, const float time);
void ABC_get_velocity_cache(AbcArchiveHandle *handle, const char *object_path, float *values, float time);
diff --git a/source/blender/alembic/intern/abc_object.h b/source/blender/alembic/intern/abc_object.h
index ded565b..e664dcb 100644
--- a/source/blender/alembic/intern/abc_object.h
+++ b/source/blender/alembic/intern/abc_object.h
@@ -78,15 +78,6 @@ private:
class CacheFile;
-enum {
- ABC_READ_VERTS = (1 << 0),
- ABC_READ_FACES = (1 << 1),
- ABC_READ_UVS = (1 << 2),
- ABC_READ_MCOLS = (1 << 3),
-
- ABC_READ_ALL = (ABC_READ_VERTS | ABC_READ_FACES | ABC_READ_UVS | ABC_READ_MCOLS),
-};
-
struct ImportSettings {
bool do_convert_mat;
float conversion_mat[4][4];
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc
index c54b8ad..ac0f51c 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -891,7 +891,7 @@ ABC_INLINE CDStreamConfig get_config(DerivedMesh *dm)
return config;
}
-static DerivedMesh *read_mesh_sample(DerivedMesh *dm, const IObject &iobject, const float time)
+static DerivedMesh *read_mesh_sample(DerivedMesh *dm, const IObject &iobject, const float time, int flags)
{
IPolyMesh mesh(iobject, kWrapExisting);
IPolyMeshSchema schema = mesh.getSchema();
@@ -906,7 +906,7 @@ static DerivedMesh *read_mesh_sample(DerivedMesh *dm, const IObject &iobject, co
/* Only read point data when streaming meshes, unless we need to create new ones. */
ImportSettings settings;
- settings.flag |= ABC_READ_VERTS;
+ settings.flag |= flags;
if (dm->getNumVerts(dm) != positions->size()) {
new_dm = CDDM_from_template(dm,
@@ -941,7 +941,7 @@ static DerivedMesh *read_mesh_sample(DerivedMesh *dm, const IObject &iobject, co
using Alembic::AbcGeom::ISubDSchema;
-static DerivedMesh *read_subd_sample(DerivedMesh *dm, const IObject &iobject, const float time)
+static DerivedMesh *read_subd_sample(DerivedMesh *dm, const IObject &iobject, const float time, int flags)
{
ISubD mesh(iobject, kWrapExisting);
ISubDSchema schema = mesh.getSchema();
@@ -955,7 +955,7 @@ static DerivedMesh *read_subd_sample(DerivedMesh *dm, const IObject &iobject, co
DerivedMesh *new_dm = NULL;
ImportSettings settings;
- settings.flag |= ABC_READ_VERTS;
+ settings.flag |= flags;
if (dm->getNumVerts(dm) != positions->size()) {
new_dm = CDDM_from_template(dm,
@@ -1076,7 +1076,8 @@ DerivedMesh *ABC_read_mesh(AbcArchiveHandle *handle,
DerivedMesh *dm,
const char *object_path,
const float time,
- const char **err_str)
+ const char **err_str,
+ int flags)
{
IArchive *archive = archive_from_handle(handle);
@@ -1101,7 +1102,7 @@ DerivedMesh *ABC_read_mesh(AbcArchiveHandle *handle,
return NULL;
}
- return read_mesh_sample(dm, iobject, time);
+ return read_mesh_sample(dm, iobject, time, flags);
}
else if (ISubD::matches(header)) {
if (ob->type != OB_MESH) {
@@ -1109,7 +1110,7 @@ DerivedMesh *ABC_read_mesh(AbcArchiveHandle *handle,
return NULL;
}
- return read_subd_sample(dm, iobject, time);
+ return read_subd_sample(dm, iobject, time, flags);
}
else if (IPoints::matches(header)) {
if (ob->type != OB_MESH) {
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index fe5f754..276e2a9 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1542,11 +1542,23 @@ enum {
MOD_NORMALEDIT_MIX_MUL = 3,
};
+enum {
+ ABC_READ_VERTS = (1 << 0),
+ ABC_READ_FACES = (1 << 1),
+ ABC_READ_UVS = (1 << 2),
+ ABC_READ_MCOLS = (1 << 3),
+
+ ABC_READ_ALL = (ABC_READ_VERTS | ABC_READ_FACES | ABC_READ_UVS | ABC_READ_MCOLS),
+};
+
typedef struct MeshSeqCacheModifierData {
ModifierData modifier;
struct CacheFile *cache_file;
char abc_object_path[1024]; /* 1024 = FILE_MAX */
+
+ int flags;
+ char pad[4];
} MeshSeqCacheModifierData;
#endif /* __DNA_MODIFIER_TYPES_H__ */
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 783a75d..ce22528 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -4275,6 +4275,28 @@ static void rna_def_modifier_meshseqcache(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Object Path", "Path to the object in the Alembic archive used to lookup geometric data");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_property(srna, "read_verts", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", ABC_READ_VERTS);
+ RNA_def_property_ui_text(prop, "Read Vertices", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "read_faces", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", ABC_READ_FACES);
+ RNA_def_property_ui_text(prop, "Read Faces", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "read_uvs", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", ABC_READ_UVS);
+ RNA_def_property_ui_text(prop, "Read UVs", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "read_mcols", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", ABC_READ_MCOLS);
+ RNA_def_property_ui_text(prop, "Read Vertex Colors", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* -------------------------- velocity vectors -------------------------- */
+
prop = RNA_def_property(srna, "velocity_cache", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(prop, 32);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index d894aa7..2dafbd6 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -50,6 +50,7 @@ static void initData(ModifierData *md)
mcmd->cache_file = NULL;
mcmd->abc_object_path[0] = '\0';
+ mcmd->flags = ABC_READ_ALL;
}
static void copyData(ModifierData *md, ModifierData *target)
@@ -101,7 +102,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
dm,
mcmd->abc_object_path,
time,
- &err_str);
+ &err_str,
+ mcmd->flags);
if (err_str) {
modifier_setError(md, "%s", err_str);
More information about the Bf-blender-cvs
mailing list