Fix T47643: Blender crash. Linked speaker issue.

Speaker's localization func would not make direct-linked its used sound datablock...
This commit is contained in:
Bastien Montagne 2016-03-01 18:09:22 +01:00 committed by Sergey Sharybin
parent aa177d48c7
commit 0c32f755a6
1 changed files with 7 additions and 0 deletions

View File

@ -81,6 +81,11 @@ Speaker *BKE_speaker_copy(Speaker *spk)
return spkn;
}
static void extern_local_speaker(Speaker *spk)
{
id_lib_extern((ID *)spk->sound);
}
void BKE_speaker_make_local(Speaker *spk)
{
Main *bmain = G.main;
@ -95,6 +100,7 @@ void BKE_speaker_make_local(Speaker *spk)
if (spk->id.lib == NULL) return;
if (spk->id.us == 1) {
id_clear_lib_data(bmain, &spk->id);
extern_local_speaker(spk);
return;
}
@ -109,6 +115,7 @@ void BKE_speaker_make_local(Speaker *spk)
if (is_local && is_lib == false) {
id_clear_lib_data(bmain, &spk->id);
extern_local_speaker(spk);
}
else if (is_local && is_lib) {
Speaker *spk_new = BKE_speaker_copy(spk);