Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2014-12-08 22:27:39 +0300
committerAntony Riakiotakis <kalast@gmail.com>2014-12-09 23:01:51 +0300
commitef8a3d65f1e6e0e40849e966bb54503ca38eb3e2 (patch)
treebc1fd48a933b42e6243c0c4c2f28d13050758466 /source/blender/editors/space_sequencer/sequencer_view.c
parent04671df15ff406a7c7ccc0aa303f6f268dbb949a (diff)
Big refactor commit.
* Minor cleanup - propname does not need to be stored anymore. * Code to support modal widgetmap registration for operators - still untested, but will be tested soon on sequencer cage widget * Widgets take parameters to initialize property slots that are used for feedback or control. Cage now uses this to feed offset/scale to different properties. * Initialize common properties during widget registration.
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_view.c')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_view.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index 4dc4d1daeea..261e261c347 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -55,6 +55,8 @@
#include "UI_view2d.h"
+#include "RNA_define.h"
+
/* own include */
#include "sequencer_intern.h"
@@ -240,28 +242,36 @@ void SEQUENCER_OT_sample(wmOperatorType *ot)
ot->flag = OPTYPE_BLOCKING;
}
-int sequencer_backdrop_transform_poll(bContext *C)
+static int sequencer_backdrop_transform_poll(bContext *C)
{
SpaceSeq *sseq = CTX_wm_space_seq(C);
+ ARegion *ar = CTX_wm_region(C);
- return (sseq && (sseq->draw_flag & SEQ_DRAW_BACKDROP));
+ return (sseq && ar && ar->type == RGN_TYPE_WINDOW && (sseq->draw_flag & SEQ_DRAW_BACKDROP));
}
-void widgetgroup_backdrop_draw(const struct bContext *C, struct wmWidgetGroup *wgroup)
+static void widgetgroup_backdrop_draw(const struct bContext *C, struct wmWidgetGroup *wgroup)
{
- wmRectTransformWidget *cage = WIDGET_rect_transform_new(wgroup, WIDGET_RECT_TRANSFORM_STYLE_SCALE_UNIFORM | WIDGET_RECT_TRANSFORM_STYLE_TRANSLATE, NULL);
+ wmOperator *op = wgroup->type->op;
+ ImBuf *ibuf;
+ Scene *scene = CTX_data_scene(C);
+ ibuf = sequencer_ibuf_get(CTX_data_main(C), scene, CTX_wm_space_seq(C), scene->r.cfra, 0);
+
+ if (ibuf) {
+ wmWidget *cage = WIDGET_rect_transform_new(wgroup, WIDGET_RECT_TRANSFORM_STYLE_SCALE_UNIFORM |
+ WIDGET_RECT_TRANSFORM_STYLE_TRANSLATE, ibuf->x, ibuf->y);
+ WM_widget_property(cage, RECT_TRANSFORM_SLOT_OFFSET, op->ptr, "offset");
+ }
}
-
static int sequencer_backdrop_transform_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
/* no poll, lives always for the duration of the operator */
wmWidgetGroupType *cagetype = WM_widgetgrouptype_new(NULL, widgetgroup_backdrop_draw, SPACE_SEQ, RGN_TYPE_WINDOW, false);
- op->customdata = cagetype;
- WM_widgetgrouptype_register(CTX_data_main(C), cagetype);
WM_event_add_modal_handler(C, op);
+ WM_event_add_widget_modal_handler(C, cagetype, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -271,10 +281,12 @@ static int sequencer_backdrop_transform_modal(bContext *C, wmOperator *op, const
case EVT_WIDGET_UPDATE:
break;
- case RETKEY:
- WM_widgetgrouptype_unregister(CTX_data_main(C), op->customdata);
- break;
+ case LEFTMOUSE:
+ if (event->val == KM_DBL_CLICK)
+ return OPERATOR_FINISHED;
+ case RETKEY:
+ return OPERATOR_FINISHED;
}
return OPERATOR_RUNNING_MODAL;
@@ -293,6 +305,6 @@ void SEQUENCER_OT_backdrop_transform(struct wmOperatorType *ot)
ot->poll = sequencer_backdrop_transform_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}