Replaced G.sce by Main.name in sound.c.

I hoped for it to resolve the bug of loading sounds with relative paths didn't work, but Main.name isn't set before the sounds are loaded, so the bug resists!
Someone who is into file loading should please fix this!
This commit is contained in:
Joerg Mueller 2009-08-25 15:30:04 +00:00
parent 3d7215da58
commit 4ba6dbce76
5 changed files with 9 additions and 10 deletions

@ -334,7 +334,6 @@ void AUD_FFMPEGReader::read(int & length, sample_t* & buffer)
// read packages and decode them
AVPacket packet;
int data_size = 0;
int pkgbuf_size = m_pkgbuf->getSize();
int pkgbuf_pos;
int left = length;
int sample_size = AUD_SAMPLE_SIZE(m_specs);

@ -54,7 +54,7 @@ void sound_delete(struct bContext *C, struct bSound* sound);
void sound_cache(struct bSound* sound, int ignore);
void sound_load(struct bSound* sound);
void sound_load(struct Main *main, struct bSound* sound);
void sound_free(struct bSound* sound);

@ -473,7 +473,7 @@ int unpackSound(ReportList *reports, bSound *sound, int how)
freePackedFile(sound->packedfile);
sound->packedfile = 0;
sound_load(sound);
sound_load(NULL, sound);
ret_value = RET_OK;
}

@ -78,7 +78,7 @@ struct bSound* sound_new_file(struct Main *main, char* filename)
int len;
strcpy(str, filename);
BLI_convertstringcode(str, G.sce);
BLI_convertstringcode(str, main->name);
len = strlen(filename);
while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\')
@ -88,7 +88,7 @@ struct bSound* sound_new_file(struct Main *main, char* filename)
strcpy(sound->name, filename);
sound->type = SOUND_TYPE_FILE;
sound_load(sound);
sound_load(main, sound);
if(!sound->snd_sound)
{
@ -114,7 +114,7 @@ struct bSound* sound_new_buffer(struct bContext *C, struct bSound *source)
sound->child_sound = source;
sound->type = SOUND_TYPE_BUFFER;
sound_load(sound);
sound_load(CTX_data_main(C), sound);
if(!sound->snd_sound)
{
@ -140,7 +140,7 @@ struct bSound* sound_new_limiter(struct bContext *C, struct bSound *source, floa
sound->end = end;
sound->type = SOUND_TYPE_LIMITER;
sound_load(sound);
sound_load(CTX_data_main(C), sound);
if(!sound->snd_sound)
{
@ -172,7 +172,7 @@ void sound_cache(struct bSound* sound, int ignore)
sound->cache = AUD_bufferSound(sound->snd_sound);
}
void sound_load(struct bSound* sound)
void sound_load(struct Main *main, struct bSound* sound)
{
if(sound)
{
@ -198,7 +198,7 @@ void sound_load(struct bSound* sound)
if(sound->id.lib)
path = sound->id.lib->filename;
else
path = G.sce;
path = main ? main->name : NULL;
BLI_convertstringcode(fullpath, path);

@ -5075,7 +5075,7 @@ static void lib_link_sound(FileData *fd, Main *main)
sound->ipo= newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX depreceated - old animation system
sound->stream = 0;
sound_load(sound);
sound_load(main, sound);
}
sound= sound->id.next;
}