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:
Diffstat (limited to 'source/blender/editors/space_clip/clip_ops.c')
-rw-r--r--source/blender/editors/space_clip/clip_ops.c56
1 files changed, 32 insertions, 24 deletions
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index c7033b0db99..b05d204b07b 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -147,6 +147,7 @@ static int open_cancel(bContext *UNUSED(C), wmOperator *op)
static int open_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
+ bScreen *screen = CTX_wm_screen(C);
PropertyPointerRNA *pprop;
PointerRNA idptr;
MovieClip *clip = NULL;
@@ -184,7 +185,7 @@ static int open_exec(bContext *C, wmOperator *op)
RNA_property_update(C, &pprop->ptr, pprop->prop);
}
else if (sc) {
- ED_space_clip_set(C, sc, clip);
+ ED_space_clip_set(C, screen, sc, clip);
}
WM_event_add_notifier(C, NC_MOVIECLIP|NA_ADDED, clip);
@@ -286,14 +287,14 @@ static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event)
vpd->y = event->y;
if (sc->flag & SC_LOCK_SELECTION)
- vpd->vec= &sc->xlockof;
+ vpd->vec = &sc->xlockof;
else
- vpd->vec= &sc->xof;
+ vpd->vec = &sc->xof;
copy_v2_v2(&vpd->xof, vpd->vec);
copy_v2_v2(&vpd->xorig, &vpd->xof);
- vpd->event_type= event->type;
+ vpd->event_type = event->type;
WM_event_add_modal_handler(C, op);
}
@@ -401,13 +402,14 @@ void CLIP_OT_view_pan(wmOperatorType *ot)
/* identifiers */
ot->name = "View Pan";
ot->idname = "CLIP_OT_view_pan";
+ ot->description = "Pan the view";
/* api callbacks */
ot->exec = view_pan_exec;
ot->invoke = view_pan_invoke;
ot->modal = view_pan_modal;
ot->cancel = view_pan_cancel;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_view_clip_poll;
/* flags */
ot->flag = OPTYPE_BLOCKING;
@@ -431,7 +433,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
SpaceClip *sc = CTX_wm_space_clip(C);
ViewZoomData *vpd;
- op->customdata= vpd= MEM_callocN(sizeof(ViewZoomData), "ClipViewZoomData");
+ op->customdata = vpd = MEM_callocN(sizeof(ViewZoomData), "ClipViewZoomData");
WM_cursor_modal(CTX_wm_window(C), BC_NSEW_SCROLLCURSOR);
vpd->x = event->x;
@@ -527,13 +529,14 @@ void CLIP_OT_view_zoom(wmOperatorType *ot)
/* identifiers */
ot->name = "View Zoom";
ot->idname = "CLIP_OT_view_zoom";
+ ot->description = "Zoom on/out the view";
/* api callbacks */
ot->exec = view_zoom_exec;
ot->invoke = view_zoom_invoke;
ot->modal = view_zoom_modal;
ot->cancel = view_zoom_cancel;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_view_clip_poll;
/* flags */
ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
@@ -575,11 +578,12 @@ void CLIP_OT_view_zoom_in(wmOperatorType *ot)
/* identifiers */
ot->name = "View Zoom In";
ot->idname = "CLIP_OT_view_zoom_in";
+ ot->description = "Zoom in the view";
/* api callbacks */
ot->exec = view_zoom_in_exec;
ot->invoke = view_zoom_in_invoke;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_view_clip_poll;
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
@@ -615,11 +619,12 @@ void CLIP_OT_view_zoom_out(wmOperatorType *ot)
/* identifiers */
ot->name = "View Zoom Out";
ot->idname = "CLIP_OT_view_zoom_out";
+ ot->description = "Zoom out the view";
/* api callbacks */
ot->exec = view_zoom_out_exec;
ot->invoke = view_zoom_out_invoke;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_view_clip_poll;
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f);
@@ -635,8 +640,8 @@ static int view_zoom_ratio_exec(bContext *C, wmOperator *op)
sclip_zoom_set(sc, ar, RNA_float_get(op->ptr, "ratio"), NULL);
/* ensure pixel exact locations for draw */
- sc->xof= (int) sc->xof;
- sc->yof= (int) sc->yof;
+ sc->xof = (int) sc->xof;
+ sc->yof = (int) sc->yof;
ED_region_tag_redraw(CTX_wm_region(C));
@@ -648,10 +653,11 @@ void CLIP_OT_view_zoom_ratio(wmOperatorType *ot)
/* identifiers */
ot->name = "View Zoom Ratio";
ot->idname = "CLIP_OT_view_zoom_ratio";
+ ot->description = "Set the zoom ratio (based on clip size)";
/* api callbacks */
ot->exec = view_zoom_ratio_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_view_clip_poll;
/* properties */
RNA_def_float(ot->srna, "ratio", 0.0f, 0.0f, FLT_MAX,
@@ -666,7 +672,7 @@ static int view_all_exec(bContext *C, wmOperator *op)
ARegion *ar;
int w, h, width, height;
float aspx, aspy;
- int fit_view= RNA_boolean_get(op->ptr, "fit_view");
+ int fit_view = RNA_boolean_get(op->ptr, "fit_view");
float zoomx, zoomy;
/* retrieve state */
@@ -679,25 +685,25 @@ static int view_all_exec(bContext *C, wmOperator *op)
w = w * aspx;
h = h * aspy;
- /* check if the image will fit in the image with zoom==1 */
+ /* check if the image will fit in the image with zoom == 1 */
width = ar->winrct.xmax - ar->winrct.xmin + 1;
height = ar->winrct.ymax - ar->winrct.ymin + 1;
if (fit_view) {
const int margin = 5; /* margin from border */
- zoomx= (float) width / (w + 2 * margin);
- zoomy= (float) height / (h + 2 * margin);
+ zoomx = (float) width / (w + 2 * margin);
+ zoomy = (float) height / (h + 2 * margin);
sclip_zoom_set(sc, ar, MIN2(zoomx, zoomy), NULL);
}
else {
if ((w >= width || h >= height) && (width > 0 && height > 0)) {
- zoomx= (float) width / w;
- zoomy= (float) height / h;
+ zoomx = (float) width / w;
+ zoomy = (float) height / h;
/* find the zoom value that will fit the image in the image space */
- sclip_zoom_set(sc, ar, 1.0f/power_of_2(1/MIN2(zoomx, zoomy)), NULL);
+ sclip_zoom_set(sc, ar, 1.0f / power_of_2(1.0f / MIN2(zoomx, zoomy)), NULL);
}
else
sclip_zoom_set(sc, ar, 1.0f, NULL);
@@ -715,10 +721,11 @@ void CLIP_OT_view_all(wmOperatorType *ot)
/* identifiers */
ot->name = "View All";
ot->idname = "CLIP_OT_view_all";
+ ot->description = "View whole image with markers";
/* api callbacks */
ot->exec = view_all_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_view_clip_poll;
/* properties */
RNA_def_boolean(ot->srna, "fit_view", 0, "Fit View", "Fit frame to the viewport");
@@ -745,10 +752,11 @@ void CLIP_OT_view_selected(wmOperatorType *ot)
/* identifiers */
ot->name = "View Selected";
ot->idname = "CLIP_OT_view_selected";
+ ot->description = "View all selected elements";
/* api callbacks */
ot->exec = view_selected_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_view_clip_poll;
}
/********************** change frame operator *********************/
@@ -799,7 +807,7 @@ static int frame_from_event(bContext *C, wmEvent *event)
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
- framenr= (int) floor(viewx + 0.5f);
+ framenr = (int) floor(viewx + 0.5f);
}
return framenr;
@@ -877,7 +885,7 @@ typedef struct ProxyBuildJob {
static void proxy_freejob(void *pjv)
{
- ProxyJob *pj= pjv;
+ ProxyJob *pj = pjv;
MEM_freeN(pj);
}
@@ -956,7 +964,7 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog
break;
*do_update = TRUE;
- *progress= ((float) cfra) / (efra - sfra);
+ *progress = ((float) cfra) / (efra - sfra);
}
if (distortion)