Fix T47109: Expose sound data-block selector

This commit is contained in:
Campbell Barton 2016-01-04 21:08:14 +11:00
parent 598180f98d
commit 982904fcc9
Notes: blender-bot 2023-02-14 08:19:31 +01:00
Referenced by issue #47109, Change duplicate sound strip path change original stip path too
2 changed files with 4 additions and 25 deletions

View File

@ -783,13 +783,10 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel, Panel):
strip = act_strip(context)
sound = strip.sound
# TODO: add support to handle SOUND datablock in sequencer soundstrips... For now, hide this useless thing!
# layout.template_ID(strip, "sound", open="sound.open")
# layout.separator()
layout.prop(strip, "filepath", text="")
layout.template_ID(strip, "sound", open="sound.open")
if sound is not None:
layout.prop(sound, "filepath", text="")
row = layout.row()
if sound.packed_file:
row.operator("sound.unpack", icon='PACKAGE', text="Unpack")

View File

@ -596,19 +596,6 @@ static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator *
static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value)
{
Sequence *seq = (Sequence *)(ptr->data);
if (seq->type == SEQ_TYPE_SOUND_RAM && seq->sound) {
/* for sound strips we need to update the sound as well.
* arguably, this could load in a new sound rather than modify an existing one.
* but while using the sequencer its most likely your not using the sound in the game engine too.
*/
PointerRNA id_ptr;
RNA_id_pointer_create((ID *)seq->sound, &id_ptr);
RNA_string_set(&id_ptr, "filepath", value);
BKE_sound_load(G.main, seq->sound);
BKE_sound_update_scene_sound(seq->scene_sound, seq->sound);
}
BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir),
sizeof(seq->strip->stripdata->name));
}
@ -2034,6 +2021,7 @@ static void rna_def_sound(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "Sequence");
prop = RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Sound");
RNA_def_property_ui_text(prop, "Sound", "Sound data-block used by this sequence");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
@ -2061,12 +2049,6 @@ static void rna_def_sound(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pan_set", NULL);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_ui_text(prop, "File", "");
RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length",
"rna_Sequence_filepath_set");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_filepath_update");
prop = RNA_def_property(srna, "show_waveform", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_AUDIO_DRAW_WAVEFORM);
RNA_def_property_ui_text(prop, "Draw Waveform", "Whether to draw the sound's waveform");