Commit: 8e97a13d3dadcb61fee74b989abc43ec3bab4ddb
Author: Lukas Tönne
Date:   Tue Nov 4 09:41:33 2014 +0100
Branches: alembic_pointcache
https://developer.blender.org/rB8e97a13d3dadcb61fee74b989abc43ec3bab4ddb

Reverted changes to the Mesh Cache modifier, this functionality is now
being implemented in the new Point Cache modifier instead.

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

M       release/scripts/startup/bl_ui/properties_data_modifier.py
M       source/blender/blenloader/intern/readfile.c
M       source/blender/blenloader/intern/versioning_270.c
M       source/blender/blenloader/intern/writefile.c
M       source/blender/makesdna/DNA_modifier_types.h
M       source/blender/makesrna/intern/rna_modifier.c
M       source/blender/modifiers/intern/MOD_meshcache.c
M       source/blender/pointcache/PTC_api.cpp
M       source/blender/pointcache/PTC_api.h
M       source/blender/pointcache/intern/mesh.cpp
M       source/blender/pointcache/intern/mesh.h

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index c91e99a..f33c7d8 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -170,17 +170,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         sub.prop(md, "seed")
 
     def MESH_CACHE(self, layout, ob, md):
-        has_export = md.cache_format in {'ALEMBIC_HDF5'}
-
         layout.prop(md, "cache_format")
         layout.prop(md, "filepath")
 
-        if has_export:
-            col = layout.column()
-            col.context_pointer_set("point_cache", md.point_cache)
-            col.context_pointer_set("point_cache_user", md)
-            col.operator("PTCACHE_OT_export")
-
         layout.label(text="Evaluation:")
         layout.prop(md, "factor", slider=True)
         layout.prop(md, "deform_mode")
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 6d76936..b89673d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4784,10 +4784,10 @@ static void direct_link_modifiers(FileData *fd, 
ListBase *lb)
                        }
                        lmd->cache_system = NULL;
                }
-               else if (md->type == eModifierType_MeshCache) {
-                       MeshCacheModifierData *mcmd = (MeshCacheModifierData 
*)md;
+               else if (md->type == eModifierType_PointCache) {
+                       PointCacheModifierData *pcmd = (PointCacheModifierData 
*)md;
 
-                       mcmd->point_cache = newdataadr(fd, mcmd->point_cache);
+                       pcmd->point_cache = newdataadr(fd, pcmd->point_cache);
                }
        }
 }
diff --git a/source/blender/blenloader/intern/versioning_270.c 
b/source/blender/blenloader/intern/versioning_270.c
index 22e99d8..a6d7ad3 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -510,18 +510,4 @@ void blo_do_versions_270(FileData *fd, Library 
*UNUSED(lib), Main *main)
                                do_versions_pointcache(&sce->id, 
rbw->pointcache);
                }
        }
-
-       if (!DNA_struct_elem_find(fd->filesdna, "MeshCacheModifierData", 
"PointCache", "point_cache")) {
-               Object *ob;
-               ModifierData *md;
-
-               for (ob = main->object.first; ob; ob = ob->id.next) {
-                       for (md = ob->modifiers.first; md; md = md->next) {
-                               if (md->type == eModifierType_MeshCache) {
-                                       MeshCacheModifierData *mcmd = 
(MeshCacheModifierData *)md;
-                                       mcmd->point_cache = BKE_ptcache_new();
-                               }
-                       }
-               }
-       }
 }
diff --git a/source/blender/blenloader/intern/writefile.c 
b/source/blender/blenloader/intern/writefile.c
index e8689cd..fa7f2d6 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1545,10 +1545,10 @@ static void write_modifiers(WriteData *wd, ListBase 
*modbase)
 
                        writedata(wd, DATA, sizeof(float)*lmd->total_verts * 3, 
lmd->vertexco);
                }
-               else if (md->type==eModifierType_MeshCache) {
-                       MeshCacheModifierData *mcmd = (MeshCacheModifierData 
*)md;
+               else if (md->type==eModifierType_PointCache) {
+                       PointCacheModifierData *pcmd = (PointCacheModifierData 
*)md;
 
-                       writestruct(wd, DATA, "PointCache", 1, 
mcmd->point_cache);
+                       writestruct(wd, DATA, "PointCache", 1, 
pcmd->point_cache);
                }
        }
 }
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index 8555e28..63c2f05 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1301,13 +1301,11 @@ typedef struct MeshCacheModifierData {
        float eval_factor;
 
        char filepath[1024];  /* FILE_MAX */
-       struct PointCache *point_cache;
 } MeshCacheModifierData;
 
 enum {
        MOD_MESHCACHE_TYPE_MDD  = 1,
        MOD_MESHCACHE_TYPE_PC2  = 2,
-       MOD_MESHCACHE_TYPE_ALEMBIC_HDF5 = 3,
 };
 
 enum {
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 994809f..5c63b95 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -3406,7 +3406,6 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna)
        static EnumPropertyItem prop_format_type_items[] = {
                {MOD_MESHCACHE_TYPE_MDD, "MDD", 0, "MDD ", ""},
                {MOD_MESHCACHE_TYPE_PC2, "PC2", 0, "PC2", ""},
-               {MOD_MESHCACHE_TYPE_ALEMBIC_HDF5, "ALEMBIC_HDF5", 0, 
"Alembic/HDF5", ""},
                {0, NULL, 0, NULL, NULL}
        };
 
@@ -3498,13 +3497,6 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Influence", "Influence of the 
deformation");
        RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-       /* pointcache */
-       prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
-       RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "point_cache");
-       RNA_def_property_struct_type(prop, "PointCache");
-       RNA_def_property_ui_text(prop, "Point Cache", "");
-
        /* -------------------------------------------------------------------- 
*/
        /* Axis Conversion */
        prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/modifiers/intern/MOD_meshcache.c 
b/source/blender/modifiers/intern/MOD_meshcache.c
index 496911e..925d969 100644
--- a/source/blender/modifiers/intern/MOD_meshcache.c
+++ b/source/blender/modifiers/intern/MOD_meshcache.c
@@ -36,15 +36,11 @@
 #include "BLI_path_util.h"
 #include "BLI_math.h"
 
-#include "BKE_cdderivedmesh.h"
 #include "BKE_DerivedMesh.h"
 #include "BKE_scene.h"
 #include "BKE_global.h"
 #include "BKE_mesh.h"
 #include "BKE_main.h"
-#include "BKE_pointcache.h"
-
-#include "PTC_api.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -54,16 +50,12 @@
 
 #include "MOD_util.h"
 
-struct BMEditMesh;
-
 static void initData(ModifierData *md)
 {
        MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md;
 
        mcmd->flag = 0;
        mcmd->type = MOD_MESHCACHE_TYPE_MDD;
-       mcmd->point_cache = BKE_ptcache_new();
-
        mcmd->interp = MOD_MESHCACHE_INTERP_LINEAR;
        mcmd->frame_scale = 1.0f;
 
@@ -76,18 +68,11 @@ static void initData(ModifierData *md)
 
 static void copyData(ModifierData *md, ModifierData *target)
 {
+#if 0
        MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md;
        MeshCacheModifierData *tmcmd = (MeshCacheModifierData *)target;
-
+#endif
        modifier_copyData_generic(md, target);
-
-       tmcmd->point_cache = BKE_ptcache_copy(mcmd->point_cache, false);
-}
-
-static void freeData(ModifierData *md)
-{
-       MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md;
-       BKE_ptcache_free(mcmd->point_cache);
 }
 
 static bool dependsOnTime(ModifierData *md)
@@ -105,60 +90,96 @@ static bool isDisabled(ModifierData *md, int 
UNUSED(useRenderParams))
 }
 
 
-static DerivedMesh *MOD_meshcache_read_alembic_times(struct PTCReader *reader, 
const char UNUSED(interp),
-                                                     const float time, const 
float UNUSED(fps), const char UNUSED(time_mode),
-                                                     const char **err_str)
+static void meshcache_do(
+        MeshCacheModifierData *mcmd, Object *ob, DerivedMesh *UNUSED(dm),
+        float (*vertexCos_Real)[3], int numVerts)
 {
-       DerivedMesh *result;
-       
-       if (PTC_read_sample(reader, time) == PTC_READ_SAMPLE_INVALID) {
-               *err_str = "Cannot read Alembic cache file";
-               return false;
-       }
-       
-       result = PTC_reader_mesh_cache_acquire_result(reader);
-       
-       return result;
-}
+       const bool use_factor = mcmd->factor < 1.0f;
+       float (*vertexCos_Store)[3] = (use_factor || (mcmd->deform_mode == 
MOD_MESHCACHE_DEFORM_INTEGRATE)) ?
+                                     MEM_mallocN(sizeof(*vertexCos_Store) * 
numVerts, __func__) : NULL;
+       float (*vertexCos)[3] = vertexCos_Store ? vertexCos_Store : 
vertexCos_Real;
 
-static DerivedMesh *meshcache_read_deform_cache(MeshCacheModifierData *mcmd, 
Object *ob, DerivedMesh *dm, float time, const char **err_str)
-{
        Scene *scene = mcmd->modifier.scene;
-       const bool use_factor = mcmd->factor < 1.0f;
        const float fps = FPS;
-       
-       float (*vertexCos_Real)[3], (*vertexCos_Store)[3], (*vertexCos)[3];
-       int numVerts = dm->getNumVerts(dm);
-       DerivedMesh *finaldm = NULL;
-       
+
        char filepath[FILE_MAX];
+       const char *err_str = NULL;
        bool ok;
-       
-       vertexCos_Real = MEM_mallocN(sizeof(*vertexCos_Real) * numVerts, 
__func__);
-       dm->getVertCos(dm, vertexCos_Real);
-
-       vertexCos_Store = (use_factor || (mcmd->deform_mode == 
MOD_MESHCACHE_DEFORM_INTEGRATE)) ?
-                          MEM_mallocN(sizeof(*vertexCos_Store) * numVerts, 
__func__) : NULL;
-       vertexCos = vertexCos_Store ? vertexCos_Store : vertexCos_Real;
-       
+
+       float time;
+
+
+       /* -------------------------------------------------------------------- 
*/
+       /* Interpret Time (the reading functions also do some of this ) */
+       if (mcmd->play_mode == MOD_MESHCACHE_PLAY_CFEA) {
+               const float cfra = BKE_scene_frame_get(scene);
+
+               switch (mcmd->time_mode) {
+                       case MOD_MESHCACHE_TIME_FRAME:
+                       {
+                               time = cfra;
+                               break;
+                       }
+                       case MOD_MESHCACHE_TIME_SECONDS:
+                       {
+                               time = cfra / fps;
+                               break;
+                       }
+                       case MOD_MESHCACHE_TIME_FACTOR:
+                       default:
+                       {
+                               time = cfra / fps;
+                               break;
+                       }
+               }
+
+               /* apply offset and scale */
+               time = (mcmd->frame_scale * time) - mcmd->frame_start;
+       }
+       else {  /*  if (mcmd->play_mode == MOD_MESHCACHE_PLAY_EVAL) { */
+               switch (mcmd->time_mode) {
+                       case MOD_MESHCACHE_TIME_FRAME:
+                       {
+                               time = mcmd->eval_frame;
+                               break;
+                       }
+                       case MOD_MESHCACHE_TIME_SECONDS:
+                       {
+                               time = mcmd->eval_time;
+                               break;
+                       }
+                       case MOD_MESHCACHE_TIME_FACTOR:
+                       default:
+                       {
+                               time = mcmd->eval_factor;
+                               break;
+                       }
+               }
+       }
+
+
+       /* -------------------------------------------------------------------- 
*/
+       /* Read the File (or error out when the file is bad) */
+
        /* would be nice if we could avoid doing this _every_ frame */
        BLI_strncpy(filepath, mcmd->filepath, sizeof(filepath));
        BLI_path_abs(filepath, ID_BLEND_PATH(G.main, (ID *)ob));
-       
+
        switch (mcmd->type) {
                case MOD_MESHCACHE_TYPE_MDD:
                        ok = MOD_meshcache_read_mdd_times(filepath, vertexCos, 
numVerts,
-                                                         mcmd->interp, time, 
fps, mcmd->time_mode, err_str);
+                                                         mcmd->in

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to