Merge branch 'blender-v4.2-release'

This commit is contained in:
Aras Pranckevicius
2024-06-17 12:44:29 +03:00
2 changed files with 28 additions and 10 deletions

View File

@@ -557,13 +557,13 @@ static void draw_seq_waveform_overlay(TimelineDrawContext *timeline_ctx,
rms *= volume;
bool is_clipping = false;
if (value_max > 1 || value_min < -1) {
float clamped_min = clamp_f(value_min, -1.0f, 1.0f);
float clamped_max = clamp_f(value_max, -1.0f, 1.0f);
if (clamped_min != value_min || clamped_max != value_max) {
is_clipping = true;
CLAMP_MAX(value_max, 1.0f);
CLAMP_MIN(value_min, -1.0f);
}
value_min = clamped_min;
value_max = clamped_max;
/* We are drawing only half to the waveform, mirroring the lower part upwards.
* If both min and max are on the same side of zero line, we want to draw a bar
@@ -596,9 +596,9 @@ static void draw_seq_waveform_overlay(TimelineDrawContext *timeline_ctx,
* height, join them. */
if (std::abs(y_mid - prev_y_mid) > timeline_ctx->pixely) {
float x0 = draw_start_frame + (i - 1) * frames_per_pixel;
timeline_ctx->quads->add_line(x0, prev_y_mid, x1, y_mid, color);
timeline_ctx->quads->add_line(x0, prev_y_mid, x1, y_mid, is_clipping ? color_clip : color);
}
timeline_ctx->quads->add_line(x1, y_mid, x2, y_mid, color);
timeline_ctx->quads->add_line(x1, y_mid, x2, y_mid, is_clipping ? color_clip : color);
}
else {
float rms_min = y_zero + max_ff(-rms, value_min) * y_scale;

View File

@@ -1970,6 +1970,26 @@ static ImBuf *seq_render_strip_stack_apply_effect(
return out;
}
static bool is_opaque_alpha_over(const Sequence *seq)
{
if (seq->blend_mode != SEQ_TYPE_ALPHAOVER) {
return false;
}
if (seq->blend_opacity < 100.0f) {
return false;
}
if (seq->mul < 1.0f && (seq->flag & SEQ_MULTIPLY_ALPHA) != 0) {
return false;
}
LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) {
/* Assume result is not opaque if there is an enabled Mask modifier. */
if ((smd->flag & SEQUENCE_MODIFIER_MUTE) == 0 && smd->type == seqModifierType_Mask) {
return false;
}
}
return true;
}
static ImBuf *seq_render_strip_stack(const SeqRenderData *context,
SeqRenderState *state,
ListBase *channels,
@@ -2008,9 +2028,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context,
/* Early out for alpha over. It requires image to be rendered, so it can't use
* `seq_get_early_out_for_blend_mode`. */
if (out == nullptr && seq->blend_mode == SEQ_TYPE_ALPHAOVER &&
early_out == StripEarlyOut::DoEffect && seq->blend_opacity == 100.0f)
{
if (out == nullptr && early_out == StripEarlyOut::DoEffect && is_opaque_alpha_over(seq)) {
ImBuf *test = seq_render_strip(context, state, seq, timeline_frame);
if (ELEM(test->planes, R_IMF_PLANES_BW, R_IMF_PLANES_RGB)) {
early_out = StripEarlyOut::UseInput2;