From 0767f95a63959e156c302520db7fbf480159abe0 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 11 Jun 2019 10:55:13 +0200 Subject: Sound: Fix queries of sound info A lot of areas were querying sound information directly using audio handle which does not exist on an original sound IDs. This change basically makes it so it's possible to query information about given sound ID, without worrying about whether it's loaded or not: if it is needed to load it first it happens automatically (no automatically-opened handles are left behind though). While this seems a bit extreme to open files on such queries it is still better than the old situation when all sound handles were opened on file load, no matter if it's needed or not. Besides, none of the changed code paths are performance critical, just handful of tools. Fixes T65696: Sequencer fails to create a new sound sequence strip via Python Fixes T65656: Audio strip - SHIFT K crashes Blender Reviewers: brecht Reviewed By: brecht Subscribers: ISS Maniphest Tasks: T65696, T65656 Differential Revision: https://developer.blender.org/D5061 --- source/blender/editors/object/object_add.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/object/object_add.c') diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 0b9ced84a59..99c3d7da2a2 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1417,6 +1417,7 @@ void OBJECT_OT_collection_instance_add(wmOperatorType *ot) static int object_speaker_add_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Object *ob; ushort local_view_bits; float loc[3], rot[3]; @@ -1434,7 +1435,7 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op) /* create new data for NLA hierarchy */ AnimData *adt = BKE_animdata_add_id(&ob->id); NlaTrack *nlt = BKE_nlatrack_add(adt, NULL); - NlaStrip *strip = BKE_nla_add_soundstrip(scene, ob->data); + NlaStrip *strip = BKE_nla_add_soundstrip(bmain, scene, ob->data); strip->start = CFRA; strip->end += strip->start; -- cgit v1.2.3