[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50415] branches/soc-2011-tomato/source/ blender: Sequencer: cache currently displaying scopes
Sergey Sharybin
sergey.vfx at gmail.com
Wed Sep 5 13:43:05 CEST 2012
Revision: 50415
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50415
Author: nazgul
Date: 2012-09-05 11:43:05 +0000 (Wed, 05 Sep 2012)
Log Message:
-----------
Sequencer: cache currently displaying scopes
This avoids calculation of scopes on every redraw, so such tools as panning
and zoom wouldn't imply re-calculating scopes.
Implemented as a structure inside of SpaceSeq, juts like it's done for clip
and image spaces.
Also fixed zebra display to work in display space.
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_draw.c
branches/soc-2011-tomato/source/blender/editors/space_sequencer/space_sequencer.c
branches/soc-2011-tomato/source/blender/makesdna/DNA_movieclip_types.h
branches/soc-2011-tomato/source/blender/makesdna/DNA_sequence_types.h
branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c
Modified: branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c 2012-09-05 11:42:57 UTC (rev 50414)
+++ branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c 2012-09-05 11:43:05 UTC (rev 50415)
@@ -5294,6 +5294,13 @@
* so fingers crossed this works fine!
*/
sseq->gpd = newlibadr_us(fd, sc->id.lib, sseq->gpd);
+
+ sseq->scopes.reference_ibuf = NULL;
+ sseq->scopes.zebra_ibuf = NULL;
+ sseq->scopes.waveform_ibuf = NULL;
+ sseq->scopes.sep_waveform_ibuf = NULL;
+ sseq->scopes.vector_ibuf = NULL;
+ sseq->scopes.histogram_ibuf = NULL;
}
else if (sl->spacetype == SPACE_NLA) {
SpaceNla *snla= (SpaceNla *)sl;
Modified: branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_draw.c 2012-09-05 11:42:57 UTC (rev 50414)
+++ branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_draw.c 2012-09-05 11:43:05 UTC (rev 50415)
@@ -850,6 +850,50 @@
return ibuf;
}
+static void sequencer_check_scopes(SequencerScopes *scopes, ImBuf *ibuf)
+{
+ if (scopes->reference_ibuf != ibuf) {
+ if (scopes->zebra_ibuf) {
+ IMB_freeImBuf(scopes->zebra_ibuf);
+ scopes->zebra_ibuf = NULL;
+ }
+
+ if (scopes->waveform_ibuf) {
+ IMB_freeImBuf(scopes->waveform_ibuf);
+ scopes->waveform_ibuf = NULL;
+ }
+
+ if (scopes->sep_waveform_ibuf) {
+ IMB_freeImBuf(scopes->sep_waveform_ibuf);
+ scopes->sep_waveform_ibuf = NULL;
+ }
+
+ if (scopes->vector_ibuf) {
+ IMB_freeImBuf(scopes->vector_ibuf);
+ scopes->vector_ibuf = NULL;
+ }
+
+ if (scopes->histogram_ibuf) {
+ IMB_freeImBuf(scopes->histogram_ibuf);
+ scopes->histogram_ibuf = NULL;
+ }
+ }
+}
+
+static ImBuf *sequencer_make_scope(Scene *scene, ImBuf *ibuf, ImBuf *(*make_scope_cb) (ImBuf *ibuf))
+{
+ ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
+ ImBuf *scope;
+
+ IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings, &scene->display_settings);
+
+ scope = make_scope_cb(display_ibuf);
+
+ IMB_freeImBuf(display_ibuf);
+
+ return scope;
+}
+
void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs, int draw_overlay)
{
struct Main *bmain = CTX_data_main(C);
@@ -913,34 +957,47 @@
if (ibuf->rect == NULL && ibuf->rect_float == NULL)
return;
- if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
- if (sseq->zebra != 0) {
- scope = make_zebra_view_from_ibuf(ibuf, sseq->zebra);
- }
- }
- else {
- ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
+ if (sseq->mainb != SEQ_DRAW_IMG_IMBUF || sseq->zebra != 0) {
+ SequencerScopes *scopes = &sseq->scopes;
- IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings, &scene->display_settings);
+ sequencer_check_scopes(scopes, ibuf);
switch (sseq->mainb) {
+ case SEQ_DRAW_IMG_IMBUF:
+ if (!scopes->zebra_ibuf) {
+ ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
+
+ IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings, &scene->display_settings);
+ scopes->zebra_ibuf = make_zebra_view_from_ibuf(display_ibuf, sseq->zebra);
+ IMB_freeImBuf(display_ibuf);
+ }
+ scope = scopes->zebra_ibuf;
+ break;
case SEQ_DRAW_IMG_WAVEFORM:
if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) {
- scope = make_sep_waveform_view_from_ibuf(display_ibuf);
+ if (!scopes->sep_waveform_ibuf)
+ scopes->sep_waveform_ibuf = sequencer_make_scope(scene, ibuf, make_sep_waveform_view_from_ibuf);
+ scope = scopes->sep_waveform_ibuf;
}
else {
- scope = make_waveform_view_from_ibuf(display_ibuf);
+ if (!scopes->waveform_ibuf)
+ scopes->waveform_ibuf = sequencer_make_scope(scene, ibuf, make_waveform_view_from_ibuf);
+ scope = scopes->waveform_ibuf;
}
break;
case SEQ_DRAW_IMG_VECTORSCOPE:
- scope = make_vectorscope_view_from_ibuf(display_ibuf);
+ if (!scopes->vector_ibuf)
+ scopes->vector_ibuf = sequencer_make_scope(scene, ibuf, make_vectorscope_view_from_ibuf);
+ scope = scopes->vector_ibuf;
break;
case SEQ_DRAW_IMG_HISTOGRAM:
- scope = make_histogram_view_from_ibuf(display_ibuf);
+ if (!scopes->histogram_ibuf)
+ scopes->histogram_ibuf = sequencer_make_scope(scene, ibuf, make_histogram_view_from_ibuf);
+ scope = scopes->histogram_ibuf;
break;
}
- IMB_freeImBuf(display_ibuf);
+ scopes->reference_ibuf = ibuf;
}
if (scope) {
@@ -1049,7 +1106,8 @@
/* draw grease-pencil (image aligned) */
draw_gpencil_2dimage(C);
- IMB_freeImBuf(ibuf);
+ if (!scope)
+ IMB_freeImBuf(ibuf);
/* ortho at pixel level */
UI_view2d_view_restore(C);
Modified: branches/soc-2011-tomato/source/blender/editors/space_sequencer/space_sequencer.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_sequencer/space_sequencer.c 2012-09-05 11:42:57 UTC (rev 50414)
+++ branches/soc-2011-tomato/source/blender/editors/space_sequencer/space_sequencer.c 2012-09-05 11:43:05 UTC (rev 50415)
@@ -57,8 +57,19 @@
#include "UI_resources.h"
#include "UI_view2d.h"
+#include "IMB_imbuf.h"
+
#include "sequencer_intern.h" // own include
+/**************************** common state *****************************/
+
+static void sequencer_scopes_tag_refresh(ScrArea *sa)
+{
+ SpaceSeq *sseq = (SpaceSeq *)sa->spacedata.first;
+
+ sseq->scopes.reference_ibuf = NULL;
+}
+
/* ******************** manage regions ********************* */
ARegion *sequencer_has_buttons_region(ScrArea *sa)
@@ -183,12 +194,27 @@
}
/* not spacelink itself */
-static void sequencer_free(SpaceLink *UNUSED(sl))
+static void sequencer_free(SpaceLink *sl)
{
-// SpaceSeq *sseq= (SpaceSequencer*) sl;
-
+ SpaceSeq *sseq= (SpaceSeq *) sl;
+ SequencerScopes *scopes = &sseq->scopes;
+
// XXX if (sseq->gpd) BKE_gpencil_free(sseq->gpd);
+ if (scopes->zebra_ibuf)
+ IMB_freeImBuf(scopes->zebra_ibuf);
+
+ if (scopes->waveform_ibuf)
+ IMB_freeImBuf(scopes->waveform_ibuf);
+
+ if (scopes->sep_waveform_ibuf)
+ IMB_freeImBuf(scopes->sep_waveform_ibuf);
+
+ if (scopes->vector_ibuf)
+ IMB_freeImBuf(scopes->vector_ibuf);
+
+ if (scopes->histogram_ibuf)
+ IMB_freeImBuf(scopes->histogram_ibuf);
}
@@ -290,8 +316,25 @@
return (SpaceLink *)sseqn;
}
+static void sequencer_listener(ScrArea *sa, wmNotifier *wmn)
+{
+ /* context changes */
+ switch (wmn->category) {
+ case NC_SCENE:
+ switch (wmn->data) {
+ case ND_FRAME:
+ case ND_SEQUENCER:
+ sequencer_scopes_tag_refresh(sa);
+ break;
+ }
+ break;
+ case NC_SPACE:
+ if (wmn->data == ND_SPACE_SEQUENCER)
+ sequencer_scopes_tag_refresh(sa);
+ break;
+ }
+}
-
/* *********************** sequencer (main) region ************************ */
/* add handlers, stuff you only do once or on area/region changes */
static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar)
@@ -610,6 +653,7 @@
st->context = sequencer_context;
st->dropboxes = sequencer_dropboxes;
st->refresh = sequencer_refresh;
+ st->listener = sequencer_listener;
/* regions: main window */
art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
Modified: branches/soc-2011-tomato/source/blender/makesdna/DNA_movieclip_types.h
===================================================================
--- branches/soc-2011-tomato/source/blender/makesdna/DNA_movieclip_types.h 2012-09-05 11:42:57 UTC (rev 50414)
+++ branches/soc-2011-tomato/source/blender/makesdna/DNA_movieclip_types.h 2012-09-05 11:43:05 UTC (rev 50415)
@@ -38,6 +38,7 @@
#include "DNA_ID.h"
#include "DNA_tracking_types.h"
#include "DNA_color_types.h" /* for color management */
+#include "DNA_sequence_types.h"
struct anim;
struct AnimData;
Modified: branches/soc-2011-tomato/source/blender/makesdna/DNA_sequence_types.h
===================================================================
--- branches/soc-2011-tomato/source/blender/makesdna/DNA_sequence_types.h 2012-09-05 11:42:57 UTC (rev 50414)
+++ branches/soc-2011-tomato/source/blender/makesdna/DNA_sequence_types.h 2012-09-05 11:43:05 UTC (rev 50415)
@@ -275,6 +275,18 @@
float contrast;
} BrightContrastModifierData;
+/* ***************** Scopes ****************** */
+
+typedef struct SequencerScopes {
+ struct ImBuf *reference_ibuf;
+
+ struct ImBuf *zebra_ibuf;
+ struct ImBuf *waveform_ibuf;
+ struct ImBuf *sep_waveform_ibuf;
+ struct ImBuf *vector_ibuf;
+ struct ImBuf *histogram_ibuf;
+} SequencerScopes;
+
#define MAXSEQ 32
#define SELECT 1
Modified: branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h
===================================================================
--- branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h 2012-09-05 11:42:57 UTC (rev 50414)
+++ branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h 2012-09-05 11:43:05 UTC (rev 50415)
@@ -473,6 +473,8 @@
int overlay_type;
struct bGPdata *gpd; /* grease-pencil data */
+
+ struct SequencerScopes scopes; /* different scoped displayed in space */
} SpaceSeq;
Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c 2012-09-05 11:42:57 UTC (rev 50414)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c 2012-09-05 11:43:05 UTC (rev 50415)
@@ -386,6 +386,8 @@
Scene *scene = (Scene *) id;
IMB_colormanagement_validate_settings(&scene->display_settings, &scene->view_settings);
+
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
}
}
@@ -470,6 +472,15 @@
}
}
+static void rna_ColorManagement_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ ID *id = ptr->id.data;
+
+ if (GS(id->name) == ID_SCE) {
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+ }
+}
+
/* this function only exists because #curvemap_evaluateF uses a 'const' qualifier */
float rna_CurveMap_evaluateF(struct CurveMap *cuma, float value)
{
@@ -852,21 +863,21 @@
"rna_ColorManagedViewSettings_view_transform_set",
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list