Commit: 32fb60ce1279c6454552d353bdf54cc5545ca996
Author: Kévin Dietrich
Date:   Wed Jun 1 14:52:35 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB32fb60ce1279c6454552d353bdf54cc5545ca996

Add a flag to indicate that a cache is made of sequence of file or not.

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

M       source/blender/alembic/ABC_alembic.h
M       source/blender/alembic/intern/abc_hair.cc
M       source/blender/alembic/intern/abc_mesh.cc
M       source/blender/alembic/intern/abc_object.h
M       source/blender/alembic/intern/alembic_capi.cc
M       source/blender/editors/io/io_alembic.c
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/source/blender/alembic/ABC_alembic.h 
b/source/blender/alembic/ABC_alembic.h
index 668fa7e..7248641 100644
--- a/source/blender/alembic/ABC_alembic.h
+++ b/source/blender/alembic/ABC_alembic.h
@@ -55,7 +55,7 @@ int ABC_export(struct Scene *scene, struct bContext *C, const 
char *filepath,
                int geogroups, int compression,
                bool packuv, float scale);
 
-void ABC_import(struct bContext *C, const char *filepath, float scale);
+void ABC_import(struct bContext *C, const char *filepath, float scale, bool 
is_sequence);
 
 void ABC_get_vertex_cache(const char *filepath, float time, void *verts, int 
max_verts, const char *object_path, int is_mvert);
 
diff --git a/source/blender/alembic/intern/abc_hair.cc 
b/source/blender/alembic/intern/abc_hair.cc
index 565a6aa..84cfe6f 100644
--- a/source/blender/alembic/intern/abc_hair.cc
+++ b/source/blender/alembic/intern/abc_hair.cc
@@ -363,17 +363,14 @@ void AbcHairReader::readObjectData(Main *bmain, Scene 
*scene, float time)
        cu->actnu = hvertices->size() - 1;
        cu->actvert = CU_ACT_NONE;
 
-       if (true) {
+       if (m_settings->is_sequence || !m_curves_schema.isConstant()) {
                ModifierData *md = 
modifier_new(eModifierType_MeshSequenceCache);
                BLI_addtail(&m_object->modifiers, md);
 
                MeshSeqCacheModifierData *mcmd = 
reinterpret_cast<MeshSeqCacheModifierData *>(md);
-//             mcmd->type = MOD_MESHCACHE_TYPE_ABC;
-//             mcmd->time_mode = MOD_MESHCACHE_TIME_SECONDS;
-//             mcmd->forward_axis = OB_POSZ;
-//             mcmd->up_axis = OB_NEGY;
 
                BLI_strncpy(mcmd->filepath, 
m_iobject.getArchive().getName().c_str(), 1024);
                BLI_strncpy(mcmd->abc_object_path, 
m_iobject.getFullName().c_str(), 1024);
+               mcmd->is_sequence = m_settings->is_sequence;
        }
 }
diff --git a/source/blender/alembic/intern/abc_mesh.cc 
b/source/blender/alembic/intern/abc_mesh.cc
index 6b3e943..7dbd698 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -1156,7 +1156,7 @@ void AbcMeshReader::readObjectData(Main *bmain, Scene 
*scene, float time)
 
        /* Add a default mesh cache modifier */
 
-       if (true || !is_constant) {
+       if (m_settings->is_sequence || !is_constant) {
                ModifierData *md = 
modifier_new(eModifierType_MeshSequenceCache);
                BLI_addtail(&m_object->modifiers, md);
 
@@ -1164,6 +1164,7 @@ void AbcMeshReader::readObjectData(Main *bmain, Scene 
*scene, float time)
 
                BLI_strncpy(mcmd->filepath, 
m_iobject.getArchive().getName().c_str(), 1024);
                BLI_strncpy(mcmd->abc_object_path, 
m_iobject.getFullName().c_str(), 1024);
+               mcmd->is_sequence = m_settings->is_sequence;
        }
 }
 
diff --git a/source/blender/alembic/intern/abc_object.h 
b/source/blender/alembic/intern/abc_object.h
index 4afcee8..df74a05 100644
--- a/source/blender/alembic/intern/abc_object.h
+++ b/source/blender/alembic/intern/abc_object.h
@@ -79,6 +79,7 @@ struct ImportSettings {
        int from_up;
        int from_forward;
        float scale;
+       bool is_sequence;
 };
 
 class AbcObjectReader {
diff --git a/source/blender/alembic/intern/alembic_capi.cc 
b/source/blender/alembic/intern/alembic_capi.cc
index 7ec4a20..5ad7f68 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -517,7 +517,7 @@ static void import_startjob(void *cjv, short *stop, short 
*do_update, float *pro
        WM_main_add_notifier(NC_SCENE | ND_FRAME, data->scene);
 }
 
-void ABC_import(bContext *C, const char *filepath, float scale)
+void ABC_import(bContext *C, const char *filepath, float scale, bool 
is_sequence)
 {
        ImportJobData *job = static_cast<ImportJobData 
*>(MEM_mallocN(sizeof(ImportJobData), "ImportJobData"));
        job->bmain = CTX_data_main(C);
@@ -525,6 +525,7 @@ void ABC_import(bContext *C, const char *filepath, float 
scale)
        BLI_strncpy(job->filename, filepath, 1024);
 
        job->settings.scale = scale;
+       job->settings.is_sequence = is_sequence;
 
        wmJob *wm_job = WM_jobs_get(CTX_wm_manager(C),
                                    CTX_wm_window(C),
diff --git a/source/blender/editors/io/io_alembic.c 
b/source/blender/editors/io/io_alembic.c
index e67357c..f9d544e 100644
--- a/source/blender/editors/io/io_alembic.c
+++ b/source/blender/editors/io/io_alembic.c
@@ -299,6 +299,13 @@ static void ui_alembic_import_settings(uiLayout *layout, 
PointerRNA *imfptr)
 
        row = uiLayoutRow(box, false);
        uiItemR(row, imfptr, "scale", 0, NULL, ICON_NONE);
+
+       box = uiLayoutBox(layout);
+       row = uiLayoutRow(box, false);
+       uiItemL(row, IFACE_("Options:"), ICON_NONE);
+
+       row = uiLayoutRow(box, false);
+       uiItemR(row, imfptr, "is_sequence", 0, NULL, ICON_NONE);
 }
 
 static void wm_alembic_import_draw(bContext *UNUSED(C), wmOperator *op)
@@ -320,8 +327,9 @@ static int wm_alembic_import_exec(bContext *C, wmOperator 
*op)
        RNA_string_get(op->ptr, "filepath", filename);
 
        const float scale = RNA_float_get(op->ptr, "scale");
+       const bool is_sequence = RNA_boolean_get(op->ptr, "is_sequence");
 
-       ABC_import(C, filename, scale);
+       ABC_import(C, filename, scale, is_sequence);
 
        return OPERATOR_FINISHED;
 }
@@ -340,6 +348,8 @@ void WM_OT_alembic_import(wmOperatorType *ot)
                                       FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 
        RNA_def_float(ot->srna, "scale", 1.0f, 0.0f, 1000.0f, "Scale", "", 
0.0f, 1000.0f);
+       RNA_def_boolean(ot->srna, "is_sequence", false,
+                       "Sequence", "Whether the cache is separated in a series 
of file");
 }
 
 #endif
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index d999200..f7291fe 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1549,6 +1549,8 @@ typedef struct MeshSeqCacheModifierData {
 
        char filepath[1024];
        char abc_object_path[1024];
+       char is_sequence;
+       char pad[7];
 } 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 8f92bab..c062bb5 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -4247,6 +4247,10 @@ static void rna_def_modifier_meshseqcache(BlenderRNA 
*brna)
        prop = RNA_def_property(srna, "abc_object_path", PROP_STRING, 
PROP_NONE);
        RNA_def_property_ui_text(prop, "Object", "Path to the object in the 
Alembic archive");
        RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+       prop = RNA_def_property(srna, "is_sequence", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_ui_text(prop, "Sequence", "Whether the cache is 
separated in a series of files");
+       RNA_def_property_update(prop, 0, "rna_Modifier_update");
 }
 
 static void rna_def_modifier_laplaciandeform(BlenderRNA *brna)
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c 
b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index 05354fb..f9f6f15 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -47,6 +47,7 @@ static void initData(ModifierData *md)
 
        mcmd->filepath[0] = '\0';
        mcmd->abc_object_path[0] = '\0';
+       mcmd->is_sequence = false;
 }
 
 static void copyData(ModifierData *md, ModifierData *target)
@@ -83,7 +84,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object 
*ob,
        int fframe;
        int frame_len;
 
-       if (BLI_path_frame_get(filepath, &fframe, &frame_len)) {
+       if (mcmd->is_sequence && BLI_path_frame_get(filepath, &fframe, 
&frame_len)) {
                char ext[32];
                BLI_path_frame_strip(filepath, true, ext);
                BLI_path_frame(filepath, frame, frame_len);
@@ -125,7 +126,7 @@ static void deformVerts(ModifierData *md, Object *ob,
        int fframe;
        int frame_len;
 
-       if (BLI_path_frame_get(filepath, &fframe, &frame_len)) {
+       if (mcmd->is_sequence && BLI_path_frame_get(filepath, &fframe, 
&frame_len)) {
                char ext[32];
                BLI_path_frame_strip(filepath, true, ext);
                BLI_path_frame(filepath, frame, frame_len);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to