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>2012-04-28 14:09:58 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-04-28 14:09:58 +0400
commita434572654d95b2910324f3c6125580f4ee28afe (patch)
treefca1e17899feedc1e51a49f66f9c0c27461d64ff /source/blender/editors/space_clip
parent54911f52d87be169bf62ffc8088c81d3b7580681 (diff)
Camera tracking: if there's no image for current frame display default grid
and allow to interact with tracks for operators which doesn't require image. Merged from tomato branch: svn merge ^/branches/soc-2011-tomato -r45624:45625
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r--source/blender/editors/space_clip/clip_draw.c5
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c33
2 files changed, 31 insertions, 7 deletions
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index bf8976035a8..2f9956fc143 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1380,7 +1380,12 @@ void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene)
if (ibuf) {
draw_movieclip_buffer(sc, ar, ibuf, width, height, zoomx, zoomy);
IMB_freeImBuf(ibuf);
+ }
+ else {
+ ED_region_grid_draw(ar, zoomx, zoomy);
+ }
+ if (width && height) {
draw_tracking_tracks(sc, ar, clip, width, height, zoomx, zoomy);
draw_distortion(sc, ar, clip, width, height, zoomx, zoomy);
}
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 2b1b311b89d..f4454394ca3 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -92,6 +92,25 @@ static int space_clip_frame_poll(bContext *C)
return FALSE;
}
+static int space_clip_size_poll(bContext *C)
+{
+ SpaceClip *sc = CTX_wm_space_clip(C);
+
+ if (sc) {
+ MovieClip *clip = ED_space_clip(sc);
+
+ if (clip) {
+ int width, height;
+
+ BKE_movieclip_get_size(clip, &sc->user, &width, &height);
+
+ return width > 0 && height > 0;
+ }
+ }
+
+ return FALSE;
+}
+
/********************** add marker operator *********************/
static void add_marker(SpaceClip *sc, float x, float y)
@@ -156,7 +175,7 @@ void CLIP_OT_add_marker(wmOperatorType *ot)
/* api callbacks */
ot->invoke = add_marker_invoke;
ot->exec = add_marker_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = space_clip_size_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -643,7 +662,7 @@ void CLIP_OT_slide_marker(wmOperatorType *ot)
ot->idname = "CLIP_OT_slide_marker";
/* api callbacks */
- ot->poll = space_clip_frame_poll;
+ ot->poll = space_clip_size_poll;
ot->invoke = slide_marker_invoke;
ot->modal = slide_marker_modal;
@@ -1200,7 +1219,7 @@ void CLIP_OT_select_grouped(wmOperatorType *ot)
/* api callbacks */
ot->exec = select_groped_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = space_clip_size_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2016,7 +2035,7 @@ static Object *get_orientation_object(bContext *C)
static int set_orientation_poll(bContext *C)
{
- if (space_clip_frame_poll(C)) {
+ if (space_clip_size_poll(C)) {
Scene *scene = CTX_data_scene(C);
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
@@ -2626,7 +2645,7 @@ void CLIP_OT_set_scale(wmOperatorType *ot)
static int set_solution_scale_poll(bContext *C)
{
- if (space_clip_frame_poll(C)) {
+ if (space_clip_size_poll(C)) {
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
MovieTracking *tracking = &clip->tracking;
@@ -2974,7 +2993,7 @@ void CLIP_OT_frame_jump(wmOperatorType *ot)
/* api callbacks */
ot->exec = frame_jump_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3031,7 +3050,7 @@ void CLIP_OT_join_tracks(wmOperatorType *ot)
/* api callbacks */
ot->exec = join_tracks_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = space_clip_size_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;