[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45272] trunk/blender: support for opengl rendering in the sequencer ( header icons as with 3D view).

Campbell Barton ideasman42 at gmail.com
Fri Mar 30 01:33:57 CEST 2012


Revision: 45272
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45272
Author:   campbellbarton
Date:     2012-03-29 23:33:50 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
support for opengl rendering in the sequencer (header icons as with 3D view).

while opengl could be used for display you couldn't output it to a file.

extended the existing opengl render operator to optionally take input from the sequencer.

notes:
- doesn't redraw in the viewport yet (only output in terminal)
- doesn't do OSA

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
    trunk/blender/source/blender/editors/render/render_opengl.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2012-03-29 23:14:09 UTC (rev 45271)
+++ trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2012-03-29 23:33:50 UTC (rev 45272)
@@ -75,6 +75,13 @@
                     row.prop(ed, "overlay_frame", text="")
                     row.prop(ed, "overlay_lock", text="", icon='LOCKED')
 
+                row = layout.row(align=True)
+                props = row.operator("render.opengl", text="", icon='RENDER_STILL')
+                props.sequencer = True
+                props = row.operator("render.opengl", text="", icon='RENDER_ANIMATION')
+                props.animation = True
+                props.sequencer = True
+
         layout.template_running_jobs()
 
 

Modified: trunk/blender/source/blender/editors/render/render_opengl.c
===================================================================
--- trunk/blender/source/blender/editors/render/render_opengl.c	2012-03-29 23:14:09 UTC (rev 45271)
+++ trunk/blender/source/blender/editors/render/render_opengl.c	2012-03-29 23:33:50 UTC (rev 45272)
@@ -50,6 +50,7 @@
 #include "BKE_main.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
+#include "BKE_sequencer.h"
 #include "BKE_writeavi.h"
 
 #include "WM_api.h"
@@ -87,6 +88,10 @@
 
 	short obcenter_dia_back; /* temp overwrite */
 
+	short is_sequencer;
+	SpaceSeq *sseq;
+
+
 	Image *ima;
 	ImageUser iuser;
 
@@ -128,8 +133,28 @@
 	const short view_context = (v3d != NULL);
 
 	rr = RE_AcquireResultRead(oglrender->re);
-	
-	if (view_context) {
+
+	if (oglrender->is_sequencer) {
+		SeqRenderData context;
+		int chanshown = oglrender->sseq ? oglrender->sseq->chanshown : 0;
+
+		context = seq_new_render_data(oglrender->bmain, scene, oglrender->sizex, oglrender->sizey, 100.0f);
+
+		ibuf = give_ibuf_seq(context, CFRA, chanshown);
+
+		if (ibuf) {
+			BLI_assert((oglrender->sizex == ibuf->x) && (oglrender->sizey == ibuf->y));
+
+			if (ibuf->rect_float == NULL) {
+				IMB_float_from_rect(ibuf);
+			}
+
+			memcpy(rr->rectf, ibuf->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey);
+
+			IMB_freeImBuf(ibuf);
+		}
+	}
+	else if (view_context) {
 		GPU_offscreen_bind(oglrender->ofs); /* bind */
 
 		/* render 3d view */
@@ -197,7 +222,7 @@
 			IMB_freeImBuf(ibuf_view);
 		}
 		else {
-			fprintf(stderr, "screen_opengl_render_apply: failed to get buffer, %s\n", err_out);
+			fprintf(stderr, "%s: failed to get buffer, %s\n", __func__, err_out);
 		}
 	}
 	
@@ -260,6 +285,7 @@
 	int sizex, sizey;
 	short is_view_context = RNA_boolean_get(op->ptr, "view_context");
 	const short is_animation = RNA_boolean_get(op->ptr, "animation");
+	const short is_sequencer = RNA_boolean_get(op->ptr, "sequencer");
 	const short is_write_still = RNA_boolean_get(op->ptr, "write_still");
 	char err_out[256] = "unknown";
 
@@ -320,6 +346,12 @@
 
 	oglrender->write_still = is_write_still && !is_animation;
 
+	oglrender->is_sequencer = is_sequencer;
+	if (is_sequencer) {
+		oglrender->sseq = CTX_wm_space_seq(C);;
+	}
+
+
 	oglrender->obcenter_dia_back = U.obcenter_dia;
 	U.obcenter_dia = 0;
 
@@ -638,6 +670,8 @@
 
 void RENDER_OT_opengl(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
 	ot->name = "OpenGL Render";
 	ot->description = "OpenGL render active viewport";
@@ -651,9 +685,15 @@
 
 	ot->poll = ED_operator_screenactive;
 
-	RNA_def_boolean(ot->srna, "animation", 0, "Animation", "Render files from the animation range of this scene");
-	RNA_def_boolean(ot->srna, "write_still", 0, "Write Image", "Save rendered the image to the output path (used only when animation is disabled)");
-	RNA_def_boolean(ot->srna, "view_context", 1, "View Context", "Use the current 3D view for rendering, else use scene settings");
+	prop = RNA_def_boolean(ot->srna, "animation", 0, "Animation", "Render files from the animation range of this scene");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "sequencer", 0, "Sequencer", "Render using the sequencers OpenGL display");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "write_still", 0, "Write Image", "Save rendered the image to the output path (used only when animation is disabled)");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "view_context", 1, "View Context", "Use the current 3D view for rendering, else use scene settings");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
 }
 
 /* function for getting an opengl buffer from a View3D, used by sequencer */




More information about the Bf-blender-cvs mailing list