VSE: Use Strip Volume property for scenes

Scene strips had scene volume property in side panel, but this meant,
that it is shared across all strips using particular scene.

Add `volume` RNA property for scene strips and use this in side panel.

Co-authored-by: 20kdc <asdd2808@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/112597
This commit is contained in:
20kdc
2023-11-21 08:09:18 +01:00
committed by Richard Antalik
parent d0e9468848
commit f01c82e268
2 changed files with 48 additions and 16 deletions
+34 -10
View File
@@ -1830,16 +1830,6 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
if strip.scene_input == 'CAMERA':
layout.template_ID(strip, "scene_camera", text="Camera")
if scene:
# Build a manual split layout as a hack to get proper alignment with the rest of the buttons.
sub = layout.row(align=True)
sub.use_property_decorate = True
split = sub.split(factor=0.4, align=True)
split.alignment = 'RIGHT'
split.label(text="Volume", text_ctxt=i18n_contexts.id_sound)
split.prop(scene, "audio_volume", text="")
sub.use_property_decorate = False
if strip.scene_input == 'CAMERA':
layout = layout.column(heading="Show")
layout.prop(strip, "use_annotations", text="Annotations")
@@ -1849,6 +1839,39 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
layout.prop(scene.render, "film_transparent")
class SEQUENCER_PT_scene_sound(SequencerButtonsPanel, Panel):
bl_label = "Sound"
bl_category = "Strip"
@classmethod
def poll(cls, context):
if not cls.has_sequencer(context):
return False
strip = context.active_sequence_strip
if not strip:
return False
return (strip.type == 'SCENE')
def draw(self, context):
strip = context.active_sequence_strip
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
layout.active = not strip.mute
col = layout.column()
col.use_property_decorate = True
split = col.split(factor=0.4)
split.alignment = 'RIGHT'
split.label(text="Strip Volume", text_ctxt=i18n_contexts.id_sound)
split.prop(strip, "volume", text="")
col.use_property_decorate = False
class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
bl_label = "Mask"
bl_category = "Strip"
@@ -2813,6 +2836,7 @@ classes = (
SEQUENCER_PT_effect,
SEQUENCER_PT_scene,
SEQUENCER_PT_scene_sound,
SEQUENCER_PT_mask,
SEQUENCER_PT_effect_text_style,
SEQUENCER_PT_effect_text_layout,
@@ -2827,6 +2827,18 @@ static void rna_def_meta(BlenderRNA *brna)
rna_def_input(srna);
}
static void rna_def_audio_options(StructRNA *srna)
{
PropertyRNA *prop;
prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, nullptr, "volume");
RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_audio_update");
}
static void rna_def_scene(BlenderRNA *brna)
{
StructRNA *srna;
@@ -2869,6 +2881,7 @@ static void rna_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use Annotations", "Show Annotations in OpenGL previews");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update");
rna_def_audio_options(srna);
rna_def_filter_video(srna);
rna_def_proxy(srna);
rna_def_input(srna);
@@ -3038,12 +3051,7 @@ static void rna_def_sound(BlenderRNA *brna)
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_sound_update");
prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, nullptr, "volume");
RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_audio_update");
rna_def_audio_options(srna);
prop = RNA_def_property(srna, "pan", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, nullptr, "pan");