2.5: Sound branch merge!
See mailing list for additional information.
This commit is contained in:
@@ -123,7 +123,7 @@ int countPackedFiles(Main *bmain)
|
||||
{
|
||||
Image *ima;
|
||||
VFont *vf;
|
||||
bSample *sample;
|
||||
bSound *sound;
|
||||
int count = 0;
|
||||
|
||||
// let's check if there are packed files...
|
||||
@@ -135,10 +135,9 @@ int countPackedFiles(Main *bmain)
|
||||
if(vf->packedfile)
|
||||
count++;
|
||||
|
||||
if(samples)
|
||||
for(sample=samples->first; sample; sample=sample->id.next)
|
||||
if(sample->packedfile)
|
||||
count++;
|
||||
for(sound=bmain->sound.first; sound; sound=sound->id.next)
|
||||
if(sound->packedfile)
|
||||
count++;
|
||||
|
||||
return count;
|
||||
}
|
||||
@@ -208,8 +207,8 @@ void packAll(Main *bmain, ReportList *reports)
|
||||
{
|
||||
Image *ima;
|
||||
VFont *vf;
|
||||
bSample *sample;
|
||||
|
||||
bSound *sound;
|
||||
|
||||
for(ima=bmain->image.first; ima; ima=ima->id.next)
|
||||
if(ima->packedfile == NULL)
|
||||
ima->packedfile = newPackedFile(reports, ima->name);
|
||||
@@ -218,10 +217,9 @@ void packAll(Main *bmain, ReportList *reports)
|
||||
if(vf->packedfile == NULL)
|
||||
vf->packedfile = newPackedFile(reports, vf->name);
|
||||
|
||||
if(samples)
|
||||
for(sample=samples->first; sample; sample=sample->id.next)
|
||||
if(sample->packedfile == NULL)
|
||||
sound_set_packedfile(sample, newPackedFile(reports, sample->name));
|
||||
for(sound=bmain->sound.first; sound; sound=sound->id.next)
|
||||
if(sound->packedfile == NULL)
|
||||
sound->packedfile = newPackedFile(reports, sound->name);
|
||||
}
|
||||
|
||||
|
||||
@@ -456,28 +454,26 @@ int unpackVFont(ReportList *reports, VFont *vfont, int how)
|
||||
return (ret_value);
|
||||
}
|
||||
|
||||
int unpackSample(ReportList *reports, bSample *sample, int how)
|
||||
int unpackSound(ReportList *reports, bSound *sound, int how)
|
||||
{
|
||||
char localname[FILE_MAXDIR + FILE_MAX], fi[FILE_MAX];
|
||||
char *newname;
|
||||
int ret_value = RET_ERROR;
|
||||
PackedFile *pf;
|
||||
|
||||
if (sample != NULL) {
|
||||
strcpy(localname, sample->name);
|
||||
|
||||
if (sound != NULL) {
|
||||
strcpy(localname, sound->name);
|
||||
BLI_splitdirstring(localname, fi);
|
||||
sprintf(localname, "//samples/%s", fi);
|
||||
|
||||
newname = unpackFile(reports, sample->name, localname, sample->packedfile, how);
|
||||
sprintf(localname, "//sounds/%s", fi);
|
||||
|
||||
newname = unpackFile(reports, sound->name, localname, sound->packedfile, how);
|
||||
if (newname != NULL) {
|
||||
strcpy(sample->name, newname);
|
||||
strcpy(sound->name, newname);
|
||||
MEM_freeN(newname);
|
||||
|
||||
pf = sample->packedfile;
|
||||
// because samples and sounds can point to the
|
||||
// same packedfile we have to check them all
|
||||
sound_set_packedfile(sample, NULL);
|
||||
freePackedFile(pf);
|
||||
freePackedFile(sound->packedfile);
|
||||
sound->packedfile = 0;
|
||||
|
||||
sound_load(sound);
|
||||
|
||||
ret_value = RET_OK;
|
||||
}
|
||||
@@ -515,7 +511,7 @@ void unpackAll(Main *bmain, ReportList *reports, int how)
|
||||
{
|
||||
Image *ima;
|
||||
VFont *vf;
|
||||
bSample *sample;
|
||||
bSound *sound;
|
||||
|
||||
for(ima=bmain->image.first; ima; ima=ima->id.next)
|
||||
if(ima->packedfile)
|
||||
@@ -525,9 +521,8 @@ void unpackAll(Main *bmain, ReportList *reports, int how)
|
||||
if(vf->packedfile)
|
||||
unpackVFont(reports, vf, how);
|
||||
|
||||
if(samples)
|
||||
for(sample=samples->first; sample; sample=sample->id.next)
|
||||
if(sample->packedfile)
|
||||
unpackSample(reports, sample, how);
|
||||
for(sound=bmain->sound.first; sound; sound=sound->id.next)
|
||||
if(sound->packedfile)
|
||||
unpackSound(reports, sound, how);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user