Commit: 53818c594b71e15c51fb9b3b76733507a08d5ab0
Author: Kévin Dietrich
Date:   Wed Jun 15 12:54:17 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB53818c594b71e15c51fb9b3b76733507a08d5ab0

Use a DerivedMesh to stream curve data as well.

Simplifies the code a bit.

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

M       source/blender/alembic/intern/alembic_capi.cc
M       source/blender/modifiers/intern/MOD_meshsequencecache.c

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

diff --git a/source/blender/alembic/intern/alembic_capi.cc 
b/source/blender/alembic/intern/alembic_capi.cc
index 6894bb06..df4c13c 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -723,7 +723,7 @@ static DerivedMesh *read_points_sample(DerivedMesh *dm, 
const IObject &iobject,
        return dm;
 }
 
-void read_curves_sample(float (*vertexCos)[3], int max_verts, const IObject 
&iobject, const float time)
+DerivedMesh *read_curves_sample(DerivedMesh *dm, const IObject &iobject, const 
float time)
 {
        ICurves points(iobject, kWrapExisting);
        ICurvesSchema schema = points.getSchema();
@@ -732,11 +732,9 @@ void read_curves_sample(float (*vertexCos)[3], int 
max_verts, const IObject &iob
 
        const P3fArraySamplePtr &positions = sample.getPositions();
 
-       for (int i = 0; i < min_ff(max_verts, positions->size()); ++i) {
-               float *vert = vertexCos[i];
-               Imath::V3f pos_in = (*positions)[i];
-               copy_yup_zup(vert, pos_in.getValue());
-       }
+       read_mverts(dm->getVertArray(dm), positions, N3fArraySamplePtr());
+
+       return dm;
 }
 
 DerivedMesh *ABC_read_mesh(DerivedMesh *dm, const char *filepath, const char 
*object_path, const float time)
@@ -762,29 +760,9 @@ DerivedMesh *ABC_read_mesh(DerivedMesh *dm, const char 
*filepath, const char *ob
        else if (IPoints::matches(header)) {
                return read_points_sample(dm, iobject, time);
        }
-
-       return NULL;
-}
-
-void ABC_read_vertex_cache(const char *filepath, const char *object_path, 
const float time,
-                           float (*vertexCos)[3], int max_verts)
-{
-       IArchive archive = open_archive(filepath);
-
-       if (!archive.valid()) {
-               return;
+       else if (ICurves::matches(header)) {
+               return read_curves_sample(dm, iobject, time);
        }
 
-       IObject iobject;
-       find_iobject(archive.getTop(), iobject, object_path);
-
-       if (!iobject.valid()) {
-               return;
-       }
-
-       const ObjectHeader &header = iobject.getHeader();
-
-       if (ICurves::matches(header)) {
-               return read_curves_sample(vertexCos, max_verts, iobject, time);
-       }
+       return NULL;
 }
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c 
b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index 4bfbc2f..8954074 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -95,31 +95,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object 
*ob,
 #endif
 }
 
-static void deformVerts(ModifierData *md, Object *ob,
-                        DerivedMesh *derivedData,
-                        float (*vertexCos)[3],
-                        int numVerts,
-                        ModifierApplyFlag flag)
-{
-       MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
-
-       Scene *scene = md->scene;
-
-       char filepath[1024];
-       BKE_cachefile_filepath_get(scene, mcmd->cache_file, filepath);
-
-       const float frame = BKE_scene_frame_get(scene);
-       const float time = BKE_cachefile_time_offset(mcmd->cache_file, frame / 
FPS);
-
-       ABC_read_vertex_cache(filepath,
-                             mcmd->abc_object_path,
-                          time,
-                             vertexCos,
-                             numVerts);
-
-       UNUSED_VARS(ob, derivedData, flag);
-}
-
 static bool dependsOnTime(ModifierData *md)
 {
        UNUSED_VARS(md);
@@ -138,11 +113,11 @@ ModifierTypeInfo modifierType_MeshSequenceCache = {
     /* name */              "Mesh Sequence Cache",
     /* structName */        "MeshSeqCacheModifierData",
     /* structSize */        sizeof(MeshSeqCacheModifierData),
-    /* type */              eModifierTypeType_DeformOrConstruct,
+    /* type */              eModifierTypeType_Constructive,
     /* flags */             eModifierTypeFlag_AcceptsMesh |
                             eModifierTypeFlag_AcceptsCVs,
     /* copyData */          copyData,
-    /* deformVerts */       deformVerts,
+    /* deformVerts */       NULL,
     /* deformMatrices */    NULL,
     /* deformVertsEM */     NULL,
     /* deformMatricesEM */  NULL,

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

Reply via email to