Fix #135631: Locked strip visibility can't be changed

Strip locking was meant to be used with strip transformation only. So
the check, whether strip is locked is removed from hide/unhide operator.

Further it was requested to lock sound strip subframe offset. Since this
is time related property, it was moved to time panel. This also
addresses request to make it more obvious, why the value can't be
changed.
The name of the property was clarified from "Offset" to
"Sound offset", because there are another 2 offsets in the panel.

Finally, when channel is locked, properties in side panel now reflects
this state. This is done by adding RNA get function for `Strip.lock`
property. Function `seq::transform_is_locked` is used instead of
checking `SEQ_LOCK` flag, because it also checks channel state. With
this setup, the lock property can't be disabled while channel is locked.
However strip lock flag will be unset, which can be prevented. (I am not sure which is better. Both are fine in my eyes.)

Pull Request: https://projects.blender.org/blender/blender/pulls/135831
This commit is contained in:
Richard Antalik
2025-03-25 21:50:05 +01:00
committed by Richard Antalik
parent 3e023fcf79
commit 0b633fab3e
7 changed files with 47 additions and 51 deletions

View File

@@ -2250,6 +2250,13 @@ class SEQUENCER_PT_time(SequencerButtonsPanel, Panel):
split.label(text="End")
split.prop(strip, "animation_offset_end", text=smpte_from_frame(strip.animation_offset_end))
if strip.type == 'SOUND':
sub2 = layout.column(align=True)
split = sub2.split(factor=factor + max_factor, align=True)
split.alignment = 'RIGHT'
split.label(text="Sound Offset", text_ctxt=i18n_contexts.id_sound)
split.prop(strip, "sound_offset", text="")
col = layout.column(align=True)
col = col.box()
col.active = (
@@ -2313,11 +2320,6 @@ class SEQUENCER_PT_adjust_sound(SequencerButtonsPanel, Panel):
split.label(text="Volume", text_ctxt=i18n_contexts.id_sound)
split.prop(strip, "volume", text="")
split = col.split(factor=0.4)
split.alignment = 'RIGHT'
split.label(text="Offset", text_ctxt=i18n_contexts.id_sound)
split.prop(strip, "sound_offset", text="")
layout.use_property_split = False
col = layout.column()

View File

@@ -858,25 +858,18 @@ static wmOperatorStatus sequencer_mute_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq::editing_get(scene);
ListBase *channels = seq::channels_displayed_get(ed);
bool selected;
selected = !RNA_boolean_get(op->ptr, "unselected");
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) {
if (!seq::transform_is_locked(channels, strip)) {
if (selected) {
if (strip->flag & SELECT) {
strip->flag |= SEQ_MUTE;
seq::relations_invalidate_dependent(scene, strip);
}
if (!RNA_boolean_get(op->ptr, "unselected")) {
if (strip->flag & SELECT) {
strip->flag |= SEQ_MUTE;
seq::relations_invalidate_dependent(scene, strip);
}
else {
if ((strip->flag & SELECT) == 0) {
strip->flag |= SEQ_MUTE;
seq::relations_invalidate_dependent(scene, strip);
}
}
else {
if ((strip->flag & SELECT) == 0) {
strip->flag |= SEQ_MUTE;
seq::relations_invalidate_dependent(scene, strip);
}
}
}
@@ -915,24 +908,18 @@ static wmOperatorStatus sequencer_unmute_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq::editing_get(scene);
ListBase *channels = seq::channels_displayed_get(ed);
bool selected;
selected = !RNA_boolean_get(op->ptr, "unselected");
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) {
if (!seq::transform_is_locked(channels, strip)) {
if (selected) {
if (strip->flag & SELECT) {
strip->flag &= ~SEQ_MUTE;
seq::relations_invalidate_dependent(scene, strip);
}
if (!RNA_boolean_get(op->ptr, "unselected")) {
if (strip->flag & SELECT) {
strip->flag &= ~SEQ_MUTE;
seq::relations_invalidate_dependent(scene, strip);
}
else {
if ((strip->flag & SELECT) == 0) {
strip->flag &= ~SEQ_MUTE;
seq::relations_invalidate_dependent(scene, strip);
}
}
else {
if ((strip->flag & SELECT) == 0) {
strip->flag &= ~SEQ_MUTE;
seq::relations_invalidate_dependent(scene, strip);
}
}
}

View File

@@ -21,6 +21,7 @@
#include "RNA_define.hh"
#include "RNA_enum_types.hh"
#include "RNA_types.hh"
#include "UI_resources.hh"
#include "rna_internal.hh"
@@ -608,6 +609,15 @@ static void rna_Strip_channel_set(PointerRNA *ptr, int value)
blender::seq::relations_invalidate_cache_composite(scene, strip);
}
static bool rna_Strip_lock_get(PointerRNA *ptr)
{
Scene *scene = reinterpret_cast<Scene *>(ptr->owner_id);
Strip *strip = static_cast<Strip *>(ptr->data);
Editing *ed = blender::seq::editing_get(scene);
ListBase *channels = blender::seq::get_channels_by_seq(ed, strip);
return blender::seq::transform_is_locked(channels, strip);
}
static void rna_Strip_use_proxy_set(PointerRNA *ptr, bool value)
{
Strip *strip = (Strip *)ptr->data;
@@ -2144,6 +2154,7 @@ static void rna_def_strip(BlenderRNA *brna)
prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SEQ_LOCK);
RNA_def_property_boolean_funcs(prop, "rna_Strip_lock_get", nullptr);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
RNA_def_property_ui_text(prop, "Lock", "Lock strip so that it cannot be transformed");
@@ -3076,7 +3087,7 @@ static void rna_def_sound(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_Strip_pan_range");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Strip_audio_update");
prop = RNA_def_property(srna, "sound_offset", PROP_FLOAT, PROP_NONE);
prop = RNA_def_property(srna, "sound_offset", PROP_FLOAT, PROP_TIME_ABSOLUTE);
RNA_def_property_float_sdna(prop, nullptr, "sound_offset");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);

View File

@@ -32,6 +32,6 @@ char *channel_name_get(ListBase *channels, int channel_index);
bool channel_is_locked(const SeqTimelineChannel *channel);
bool channel_is_muted(const SeqTimelineChannel *channel);
int channel_index_get(const SeqTimelineChannel *channel);
ListBase *get_channels_by_seq(ListBase *seqbase, ListBase *channels, const Strip *strip);
ListBase *get_channels_by_seq(Editing *ed, const Strip *strip);
} // namespace blender::seq

View File

@@ -18,6 +18,8 @@
#include "BLT_translation.hh"
#include "sequencer.hh"
#include "SEQ_channels.hh"
#include "SEQ_sequencer.hh"
@@ -86,20 +88,14 @@ bool channel_is_muted(const SeqTimelineChannel *channel)
return (channel->flag & SEQ_CHANNEL_MUTE) != 0;
}
ListBase *get_channels_by_seq(ListBase *seqbase, ListBase *channels, const Strip *strip)
ListBase *get_channels_by_seq(Editing *ed, const Strip *strip)
{
ListBase *lb = nullptr;
LISTBASE_FOREACH (Strip *, istrip, seqbase) {
if (strip == istrip) {
return channels;
}
if ((lb = get_channels_by_seq(&istrip->seqbase, &istrip->channels, strip))) {
return lb;
}
Strip *strip_owner = SEQ_lookup_meta_by_strip(ed, strip);
if (strip_owner != nullptr) {
return &strip_owner->channels;
}
return nullptr;
return &ed->channels;
}
} // namespace blender::seq

View File

@@ -39,7 +39,7 @@ static ImBuf *do_adjustment_impl(const RenderData *context, Strip *strip, float
ed = context->scene->ed;
ListBase *seqbasep = get_seqbase_by_seq(context->scene, strip);
ListBase *channels = get_channels_by_seq(&ed->seqbase, &ed->channels, strip);
ListBase *channels = get_channels_by_seq(ed, strip);
/* Clamp timeline_frame to strip range so it behaves as if it had "still frame" offset (last
* frame is static after end of strip). This is how most strips behave. This way transition

View File

@@ -48,7 +48,7 @@ static ImBuf *do_multicam(const RenderData *context,
return nullptr;
}
ListBase *seqbasep = get_seqbase_by_seq(context->scene, strip);
ListBase *channels = get_channels_by_seq(&ed->seqbase, &ed->channels, strip);
ListBase *channels = get_channels_by_seq(ed, strip);
if (!seqbasep) {
return nullptr;
}