From a4c17c7c88dfdb1f4694a70f9be4639fe892e43b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Nov 2007 10:38:59 +0000 Subject: 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 --- source/blender/blenkernel/intern/pointcache.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/pointcache.c') 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: -- cgit v1.2.3