diff options
author | Joshua Leung <aligorith@gmail.com> | 2012-06-11 04:21:50 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2012-06-11 04:21:50 +0400 |
commit | 0df68aacb10a7f947673d925e09a539ee8c4bb9c (patch) | |
tree | c19679d63689445aa770bdfc2b421a71229235e2 /source/blender/editors/space_sequencer | |
parent | f305261f14254656c888438205887769ad45b8bd (diff) |
Grease Pencil - Support for Grease Pencil in the Sequence Editor preview/image
space works again
This commit restores the support for using Grease Pencil in the Sequence Editor
image preview region, making it possible to scribble on footage for review
purposes again. Due to internal changes in how the Sequencer handles the image
drawing for this stuff (i.e. it is now fully based on View2D instead of trying
to implement its own little crazy offset+zoom stuff), a lot of the old code for
handling those offsets is no longer needed. Instead, one of the "standard" cases
is now used, and works quite well.
Bugfixes:
* View-space Grease Pencil drawing was done in wrong place (before view2d
restore)
* Grease Pencil entry in RNA had wrong/missing type
Credits:
* DingTo - initial patch/attempt at restoring support
* Aligorith - solved the "offset problems"
Diffstat (limited to 'source/blender/editors/space_sequencer')
4 files changed, 36 insertions, 9 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c index aeedafa9992..1e452f2052d 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.c +++ b/source/blender/editors/space_sequencer/sequencer_buttons.c @@ -25,8 +25,6 @@ * \ingroup spseq */ - - #include <string.h> #include <stdio.h> @@ -36,10 +34,13 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "BKE_context.h" #include "BKE_screen.h" #include "ED_screen.h" +#include "ED_gpencil.h" #include "WM_api.h" #include "WM_types.h" @@ -48,6 +49,19 @@ #include "sequencer_intern.h" +/* **************************** buttons ********************************* */ + +void sequencer_buttons_register(ARegionType *art) +{ + PanelType *pt; + + pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil"); + strcpy(pt->idname, "SEQUENCER_PT_gpencil"); + strcpy(pt->label, N_("Grease Pencil")); + pt->draw= gpencil_panel_standard; + BLI_addtail(&art->paneltypes, pt); +} + /* **************** operator to open/close properties view ************* */ static int sequencer_properties(bContext *C, wmOperator *UNUSED(op)) diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index b674943b2dc..3119c2d44f8 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -58,6 +58,7 @@ #include "BIF_glutil.h" #include "ED_anim_api.h" +#include "ED_gpencil.h" #include "ED_markers.h" #include "ED_mask.h" #include "ED_types.h" @@ -976,16 +977,16 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq /* draw grease-pencil (image aligned) */ // if (sseq->flag & SEQ_DRAW_GPENCIL) -// XXX draw_gpencil_2dimage(sa, ibuf); + draw_gpencil_2dimage(C); IMB_freeImBuf(ibuf); - /* draw grease-pencil (screen aligned) */ -// if (sseq->flag & SEQ_DRAW_GPENCIL) -// XXX draw_gpencil_view2d(sa, 0); - /* ortho at pixel level */ UI_view2d_view_restore(C); + + /* draw grease-pencil (screen aligned) */ +// if (sseq->flag & SEQ_DRAW_GPENCIL) + draw_gpencil_view2d(C, 0); //if (sc->mode == SC_MODE_MASKEDIT) { if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) { diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 25a322c6905..14d2ccdbbbe 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -174,7 +174,7 @@ struct ImBuf *make_zebra_view_from_ibuf(struct ImBuf * ibuf, float perc); struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf); /* sequencer_buttons.c */ - +void sequencer_buttons_register(struct ARegionType *art); void SEQUENCER_OT_properties(struct wmOperatorType *ot); #endif /* __SEQUENCER_INTERN_H__ */ diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 3643f92d334..dbfc554007a 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -485,6 +485,11 @@ static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { + case NC_SCREEN: + if (wmn->data == ND_GPENCIL) { + ED_region_tag_redraw(ar); + } + break; case NC_SCENE: switch (wmn->data) { case ND_FRAME: @@ -534,6 +539,11 @@ static void sequencer_buttons_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ switch (wmn->category) { + case NC_SCREEN: + if (wmn->data == ND_GPENCIL) { + ED_region_tag_redraw(ar); + } + break; case NC_SCENE: switch (wmn->data) { case ND_FRAME: @@ -590,7 +600,7 @@ void ED_spacetype_sequencer(void) art->init = sequencer_preview_area_init; art->draw = sequencer_preview_area_draw; art->listener = sequencer_preview_area_listener; - art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION; + art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL; BLI_addhead(&st->regiontypes, art); /* regions: listview/buttons */ @@ -602,6 +612,8 @@ void ED_spacetype_sequencer(void) art->init = sequencer_buttons_area_init; art->draw = sequencer_buttons_area_draw; BLI_addhead(&st->regiontypes, art); + + sequencer_buttons_register(art); /* regions: header */ art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); |