Page MenuHome

Add Transparancy to Rectangle Overlay in the VSE
Needs RevisionPublic

Authored by John Quillan (jquillan) on Apr 18 2020, 10:44 PM.

Details

Summary

Here is a patch to add transparency to the Rectangle Overlay in the VSE. This would allow using the Rectangle Overlay to be used to easily align the current frame with some other frame in the sequence.

Here is how the overlay panel looks now

Here is with full opacity (1.0)

Here is with some transparency, notice I can see through to previous frame in this case

Diff Detail

Repository
rB Blender

Event Timeline

John Quillan (jquillan) requested review of this revision.Apr 18 2020, 10:44 PM
John Quillan (jquillan) created this revision.

Can you please update patch description, to explain (briefly) what this patch does and why is it useful? Technically description should be pretty much same as commit message https://wiki.blender.org/wiki/Style_Guide/Commit_Messages

I had made two changes to the startup.blend files to get the value to be 1.0 by default (not sure that was the correct way to go about this) but not sure how to add them to the patch.

Changes in default values for existing items are done in versioning_xxx_.c, runtime default values are defined all over the code and property defaut values can be defined in RNA code.
Can you specify exactly what property / variable you want to change?

John Quillan (jquillan) edited the summary of this revision. (Show Details)Apr 19 2020, 1:31 AM

Can you specify exactly what property / variable you want to change?

It is a new property "overlay_blend". It always starts up with a value of 0.0 which is undesirable because you can not seen the overlay in that case.

runtime default values are defined all over the code

I will try again. I tried initializing the value in sequencer_new function in space_sequencer.c but that did not work. Any guidance would be appreciated.

I see when that is called now. I will figure this out eventually.

Updated the patch. This should be better.

@John Quillan (jquillan) Interesting round of patches you have been submitting for the VSE. Maybe you would like to join the VSE chat, if you got more patch-ideas for the VSE you want to discuss? https://blender.chat/channel/vse

The functionality seems fine. @Richard Antalik (ISS) should decide if this should be accepted though.

release/scripts/startup/bl_ui/space_sequencer.py
2009

Don't use abbreviations like Rect in the UI. In the case just Opacity should be fine.

source/blender/makesdna/DNA_space_types.h
574

overlay_opacity might be a better name.

source/blender/makesrna/intern/rna_space.c
4835

"Overlay Opacity"

Sergey Sharybin (sergey) requested changes to this revision.Apr 22 2020, 10:53 AM
Sergey Sharybin (sergey) added inline comments.
source/blender/blenloader/intern/versioning_280.c
4982

This seems to be in the wrong place.

Should be done for any file saved in any version prior to the current one.

This revision now requires changes to proceed.Apr 22 2020, 10:53 AM
Richard Antalik (ISS) added inline comments.
source/blender/blenloader/intern/versioning_280.c
4982

Note, that this patch is applicable for version 2.90 only, so this would have to be done in that file.

This can be a bit confusing but it's quite easy once you understand how it works:

Versioning functions will run for for every .blend file you open, and if file is older than current version (checked by MAIN_VERSION_ATLEAST) you can run code to make changes to file before it is processed further

Look for function blo_do_versions_290 and append your versioning code to end of that function. There will be comment Versioning code until next subversion bump goes here.

Last thing is bumping subversion, you usually don't need to do it unless you need to guarantee, that versioning code can be run only once for a .blend file

So you should put this to a 2.90 versioning file

for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
  for (ScrArea *area = screen->areabase.first; area; area = area->next) {
    for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
      if (sl->spacetype == SPACE_SEQ) {
        SpaceSeq *sseq = (SpaceSeq *)sl;
        sseq->overlay_blend = 1.0f;
      }
    }
  }
}
John Quillan (jquillan) marked 5 inline comments as done.

Address all comments.

Updating patch. All comments were addressed.

Campbell Barton (campbellbarton) requested changes to this revision.Apr 25 2020, 6:34 AM

This patch doesn't handle the case when glsl drawing is used,
in this case different drawing code is used and immUnbindProgram isn't called.

source/blender/editors/space_sequencer/sequencer_draw.c
1661–1665

This doesn't account for the code path where glsl_used is true,
where sequencer_OCIO_transform_ibuf is used instead of binding the shader here.

This revision now requires changes to proceed.Apr 25 2020, 6:34 AM

Looked into this, I think you'll need to pass an alpha argument to OCIOImpl::setupGLSLDraw.

Don't think you need to pass it. Should be possible to have uniform in the OCIO shader which can be set using immUniform*.
This is something where @Clément Foucault (fclem) would be best to provide a way to override alpha, or to tell how to do it :)

Thanks for the feed back. I have just barely started looking into this.

source/blender/editors/space_sequencer/sequencer_draw.c
1661–1665

So in looking at this, this does work when glsl_used is true.

I have however found some issues I would like to fix as well.

A) This only works when we are displaying "Color & Alpha", but not for just "Color"
B) It seems that we try to draw the overlay when we are showing the histogram and luma waveform, neither which make sense.