diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-05-07 12:53:59 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-05-07 12:53:59 +0400 |
commit | c79892c5cdb74fdb6fb2534055877e5965d07850 (patch) | |
tree | a8dcd588e3fbe9702c074d7a741d5386acdb3d80 /source/blender/editors/space_clip | |
parent | 3ef11693f56429239771f8c043bf2fe2838a5fc7 (diff) |
Style cleanup of own modules using style checker from Campbell.
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r-- | source/blender/editors/space_clip/clip_buttons.c | 35 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_dopesheet_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_dopesheet_ops.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_draw.c | 101 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_editor.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_graph_draw.c | 9 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_graph_ops.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_ops.c | 53 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_toolbar.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_utils.c | 13 | ||||
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 62 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 321 |
12 files changed, 331 insertions, 302 deletions
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index 5761a285d72..18f191a46a6 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -165,9 +165,10 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname) block = uiLayoutAbsoluteBlock(layout); - scopes->track_preview_height = (scopes->track_preview_height<=UI_UNIT_Y)?UI_UNIT_Y:scopes->track_preview_height; + scopes->track_preview_height = (scopes->track_preview_height <= UI_UNIT_Y)?UI_UNIT_Y : scopes->track_preview_height; - uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, scopes->track_preview_height, scopes, 0, 0, 0, 0, ""); + uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, rect.xmax - rect.xmin, + scopes->track_preview_height, scopes, 0, 0, 0, 0, ""); } /********************* Marker Template ************************/ @@ -213,7 +214,7 @@ static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) marker->flag = cb->marker_flag; - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL); } static void marker_block_handler(bContext *C, void *arg_cb, int event) @@ -227,12 +228,12 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event) marker = BKE_tracking_ensure_marker(cb->track, cb->framenr); if (event == B_MARKER_POS) { - marker->pos[0] = cb->marker_pos[0]/width; - marker->pos[1] = cb->marker_pos[1]/height; + marker->pos[0] = cb->marker_pos[0] / width; + marker->pos[1] = cb->marker_pos[1] / height; /* to update position of "parented" objects */ DAG_id_tag_update(&cb->clip->id, 0); - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL); ok = TRUE; } @@ -278,17 +279,17 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event) sub_v2_v2v2(search_dim, cb->track->search_max, cb->track->search_min); - dim[0] = cb->track_search[0]/width; - dim[1] = cb->track_search[1]/height; + dim[0] = cb->track_search[0] / width; + dim[1] = cb->track_search[1] / height; sub_v2_v2(dim, search_dim); mul_v2_fl(dim, 0.5f); - cb->track->search_min[0]-= dim[0]; - cb->track->search_min[1]-= dim[1]; + cb->track->search_min[0] -= dim[0]; + cb->track->search_min[1] -= dim[1]; - cb->track->search_max[0]+= dim[0]; - cb->track->search_max[1]+= dim[1]; + cb->track->search_max[0] += dim[0]; + cb->track->search_max[1] += dim[1]; BKE_tracking_clamp_track(cb->track, CLAMP_SEARCH_DIM); @@ -314,16 +315,17 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event) /* to update position of "parented" objects */ DAG_id_tag_update(&cb->clip->id, 0); - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL); ok = TRUE; } if (ok) - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, cb->clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, cb->clip); } -void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *trackptr, int compact) +void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *userptr, + PointerRNA *trackptr, int compact) { PropertyRNA *prop; uiBlock *block; @@ -375,7 +377,8 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P else tip = "Marker is enabled at current frame"; - bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20, &cb->marker_flag, 0, 0, 1, 0, tip); + bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20, + &cb->marker_flag, 0, 0, 1, 0, tip); uiButSetNFunc(bt, marker_update_cb, cb, NULL); } else { diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index 574eb5b2570..84209f7b744 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -122,13 +122,13 @@ static void draw_keyframe_shape(float x, float y, float xscale, float yscale, sh /* adjust view transform before starting */ glTranslatef(x, y, 0.0f); - glScalef(1.0f/xscale*hsize, 1.0f/yscale*hsize, 1.0f); + glScalef(1.0f / xscale * hsize, 1.0f / yscale * hsize, 1.0f); /* anti-aliased lines for more consistent appearance */ glEnable(GL_LINE_SMOOTH); if (sel) - UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255*(1.0f-alpha)); + UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255 * (1.0f - alpha)); else glColor4f(0.91f, 0.91f, 0.91f, alpha); diff --git a/source/blender/editors/space_clip/clip_dopesheet_ops.c b/source/blender/editors/space_clip/clip_dopesheet_ops.c index 9b9190e3e05..0fd17523425 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_ops.c +++ b/source/blender/editors/space_clip/clip_dopesheet_ops.c @@ -100,7 +100,7 @@ static int dopesheet_select_channel_exec(bContext *C, wmOperator *op) current_channel_index++; } - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); return OPERATOR_FINISHED; } @@ -129,7 +129,7 @@ void CLIP_OT_dopesheet_select_channel(wmOperatorType *ot) ot->poll = dopesheet_select_channel_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 33bc67db8e4..f92f639586d 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -87,7 +87,7 @@ void clip_draw_curfra_label(SpaceClip *sc, float x, float y) glRecti(x, y, x + font_dims[0] + 6.0f, y + font_dims[1] + 4.0f); UI_ThemeColor(TH_TEXT); - BLF_position(fontid, x+2.0f, y+2.0f, 0.0f); + BLF_position(fontid, x + 2.0f, y + 2.0f, 0.0f); BLF_draw(fontid, numstr, sizeof(numstr)); } @@ -128,7 +128,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc int framenr; MovieTrackingMarker *marker; - while (a<track->markersnr) { + while (a < track->markersnr) { if (track->markers[a].framenr >= i) break; @@ -191,7 +191,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc x = (sc->user.framenr - sfra) / (efra - sfra + 1) * ar->winx; UI_ThemeColor(TH_CFRAME); - glRecti(x, 0, x+framelen, 8); + glRecti(x, 0, x + framelen, 8); clip_draw_curfra_label(sc, x, 8.0f); } @@ -267,7 +267,7 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf, * be binder fallback to simple draw pixels solution */ if (need_fallback) { /* set zoom */ - glPixelZoom(zoomx*width/ibuf->x, zoomy*height/ibuf->y); + glPixelZoom(zoomx * width / ibuf->x, zoomy * height / ibuf->y); glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); @@ -346,7 +346,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin b = count; i = framenr; - while (i <= framenr+count) { + while (i <= framenr + count) { marker = BKE_tracking_get_marker(track, i); if (!marker || marker->flag & MARKER_DISABLED) @@ -357,7 +357,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin curindex = b; add_v2_v2v2(path[b++], marker->pos, track->offset); - ED_clip_point_undistorted_pos(sc, path[b-1], path[b-1]); + ED_clip_point_undistorted_pos(sc, path[b - 1], path[b - 1]); } else break; @@ -414,7 +414,8 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin glPointSize(1.0f); } -static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, float marker_pos[2], int width, int height) +static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, + float marker_pos[2], int width, int height) { int tiny = sc->flag & SC_SHOW_TINY_MARKER; int show_search = FALSE; @@ -434,7 +435,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT ED_clip_point_undistorted_pos(sc, pos, pos); - if (BLI_in_rctf(&r, pos[0]-marker_pos[0], pos[1]-marker_pos[1])) { + if (BLI_in_rctf(&r, pos[0] - marker_pos[0], pos[1] - marker_pos[1])) { if (tiny) glPointSize(3.0f); else glPointSize(4.0f); glBegin(GL_POINTS); @@ -513,7 +514,8 @@ static void track_colors(MovieTrackingTrack *track, int act, float col[3], float } } -static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, float marker_pos[2], int width, int height, int act, int sel) +static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, + float marker_pos[2], int width, int height, int act, int sel) { int tiny = sc->flag & SC_SHOW_TINY_MARKER; int show_search = 0; @@ -521,8 +523,8 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra track_colors(track, act, col, scol); - px[0]= 1.0f / width / sc->zoom; - px[1]= 1.0f / height / sc->zoom; + px[0] = 1.0f / width / sc->zoom; + px[1] = 1.0f / height / sc->zoom; /* marker position and offset position */ if ((track->flag & SELECT) == sel && (marker->flag & MARKER_DISABLED) == 0) { @@ -548,7 +550,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra add_v2_v2v2(pos, marker->pos, track->offset); ED_clip_point_undistorted_pos(sc, pos, pos); - if (BLI_in_rctf(&r, pos[0]-marker_pos[0], pos[1]-marker_pos[1])) { + if (BLI_in_rctf(&r, pos[0] - marker_pos[0], pos[1] - marker_pos[1])) { if (!tiny) glPointSize(2.0f); @@ -768,18 +770,18 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo } glBegin(GL_QUADS); - glVertex3f(x-tdx, y+tdy, 0); - glVertex3f(x+tdx, y+tdy, 0); - glVertex3f(x+tdx, y-tdy, 0); - glVertex3f(x-tdx, y-tdy, 0); + glVertex3f(x - tdx, y + tdy, 0); + glVertex3f(x + tdx, y + tdy, 0); + glVertex3f(x + tdx, y - tdy, 0); + glVertex3f(x - tdx, y - tdy, 0); glEnd(); /* search re-sizing triangle */ x = track->search_max[0]; y = track->search_min[1]; - tdx = searchdx*2.0f; - tdy = searchdy*2.0f; + tdx = searchdx * 2.0f; + tdy = searchdy * 2.0f; if (outline) { tdx += px[0]; @@ -788,12 +790,12 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo glBegin(GL_TRIANGLES); glVertex3f(x, y, 0); - glVertex3f(x-tdx, y, 0); - glVertex3f(x, y+tdy, 0); + glVertex3f(x - tdx, y, 0); + glVertex3f(x, y + tdy, 0); glEnd(); } - if ((sc->flag & SC_SHOW_MARKER_PATTERN) && ((track->pat_flag & SELECT)==sel || outline)) { + if ((sc->flag & SC_SHOW_MARKER_PATTERN) && ((track->pat_flag & SELECT) == sel || outline)) { if (!outline) { if (track->pat_flag & SELECT) glColor3fv(scol); @@ -814,10 +816,10 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo } glBegin(GL_QUADS); - glVertex3f(x-tdx, y+tdy, 0); - glVertex3f(x+tdx, y+tdy, 0); - glVertex3f(x+tdx, y-tdy, 0); - glVertex3f(x-tdx, y-tdy, 0); + glVertex3f(x - tdx, y + tdy, 0); + glVertex3f(x + tdx, y + tdy, 0); + glVertex3f(x + tdx, y - tdy, 0); + glVertex3f(x - tdx, y - tdy, 0); glEnd(); /* pattern re-sizing triangle */ @@ -834,8 +836,8 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo glBegin(GL_TRIANGLES); glVertex3f(x, y, 0); - glVertex3f(x-tdx, y, 0); - glVertex3f(x, y+tdy, 0); + glVertex3f(x - tdx, y, 0); + glVertex3f(x, y + tdy, 0); glEnd(); } @@ -845,8 +847,8 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo glLineWidth(1.0f); } -static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, float marker_pos[2], int act, - int width, int height, float zoomx, float zoomy) +static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, + float marker_pos[2], int act, int width, int height, float zoomx, float zoomy) { char str[128] = {0}, state[64] = {0}; float dx = 0.0f, dy = 0.0f, fontsize, pos[3]; @@ -971,7 +973,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, /* count */ track = tracksbase->first; while (track) { - if ((track->flag & TRACK_HIDDEN)==0) { + if ((track->flag & TRACK_HIDDEN) == 0) { marker = BKE_tracking_get_marker(track, framenr); if (MARKER_VISIBLE(sc, track, marker)) @@ -988,7 +990,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, track = tracksbase->first; fp = marker_pos; while (track) { - if ((track->flag & TRACK_HIDDEN)==0) { + if ((track->flag & TRACK_HIDDEN) == 0) { marker = BKE_tracking_get_marker(track, framenr); if (MARKER_VISIBLE(sc, track, marker)) { @@ -1009,7 +1011,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, if (sc->flag & SC_SHOW_TRACK_PATH) { track = tracksbase->first; while (track) { - if ((track->flag & TRACK_HIDDEN)==0) + if ((track->flag & TRACK_HIDDEN) == 0) draw_track_path(sc, clip, track); track = track->next; @@ -1020,7 +1022,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, track = tracksbase->first; fp = marker_pos; while (track) { - if ((track->flag & TRACK_HIDDEN)==0) { + if ((track->flag & TRACK_HIDDEN) == 0) { marker = BKE_tracking_get_marker(track, framenr); if (MARKER_VISIBLE(sc, track, marker)) { @@ -1044,7 +1046,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, track = tracksbase->first; fp = marker_pos; while (track) { - if ((track->flag & TRACK_HIDDEN)==0) { + if ((track->flag & TRACK_HIDDEN) == 0) { int act = track == act_track; marker = BKE_tracking_get_marker(track, framenr); @@ -1066,7 +1068,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, /* active marker would be displayed on top of everything else */ if (act_track) { - if ((act_track->flag & TRACK_HIDDEN)==0) { + if ((act_track->flag & TRACK_HIDDEN) == 0) { marker = BKE_tracking_get_marker(act_track, framenr); if (MARKER_VISIBLE(sc, act_track, marker)) { @@ -1096,7 +1098,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, if (MARKER_VISIBLE(sc, track, marker)) { float npos[2]; copy_v4_v4(vec, track->bundle_pos); - vec[3]=1; + vec[3] = 1; mul_v4_m4v4(pos, mat, vec); @@ -1111,7 +1113,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, sub_v2_v2(vec, npos); - if (len_v2(vec)< 3.0f) + if (len_v2(vec) < 3.0f) glColor3f(0.0f, 1.0f, 0.0f); else glColor3f(1.0f, 0.0f, 0.0f); @@ -1165,7 +1167,8 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, MEM_freeN(marker_pos); } -static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int width, int height, float zoomx, float zoomy) +static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, + int width, int height, float zoomx, float zoomy) { float x, y; const int n = 10; @@ -1199,9 +1202,9 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid for (a = 0; a < 4; a++) { if (a < 2) - val[a][a%2] = FLT_MAX; + val[a][a % 2] = FLT_MAX; else - val[a][a%2] = -FLT_MAX; + val[a][a % 2] = -FLT_MAX; } zero_v2(pos); @@ -1213,10 +1216,10 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid for (a = 0; a < 4; a++) { int ok; - if (a<2) - ok = tpos[a%2] < val[a][a%2]; + if (a < 2) + ok = tpos[a % 2] < val[a][a % 2]; else - ok = tpos[a%2] > val[a][a%2]; + ok = tpos[a % 2] > val[a][a % 2]; if (ok) { copy_v2_v2(val[a], tpos); @@ -1310,11 +1313,11 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid pos[0] = stroke->points[i].x * width; pos[1] = stroke->points[i].y * height * aspy; - npos[0] = stroke->points[i+1].x * width; - npos[1] = stroke->points[i+1].y * height * aspy; + npos[0] = stroke->points[i + 1].x * width; + npos[1] = stroke->points[i + 1].y * height * aspy; len = len_v2v2(pos, npos); - steps = ceil(len/5.0f); + steps = ceil(len / 5.0f); /* we want to distort only long straight lines */ if (stroke->totpoints == 2) { @@ -1323,11 +1326,11 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid } sub_v2_v2v2(dpos, npos, pos); - mul_v2_fl(dpos, 1.0f/steps); + mul_v2_fl(dpos, 1.0f / steps); for (j = 0; j <= steps; j++) { BKE_tracking_apply_intrinsics(tracking, pos, tpos); - glVertex2f(tpos[0]/width, tpos[1]/(height*aspy)); + glVertex2f(tpos[0] / width, tpos[1] / (height*aspy)); add_v2_v2(pos, dpos); } @@ -1434,7 +1437,7 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d) if (onlyv2d) { /* if manual calibration is used then grease pencil data is already * drawed in draw_distortion */ - if ((sc->flag & SC_MANUAL_CALIBRATION)==0 || sc->mode != SC_MODE_DISTORTION) { + if ((sc->flag & SC_MANUAL_CALIBRATION) == 0 || sc->mode != SC_MODE_DISTORTION) { ibuf = ED_space_clip_get_buffer(sc); if (ibuf) { diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index bd34a51819c..94422e51891 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -162,7 +162,7 @@ void ED_space_clip_set(bContext *C, bScreen *screen, SpaceClip *sc, MovieClip *c } if (C) - WM_event_add_notifier(C, NC_MOVIECLIP|NA_SELECTED, sc->clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_SELECTED, sc->clip); } MovieClip *ED_space_clip(SpaceClip *sc) @@ -220,8 +220,8 @@ void ED_space_clip_zoom(SpaceClip *sc, ARegion *ar, float *zoomx, float *zoomy) ED_space_clip_size(sc, &width, &height); - *zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1)/(float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin)*width); - *zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1)/(float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin)*height); + *zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin) * width); + *zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin) * height); } void ED_space_clip_aspect(SpaceClip *sc, float *aspx, float *aspy) @@ -317,7 +317,8 @@ int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit) return FALSE; /* center view */ - clip_view_center_to_point(sc, (max[0]+min[0])/(2*frame_width), (max[1]+min[1])/(2*frame_height)); + clip_view_center_to_point(sc, (max[0] + min[0]) / (2 * frame_width), + (max[1] + min[1]) / (2 * frame_height)); w = max[0] - min[0]; h = max[1] - min[1]; @@ -337,7 +338,7 @@ int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit) newzoom = 1.0f / power_of_2(1.0f / MIN2(zoomx, zoomy)); - if (fit || sc->zoom>newzoom) + if (fit || sc->zoom > newzoom) sc->zoom = newzoom; } diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index 9f9bdcb6cd2..853a7d7cad1 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -81,7 +81,7 @@ static void draw_curve_knot(float x, float y, float xscale, float yscale, float glPushMatrix(); glTranslatef(x, y, 0.0f); - glScalef(1.0f/xscale*hsize, 1.0f/yscale*hsize, 1.0f); + glScalef(1.0f / xscale * hsize, 1.0f / yscale * hsize, 1.0f); glCallList(displist); glPopMatrix(); @@ -166,7 +166,8 @@ static void draw_tracks_curves(View2D *v2d, SpaceClip *sc) /* draw graph lines */ glEnable(GL_BLEND); - clip_graph_tracking_values_iterate(sc, act_track, tracking_segment_point_cb, tracking_segment_start_cb, tracking_segment_end_cb); + clip_graph_tracking_values_iterate(sc, act_track, tracking_segment_point_cb, + tracking_segment_start_cb, tracking_segment_end_cb); glDisable(GL_BLEND); /* selected knot handles on top of curves */ @@ -183,10 +184,10 @@ static void draw_frame_curves(SpaceClip *sc) glColor3f(0.0f, 0.0f, 1.0f); - for (i = 0; i<reconstruction->camnr; i++) { + for (i = 0; i < reconstruction->camnr; i++) { MovieReconstructedCamera *camera = &reconstruction->cameras[i]; - if (lines && camera->framenr!=prevfra+1) { + if (lines && camera->framenr != prevfra + 1) { glEnd(); lines = 0; } diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index efe48cd4b36..10692ada5d9 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -144,7 +144,7 @@ static void find_nearest_tracking_knot_cb(void *userdata, MovieTrackingTrack *tr float d = dx * dx + dy * dy; if (data->marker == NULL || d < data->min_dist) { - float co[2]= {marker->framenr, val}; + float co[2] = {marker->framenr, val}; data->track = track; data->marker = marker; @@ -252,7 +252,7 @@ static int mouse_select(bContext *C, float co[2], int extend) } if (sel) - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); return OPERATOR_FINISHED; } @@ -358,7 +358,7 @@ static int border_select_graph_exec(bContext *C, wmOperator *op) clip_graph_tracking_values_iterate_track(sc, act_track, &userdata, border_select_cb, NULL, NULL); if (userdata.change) { - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); return OPERATOR_FINISHED; } @@ -430,7 +430,7 @@ static int graph_select_all_markers_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); return OPERATOR_FINISHED; } @@ -447,7 +447,7 @@ void CLIP_OT_graph_select_all_markers(wmOperatorType *ot) ot->poll = ED_space_clip_graph_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; WM_operator_properties_select_all(ot); } @@ -481,7 +481,7 @@ void CLIP_OT_graph_delete_curve(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /******************** delete knot operator ********************/ @@ -522,7 +522,7 @@ void CLIP_OT_graph_delete_knot(wmOperatorType *ot) ot->poll = ED_space_clip_graph_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /******************** view all operator ********************/ @@ -662,7 +662,7 @@ static int graph_disable_markers_exec(bContext *C, wmOperator *op) DAG_id_tag_update(&clip->id, 0); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip); return OPERATOR_FINISHED; } @@ -686,7 +686,7 @@ void CLIP_OT_graph_disable_markers(wmOperatorType *ot) ot->poll = ED_space_clip_graph_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Disable action to execute"); diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 485830dbe6c..fb99bf37a24 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -93,8 +93,8 @@ static void sclip_zoom_set(SpaceClip *sc, ARegion *ar, float zoom, float locatio if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) { ED_space_clip_size(sc, &width, &height); - sc->xof += ((location[0] - 0.5f) * width-sc->xof) * (sc->zoom-oldzoom) / sc->zoom; - sc->yof += ((location[1] - 0.5f) * height-sc->yof) * (sc->zoom-oldzoom) / sc->zoom; + sc->xof += ((location[0] - 0.5f) * width - sc->xof) * (sc->zoom - oldzoom) / sc->zoom; + sc->yof += ((location[1] - 0.5f) * height - sc->yof) * (sc->zoom - oldzoom) / sc->zoom; } } @@ -164,7 +164,8 @@ static int open_exec(bContext *C, wmOperator *op) if (op->customdata) MEM_freeN(op->customdata); - BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s.", str, errno ? strerror(errno) : "Unsupported movie clip format"); + BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s.", str, + errno ? strerror(errno) : "Unsupported movie clip format"); return OPERATOR_CANCELLED; } @@ -188,7 +189,7 @@ static int open_exec(bContext *C, wmOperator *op) ED_space_clip_set(C, screen, sc, clip); } - WM_event_add_notifier(C, NC_MOVIECLIP|NA_ADDED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_ADDED, clip); MEM_freeN(op->customdata); @@ -233,10 +234,11 @@ void CLIP_OT_open(wmOperatorType *ot) ot->cancel = open_cancel; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY); + WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, + WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY); } /******************* reload clip operator *********************/ @@ -250,7 +252,7 @@ static int reload_exec(bContext *C, wmOperator *UNUSED(op)) BKE_movieclip_reload(clip); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); return OPERATOR_FINISHED; } @@ -412,7 +414,7 @@ void CLIP_OT_view_pan(wmOperatorType *ot) ot->poll = ED_space_clip_view_clip_poll; /* flags */ - ot->flag = OPTYPE_BLOCKING; + ot->flag = OPTYPE _ BLOCKING; /* properties */ RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX, @@ -500,7 +502,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event) switch (event->type) { case MOUSEMOVE: - factor = 1.0f + (vpd->x-event->x + vpd->y - event->y) / 300.0f; + factor = 1.0f + (vpd->x - event->x + vpd->y - event->y) / 300.0f; RNA_float_set(op->ptr, "factor", factor); sclip_zoom_set(sc, ar, vpd->zoom * factor, vpd->location); ED_region_tag_redraw(CTX_wm_region(C)); @@ -539,7 +541,7 @@ void CLIP_OT_view_zoom(wmOperatorType *ot) ot->poll = ED_space_clip_view_clip_poll; /* flags */ - ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER; + ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER; /* properties */ RNA_def_float(ot->srna, "factor", 0.0f, 0.0f, FLT_MAX, @@ -586,7 +588,8 @@ 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); + RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", + "Cursor location in screen coordinates", -10.0f, 10.0f); } static int view_zoom_out_exec(bContext *C, wmOperator *op) @@ -627,7 +630,8 @@ 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 normalised (0.0-1.0) coordinates", -10.0f, 10.0f); + 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); } /********************** view zoom ratio operator *********************/ @@ -781,7 +785,7 @@ static void change_frame_apply(bContext *C, wmOperator *op) /* do updates */ sound_seek_scene(CTX_data_main(C), CTX_data_scene(C)); - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); } static int change_frame_exec(bContext *C, wmOperator *op) @@ -867,7 +871,7 @@ void CLIP_OT_change_frame(wmOperatorType *ot) ot->poll = change_frame_poll; /* flags */ - ot->flag = OPTYPE_BLOCKING|OPTYPE_UNDO; + ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO; /* rna */ RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME); @@ -904,16 +908,16 @@ static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undisto int size_nr = undistort ? 1 : 0; if (size_flag & size_flags[size_nr][0]) - build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_25; + build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_25; if (size_flag & size_flags[size_nr][1]) - build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_50; + build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_50; if (size_flag & size_flags[size_nr][2]) - build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_75; + build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_75; if (size_flag & size_flags[size_nr][3]) - build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_100; + build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_100; return build_count; } @@ -958,7 +962,8 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog if (clip->source != MCLIP_SRC_MOVIE) BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, NULL, cfra, build_sizes, build_count, 0); - BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, distortion, cfra, build_undistort_sizes, build_undistort_count, 1); + BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, distortion, cfra, + build_undistort_sizes, build_undistort_count, 1); if (*stop || G.afbreek) break; @@ -986,7 +991,7 @@ static void proxy_endjob(void *pjv) BKE_movieclip_reload(pj->clip); - WM_main_add_notifier(NC_MOVIECLIP|ND_DISPLAY, pj->clip); + WM_main_add_notifier(NC_MOVIECLIP | ND_DISPLAY, pj->clip); } static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op)) @@ -1015,7 +1020,7 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op)) } WM_jobs_customdata(steve, pj, proxy_freejob); - WM_jobs_timer(steve, 0.2, NC_MOVIECLIP|ND_DISPLAY, 0); + WM_jobs_timer(steve, 0.2, NC_MOVIECLIP | ND_DISPLAY, 0); WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob); G.afbreek = 0; @@ -1057,7 +1062,7 @@ static int mode_set_exec(bContext *C, wmOperator *op) sc->mode = mode; } - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CLIP, NULL); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CLIP, NULL); return OPERATOR_FINISHED; } @@ -1094,14 +1099,14 @@ void ED_operatormacros_clip(void) wmOperatorTypeMacro *otmacro; ot = WM_operatortype_append_macro("CLIP_OT_add_marker_move", "Add Marker and Move", - "Add new marker and move it on movie", OPTYPE_UNDO|OPTYPE_REGISTER); + "Add new marker and move it on movie", OPTYPE_UNDO | OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "CLIP_OT_add_marker"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_struct_idprops_unset(otmacro->ptr, "release_confirm"); ot = WM_operatortype_append_macro("CLIP_OT_add_marker_slide", "Add Marker and Slide", "Add new marker and slide it with mouse until mouse button release", - OPTYPE_UNDO|OPTYPE_REGISTER); + OPTYPE_UNDO | OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "CLIP_OT_add_marker"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_boolean_set(otmacro->ptr, "release_confirm", TRUE); diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c index da8bf8fedd9..3ffba75f2ef 100644 --- a/source/blender/editors/space_clip/clip_toolbar.c +++ b/source/blender/editors/space_clip/clip_toolbar.c @@ -151,7 +151,7 @@ static ARegion *clip_has_tools_region(ScrArea *sa) BLI_insertlinkafter(&sa->regionbase, artool, arprops); arprops->regiontype = RGN_TYPE_TOOL_PROPS; - arprops->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV; + arprops->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV; } return artool; diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index 2545106d132..4142c30d825 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -190,20 +190,21 @@ void clip_delete_track(bContext *C, MovieClip *clip, ListBase *tracksbase, Movie BKE_tracking_free_track(track); BLI_freelinkN(tracksbase, track); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); if (update_stab) { tracking->stabilization.ok = FALSE; - WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip); } DAG_id_tag_update(&clip->id, 0); if (has_bundle) - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL); } -void clip_delete_marker(bContext *C, MovieClip *clip, ListBase *tracksbase, MovieTrackingTrack *track, MovieTrackingMarker *marker) +void clip_delete_marker(bContext *C, MovieClip *clip, ListBase *tracksbase, + MovieTrackingTrack *track, MovieTrackingMarker *marker) { if (track->markersnr == 1) { clip_delete_track(C, clip, tracksbase, track); @@ -211,7 +212,7 @@ void clip_delete_marker(bContext *C, MovieClip *clip, ListBase *tracksbase, Movi else { BKE_tracking_delete_marker(track, marker->framenr); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); } } @@ -253,7 +254,7 @@ void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene) /* because the frame number text is subject to the same scaling as the contents of the view */ UI_view2d_getscale(v2d, &xscale, &yscale); - glScalef(1.0f/xscale, 1.0f, 1.0f); + glScalef(1.0f / xscale, 1.0f, 1.0f); clip_draw_curfra_label(sc, (float)sc->user.framenr * xscale, 18); diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 1c0d2db91a9..a3e17d420b3 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -81,7 +81,7 @@ static void init_preview_region(const bContext *C, ARegion *ar) if (sc->view == SC_VIEW_DOPESHEET) { ar->v2d.tot.xmin = -10.0f; - ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f; + ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f; ar->v2d.tot.xmax = (float)(sa->winx); ar->v2d.tot.ymax = 0.0f; @@ -95,7 +95,7 @@ static void init_preview_region(const bContext *C, ARegion *ar) ar->v2d.minzoom = 0.01f; ar->v2d.maxzoom = 50; - ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); + ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL); ar->v2d.scroll |= (V2D_SCROLL_RIGHT); ar->v2d.keepzoom = V2D_LOCKZOOM_Y; ar->v2d.keepofs = V2D_KEEPOFS_Y; @@ -116,8 +116,8 @@ static void init_preview_region(const bContext *C, ARegion *ar) ar->v2d.max[0] = MAXFRAMEF; ar->v2d.max[1] = FLT_MAX; - ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); - ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL); + ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL); + ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL); ar->v2d.minzoom = 0.0f; ar->v2d.maxzoom = 0.0f; @@ -232,7 +232,8 @@ static SpaceLink *clip_new(const bContext *C) sc = MEM_callocN(sizeof(SpaceClip), "initclip"); sc->spacetype = SPACE_CLIP; - sc->flag = SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH|SC_MANUAL_CALIBRATION|SC_SHOW_GRAPH_TRACKS|SC_SHOW_GRAPH_FRAMES; + sc->flag = SC_SHOW_MARKER_PATTERN | SC_SHOW_TRACK_PATH | SC_MANUAL_CALIBRATION | + SC_SHOW_GRAPH_TRACKS | SC_SHOW_GRAPH_FRAMES; sc->zoom = 1.0f; sc->path_length = 20; sc->scopes.track_preview_height = 120; @@ -256,7 +257,7 @@ static SpaceLink *clip_new(const bContext *C) BLI_addtail(&sc->regionbase, ar); ar->regiontype = RGN_TYPE_TOOL_PROPS; - ar->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV; + ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV; /* properties view */ ar = MEM_callocN(sizeof(ARegion), "properties for clip"); @@ -369,12 +370,12 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn) } break; case NC_SCREEN: - if (wmn->data ==ND_ANIMPLAY) { + if (wmn->data == ND_ANIMPLAY) { ED_area_tag_redraw(sa); } break; case NC_SPACE: - if (wmn->data ==ND_SPACE_CLIP) { + if (wmn->data == ND_SPACE_CLIP) { clip_scopes_tag_refresh(sa); clip_stabilization_tag_refresh(sa); ED_area_tag_redraw(sa); @@ -512,7 +513,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_CTRL, 0); RNA_boolean_set(kmi->ptr, "backwards", FALSE); RNA_boolean_set(kmi->ptr, "sequence", TRUE); - kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0); + kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0); RNA_boolean_set(kmi->ptr, "backwards", TRUE); RNA_boolean_set(kmi->ptr, "sequence", TRUE); @@ -560,16 +561,16 @@ static void clip_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "CLIP_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0); /* jump to special frame */ - kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "position", 0); - kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "position", 1); - kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "position", 2); - kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "position", 3); /* "timeline" */ @@ -645,7 +646,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_UPTO); RNA_boolean_set(kmi->ptr, "clear_active", FALSE); - kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_ALL); RNA_boolean_set(kmi->ptr, "clear_active", FALSE); @@ -690,7 +691,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_UPTO); RNA_boolean_set(kmi->ptr, "clear_active", TRUE); - kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_ALL); RNA_boolean_set(kmi->ptr, "clear_active", TRUE); @@ -708,7 +709,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf) RNA_boolean_set(kmi->ptr, "extend", TRUE); /* toggle */ } -const char *clip_context_dir[]= {"edit_movieclip", NULL}; +const char *clip_context_dir[] = {"edit_movieclip", NULL}; static int clip_context(const bContext *C, const char *member, bContextDataResult *result) { @@ -879,8 +880,8 @@ static void clip_refresh(const bContext *C, ScrArea *sa) ar_tool_props->v2d.flag &= ~V2D_IS_INITIALISED; view_changed = TRUE; } - if (ar_tool_props && (ar_tool_props->alignment != (RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV))) { - ar_tool_props->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV; + if (ar_tool_props && (ar_tool_props->alignment != (RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV))) { + ar_tool_props->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV; view_changed = TRUE; } } @@ -984,8 +985,8 @@ static void movieclip_main_area_set_view2d(SpaceClip *sc, ARegion *ar) ar->v2d.mask.ymax = winy; /* which part of the image space do we see? */ - x1 = ar->winrct.xmin + (winx-sc->zoom * w) / 2.0f; - y1 = ar->winrct.ymin + (winy-sc->zoom * h) / 2.0f; + x1 = ar->winrct.xmin + (winx - sc->zoom * w) / 2.0f; + y1 = ar->winrct.ymin + (winy - sc->zoom * h) / 2.0f; x1 -= sc->zoom * sc->xof; y1 -= sc->zoom * sc->yof; @@ -1146,7 +1147,8 @@ static void dopesheet_area_draw(const bContext *C, ARegion *ar) /* time grid */ unit = (sc->flag & SC_SHOW_SECONDS)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; - grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); + grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, + V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); UI_view2d_grid_free(grid); @@ -1298,11 +1300,11 @@ static void clip_properties_area_listener(ARegion *ar, wmNotifier *wmn) /* context changes */ switch (wmn->category) { case NC_SCREEN: - if (wmn->data ==ND_GPENCIL) + if (wmn->data == ND_GPENCIL) ED_region_tag_redraw(ar); break; case NC_BRUSH: - if (wmn->action ==NA_EDITED) + if (wmn->action == NA_EDITED) ED_region_tag_redraw(ar); break; } @@ -1336,7 +1338,7 @@ void ED_spacetype_clip(void) art->init = clip_main_area_init; art->draw = clip_main_area_draw; art->listener = clip_main_area_listener; - art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI|ED_KEYMAP_GPENCIL; + art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI | ED_KEYMAP_GPENCIL; BLI_addhead(&st->regiontypes, art); @@ -1347,7 +1349,7 @@ void ED_spacetype_clip(void) art->init = clip_preview_area_init; art->draw = clip_preview_area_draw; art->listener = clip_preview_area_listener; - art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI|ED_KEYMAP_VIEW2D; + art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI | ED_KEYMAP_VIEW2D; BLI_addhead(&st->regiontypes, art); @@ -1355,7 +1357,7 @@ void ED_spacetype_clip(void) art = MEM_callocN(sizeof(ARegionType), "spacetype clip region properties"); art->regionid = RGN_TYPE_UI; art->prefsizex = UI_COMPACT_PANEL_WIDTH; - art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI; + art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI; art->init = clip_properties_area_init; art->draw = clip_properties_area_draw; art->listener = clip_properties_area_listener; @@ -1366,7 +1368,7 @@ void ED_spacetype_clip(void) art = MEM_callocN(sizeof(ARegionType), "spacetype clip region tools"); art->regionid = RGN_TYPE_TOOLS; art->prefsizex = UI_COMPACT_PANEL_WIDTH; - art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI; + art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI; art->listener = clip_props_area_listener; art->init = clip_tools_area_init; art->draw = clip_tools_area_draw; @@ -1378,7 +1380,7 @@ void ED_spacetype_clip(void) art->regionid = RGN_TYPE_TOOL_PROPS; art->prefsizex = 0; art->prefsizey = 120; - art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI; + art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI; art->listener = clip_props_area_listener; art->init = clip_tools_area_init; art->draw = clip_tools_area_draw; @@ -1390,7 +1392,7 @@ void ED_spacetype_clip(void) art = MEM_callocN(sizeof(ARegionType), "spacetype clip region"); art->regionid = RGN_TYPE_HEADER; art->prefsizey = HEADERY; - art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER; + art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER; art->init = clip_header_area_init; art->draw = clip_header_area_draw; @@ -1403,7 +1405,7 @@ void ED_spacetype_clip(void) art = MEM_callocN(sizeof(ARegionType), "spacetype clip channels region"); art->regionid = RGN_TYPE_CHANNELS; art->prefsizex = UI_COMPACT_PANEL_WIDTH; - art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI; + art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI; art->listener = clip_channels_area_listener; art->init = clip_channels_area_init; art->draw = clip_channels_area_draw; diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 56f50d41a12..8e11269254f 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -116,7 +116,7 @@ static int add_marker_exec(bContext *C, wmOperator *op) sc->xlockof = 0; sc->ylockof = 0; - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); return OPERATOR_FINISHED; } @@ -145,7 +145,7 @@ void CLIP_OT_add_marker(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_size_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MIN, FLT_MAX, @@ -190,7 +190,7 @@ void CLIP_OT_delete_track(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** delete marker operator *********************/ @@ -211,7 +211,7 @@ static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op)) MovieTrackingMarker *marker = BKE_tracking_exact_marker(track, framenr); if (marker) { - has_selection |= track->markersnr>1; + has_selection |= track->markersnr > 1; clip_delete_marker(C, clip, tracksbase, track, marker); } @@ -241,7 +241,7 @@ void CLIP_OT_delete_marker(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** slide marker operator *********************/ @@ -357,8 +357,8 @@ static int mouse_on_corner(SpaceClip *sc, MovieTrackingTrack *track, MovieTracki inside = co[0] >= crn[0] - dx && co[0] <= crn[0] + tdx && co[1] >= crn[1] - tdy && co[1] <= crn[1] + dy; } else { - crn[0] = marker->pos[0]+min[0]; - crn[1] = marker->pos[1]+max[1]; + crn[0] = marker->pos[0] + min[0]; + crn[1] = marker->pos[1] + max[1]; inside = co[0] >= crn[0] - dx && co[0] <= crn[0] + dx && co[1] >= crn[1] - dy && co[1] <= crn[1] + dy; } @@ -374,7 +374,7 @@ static int mouse_on_offset(SpaceClip *sc, MovieTrackingTrack *track, MovieTracki add_v2_v2v2(pos, marker->pos, track->offset); dx = 12.0f / width / sc->zoom; - dy = 12.0f / height /sc->zoom; + dy = 12.0f / height / sc->zoom; dx = MIN2(dx, (track->pat_max[0] - track->pat_min[0]) / 2.0f); dy = MIN2(dy, (track->pat_max[1] - track->pat_min[1]) / 2.0f); @@ -421,21 +421,26 @@ static void *slide_marker_customdata(bContext *C, wmEvent *event) if ((marker->flag & MARKER_DISABLED) == 0) { if (!customdata) if (mouse_on_offset(sc, track, marker, co, width, height)) - customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_POINT, SLIDE_ACTION_POS, width, height); + customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_POINT, + SLIDE_ACTION_POS, width, height); if (sc->flag & SC_SHOW_MARKER_SEARCH) { if (mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 1, width, height)) - customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, SLIDE_ACTION_OFFSET, width, height); + customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, + SLIDE_ACTION_OFFSET, width, height); else if (mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 0, width, height)) - customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, SLIDE_ACTION_SIZE, width, height); + customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, + SLIDE_ACTION_SIZE, width, height); } if (!customdata && (sc->flag & SC_SHOW_MARKER_PATTERN)) { if (mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 1, width, height)) - customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT, SLIDE_ACTION_OFFSET, width, height); + customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT, + SLIDE_ACTION_OFFSET, width, height); if (!customdata && mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 0, width, height)) - customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT, SLIDE_ACTION_SIZE, width, height); + customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT, + SLIDE_ACTION_SIZE, width, height); } if (customdata) @@ -465,7 +470,7 @@ static int slide_marker_invoke(bContext *C, wmOperator *op, wmEvent *event) hide_cursor(C); WM_event_add_modal_handler(C, op); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); return OPERATOR_RUNNING_MODAL; } @@ -490,7 +495,7 @@ static void cancel_mouse_slide(SlideMarkerData *data) else { int a; - for (a = 0; a<data->track->markersnr; a++) + for (a = 0; a < data->track->markersnr; a++) copy_v2_v2(data->track->markers[a].pos, data->smarkers[a]); copy_v2_v2(data->offset, data->soff); @@ -527,8 +532,8 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event) /* no break! update area size */ case MOUSEMOVE: - mdelta[0] = event->mval[0]-data->mval[0]; - mdelta[1] = event->mval[1]-data->mval[1]; + mdelta[0] = event->mval[0] - data->mval[0]; + mdelta[1] = event->mval[1] - data->mval[1]; dx = mdelta[0] / data->width / sc->zoom; @@ -554,7 +559,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event) data->marker->flag &= ~MARKER_TRACKED; } - WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); + WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); DAG_id_tag_update(&sc->clip->id, 0); } else { @@ -580,7 +585,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event) else { int a; - for (a = 0; a<data->track->markersnr; a++) + for (a = 0; a < data->track->markersnr; a++) add_v2_v2v2(data->track->markers[a].pos, data->smarkers[a], d); sub_v2_v2v2(data->offset, data->soff, d); @@ -591,7 +596,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event) } } - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL); break; @@ -613,7 +618,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event) show_cursor(C); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL); return OPERATOR_CANCELLED; } @@ -634,7 +639,7 @@ void CLIP_OT_slide_marker(wmOperatorType *ot) ot->modal = slide_marker_modal; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_GRAB_POINTER|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_POINTER | OPTYPE_BLOCKING; /* properties */ RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX, @@ -657,10 +662,10 @@ static int mouse_on_side(float co[2], float x1, float y1, float x2, float y2, fl static int mouse_on_rect(float co[2], float pos[2], float min[2], float max[2], float epsx, float epsy) { - return mouse_on_side(co, pos[0]+min[0], pos[1]+min[1], pos[0]+max[0], pos[1]+min[1], epsx, epsy) || - mouse_on_side(co, pos[0]+min[0], pos[1]+min[1], pos[0]+min[0], pos[1]+max[1], epsx, epsy) || - mouse_on_side(co, pos[0]+min[0], pos[1]+max[1], pos[0]+max[0], pos[1]+max[1], epsx, epsy) || - mouse_on_side(co, pos[0]+max[0], pos[1]+min[1], pos[0]+max[0], pos[1]+max[1], epsx, epsy); + return mouse_on_side(co, pos[0] + min[0], pos[1] + min[1], pos[0] + max[0], pos[1] + min[1], epsx, epsy) || + mouse_on_side(co, pos[0] + min[0], pos[1] + min[1], pos[0] + min[0], pos[1] + max[1], epsx, epsy) || + mouse_on_side(co, pos[0] + min[0], pos[1] + max[1], pos[0] + max[0], pos[1] + max[1], epsx, epsy) || + mouse_on_side(co, pos[0] + max[0], pos[1] + min[1], pos[0] + max[0], pos[1] + max[1], epsx, epsy); } static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *track) @@ -671,9 +676,9 @@ static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *trac ED_space_clip_size(sc, &width, &height); - epsx = MIN4(track->pat_min[0]-track->search_min[0], track->search_max[0]-track->pat_max[0], + epsx = MIN4(track->pat_min[0] - track->search_min[0], track->search_max[0] - track->pat_max[0], fabsf(track->pat_min[0]), fabsf(track->pat_max[0])) / 2; - epsy = MIN4(track->pat_min[1]-track->search_min[1], track->search_max[1]-track->pat_max[1], + epsy = MIN4(track->pat_min[1] - track->search_min[1], track->search_max[1] - track->pat_max[1], fabsf(track->pat_min[1]), fabsf(track->pat_max[1])) / 2; epsx = MAX2(epsx, 2.0f / width); @@ -684,7 +689,7 @@ static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *trac return TRACK_AREA_SEARCH; } - if ((marker->flag & MARKER_DISABLED)== 0) { + if ((marker->flag & MARKER_DISABLED) == 0) { if (sc->flag & SC_SHOW_MARKER_PATTERN) if (mouse_on_rect(co, marker->pos, track->pat_min, track->pat_max, epsx, epsy)) return TRACK_AREA_PAT; @@ -692,8 +697,11 @@ static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *trac epsx = 12.0f / width; epsy = 12.0f / height; - if (fabsf(co[0]-marker->pos[0]-track->offset[0])< epsx && fabsf(co[1]-marker->pos[1]-track->offset[1])<=epsy) + if (fabsf(co[0] - marker->pos[0] - track->offset[0]) < epsx && + fabsf(co[1] - marker->pos[1] - track->offset[1]) <= epsy) + { return TRACK_AREA_POINT; + } } return TRACK_AREA_NONE; @@ -702,7 +710,7 @@ static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *trac static float dist_to_rect(float co[2], float pos[2], float min[2], float max[2]) { float d1, d2, d3, d4; - float p[2] = {co[0]-pos[0], co[1]-pos[1]}; + float p[2] = {co[0] - pos[0], co[1] - pos[1]}; float v1[2] = {min[0], min[1]}, v2[2] = {max[0], min[1]}, v3[2] = {max[0], max[1]}, v4[2] = {min[0], max[1]}; @@ -726,8 +734,9 @@ static MovieTrackingTrack *find_nearest_track(SpaceClip *sc, ListBase *tracksbas if (((cur->flag & TRACK_HIDDEN) == 0) && MARKER_VISIBLE(sc, cur, marker)) { float dist, d1, d2 = FLT_MAX, d3 = FLT_MAX; - d1 = sqrtf((co[0]-marker->pos[0]-cur->offset[0])*(co[0]-marker->pos[0]-cur->offset[0])+ - (co[1]-marker->pos[1]-cur->offset[1])*(co[1]-marker->pos[1]-cur->offset[1])); /* distance to marker point */ + /* distance to marker point */ + d1 = sqrtf((co[0] - marker->pos[0] - cur->offset[0]) * (co[0] - marker->pos[0] - cur->offset[0]) + + (co[1] - marker->pos[1] - cur->offset[1]) * (co[1] - marker->pos[1] - cur->offset[1])); /* distance to pattern boundbox */ if (sc->flag & SC_SHOW_MARKER_PATTERN) @@ -740,7 +749,7 @@ static MovieTrackingTrack *find_nearest_track(SpaceClip *sc, ListBase *tracksbas /* choose minimal distance. useful for cases of overlapped markers. */ dist = MIN3(d1, d2, d3); - if (track == NULL || dist<mindist) { + if (track == NULL || dist < mindist) { track = cur; mindist = dist; } @@ -791,7 +800,7 @@ static int mouse_select(bContext *C, float co[2], int extend) BKE_tracking_dopesheet_tag_update(tracking); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); return OPERATOR_FINISHED; } @@ -821,7 +830,7 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event) clip->tracking.act_track = slidedata->track; - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); MEM_freeN(slidedata); @@ -890,7 +899,7 @@ static int border_select_exec(bContext *C, wmOperator *op) if (MARKER_VISIBLE(sc, track, marker)) { if (BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) { - BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT); + BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode != GESTURE_MODAL_SELECT); } else if (!extend) { BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, 1); @@ -906,7 +915,7 @@ static int border_select_exec(bContext *C, wmOperator *op) if (change) { BKE_tracking_dopesheet_tag_update(tracking); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); return OPERATOR_FINISHED; } @@ -981,7 +990,7 @@ static int circle_select_exec(bContext *C, wmOperator *op) MovieTrackingMarker *marker = BKE_tracking_get_marker(track, sc->user.framenr); if (MARKER_VISIBLE(sc, track, marker) && marker_inside_ellipse(marker, offset, ellipse)) { - BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT); + BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode != GESTURE_MODAL_SELECT); change = TRUE; } @@ -993,7 +1002,7 @@ static int circle_select_exec(bContext *C, wmOperator *op) if (change) { BKE_tracking_dopesheet_tag_update(tracking); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); return OPERATOR_FINISHED; } @@ -1015,7 +1024,7 @@ void CLIP_OT_select_circle(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); @@ -1057,7 +1066,7 @@ static int select_all_exec(bContext *C, wmOperator *op) track = tracksbase->first; while (track) { - if ((track->flag & TRACK_HIDDEN)==0) { + if ((track->flag & TRACK_HIDDEN) == 0) { marker = BKE_tracking_get_marker(track, framenr); if (MARKER_VISIBLE(sc, track, marker)) { @@ -1092,7 +1101,7 @@ static int select_all_exec(bContext *C, wmOperator *op) BKE_tracking_dopesheet_tag_update(tracking); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); return OPERATOR_FINISHED; } @@ -1109,7 +1118,7 @@ void CLIP_OT_select_all(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; WM_operator_properties_select_all(ot); } @@ -1133,7 +1142,7 @@ static int select_groped_exec(bContext *C, wmOperator *op) marker = BKE_tracking_get_marker(track, sc->user.framenr); if (group == 0) { /* Keyframed */ - ok = marker->framenr == sc->user.framenr && (marker->flag & MARKER_TRACKED)==0; + ok = marker->framenr == sc->user.framenr && (marker->flag & MARKER_TRACKED) == 0; } else if (group == 1) { /* Estimated */ ok = marker->framenr != sc->user.framenr; @@ -1174,7 +1183,7 @@ static int select_groped_exec(bContext *C, wmOperator *op) BKE_tracking_dopesheet_tag_update(tracking); - WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip); return OPERATOR_FINISHED; } @@ -1202,7 +1211,7 @@ void CLIP_OT_select_grouped(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_size_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* proeprties */ RNA_def_enum(ot->srna, "group", select_group_items, TRACK_CLEAR_REMAINED, "Action", "Clear action to execute"); @@ -1254,10 +1263,10 @@ static void clear_invisible_track_selection(SpaceClip *sc, MovieClip *clip) ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking); int hidden = 0; - if ((sc->flag & SC_SHOW_MARKER_PATTERN)==0) + if ((sc->flag & SC_SHOW_MARKER_PATTERN) == 0) hidden |= TRACK_AREA_PAT; - if ((sc->flag & SC_SHOW_MARKER_SEARCH)==0) + if ((sc->flag & SC_SHOW_MARKER_SEARCH) == 0) hidden |= TRACK_AREA_SEARCH; if (hidden) { @@ -1284,7 +1293,7 @@ static void track_init_markers(SpaceClip *sc, MovieClip *clip, int *frames_limit track = tracksbase->first; while (track) { if (TRACK_VIEW_SELECTED(sc, track)) { - if ((track->flag & TRACK_HIDDEN)==0 && (track->flag & TRACK_LOCKED)==0) { + if ((track->flag & TRACK_HIDDEN) == 0 && (track->flag & TRACK_LOCKED) == 0) { BKE_tracking_ensure_marker(track, framenr); if (track->frames_limit) { @@ -1391,15 +1400,15 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo if (!BKE_tracking_next(tmj->context)) break; - exec_time = PIL_check_seconds_timer()-start_time; + exec_time = PIL_check_seconds_timer() - start_time; if (tmj->delay > (float)exec_time) - PIL_sleep_ms(tmj->delay-(float)exec_time); + PIL_sleep_ms(tmj->delay - (float)exec_time); } else if (!BKE_tracking_next(tmj->context)) break; *do_update = TRUE; - *progress = (float)(framenr-tmj->sfra) / (tmj->efra-tmj->sfra); + *progress = (float)(framenr - tmj->sfra) / (tmj->efra - tmj->sfra); if (tmj->backwards) framenr--; @@ -1435,7 +1444,7 @@ static void track_markers_freejob(void *tmv) MEM_freeN(tmj); - WM_main_add_notifier(NC_SCENE|ND_FRAME, tmj->scene); + WM_main_add_notifier(NC_SCENE | ND_FRAME, tmj->scene); } static int track_markers_exec(bContext *C, wmOperator *op) @@ -1450,7 +1459,7 @@ static int track_markers_exec(bContext *C, wmOperator *op) int sequence = RNA_boolean_get(op->ptr, "sequence"); int frames_limit; - if (track_count_markers(sc, clip)==0) + if (track_count_markers(sc, clip) == 0) return OPERATOR_CANCELLED; track_init_markers(sc, clip, &frames_limit); @@ -1462,8 +1471,10 @@ static int track_markers_exec(bContext *C, wmOperator *op) /* limit frames to be tracked by user setting */ if (frames_limit) { - if (backwards) efra = MAX2(efra, sfra-frames_limit); - else efra = MIN2(efra, sfra+frames_limit); + if (backwards) + efra = MAX2(efra, sfra - frames_limit); + else + efra = MIN2(efra, sfra + frames_limit); } if (!track_markers_check_direction(backwards, framenr, efra)) @@ -1489,8 +1500,8 @@ static int track_markers_exec(bContext *C, wmOperator *op) /* update scene current frame to the lastes tracked frame */ scene->r.cfra = framenr; - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip); - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip); + WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); return OPERATOR_FINISHED; } @@ -1513,7 +1524,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve if (clip->tracking_context) return OPERATOR_CANCELLED; - if (track_count_markers(sc, clip)==0) + if (track_count_markers(sc, clip) == 0) return OPERATOR_CANCELLED; if (!sequence) @@ -1534,8 +1545,10 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve * with fixed FPS. To deal with editor refresh we have to synchronize * tracks from job and tracks in clip. Do this in timer callback * to prevent threading conflicts. */ - if (tmj->delay>0) WM_jobs_timer(steve, tmj->delay/1000.0f, NC_MOVIECLIP|NA_EVALUATED, 0); - else WM_jobs_timer(steve, 0.2, NC_MOVIECLIP|NA_EVALUATED, 0); + if (tmj->delay > 0) + WM_jobs_timer(steve, tmj->delay / 1000.0f, NC_MOVIECLIP | NA_EVALUATED, 0); + else + WM_jobs_timer(steve, 0.2, NC_MOVIECLIP | NA_EVALUATED, 0); WM_jobs_callbacks(steve, track_markers_startjob, NULL, track_markers_updatejob, NULL); @@ -1554,7 +1567,7 @@ static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *eve { /* no running tracking, remove handler and pass through */ if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) - return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH; + return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH; /* running tracking */ switch (event->type) { @@ -1691,8 +1704,8 @@ static void solve_camera_freejob(void *scv) DAG_id_tag_update(&clip->id, 0); - WM_main_add_notifier(NC_MOVIECLIP|NA_EVALUATED, clip); - WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, NULL); + WM_main_add_notifier(NC_MOVIECLIP | NA_EVALUATED, clip); + WM_main_add_notifier(NC_OBJECT | ND_TRANSFORM, NULL); /* update active clip displayed in scene buttons */ WM_main_add_notifier(NC_SCENE, scene); @@ -1753,12 +1766,12 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even /* hide reconstruction statistics from previous solve */ reconstruction->flag &= ~TRACKING_RECONSTRUCTED; - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip); /* setup job */ steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Solve Camera", WM_JOB_PROGRESS); WM_jobs_customdata(steve, scj, solve_camera_freejob); - WM_jobs_timer(steve, 0.1, NC_MOVIECLIP|NA_EVALUATED, 0); + WM_jobs_timer(steve, 0.1, NC_MOVIECLIP | NA_EVALUATED, 0); WM_jobs_callbacks(steve, solve_camera_startjob, NULL, solve_camera_updatejob, NULL); G.afbreek = 0; @@ -1776,7 +1789,7 @@ static int solve_camera_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *even { /* no running solver, remove handler and pass through */ if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) - return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH; + return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH; /* running tracking */ switch (event->type) { @@ -1802,7 +1815,7 @@ void CLIP_OT_solve_camera(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** clear solution operator *********************/ @@ -1832,8 +1845,8 @@ static int clear_solution_exec(bContext *C, wmOperator *UNUSED(op)) DAG_id_tag_update(&clip->id, 0); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip); - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL); return OPERATOR_FINISHED; } @@ -1850,7 +1863,7 @@ void CLIP_OT_clear_solution(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** clear track operator *********************/ @@ -1878,7 +1891,7 @@ static int clear_track_path_exec(bContext *C, wmOperator *op) } } - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip); return OPERATOR_FINISHED; } @@ -1902,7 +1915,7 @@ void CLIP_OT_clear_track_path(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* proeprties */ RNA_def_enum(ot->srna, "action", clear_path_actions, TRACK_CLEAR_REMAINED, "Action", "Clear action to execute"); @@ -1921,7 +1934,7 @@ static int disable_markers_exec(bContext *C, wmOperator *op) int action = RNA_enum_get(op->ptr, "action"); while (track) { - if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) { + if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) { MovieTrackingMarker *marker = BKE_tracking_ensure_marker(track, sc->user.framenr); if (action == 0) @@ -1936,7 +1949,7 @@ static int disable_markers_exec(bContext *C, wmOperator *op) DAG_id_tag_update(&clip->id, 0); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip); return OPERATOR_FINISHED; } @@ -1960,7 +1973,7 @@ void CLIP_OT_disable_markers(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Disable action to execute"); @@ -1973,13 +1986,13 @@ static Object *get_camera_with_movieclip(Scene *scene, MovieClip *clip) Object *camera = scene->camera; Base *base; - if (camera && BKE_object_movieclip_get(scene, camera, 0)==clip) + if (camera && BKE_object_movieclip_get(scene, camera, 0) == clip) return camera; base = scene->base.first; while (base) { if (base->object->type == OB_CAMERA) { - if (BKE_object_movieclip_get(scene, base->object, 0)==clip) { + if (BKE_object_movieclip_get(scene, base->object, 0) == clip) { camera = base->object; break; } @@ -2144,7 +2157,7 @@ static int set_origin_exec(bContext *C, wmOperator *op) track = track->next; } - mul_v3_fl(median, 1.0f/selected_count); + mul_v3_fl(median, 1.0f / selected_count); BKE_get_tracking_mat(scene, camera, mat); @@ -2162,8 +2175,8 @@ static int set_origin_exec(bContext *C, wmOperator *op) DAG_id_tag_update(&clip->id, 0); DAG_id_tag_update(&object->id, OB_RECALC_OB); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip); - WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip); + WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; } @@ -2180,7 +2193,7 @@ void CLIP_OT_set_origin(wmOperatorType *ot) ot->poll = set_orientation_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_boolean(ot->srna, "use_median", 0, "Use Median", "Set origin to median point of selected bundles"); @@ -2254,7 +2267,7 @@ static void set_axis(Scene *scene, Object *ob, MovieClip *clip, MovieTrackingOb else { copy_v3_v3(mat[1], vec); - if (is_camera || fabsf(vec[2])<1e-3f) { + if (is_camera || fabsf(vec[2]) < 1e-3f) { mat[1][2] = 0.0f; mat[2][0] = 0.0f; mat[2][1] = 0.0f; mat[2][2] = 1.0f; cross_v3_v3v3(mat[0], mat[1], mat[2]); @@ -2318,7 +2331,7 @@ static int set_plane_exec(bContext *C, wmOperator *op) {1.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}; /* 90 degrees Y-axis rotation matrix */ - if (count_selected_bundles(C)!=3) { + if (count_selected_bundles(C) != 3) { BKE_report(op->reports, RPT_ERROR, "Three tracks with bundles are needed to orient the floor"); return OPERATOR_CANCELLED; @@ -2339,7 +2352,7 @@ static int set_plane_exec(bContext *C, wmOperator *op) /* get 3 bundles to use as reference */ track = tracksbase->first; - while (track && tot<3) { + while (track && tot < 3) { if (track->flag & TRACK_HAS_BUNDLE && TRACK_VIEW_SELECTED(sc, track)) { mul_v3_m4v3(vec[tot], mat, track->bundle_pos); @@ -2389,7 +2402,7 @@ static int set_plane_exec(bContext *C, wmOperator *op) BKE_object_apply_mat4(object, newmat, 0, 0); /* make camera have positive z-coordinate */ - if (object->loc[2]<0) { + if (object->loc[2] < 0) { invert_m4(rot); mult_m4_m4m4(newmat, rot, mat); BKE_object_apply_mat4(object, newmat, 0, 0); @@ -2405,8 +2418,8 @@ static int set_plane_exec(bContext *C, wmOperator *op) DAG_id_tag_update(&clip->id, 0); DAG_id_tag_update(&object->id, OB_RECALC_OB); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip); - WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip); + WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; } @@ -2429,7 +2442,7 @@ void CLIP_OT_set_plane(wmOperatorType *ot) ot->poll = set_orientation_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_enum(ot->srna, "plane", plane_items, 0, "Plane", "Plane to be used for orientation"); @@ -2449,7 +2462,7 @@ static int set_axis_exec(bContext *C, wmOperator *op) ListBase *tracksbase; int axis = RNA_enum_get(op->ptr, "axis"); - if (count_selected_bundles(C)!=1) { + if (count_selected_bundles(C) != 1) { BKE_report(op->reports, RPT_ERROR, "Single track with bundle should be selected to define axis"); return OPERATOR_CANCELLED; @@ -2477,8 +2490,8 @@ static int set_axis_exec(bContext *C, wmOperator *op) DAG_id_tag_update(&clip->id, 0); DAG_id_tag_update(&object->id, OB_RECALC_OB); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip); - WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip); + WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; } @@ -2501,7 +2514,7 @@ void CLIP_OT_set_axis(wmOperatorType *ot) ot->poll = set_orientation_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_enum(ot->srna, "axis", axis_actions, 0, "Axis", "Axis to use to align bundle along"); @@ -2551,7 +2564,7 @@ static int do_set_scale(bContext *C, wmOperator *op, int scale_solution) sub_v3_v3(vec[0], vec[1]); - if (len_v3(vec[0])>1e-5f) { + if (len_v3(vec[0]) > 1e-5f) { scale = dist / len_v3(vec[0]); if (tracking_object->flag & TRACKING_OBJECT_CAMERA) { @@ -2561,7 +2574,7 @@ static int do_set_scale(bContext *C, wmOperator *op, int scale_solution) else if (!scale_solution) { Object *solver_camera = object_solver_camera(scene, object); - object->size[0] = object->size[1] = object->size[2] = 1.0f/scale; + object->size[0] = object->size[1] = object->size[2] = 1.0f / scale; if (solver_camera) { object->size[0] /= solver_camera->size[0]; @@ -2578,8 +2591,8 @@ static int do_set_scale(bContext *C, wmOperator *op, int scale_solution) if (object) DAG_id_tag_update(&object->id, OB_RECALC_OB); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip); - WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip); + WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); } return OPERATOR_FINISHED; @@ -2614,7 +2627,7 @@ void CLIP_OT_set_scale(wmOperatorType *ot) ot->poll = set_orientation_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_float(ot->srna, "distance", 0.0f, -FLT_MAX, FLT_MAX, @@ -2666,7 +2679,7 @@ void CLIP_OT_set_solution_scale(wmOperatorType *ot) ot->poll = set_solution_scale_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_float(ot->srna, "distance", 0.0f, -FLT_MAX, FLT_MAX, @@ -2686,10 +2699,10 @@ static int set_center_principal_exec(bContext *C, wmOperator *UNUSED(op)) if (width == 0 || height == 0) return OPERATOR_CANCELLED; - clip->tracking.camera.principal[0] = ((float)width)/2.0f; - clip->tracking.camera.principal[1] = ((float)height)/2.0f; + clip->tracking.camera.principal[0] = ((float)width) / 2.0f; + clip->tracking.camera.principal[1] = ((float)height) / 2.0f; - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); return OPERATOR_FINISHED; } @@ -2706,7 +2719,7 @@ void CLIP_OT_set_center_principal(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** hide tracks operator *********************/ @@ -2745,7 +2758,7 @@ static int hide_tracks_exec(bContext *C, wmOperator *op) BKE_tracking_dopesheet_tag_update(tracking); - WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, NULL); return OPERATOR_FINISHED; } @@ -2762,7 +2775,7 @@ void CLIP_OT_hide_tracks(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected tracks"); @@ -2787,7 +2800,7 @@ static int hide_tracks_clear_exec(bContext *C, wmOperator *UNUSED(op)) BKE_tracking_dopesheet_tag_update(tracking); - WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, NULL); return OPERATOR_FINISHED; } @@ -2804,7 +2817,7 @@ void CLIP_OT_hide_tracks_clear(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** detect features operator *********************/ @@ -2862,7 +2875,7 @@ static int detect_features_exec(bContext *C, wmOperator *op) IMB_freeImBuf(ibuf); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -2886,7 +2899,7 @@ void CLIP_OT_detect_features(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_frame_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_enum(ot->srna, "placement", placement_items, 0, "Placement", "Placement for detected features"); @@ -2914,8 +2927,8 @@ static int frame_jump_exec(bContext *C, wmOperator *op) delta = pos == 1 ? 1 : -1; - while (sc->user.framenr+delta >= SFRA && sc->user.framenr+delta <= EFRA) { - MovieTrackingMarker *marker = BKE_tracking_exact_marker(track, sc->user.framenr+delta); + while (sc->user.framenr + delta >= SFRA && sc->user.framenr + delta <= EFRA) { + MovieTrackingMarker *marker = BKE_tracking_exact_marker(track, sc->user.framenr + delta); if (!marker || marker->flag & MARKER_DISABLED) break; @@ -2933,7 +2946,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op) a += delta; - while (a+delta >= SFRA && a+delta <= EFRA) { + while (a + delta >= SFRA && a + delta <= EFRA) { MovieReconstructedCamera *cam; cam = BKE_tracking_get_reconstructed_camera(tracking, object, a); @@ -2953,10 +2966,10 @@ static int frame_jump_exec(bContext *C, wmOperator *op) CFRA = sc->user.framenr; sound_seek_scene(CTX_data_main(C), CTX_data_scene(C)); - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); } - WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, NULL); return OPERATOR_FINISHED; } @@ -2981,7 +2994,7 @@ void CLIP_OT_frame_jump(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_enum(ot->srna, "position", position_items, 0, "Position", "Position to jump to"); @@ -3021,7 +3034,7 @@ static int join_tracks_exec(bContext *C, wmOperator *op) track = next; } - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); return OPERATOR_FINISHED; } @@ -3038,7 +3051,7 @@ void CLIP_OT_join_tracks(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_size_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** lock tracks operator *********************/ @@ -3064,7 +3077,7 @@ static int lock_tracks_exec(bContext *C, wmOperator *op) track = track->next; } - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip); return OPERATOR_FINISHED; } @@ -3088,7 +3101,7 @@ void CLIP_OT_lock_tracks(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Lock action to execute"); @@ -3121,7 +3134,7 @@ static int track_copy_color_exec(bContext *C, wmOperator *UNUSED(op)) track = track->next; } - WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip); return OPERATOR_FINISHED; } @@ -3138,7 +3151,7 @@ void CLIP_OT_track_copy_color(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** add 2d stabilization tracks operator *********************/ @@ -3155,7 +3168,7 @@ static int stabilize_2d_add_exec(bContext *C, wmOperator *UNUSED(op)) track = tracksbase->first; while (track) { - if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_USE_2D_STAB)==0) { + if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_USE_2D_STAB) == 0) { track->flag |= TRACK_USE_2D_STAB; stab->tot_track++; @@ -3169,7 +3182,7 @@ static int stabilize_2d_add_exec(bContext *C, wmOperator *UNUSED(op)) stab->ok = 0; DAG_id_tag_update(&clip->id, 0); - WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip); } return OPERATOR_FINISHED; @@ -3187,7 +3200,7 @@ void CLIP_OT_stabilize_2d_add(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** remove 2d stabilization tracks operator *********************/ @@ -3211,7 +3224,7 @@ static int stabilize_2d_remove_exec(bContext *C, wmOperator *UNUSED(op)) stab->act_track--; stab->tot_track--; - if (stab->act_track<0) + if (stab->act_track < 0) stab->act_track = 0; update = 1; @@ -3229,7 +3242,7 @@ static int stabilize_2d_remove_exec(bContext *C, wmOperator *UNUSED(op)) stab->ok = 0; DAG_id_tag_update(&clip->id, 0); - WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip); } return OPERATOR_FINISHED; @@ -3247,7 +3260,7 @@ void CLIP_OT_stabilize_2d_remove(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** select 2d stabilization tracks operator *********************/ @@ -3273,7 +3286,7 @@ static int stabilize_2d_select_exec(bContext *C, wmOperator *UNUSED(op)) } if (update) - WM_event_add_notifier(C, NC_MOVIECLIP|ND_SELECT, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | ND_SELECT, clip); return OPERATOR_FINISHED; } @@ -3290,7 +3303,7 @@ void CLIP_OT_stabilize_2d_select(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** set 2d stabilization rotation track operator *********************/ @@ -3309,7 +3322,7 @@ static int stabilize_2d_set_rotation_exec(bContext *C, wmOperator *UNUSED(op)) stab->ok = 0; DAG_id_tag_update(&clip->id, 0); - WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip); } return OPERATOR_FINISHED; @@ -3327,7 +3340,7 @@ void CLIP_OT_stabilize_2d_set_rotation(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** clean tracks operator *********************/ @@ -3342,30 +3355,30 @@ static int is_track_clean(MovieTrackingTrack *track, int frames, int del) if (del) new_markers = MEM_callocN(markersnr*sizeof(MovieTrackingMarker), "track cleaned markers"); - for (a = 0; a<markersnr; a++) { + for (a = 0; a < markersnr; a++) { int end = 0; if (prev == -1) { - if ((markers[a].flag & MARKER_DISABLED)==0) + if ((markers[a].flag & MARKER_DISABLED) == 0) prev = a; else start_disabled = 1; } if (prev >= 0) { - end = a == markersnr-1; - end |= (a < markersnr-1) && (markers[a].framenr != markers[a+1].framenr-1 || - markers[a].flag & MARKER_DISABLED); + end = a == markersnr - 1; + end |= (a < markersnr - 1) && (markers[a].framenr != markers[a + 1].framenr - 1 || + markers[a].flag & MARKER_DISABLED); } if (end) { int segok = 1, len = 0; - if (a != prev && markers[a].framenr != markers[a-1].framenr+1) - len = a-prev; + if (a != prev && markers[a].framenr != markers[a - 1].framenr + 1) + len = a - prev; else if (markers[a].flag & MARKER_DISABLED) - len = a-prev; - else len = a-prev+1; + len = a - prev; + else len = a - prev + 1; if (frames) { if (len < frames) { @@ -3386,7 +3399,7 @@ static int is_track_clean(MovieTrackingTrack *track, int frames, int del) /* place disabled marker in front of current segment */ if (start_disabled) { - memcpy(new_markers+count, markers+prev, sizeof(MovieTrackingMarker)); + memcpy(new_markers + count, markers + prev, sizeof(MovieTrackingMarker)); new_markers[count].framenr--; new_markers[count].flag |= MARKER_DISABLED; @@ -3394,7 +3407,7 @@ static int is_track_clean(MovieTrackingTrack *track, int frames, int del) start_disabled = 0; } - memcpy(new_markers+count, markers+prev, t*sizeof(MovieTrackingMarker)); + memcpy(new_markers + count, markers + prev, t * sizeof(MovieTrackingMarker)); count += t; } else if (markers[a].flag & MARKER_DISABLED) { @@ -3443,11 +3456,11 @@ static int clean_tracks_exec(bContext *C, wmOperator *op) while (track) { next = track->next; - if ((track->flag & TRACK_HIDDEN)==0 && (track->flag & TRACK_LOCKED)==0) { + if ((track->flag & TRACK_HIDDEN) == 0 && (track->flag & TRACK_LOCKED) == 0) { int ok = 1; ok = (is_track_clean(track, frames, action == TRACKING_CLEAN_DELETE_SEGMENT)) && - (error == 0.0f || (track->flag & TRACK_HAS_BUNDLE)==0 || track->error < error); + (error == 0.0f || (track->flag & TRACK_HAS_BUNDLE) == 0 || track->error < error); if (!ok) { if (action == TRACKING_CLEAN_SELECT) { @@ -3476,7 +3489,7 @@ static int clean_tracks_exec(bContext *C, wmOperator *op) track = next; } - WM_event_add_notifier(C, NC_MOVIECLIP|ND_SELECT, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | ND_SELECT, clip); return OPERATOR_FINISHED; } @@ -3503,7 +3516,7 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot) static EnumPropertyItem actions_items[] = { {TRACKING_CLEAN_SELECT, "SELECT", 0, "Select", "Select unclean tracks"}, {TRACKING_CLEAN_DELETE_TRACK, "DELETE_TRACK", 0, "Delete Track", "Delete unclean tracks"}, - {TRACKING_CLEAN_DELETE_SEGMENT, "DELETE_SEGMENTS", 0, "Delete Segments", "Delete unclean segments of tracks"}, + {TRACKING_CLEAN DELETE_SEGMENT, "DELETE_SEGMENTS", 0, "Delete Segments", "Delete unclean segments of tracks"}, {0, NULL, 0, NULL, NULL} }; @@ -3518,7 +3531,7 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_int(ot->srna, "frames", 0, 0, INT_MAX, "Tracked Frames", @@ -3538,7 +3551,7 @@ static int tracking_object_new_exec(bContext *C, wmOperator *UNUSED(op)) BKE_tracking_new_object(tracking, "Object"); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); return OPERATOR_FINISHED; } @@ -3555,7 +3568,7 @@ void CLIP_OT_tracking_object_new(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** remove tracking object *********************/ @@ -3576,7 +3589,7 @@ static int tracking_object_remove_exec(bContext *C, wmOperator *op) BKE_tracking_remove_object(tracking, object); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); return OPERATOR_FINISHED; } @@ -3593,7 +3606,7 @@ void CLIP_OT_tracking_object_remove(wmOperatorType *ot) ot->poll = ED_space_clip_tracking_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /********************** copy tracks to clipboard operator *********************/ @@ -3647,7 +3660,7 @@ static int paste_tracks_exec(bContext *C, wmOperator *UNUSED(op)) BKE_tracking_clipboard_paste_tracks(tracking, object); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); return OPERATOR_FINISHED; } @@ -3664,5 +3677,5 @@ void CLIP_OT_paste_tracks(wmOperatorType *ot) ot->poll = paste_tracks_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } |