Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-11-30 13:38:59 +0300
committerCampbell Barton <ideasman42@gmail.com>2007-11-30 13:38:59 +0300
commita4c17c7c88dfdb1f4694a70f9be4639fe892e43b (patch)
tree132e48dbb2a7aeb45c99e59a160f283b79deddfe /source/blender/blenkernel/intern/pointcache.c
parent04a009b047e13f6696b6780419b1561ef29c9854 (diff)
anim.c, buttons_object.c, readfile.c, BKE_blender.h - dupliFace scale option, needed for leaves.
modifier.c, BKE_modifier.h - flag for modifiers to say they use pointcache, also new func modifiers_usesPointCache renamed //pointcache to //blendcache_blendfilename so blendfiles in the same dir dont conflict, and other to show this dir isnt limited to pointcache only (nodes way want to use this) wizard_curve2tree.py - better defaults for pretty tree's
Diffstat (limited to 'source/blender/blenkernel/intern/pointcache.c')
-rw-r--r--source/blender/blenkernel/intern/pointcache.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index c4ef437019e..2afcf19427c 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -59,7 +59,17 @@
static int ptcache_path(char *filename)
{
- sprintf(filename, PTCACHE_PATH);
+ char dir[FILE_MAX], file[FILE_MAX]; /* we dont want the dir, only the file */
+ int i;
+
+ BLI_split_dirfile(G.sce, dir, file);
+ i = strlen(file);
+
+ /* remove .blend */
+ if (i > 6)
+ file[i-6] = '\0';
+
+ sprintf(filename, PTCACHE_PATH"%s/", file); /* add blend file name to pointcache dir */
BLI_convertstringcode(filename, G.sce, 0);
return strlen(filename);
}
@@ -72,6 +82,8 @@ int BKE_ptcache_id_filename(struct ID *id, char *filename, int cfra, int stack_i
filename[0] = '\0';
newname = filename;
+ if (!G.relbase_valid) return 0; /* save blend fiel before using pointcache */
+
/* start with temp dir */
if (do_path) {
len = ptcache_path(filename);
@@ -100,6 +112,8 @@ FILE *BKE_ptcache_id_fopen(struct ID *id, char mode, int cfra, int stack_index)
FILE *fp = NULL;
char filename[(FILE_MAXDIR+FILE_MAXFILE)*2];
+ if (!G.relbase_valid) return NULL; /* save blend fiel before using pointcache */
+
BKE_ptcache_id_filename(id, filename, cfra, stack_index, 1, 1);
if (mode=='r') {
@@ -135,6 +149,8 @@ void BKE_ptcache_id_clear(struct ID *id, char mode, int cfra, int stack_index)
char filename[(FILE_MAXDIR+FILE_MAXFILE)*2];
char path_full[(FILE_MAXDIR+FILE_MAXFILE)*2];
+ if (!G.relbase_valid) return; /* save blend fiel before using pointcache */
+
/* clear all files in the temp dir with the prefix of the ID and the ".bphys" suffix */
switch (mode) {
case PTCACHE_CLEAR_ALL: