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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-04-04 13:50:38 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-04-04 13:50:38 +0400
commit845aea6864cf4b3aa34d7676f725ab268465e34f (patch)
treec8c9c04cc8b4d5053e41ce438ae4cf9723a153b0 /source/blender/editors/space_clip/clip_ops.c
parentef1af9f9c41a9cb33550bcaf396023ff840a3dab (diff)
Clip editor prefetch changes
Made it an operator instead of automatic prefetching. Filling the whole memory with frames is not always desired behavior. Now prefetching is available via P-key, or from Clip panel in toolbox or from Clip menu. Also enabled prefetching for non-proxied movies.
Diffstat (limited to 'source/blender/editors/space_clip/clip_ops.c')
-rw-r--r--source/blender/editors/space_clip/clip_ops.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 8e03691e64f..ab00c078226 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -1378,6 +1378,47 @@ void CLIP_OT_view_ndof(wmOperatorType *ot)
ot->invoke = clip_view_ndof_invoke;
}
+/********************** Prefetch operator *********************/
+
+static int clip_prefetch_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
+{
+ /* no running blender, remove handler and pass through */
+ if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_CLIP_PREFETCH))
+ return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
+
+ /* running render */
+ switch (event->type) {
+ case ESCKEY:
+ return OPERATOR_RUNNING_MODAL;
+ break;
+ }
+
+ return OPERATOR_PASS_THROUGH;
+}
+
+static int clip_prefetch_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(_event))
+{
+ clip_start_prefetch_job(C);
+
+ /* add modal handler for ESC */
+ WM_event_add_modal_handler(C, op);
+
+ return OPERATOR_RUNNING_MODAL;
+}
+
+void CLIP_OT_prefetch(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Prefetch Frames";
+ ot->idname = "CLIP_OT_prefetch";
+ ot->description = "Prefetch frames from disk for faster playback/tracking";
+
+ /* api callbacks */
+ ot->poll = ED_space_clip_view_clip_poll;
+ ot->invoke = clip_prefetch_invoke;
+ ot->modal = clip_prefetch_modal;
+}
+
/********************** macroses *********************/
void ED_operatormacros_clip(void)