diff options
author | Ton Roosendaal <ton@blender.org> | 2006-12-21 17:00:18 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-12-21 17:00:18 +0300 |
commit | e4663acd76419a16d332a0fef2d75bf7bfe943e9 (patch) | |
tree | 8bd6a044c9e9266723091a67ec0ef82321d005ec /source | |
parent | 47bc3d1208c48903f53728d17d3acbb1ccbd06cb (diff) |
UnPack data fix:
Now uses original filename for unpacking, instead of the Blender ID name.
That latter was a nice idea, but because of its 20 char maxname limit
not working well.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_packedFile.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/packedFile.c | 45 |
2 files changed, 9 insertions, 37 deletions
diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h index be9792322c4..4b362bbb38f 100644 --- a/source/blender/blenkernel/BKE_packedFile.h +++ b/source/blender/blenkernel/BKE_packedFile.h @@ -56,7 +56,6 @@ int writePackedFile(char * filename, struct PackedFile *pf, int guimode); int checkPackedFile(char * filename, struct PackedFile * pf); char * unpackFile(char * abs_name, char * local_name, struct PackedFile * pf, int how); int unpackVFont(struct VFont * vfont, int how); -void create_local_name(char *localname, char *prefix, char *filename); int unpackSample(struct bSample *sample, int how); int unpackImage(struct Image * ima, int how); void unpackAll(int how); diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 0cdfda3be5d..4edf989acda 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -527,46 +527,17 @@ int unpackVFont(VFont * vfont, int how) return (ret_value); } -/* -create_local_name() creates a relative (starting with //) name. -Because it is allowed to have /'s and \'s in blenderobject names -we have to remove these first. -*/ - - -void create_local_name(char *localname, char *prefix, char *filename) -{ - char tempname[FILE_MAXDIR + FILE_MAXFILE]; - int i, len; - - strcpy(tempname, filename); - len = strlen(tempname); - - for (i = 0; i < len ; i++) { - switch (tempname[i]) - { - case '/': - case '\\': - case ' ': - tempname[i] = '_'; - break; - } - } - - strcpy(localname, prefix); - strcat(localname, tempname); -} - - int unpackSample(bSample *sample, int how) { - char localname[FILE_MAXDIR + FILE_MAXFILE]; + char localname[FILE_MAX], fi[FILE_MAX]; char * newname; int ret_value = RET_ERROR; PackedFile *pf; if (sample != NULL) { - create_local_name(localname, "//samples/", sample->id.name + 2); + strcpy(localname, sample->name); + BLI_splitdirstring(localname, fi); + sprintf(localname, "//samples/%s", fi); newname = unpackFile(sample->name, localname, sample->packedfile, how); if (newname != NULL) { @@ -588,13 +559,15 @@ int unpackSample(bSample *sample, int how) int unpackImage(Image * ima, int how) { - char localname[FILE_MAXDIR + FILE_MAXFILE]; + char localname[FILE_MAX], fi[FILE_MAX]; char * newname; int ret_value = RET_ERROR; if (ima != NULL) { - create_local_name(localname, "//textures/", ima->id.name + 2); - + strcpy(localname, ima->name); + BLI_splitdirstring(localname, fi); + sprintf(localname, "//textures/%s", fi); + newname = unpackFile(ima->name, localname, ima->packedfile, how); if (newname != NULL) { ret_value = RET_OK; |