Commit: eae8bb4c8ddb309687afea45eadfbd49dd2c3386
Author: Lukas Tönne
Date:   Thu Feb 19 13:10:54 2015 +0100
Branches: alembic_pointcache
https://developer.blender.org/rBeae8bb4c8ddb309687afea45eadfbd49dd2c3386

Use a cache library pointer in point caches to replace the per-object
path construction.

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

M       release/scripts/startup/bl_ui/properties_physics_common.py
M       source/blender/blenloader/intern/readfile.c
M       source/blender/makesdna/DNA_pointcache_types.h
M       source/blender/makesrna/intern/rna_pointcache.c
M       source/blender/modifiers/intern/MOD_cloth.c
M       source/blender/modifiers/intern/MOD_dynamicpaint.c
M       source/blender/modifiers/intern/MOD_smoke.c

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

diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py 
b/release/scripts/startup/bl_ui/properties_physics_common.py
index 598fb77..e9210ad 100644
--- a/release/scripts/startup/bl_ui/properties_physics_common.py
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@ -118,6 +118,8 @@ def point_cache_ui(self, context, cache_user, cache, 
enabled, cachetype):
     layout.context_pointer_set("point_cache", cache)
     layout.context_pointer_set("point_cache_user", cache_user)
 
+    layout.template_ID(cache, "cache_library")
+
     row = layout.row()
     if supports_external:
         row.prop(cache, "use_external")
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 9560df0..39796a5 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3634,6 +3634,11 @@ static void direct_link_material(FileData *fd, Material 
*ma)
 }
 
 /* ************ READ PARTICLE SETTINGS ***************** */
+static void lib_link_pointcache(FileData *fd, ID *id, PointCache *cache)
+{
+       cache->cachelib = newlibadr_us(fd, id->lib, cache->cachelib);
+}
+
 static void direct_link_pointcache(FileData *UNUSED(fd), PointCache *cache)
 {
        if (!cache)
@@ -3821,6 +3826,9 @@ static void lib_link_particlesystems(FileData *fd, Object 
*ob, ID *id, ListBase
                                psys->clmd->coll_parms->group = newlibadr(fd, 
id->lib, psys->clmd->coll_parms->group);
                                psys->clmd->modifier.error = NULL;
                        }
+                       
+                       if (psys->pointcache)
+                               lib_link_pointcache(fd, id, psys->pointcache);
                }
                else {
                        /* particle modifier must be removed before particle 
system */
@@ -4523,8 +4531,12 @@ static void lib_link_object(FileData *fd, Main *main)
                        if (ob->pd)
                                lib_link_partdeflect(fd, &ob->id, ob->pd);
                        
-                       if (ob->soft)
+                       if (ob->soft) {
                                ob->soft->effector_weights->group = 
newlibadr(fd, ob->id.lib, ob->soft->effector_weights->group);
+                               
+                               if (ob->soft->pointcache)
+                                       lib_link_pointcache(fd, &ob->id, 
ob->soft->pointcache);
+                       }
                        
                        lib_link_particlesystems(fd, ob, &ob->id, 
&ob->particlesystem);
                        lib_link_modifiers(fd, ob);
@@ -5310,6 +5322,8 @@ static void lib_link_scene(FileData *fd, Main *main)
                        /* rigidbody world relies on it's linked groups */
                        if (sce->rigidbody_world) {
                                RigidBodyWorld *rbw = sce->rigidbody_world;
+                               if (rbw->pointcache)
+                                       lib_link_pointcache(fd, &sce->id, 
rbw->pointcache);
                                if (rbw->group)
                                        rbw->group = newlibadr(fd, sce->id.lib, 
rbw->group);
                                if (rbw->constraints)
diff --git a/source/blender/makesdna/DNA_pointcache_types.h 
b/source/blender/makesdna/DNA_pointcache_types.h
index fec2bd2..18a53e2 100644
--- a/source/blender/makesdna/DNA_pointcache_types.h
+++ b/source/blender/makesdna/DNA_pointcache_types.h
@@ -154,6 +154,8 @@ typedef struct PointCache {
 
        /**** NEW POINTCACHE ****/
        char cachedir[768];     /* FILE_MAXDIR length */
+       
+       struct CacheLibrary *cachelib;
 } PointCache;
 
 typedef enum ePointCacheFlag {
diff --git a/source/blender/makesrna/intern/rna_pointcache.c 
b/source/blender/makesrna/intern/rna_pointcache.c
index 6422013..5f20e77 100644
--- a/source/blender/makesrna/intern/rna_pointcache.c
+++ b/source/blender/makesrna/intern/rna_pointcache.c
@@ -213,6 +213,12 @@ static void rna_def_pointcache(BlenderRNA *brna)
        RNA_def_struct_ui_text(srna, "Point Cache", "Point cache for physics 
simulations");
        RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
 
+       prop = RNA_def_property(srna, "cache_library", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "cachelib");
+       RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+       RNA_def_property_ui_text(prop, "Cache Library", "Cache library to use 
for storage");
+       RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
+
 #ifdef POINTCACHE_OLD
        prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
        RNA_def_property_int_sdna(prop, NULL, "startframe");
diff --git a/source/blender/modifiers/intern/MOD_cloth.c 
b/source/blender/modifiers/intern/MOD_cloth.c
index 394b2ff..57abeb0 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -221,6 +221,9 @@ static void foreachIDLink(ModifierData *md, Object *ob,
 {
        ClothModifierData *clmd = (ClothModifierData *) md;
 
+       if (clmd->point_cache)
+               walk(userData, ob, (ID **)&clmd->point_cache->cachelib);
+
        if (clmd->coll_parms) {
                walk(userData, ob, (ID **)&clmd->coll_parms->group);
        }
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c 
b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index 5236365..bd8389c 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -29,6 +29,7 @@
 
 #include "DNA_dynamicpaint_types.h"
 #include "DNA_object_types.h"
+#include "DNA_pointcache_types.h"
 #include "DNA_scene_types.h"
 
 #include "BLI_utildefines.h"
@@ -148,6 +149,9 @@ static void foreachIDLink(ModifierData *md, Object *ob,
                DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
 
                for (; surface; surface = surface->next) {
+                       if (surface->pointcache)
+                               walk(userData, ob, (ID 
**)&surface->pointcache->cachelib);
+                       
                        walk(userData, ob, (ID **)&surface->brush_group);
                        walk(userData, ob, (ID **)&surface->init_texture);
                }
diff --git a/source/blender/modifiers/intern/MOD_smoke.c 
b/source/blender/modifiers/intern/MOD_smoke.c
index f260c04..985bad0 100644
--- a/source/blender/modifiers/intern/MOD_smoke.c
+++ b/source/blender/modifiers/intern/MOD_smoke.c
@@ -38,10 +38,11 @@
 #include "MEM_guardedalloc.h"
 
 #include "DNA_group_types.h"
+#include "DNA_object_force.h"
 #include "DNA_object_types.h"
+#include "DNA_pointcache_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_smoke_types.h"
-#include "DNA_object_force.h"
 
 #include "BLI_utildefines.h"
 
@@ -179,6 +180,9 @@ static void foreachIDLink(ModifierData *md, Object *ob,
        SmokeModifierData *smd = (SmokeModifierData *) md;
 
        if (smd->type == MOD_SMOKE_TYPE_DOMAIN && smd->domain) {
+               if (smd->domain->point_cache[0])
+                       walk(userData, ob, (ID 
**)&smd->domain->point_cache[0]->cachelib);
+
                walk(userData, ob, (ID **)&smd->domain->coll_group);
                walk(userData, ob, (ID **)&smd->domain->fluid_group);
                walk(userData, ob, (ID **)&smd->domain->eff_group);

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

Reply via email to