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
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-06-07 20:36:19 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-06-07 20:36:19 +0400
commit64c45caff963c30cb9d4f6c0e94036ffa8363882 (patch)
tree404728f4b74c4fc9eb42a86ec096db569e593422 /source
parent8a500eea9a7414747eeb45d97b8581a507322db6 (diff)
Remove checks for valid frame from poll function in clip editor space
This results in some buttons not disabled when there's no currently displaying frame, but this saves lots of cache lookups and threading loks for every frame update.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/ED_clip.h2
-rw-r--r--source/blender/editors/space_clip/clip_editor.c33
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c54
3 files changed, 27 insertions, 62 deletions
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 6b1028525a7..1d42954a416 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -47,8 +47,6 @@ int ED_space_clip_poll(struct bContext *C);
int ED_space_clip_view_clip_poll(struct bContext *C);
int ED_space_clip_tracking_poll(struct bContext *C);
-int ED_space_clip_tracking_size_poll(struct bContext *C);
-int ED_space_clip_tracking_frame_poll(struct bContext *C);
int ED_space_clip_maskedit_poll(struct bContext *C);
int ED_space_clip_maskedit_mask_poll(bContext *C);
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index ab100b46f70..bcda1d59555 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -96,39 +96,6 @@ int ED_space_clip_tracking_poll(bContext *C)
return FALSE;
}
-int ED_space_clip_tracking_size_poll(bContext *C)
-{
- if (ED_space_clip_tracking_poll(C)) {
- MovieClip *clip = CTX_data_edit_movieclip(C);
-
- if (clip) {
- SpaceClip *sc = CTX_wm_space_clip(C);
- int width, height;
-
- BKE_movieclip_get_size(clip, &sc->user, &width, &height);
-
- return width > 0 && height > 0;
- }
- }
-
- return FALSE;
-}
-
-int ED_space_clip_tracking_frame_poll(bContext *C)
-{
- if (ED_space_clip_tracking_poll(C)) {
- MovieClip *clip = CTX_data_edit_movieclip(C);
-
- if (clip) {
- SpaceClip *sc = CTX_wm_space_clip(C);
-
- return BKE_movieclip_has_frame(clip, &sc->user);
- }
- }
-
- return FALSE;
-}
-
int ED_space_clip_maskedit_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 7073fdb3542..fdd4dfc57d0 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -107,6 +107,7 @@ static int add_marker_exec(bContext *C, wmOperator *op)
int width, height;
ED_space_clip_size(sc, &width, &height);
+
if (!width || !height)
return OPERATOR_CANCELLED;
@@ -144,7 +145,7 @@ void CLIP_OT_add_marker(wmOperatorType *ot)
/* api callbacks */
ot->invoke = add_marker_invoke;
ot->exec = add_marker_exec;
- ot->poll = ED_space_clip_tracking_size_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -638,7 +639,7 @@ void CLIP_OT_slide_marker(wmOperatorType *ot)
ot->idname = "CLIP_OT_slide_marker";
/* api callbacks */
- ot->poll = ED_space_clip_tracking_size_poll;
+ ot->poll = ED_space_clip_tracking_poll;
ot->invoke = slide_marker_invoke;
ot->modal = slide_marker_modal;
@@ -1308,7 +1309,7 @@ void CLIP_OT_select_grouped(wmOperatorType *ot)
/* api callbacks */
ot->exec = select_groped_exec;
- ot->poll = ED_space_clip_tracking_size_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1693,7 +1694,7 @@ void CLIP_OT_track_markers(wmOperatorType *ot)
/* api callbacks */
ot->exec = track_markers_exec;
ot->invoke = track_markers_invoke;
- ot->poll = ED_space_clip_tracking_frame_poll;
+ ot->poll = ED_space_clip_tracking_poll;
ot->modal = track_markers_modal;
/* flags */
@@ -2134,19 +2135,17 @@ static Object *get_orientation_object(bContext *C)
static int set_orientation_poll(bContext *C)
{
- if (ED_space_clip_tracking_size_poll(C)) {
- Scene *scene = CTX_data_scene(C);
- SpaceClip *sc = CTX_wm_space_clip(C);
- MovieClip *clip = ED_space_clip(sc);
- MovieTracking *tracking = &clip->tracking;
- MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
+ Scene *scene = CTX_data_scene(C);
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ MovieClip *clip = ED_space_clip(sc);
+ MovieTracking *tracking = &clip->tracking;
+ MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
- if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
- return TRUE;
- }
- else {
- return OBACT != NULL;
- }
+ if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
+ return TRUE;
+ }
+ else {
+ return OBACT != NULL;
}
return FALSE;
@@ -2744,16 +2743,12 @@ void CLIP_OT_set_scale(wmOperatorType *ot)
static int set_solution_scale_poll(bContext *C)
{
- if (ED_space_clip_tracking_size_poll(C)) {
- SpaceClip *sc = CTX_wm_space_clip(C);
- MovieClip *clip = ED_space_clip(sc);
- MovieTracking *tracking = &clip->tracking;
- MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
-
- return (tracking_object->flag & TRACKING_OBJECT_CAMERA) == 0;
- }
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ MovieClip *clip = ED_space_clip(sc);
+ MovieTracking *tracking = &clip->tracking;
+ MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
- return 0;
+ return (tracking_object->flag & TRACKING_OBJECT_CAMERA) == 0;
}
static int set_solution_scale_exec(bContext *C, wmOperator *op)
@@ -2963,6 +2958,11 @@ static int detect_features_exec(bContext *C, wmOperator *op)
int framenr = ED_space_clip_clip_framenr(sc);
bGPDlayer *layer = NULL;
+ if (!ibuf) {
+ BKE_report(op->reports, RPT_ERROR, "Feature detection requires valid clip frame");
+ return OPERATOR_CANCELLED;
+ }
+
if (placement != 0) {
layer = detect_get_layer(clip);
place_outside_layer = placement == 2;
@@ -3003,7 +3003,7 @@ void CLIP_OT_detect_features(wmOperatorType *ot)
/* api callbacks */
ot->exec = detect_features_exec;
- ot->poll = ED_space_clip_tracking_frame_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3156,7 +3156,7 @@ void CLIP_OT_join_tracks(wmOperatorType *ot)
/* api callbacks */
ot->exec = join_tracks_exec;
- ot->poll = ED_space_clip_tracking_size_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;