[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59587] branches/soc-2013-vse/source/ blender: Adding seqViewHandle.

Alexander Kuznetsov kuzsasha at gmail.com
Wed Aug 28 07:03:02 CEST 2013


Revision: 59587
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59587
Author:   alexk
Date:     2013-08-28 05:03:02 +0000 (Wed, 28 Aug 2013)
Log Message:
-----------
Adding seqViewHandle. Handles for views in the engine. It stores the view, its size plus type, which needs to be rendered. View handle is attached to SpaceSeq. Problematicly, some events like *_init don't have context attached to them, which makes assigning target view size complicated. Therefore, this is done in sequencer_refresh. Engine has time a little time before draw, but we rendr few frames ahead. However, we want to start rendering next frame as soon as possible and postpone drawing of sequencer. But for this we need to alter wm, which is too risky without testing.

Modified Paths:
--------------
    branches/soc-2013-vse/source/blender/editors/space_sequencer/space_sequencer.c
    branches/soc-2013-vse/source/blender/sequencer/sequencer_main.h
    branches/soc-2013-vse/source/blender/sequencer/sequencer_seqViewHandle.h

Added Paths:
-----------
    branches/soc-2013-vse/source/blender/sequencer/sequencer_seqViewHandle.cpp

Modified: branches/soc-2013-vse/source/blender/editors/space_sequencer/space_sequencer.c
===================================================================
--- branches/soc-2013-vse/source/blender/editors/space_sequencer/space_sequencer.c	2013-08-28 04:32:39 UTC (rev 59586)
+++ branches/soc-2013-vse/source/blender/editors/space_sequencer/space_sequencer.c	2013-08-28 05:03:02 UTC (rev 59587)
@@ -60,6 +60,7 @@
 #include "IMB_imbuf.h"
 
 #include "sequencer_intern.h"   // own include
+#include "sequencer_main.h"
 
 /**************************** common state *****************************/
 
@@ -219,17 +220,40 @@
 		IMB_freeImBuf(scopes->histogram_ibuf);
 }
 
-
 /* spacetype; init callback */
-static void sequencer_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
+static void sequencer_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
 {
-	
+	SpaceSeq *sseq = (SpaceSeq *)sa->spacedata.first;
+
+	if(sseq)
+	{
+		if(!sseq->handler_view)
+			sseq->handler_view = SEQ_AddView();
+
+		if(sseq->view != SEQ_VIEW_SEQUENCE)
+			SEQ_ViewVisible(sseq->handler_view, 1);
+		else
+			SEQ_ViewVisible(sseq->handler_view, 0);
+	}
+
+
 }
+static void sequencer_exit(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
+{
+	SpaceSeq *sseq = (SpaceSeq *)sa->spacedata.first;
 
+	if(sseq && sseq->handler_view)
+		SEQ_ViewVisible(sseq->handler_view, 0);
+
+}
+
+
+
 static void sequencer_refresh(const bContext *C, ScrArea *sa)
 {
 	wmWindowManager *wm = CTX_wm_manager(C);
 	wmWindow *window = CTX_wm_window(C);
+	Scene *scene = CTX_data_scene(C);
 	SpaceSeq *sseq = (SpaceSeq *)sa->spacedata.first;
 	ARegion *ar_main = sequencer_find_region(sa, RGN_TYPE_WINDOW);
 	ARegion *ar_preview = sequencer_find_region(sa, RGN_TYPE_PREVIEW);
@@ -302,6 +326,17 @@
 			break;
 	}
 
+	if(sseq->handler_view)
+	{
+		float width = 0, height = 0;
+
+		draw_get_render_size(scene, sseq, &width, &height);
+
+		SEQ_ViewSetImageResolution(sseq->handler_view, width, height);
+
+		SEQ_ViewSetScopeMode(sseq->handler_view, sseq->mainb, 0, 1.0f, ceil(width), ceil(height));
+	}
+
 	if (view_changed) {
 		ED_area_initialize(wm, window, sa);
 		ED_area_tag_redraw(sa);
@@ -322,19 +357,29 @@
 {
 	/* context changes */
 	switch (wmn->category) {
+		case NC_WM:
+			if(wmn->data == ND_FILEREAD){
+				ED_area_tag_refresh(sa);
+			}
+			break;
 		case NC_SCENE:
 			switch (wmn->data) {
 				case ND_FRAME:
 				case ND_SEQUENCER:
-					sequencer_scopes_tag_refresh(sa);
+					ED_area_tag_refresh(sa);
 					break;
 			}
 			break;
 		case NC_WINDOW:
 		case NC_SPACE:
-			if (wmn->data == ND_SPACE_SEQUENCER)
-				sequencer_scopes_tag_refresh(sa);
+			switch (wmn->data) {
+				case ND_SPACE_SEQUENCER:
+				case ND_SPACE_CHANGED:
+					ED_area_tag_refresh(sa);
+					break;
+			}
 			break;
+
 	}
 }
 
@@ -526,8 +571,11 @@
 	/* own keymap */
 	keymap = WM_keymap_find(wm->defaultconf, "SequencerPreview", SPACE_SEQ, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+
 }
 
+
+
 static void sequencer_preview_area_draw(const bContext *C, ARegion *ar)
 {
 	ScrArea *sa = CTX_wm_area(C);
@@ -653,6 +701,7 @@
 	st->new = sequencer_new;
 	st->free = sequencer_free;
 	st->init = sequencer_init;
+	st->exit = sequencer_exit;
 	st->duplicate = sequencer_duplicate;
 	st->operatortypes = sequencer_operatortypes;
 	st->keymap = sequencer_keymap;

Modified: branches/soc-2013-vse/source/blender/sequencer/sequencer_main.h
===================================================================
--- branches/soc-2013-vse/source/blender/sequencer/sequencer_main.h	2013-08-28 04:32:39 UTC (rev 59586)
+++ branches/soc-2013-vse/source/blender/sequencer/sequencer_main.h	2013-08-28 05:03:02 UTC (rev 59587)
@@ -29,6 +29,7 @@
 
 typedef struct seqViewData
 {
+	unsigned int textid;
 	void *pointer;
 	int phys_size[2];
 } seqViewData;
@@ -47,7 +48,8 @@
 seqViewData SEQ_ViewGetData(seqViewHandle *view);
 
 void SEQ_ViewVisible(seqViewHandle *view, int visible);
-void SEQ_ViewSetResolution(seqViewHandle *view, int width, int height);
+void SEQ_ViewSetImageResolution(seqViewHandle *view, float width, float height);
+void SEQ_ViewSetScopeMode(seqViewHandle *view, int mode, int submode, float samplerate, int width, int height);
 
 
 

Added: branches/soc-2013-vse/source/blender/sequencer/sequencer_seqViewHandle.cpp
===================================================================
--- branches/soc-2013-vse/source/blender/sequencer/sequencer_seqViewHandle.cpp	                        (rev 0)
+++ branches/soc-2013-vse/source/blender/sequencer/sequencer_seqViewHandle.cpp	2013-08-28 05:03:02 UTC (rev 59587)
@@ -0,0 +1 @@
+ 

Modified: branches/soc-2013-vse/source/blender/sequencer/sequencer_seqViewHandle.h
===================================================================
--- branches/soc-2013-vse/source/blender/sequencer/sequencer_seqViewHandle.h	2013-08-28 04:32:39 UTC (rev 59586)
+++ branches/soc-2013-vse/source/blender/sequencer/sequencer_seqViewHandle.h	2013-08-28 05:03:02 UTC (rev 59587)
@@ -4,24 +4,23 @@
 #include "MEM_guardedalloc.h"
 #include "sequencer_main.h"
 #include <math.h>
+#include "DNA_space_types.h"
 
 class seqEngine;
 
-typedef enum seqViewType
-{
-	SEQ_VIEW_PICTURE,
-	SEQ_VIEW_HISTOGRAm
 
-} seqViewType;
 
 class seqViewHandle{
 
 
 private:
+
+	int mode, submode;
 	float size[2];
 	int phys_size[2];
-	seqViewType type;
+	int scope_size[2];
 	bool visible;
+	bool changed; /* to drop old renders with wrong size */
 
 
 	void phys_size_update()
@@ -32,19 +31,39 @@
 
 public:
 
-	void set_visable(bool v)
+	void set_visible(bool v)
 	{
 		visible = v;
-		//engine add outputs
+
+		changed = true;
+
 	}
 
+	bool is_changed()
+	{
+		return changed;
+	}
+
+	void reset_changed()
+	{
+		changed = false;
+	}
+
 	void set_size(float width, float height)
 	{
-		size[0] = width;
-		size[1] = height;
+		if(size[0] != width)
+		{
+			size[0] = width;
+			changed = true;
+		}
+		if(size[1] != height)
+		{
+			size[1] = height;
+			changed = true;
+		}
 
-		phys_size_update();
-
+		if(changed)
+			phys_size_update();
 	}
 
 	float get_sizex(){
@@ -55,21 +74,59 @@
 		return size[1];
 	}
 
+
+
+
+	void set_scope_mode(int mode, int submode, int samplerate)
+	{
+		if(this->mode != mode || this->submode != submode)
+		{
+			this->mode = mode;
+			this->submode = submode;
+
+			changed = true;
+		}
+	}
+
+	int get_mode()
+	{
+		return mode;
+	}
+
+
+	void set_scope_resolution(int width, int height)
+	{
+		if(this->scope_size[0] != width || this->scope_size[1] != height)
+		{
+			this->scope_size[0] = width;
+			this->scope_size[1] = height;
+
+			changed = true;
+		}
+	}
+
+	int get_scope_resolutionx()
+	{
+		return scope_size[0];
+	}
+
+	int get_scope_resolutiony()
+	{
+		return scope_size[1];
+	}
+
 	seqViewHandle() :
-		type(SEQ_VIEW_PICTURE),
-		visible(false)
+		visible(false),
+		mode(SEQ_DRAW_IMG_IMBUF)
 	{
-		type = SEQ_VIEW_PICTURE;
 		size[0] = size[1] =0.0f;
 		phys_size[0] = phys_size[1] = 0;
 
+		scope_size[0] = scope_size[1];
 	}
-
 	seqViewData getData(seqEngine *se);
 
-
 	MEM_CXX_CLASS_ALLOC_FUNCS("seqViewHendle");
-
 };
 
 




More information about the Bf-blender-cvs mailing list