diff options
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r-- | source/blender/editors/space_clip/clip_draw.c | 28 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_graph_ops.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_ops.c | 21 | ||||
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 4 |
5 files changed, 35 insertions, 38 deletions
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 9c31b909a95..cf7032cbe2d 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -1592,21 +1592,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, } } - if (sc->gpencil_src == SC_GPENCIL_SRC_TRACK) { - MovieTrackingTrack *track = BKE_tracking_track_get_active(&sc->clip->tracking); - - if (track) { - int framenr = ED_space_clip_get_clip_frame_number(sc); - MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr); - - offsx = marker->pos[0]; - offsy = marker->pos[1]; - - gpd = track->gpd; - } - - } - else { + if (sc->gpencil_src != SC_GPENCIL_SRC_TRACK) { gpd = clip->gpd; } @@ -1725,7 +1711,7 @@ void clip_draw_main(const bContext *C, SpaceClip *sc, ARegion *ar) smat[1][1] = 1.0f / height; invert_m4_m4(ismat, smat); - mul_serie_m4(sc->unistabmat, smat, sc->stabmat, ismat, NULL, NULL, NULL, NULL, NULL); + mul_m4_series(sc->unistabmat, smat, sc->stabmat, ismat); } } else if ((sc->flag & SC_MUTE_FOOTAGE) == 0) { @@ -1775,13 +1761,15 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d) return; if (onlyv2d) { - /* if manual calibration is used then grease pencil data is already - * drawn in draw_distortion */ - if ((sc->flag & SC_MANUAL_CALIBRATION) == 0) { + bool is_track_source = sc->gpencil_src == SC_GPENCIL_SRC_TRACK; + /* if manual calibration is used then grease pencil data + * associated with the clip is already drawn in draw_distortion + */ + if ((sc->flag & SC_MANUAL_CALIBRATION) == 0 || is_track_source) { glPushMatrix(); glMultMatrixf(sc->unistabmat); - if (sc->gpencil_src == SC_GPENCIL_SRC_TRACK) { + if (is_track_source) { MovieTrackingTrack *track = BKE_tracking_track_get_active(&sc->clip->tracking); if (track) { diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index 95f59e79c08..d1e2c770ade 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -104,7 +104,7 @@ typedef struct { int coord; /* coordinate index of found entuty (0 = X-axis, 1 = Y-axis) */ bool has_prev; /* if there's valid coordinate of previous point of curve segment */ - float min_dist, /* minimal distance between mouse and currently found entuty */ + float min_dist_sq, /* minimal distance between mouse and currently found entity */ mouse_co[2], /* mouse coordinate */ prev_co[2], /* coordinate of previeous point of segment */ min_co[2]; /* coordinate of entity with minimal distance */ @@ -121,11 +121,11 @@ static void find_nearest_tracking_segment_cb(void *userdata, MovieTrackingTrack float co[2] = {scene_framenr, val}; if (data->has_prev) { - float d = dist_to_line_segment_v2(data->mouse_co, data->prev_co, co); + float dist_sq = dist_squared_to_line_segment_v2(data->mouse_co, data->prev_co, co); - if (data->track == NULL || d < data->min_dist) { + if (data->track == NULL || dist_sq < data->min_dist_sq) { data->track = track; - data->min_dist = d; + data->min_dist_sq = dist_sq; data->coord = coord; copy_v2_v2(data->min_co, co); } @@ -146,15 +146,15 @@ static void find_nearest_tracking_knot_cb(void *userdata, MovieTrackingTrack *tr MovieTrackingMarker *marker, int coord, int scene_framenr, float val) { MouseSelectUserData *data = userdata; - float dx = scene_framenr - data->mouse_co[0], dy = val - data->mouse_co[1]; - float d = dx * dx + dy * dy; + float mdiff[2] = {scene_framenr - data->mouse_co[0], val - data->mouse_co[1]}; + float dist_sq = len_squared_v2(mdiff); - if (data->marker == NULL || d < data->min_dist) { + if (data->marker == NULL || dist_sq < data->min_dist_sq) { float co[2] = {scene_framenr, val}; data->track = track; data->marker = marker; - data->min_dist = d; + data->min_dist_sq = dist_sq; data->coord = coord; copy_v2_v2(data->min_co, co); } @@ -164,7 +164,7 @@ static void find_nearest_tracking_knot_cb(void *userdata, MovieTrackingTrack *tr static void mouse_select_init_data(MouseSelectUserData *userdata, const float co[2]) { memset(userdata, 0, sizeof(MouseSelectUserData)); - userdata->min_dist = FLT_MAX; + userdata->min_dist_sq = FLT_MAX; copy_v2_v2(userdata->mouse_co, co); } diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index c0434def3d5..87efaa615ee 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -591,6 +591,8 @@ static void view_zoom_cancel(bContext *C, wmOperator *op) void CLIP_OT_view_zoom(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "View Zoom"; ot->idname = "CLIP_OT_view_zoom"; @@ -607,8 +609,9 @@ void CLIP_OT_view_zoom(wmOperatorType *ot) ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER; /* properties */ - RNA_def_float(ot->srna, "factor", 0.0f, -FLT_MAX, FLT_MAX, - "Factor", "Zoom factor, values higher than 1.0 zoom in, lower values zoom out", -FLT_MAX, FLT_MAX); + prop = RNA_def_float(ot->srna, "factor", 0.0f, -FLT_MAX, FLT_MAX, "Factor", + "Zoom factor, values higher than 1.0 zoom in, lower values zoom out", -FLT_MAX, FLT_MAX); + RNA_def_property_flag(prop, PROP_HIDDEN); } /********************** view zoom in/out operator *********************/ @@ -641,6 +644,8 @@ static int view_zoom_in_invoke(bContext *C, wmOperator *op, const wmEvent *event void CLIP_OT_view_zoom_in(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "View Zoom In"; ot->idname = "CLIP_OT_view_zoom_in"; @@ -652,8 +657,9 @@ void CLIP_OT_view_zoom_in(wmOperatorType *ot) 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); + prop = RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", + "Cursor location in screen coordinates", -10.0f, 10.0f); + RNA_def_property_flag(prop, PROP_HIDDEN); } static int view_zoom_out_exec(bContext *C, wmOperator *op) @@ -684,6 +690,8 @@ static int view_zoom_out_invoke(bContext *C, wmOperator *op, const wmEvent *even void CLIP_OT_view_zoom_out(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "View Zoom Out"; ot->idname = "CLIP_OT_view_zoom_out"; @@ -695,8 +703,9 @@ void CLIP_OT_view_zoom_out(wmOperatorType *ot) 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 normalized (0.0-1.0) coordinates", -10.0f, 10.0f); + prop = RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", + "Cursor location in normalized (0.0-1.0) coordinates", -10.0f, 10.0f); + RNA_def_property_flag(prop, PROP_HIDDEN); } /********************** view zoom ratio operator *********************/ diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index d3be25050c8..a6fbb0c399d 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -846,7 +846,7 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul static int clip_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_PATH) - if (ELEM4(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */ + if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */ return true; return false; diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index ce14471f608..abbffcd8546 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -2277,7 +2277,7 @@ static void set_axis(Scene *scene, Object *ob, MovieClip *clip, MovieTrackingOb copy_v3_v3(lmat[3], obmat[3]); invert_m4_m4(ilmat, lmat); - mul_serie_m4(mat, lmat, mat, ilmat, obmat, NULL, NULL, NULL, NULL); + mul_m4_series(mat, lmat, mat, ilmat, obmat); } else { mul_m4_m4m4(mat, obmat, mat); @@ -2996,7 +2996,7 @@ void CLIP_OT_detect_features(wmOperatorType *ot) /* properties */ RNA_def_enum(ot->srna, "placement", placement_items, 0, "Placement", "Placement for detected features"); RNA_def_int(ot->srna, "margin", 16, 0, INT_MAX, "Margin", "Only features further than margin pixels from the image edges are considered", 0, 300); - RNA_def_float(ot->srna, "threshold", 1.0f, 0.0001f, FLT_MAX, "Threshold", "Threshold level to consider feature good enough for tracking", 0.0001f, FLT_MAX); + RNA_def_float(ot->srna, "threshold", 0.5f, 0.0001f, FLT_MAX, "Threshold", "Threshold level to consider feature good enough for tracking", 0.0001f, FLT_MAX); RNA_def_int(ot->srna, "min_distance", 120, 0, INT_MAX, "Distance", "Minimal distance accepted between two features", 0, 300); } |