[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54904] trunk/blender: Added RGBA|RGB channels toggle to sequencer preview

Sergey Sharybin sergey.vfx at gmail.com
Wed Feb 27 11:26:58 CET 2013


Revision: 54904
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54904
Author:   nazgul
Date:     2013-02-27 10:26:58 +0000 (Wed, 27 Feb 2013)
Log Message:
-----------
Added RGBA|RGB channels toggle to sequencer preview

Main purpose of this is to be more compatible with older
versions of blender (before alpha cleanup) where sequencer
used to display premultiplied image on an straight opengl
viewport.

Now sequencer preview would behave closer to image editor
However adding Alpha and R|G|B displays is not so simple
because sequencer is using 2D textures. Would be nice to
implement this options as well, but this is not so much
important IMO.

This hall fix
- #34453: VSE: Subtract function does not work properly

TODO: Make RGBA display default for our startup.blend

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
    trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
    trunk/blender/source/blender/editors/space_sequencer/space_sequencer.c
    trunk/blender/source/blender/makesdna/DNA_space_types.h
    trunk/blender/source/blender/makesrna/intern/rna_space.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2013-02-27 10:19:31 UTC (rev 54903)
+++ trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2013-02-27 10:26:58 UTC (rev 54904)
@@ -89,6 +89,7 @@
                 layout.separator()
                 layout.operator("sequencer.refresh_all")
 
+            layout.prop(st, "preview_channels", expand=True, text="")
             layout.prop(st, "display_channel", text="Channel")
 
             ed = context.scene.sequence_editor

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c	2013-02-27 10:19:31 UTC (rev 54903)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c	2013-02-27 10:26:58 UTC (rev 54904)
@@ -1059,8 +1059,10 @@
 
 	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, display_buffer);
 
-	glEnable(GL_BLEND);
-	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	if (sseq->flag & SEQ_USE_ALPHA) {
+		glEnable(GL_BLEND);
+		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	}
 
 	glBegin(GL_QUADS);
 
@@ -1093,7 +1095,8 @@
 	glEnd();
 	glBindTexture(GL_TEXTURE_2D, last_texid);
 	glDisable(GL_TEXTURE_2D);
-	glDisable(GL_BLEND);
+	if (sseq->flag & SEQ_USE_ALPHA)
+		glDisable(GL_BLEND);
 	glDeleteTextures(1, &texid);
 
 	if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {

Modified: trunk/blender/source/blender/editors/space_sequencer/space_sequencer.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/space_sequencer.c	2013-02-27 10:19:31 UTC (rev 54903)
+++ trunk/blender/source/blender/editors/space_sequencer/space_sequencer.c	2013-02-27 10:26:58 UTC (rev 54904)
@@ -120,7 +120,7 @@
 	sseq->chanshown = 0;
 	sseq->view = SEQ_VIEW_SEQUENCE;
 	sseq->mainb = SEQ_DRAW_IMG_IMBUF;
-	sseq->flag = SEQ_SHOW_GPENCIL;
+	sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA;
 
 	/* header */
 	ar = MEM_callocN(sizeof(ARegion), "header for sequencer");

Modified: trunk/blender/source/blender/makesdna/DNA_space_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_space_types.h	2013-02-27 10:19:31 UTC (rev 54903)
+++ trunk/blender/source/blender/makesdna/DNA_space_types.h	2013-02-27 10:26:58 UTC (rev 54904)
@@ -497,6 +497,7 @@
 	SEQ_DRAW_SAFE_MARGINS       = (1 << 3),
 	SEQ_SHOW_GPENCIL            = (1 << 4),
 	SEQ_NO_DRAW_CFRANUM         = (1 << 5),
+	SEQ_USE_ALPHA               = (1 << 6), /* use RGBA display mode for preview */
 } eSpaceSeq_Flag;
 
 /* sseq->view */

Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c	2013-02-27 10:19:31 UTC (rev 54903)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c	2013-02-27 10:26:58 UTC (rev 54904)
@@ -2248,6 +2248,13 @@
 		{0, NULL, 0, NULL, NULL}
 	};
 
+	static EnumPropertyItem preview_channels_items[] = {
+		{SEQ_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
+		                "Draw image with RGB colors and alpha transparency"},
+		{0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
 	srna = RNA_def_struct(brna, "SpaceSequenceEditor", "Space");
 	RNA_def_struct_sdna(srna, "SpaceSeq");
 	RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data");
@@ -2265,7 +2272,7 @@
 	RNA_def_property_enum_items(prop, display_mode_items);
 	RNA_def_property_ui_text(prop, "Display Mode", "View mode to use for displaying sequencer output");
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-		
+
 	/* flags */
 	prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_NO_DRAW_CFRANUM);
@@ -2310,7 +2317,13 @@
 	                         "The channel number shown in the image preview. 0 is the result of all strips combined");
 	RNA_def_property_range(prop, -5, MAXSEQ);
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-	
+
+	prop = RNA_def_property(srna, "preview_channels", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+	RNA_def_property_enum_items(prop, preview_channels_items);
+	RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the preview to draw");
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
 	prop = RNA_def_property(srna, "draw_overexposed", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "zebra");
 	RNA_def_property_ui_text(prop, "Show Overexposed", "Show overexposed areas with zebra stripes");




More information about the Bf-blender-cvs mailing list