Fix for [#24654] Sound Actuator doesn't find the file when Blender is reopened.
This commit is contained in:
@@ -50,7 +50,7 @@ void packAll(struct Main *bmain, struct ReportList *reports);
|
|||||||
/* unpack */
|
/* unpack */
|
||||||
char *unpackFile(struct ReportList *reports, char *abs_name, char *local_name, struct PackedFile *pf, int how);
|
char *unpackFile(struct ReportList *reports, char *abs_name, char *local_name, struct PackedFile *pf, int how);
|
||||||
int unpackVFont(struct ReportList *reports, struct VFont *vfont, int how);
|
int unpackVFont(struct ReportList *reports, struct VFont *vfont, int how);
|
||||||
int unpackSound(struct ReportList *reports, struct bSound *sound, int how);
|
int unpackSound(struct Main *bmain, struct ReportList *reports, struct bSound *sound, int how);
|
||||||
int unpackImage(struct ReportList *reports, struct Image *ima, int how);
|
int unpackImage(struct ReportList *reports, struct Image *ima, int how);
|
||||||
void unpackAll(struct Main *bmain, struct ReportList *reports, int how);
|
void unpackAll(struct Main *bmain, struct ReportList *reports, int how);
|
||||||
|
|
||||||
|
@@ -467,7 +467,7 @@ int unpackVFont(ReportList *reports, VFont *vfont, int how)
|
|||||||
return (ret_value);
|
return (ret_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int unpackSound(ReportList *reports, bSound *sound, int how)
|
int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how)
|
||||||
{
|
{
|
||||||
char localname[FILE_MAXDIR + FILE_MAX], fi[FILE_MAX];
|
char localname[FILE_MAXDIR + FILE_MAX], fi[FILE_MAX];
|
||||||
char *newname;
|
char *newname;
|
||||||
@@ -486,7 +486,7 @@ int unpackSound(ReportList *reports, bSound *sound, int how)
|
|||||||
freePackedFile(sound->packedfile);
|
freePackedFile(sound->packedfile);
|
||||||
sound->packedfile = 0;
|
sound->packedfile = 0;
|
||||||
|
|
||||||
sound_load(NULL, sound);
|
sound_load(bmain, sound);
|
||||||
|
|
||||||
ret_value = RET_OK;
|
ret_value = RET_OK;
|
||||||
}
|
}
|
||||||
@@ -536,6 +536,6 @@ void unpackAll(Main *bmain, ReportList *reports, int how)
|
|||||||
|
|
||||||
for(sound=bmain->sound.first; sound; sound=sound->id.next)
|
for(sound=bmain->sound.first; sound; sound=sound->id.next)
|
||||||
if(sound->packedfile)
|
if(sound->packedfile)
|
||||||
unpackSound(reports, sound, how);
|
unpackSound(bmain, reports, sound, how);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -236,7 +236,7 @@ void sound_delete_cache(struct bSound* sound)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sound_load(struct Main *UNUSED(bmain), struct bSound* sound)
|
void sound_load(struct Main *bmain, struct bSound* sound)
|
||||||
{
|
{
|
||||||
if(sound)
|
if(sound)
|
||||||
{
|
{
|
||||||
@@ -266,8 +266,7 @@ void sound_load(struct Main *UNUSED(bmain), struct bSound* sound)
|
|||||||
if(sound->id.lib)
|
if(sound->id.lib)
|
||||||
path = sound->id.lib->filepath;
|
path = sound->id.lib->filepath;
|
||||||
else
|
else
|
||||||
// XXX this should be fixed!
|
path = bmain->name;
|
||||||
path = /*bmain ? bmain->name :*/ G.main->name;
|
|
||||||
|
|
||||||
BLI_path_abs(fullpath, path);
|
BLI_path_abs(fullpath, path);
|
||||||
|
|
||||||
@@ -277,7 +276,7 @@ void sound_load(struct Main *UNUSED(bmain), struct bSound* sound)
|
|||||||
/* or else load it from disk */
|
/* or else load it from disk */
|
||||||
else
|
else
|
||||||
sound->handle = AUD_load(fullpath);
|
sound->handle = AUD_load(fullpath);
|
||||||
} // XXX
|
}
|
||||||
// XXX unused currently
|
// XXX unused currently
|
||||||
#if 0
|
#if 0
|
||||||
break;
|
break;
|
||||||
|
@@ -275,7 +275,7 @@ static int unpack_exec(bContext *C, wmOperator *op)
|
|||||||
if(G.fileflags & G_AUTOPACK)
|
if(G.fileflags & G_AUTOPACK)
|
||||||
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save.");
|
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save.");
|
||||||
|
|
||||||
unpackSound(op->reports, sound, method);
|
unpackSound(CTX_data_main(C), op->reports, sound, method);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user