pointcache support for relative external paths with the useual // prefix as well as library path option.

This commit is contained in:
Campbell Barton
2010-07-14 07:47:03 +00:00
parent 7a2394c718
commit 6b6cdbe322
2 changed files with 10 additions and 7 deletions

View File

@@ -46,7 +46,10 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
split.prop(cache, "name", text="File Name")
split.prop(cache, "index", text="")
layout.label(text="File Path:")
row = layout.row()
row.label(text="File Path:")
row.prop(cache, "use_library_path", "Use Lib Path")
layout.prop(cache, "filepath", text="")
layout.label(text=cache.info)

View File

@@ -1067,20 +1067,20 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
static int ptcache_path(PTCacheID *pid, char *filename)
{
Library *lib;
Library *lib= (pid)? pid->ob->id.lib: NULL;
const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.sce;
size_t i;
lib= (pid)? pid->ob->id.lib: NULL;
if(pid->cache->flag & PTCACHE_EXTERNAL) {
strcpy(filename, pid->cache->path);
if(strncmp(filename, "//", 2)==0)
BLI_path_abs(filename, blendfilename);
return BLI_add_slash(filename); /* new strlen() */
}
else if (G.relbase_valid || lib) {
char file[MAX_PTCACHE_PATH]; /* we dont want the dir, only the file */
char *blendfilename;
blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.sce;
BLI_split_dirfile(blendfilename, NULL, file);
i = strlen(file);