Style cleanup of own modules using style checker from Campbell.

This commit is contained in:
Sergey Sharybin 2012-05-07 08:53:59 +00:00
parent 3ef11693f5
commit c79892c5cd
16 changed files with 871 additions and 697 deletions

File diff suppressed because it is too large Load Diff

@ -484,7 +484,8 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, int flipnormal)
dl = dl->next; dl = dl->next;
} }
if (totvert && (tot = BLI_scanfill_calc(&sf_ctx, FALSE))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { /* XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { */
if (totvert && (tot = BLI_scanfill_calc(&sf_ctx, FALSE))) {
if (tot) { if (tot) {
dlnew = MEM_callocN(sizeof(DispList), "filldisplist"); dlnew = MEM_callocN(sizeof(DispList), "filldisplist");
dlnew->type = DL_INDEX3; dlnew->type = DL_INDEX3;
@ -743,7 +744,8 @@ static ModifierData *curve_get_tessellate_point(Scene *scene, Object *ob, int fo
return pretessellatePoint; return pretessellatePoint;
} }
static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, float (**originalVerts_r)[3], float (**deformedVerts_r)[3], int *numVerts_r) static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, float (**originalVerts_r)[3],
float (**deformedVerts_r)[3], int *numVerts_r)
{ {
ModifierData *md = modifiers_getVirtualModifierList(ob); ModifierData *md = modifiers_getVirtualModifierList(ob);
ModifierData *pretessellatePoint; ModifierData *pretessellatePoint;
@ -1412,7 +1414,8 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
/* CU_2D conflicts with R_NOPUNOFLIP */ /* CU_2D conflicts with R_NOPUNOFLIP */
dl->rt = nu->flag & ~CU_2D; dl->rt = nu->flag & ~CU_2D;
dl->bevelSplitFlag = MEM_callocN(sizeof(*dl->col2) * ((steps + 0x1F) >> 5), "bevelSplitFlag"); dl->bevelSplitFlag = MEM_callocN(sizeof(*dl->col2) * ((steps + 0x1F) >> 5),
"bevelSplitFlag");
/* for each point of poly make a bevel piece */ /* for each point of poly make a bevel piece */
bevp = (BevPoint *)(bl + 1) + start; bevp = (BevPoint *)(bl + 1) + start;

@ -635,7 +635,8 @@ static ImBuf *get_postprocessed_cached_frame(MovieClip *clip, MovieClipUser *use
return cache->postprocessed.ibuf; return cache->postprocessed.ibuf;
} }
static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, int flag, int postprocess_flag) static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf,
int flag, int postprocess_flag)
{ {
MovieClipCache *cache = clip->cache; MovieClipCache *cache = clip->cache;
MovieTrackingCamera *camera = &clip->tracking.camera; MovieTrackingCamera *camera = &clip->tracking.camera;
@ -851,7 +852,8 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user
return stableibuf; return stableibuf;
} }
ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float loc[2], float *scale, float *angle, int postprocess_flag) ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float loc[2], float *scale, float *angle,
int postprocess_flag)
{ {
ImBuf *ibuf, *stableibuf = NULL; ImBuf *ibuf, *stableibuf = NULL;
int framenr = user->framenr; int framenr = user->framenr;

@ -166,11 +166,11 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
/* search shouldn't be moved inside pattern */ /* search shouldn't be moved inside pattern */
if (track->search_min[a] > pat_min[a]) { if (track->search_min[a] > pat_min[a]) {
track->search_min[a] = pat_min[a]; track->search_min[a] = pat_min[a];
track->search_max[a] = track->search_min[a]+dim[a]; track->search_max[a] = track->search_min[a] + dim[a];
} }
if (track->search_max[a] < pat_max[a]) { if (track->search_max[a] < pat_max[a]) {
track->search_max[a] = pat_max[a]; track->search_max[a] = pat_max[a];
track->search_min[a] = track->search_max[a]-dim[a]; track->search_min[a] = track->search_max[a] - dim[a];
} }
} }
} }
@ -196,8 +196,8 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
sub_v2_v2v2(dim, track->pat_max, track->pat_min); sub_v2_v2v2(dim, track->pat_max, track->pat_min);
for (a = 0; a < 2; a++) { for (a = 0; a < 2; a++) {
track->pat_min[a] = -dim[a]/2.0f; track->pat_min[a] = -dim[a] / 2.0f;
track->pat_max[a] = dim[a]/2.0f; track->pat_max[a] = dim[a] / 2.0f;
} }
} }
} }
@ -302,8 +302,9 @@ MovieTrackingMarker *BKE_tracking_insert_marker(MovieTrackingTrack *track, Movie
else else
track->markers = MEM_callocN(sizeof(MovieTrackingMarker), "MovieTracking markers"); track->markers = MEM_callocN(sizeof(MovieTrackingMarker), "MovieTracking markers");
memmove(track->markers+a+2, track->markers+a+1, (track->markersnr-a-2)*sizeof(MovieTrackingMarker)); memmove(track->markers + a + 2, track->markers + a + 1,
track->markers[a+1] = *marker; (track->markersnr - a - 2) * sizeof(MovieTrackingMarker));
track->markers[a + 1] = *marker;
track->last_marker = a + 1; track->last_marker = a + 1;
@ -315,12 +316,13 @@ void BKE_tracking_delete_marker(MovieTrackingTrack *track, int framenr)
{ {
int a = 0; int a = 0;
while (a<track->markersnr) { while (a < track->markersnr) {
if (track->markers[a].framenr == framenr) { if (track->markers[a].framenr == framenr) {
if (track->markersnr > 1) { if (track->markersnr > 1) {
memmove(track->markers+a, track->markers+a+1, (track->markersnr-a-1)*sizeof(MovieTrackingMarker)); memmove(track->markers + a, track->markers + a + 1,
(track->markersnr - a - 1) * sizeof(MovieTrackingMarker));
track->markersnr--; track->markersnr--;
track->markers = MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr); track->markers = MEM_reallocN(track->markers, sizeof(MovieTrackingMarker) * track->markersnr);
} }
else { else {
MEM_freeN(track->markers); MEM_freeN(track->markers);
@ -337,7 +339,7 @@ void BKE_tracking_delete_marker(MovieTrackingTrack *track, int framenr)
MovieTrackingMarker *BKE_tracking_get_marker(MovieTrackingTrack *track, int framenr) MovieTrackingMarker *BKE_tracking_get_marker(MovieTrackingTrack *track, int framenr)
{ {
int a = track->markersnr-1; int a = track->markersnr - 1;
if (!track->markersnr) if (!track->markersnr)
return NULL; return NULL;
@ -360,7 +362,7 @@ MovieTrackingMarker *BKE_tracking_get_marker(MovieTrackingTrack *track, int fram
} }
/* if there's no marker for exact position, use nearest marker from left side */ /* if there's no marker for exact position, use nearest marker from left side */
return &track->markers[a-1]; return &track->markers[a - 1];
} }
else { else {
while (a >= 0 && track->markers[a].framenr >= framenr) { while (a >= 0 && track->markers[a].framenr >= framenr) {
@ -461,16 +463,16 @@ void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame, int actio
} }
if (track->markersnr) if (track->markersnr)
put_disabled_marker(track, &track->markers[track->markersnr-1], 0, 1); put_disabled_marker(track, &track->markers[track->markersnr - 1], 0, 1);
} }
else if (action == TRACK_CLEAR_UPTO) { else if (action == TRACK_CLEAR_UPTO) {
a = track->markersnr-1; a = track->markersnr - 1;
while (a >= 0) { while (a >= 0) {
if (track->markers[a].framenr <= ref_frame) { if (track->markers[a].framenr <= ref_frame) {
memmove(track->markers, track->markers+a, (track->markersnr-a)*sizeof(MovieTrackingMarker)); memmove(track->markers, track->markers + a, (track->markersnr - a) * sizeof(MovieTrackingMarker));
track->markersnr = track->markersnr-a; track->markersnr = track->markersnr - a;
track->markers = MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr); track->markers = MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
break; break;
@ -521,8 +523,8 @@ void BKE_tracking_join_tracks(MovieTrackingTrack *dst_track, MovieTrackingTrack
markers[i] = dst_track->markers[b++]; markers[i] = dst_track->markers[b++];
} }
else { else {
if ((src_track->markers[a].flag & MARKER_DISABLED)==0) { if ((src_track->markers[a].flag & MARKER_DISABLED) == 0) {
if ((dst_track->markers[b].flag & MARKER_DISABLED)==0) { if ((dst_track->markers[b].flag & MARKER_DISABLED) == 0) {
/* both tracks are enabled on this frame, so find the whole segment /* both tracks are enabled on this frame, so find the whole segment
* on which tracks are intersecting and blend tracks using linear * on which tracks are intersecting and blend tracks using linear
* interpolation to prevent jumps */ * interpolation to prevent jumps */
@ -532,8 +534,8 @@ void BKE_tracking_join_tracks(MovieTrackingTrack *dst_track, MovieTrackingTrack
int j, inverse = 0; int j, inverse = 0;
inverse = (b == 0) || inverse = (b == 0) ||
(dst_track->markers[b-1].flag & MARKER_DISABLED) || (dst_track->markers[b - 1].flag & MARKER_DISABLED) ||
(dst_track->markers[b-1].framenr != frame - 1); (dst_track->markers[b - 1].framenr != frame - 1);
/* find length of intersection */ /* find length of intersection */
while (a < src_track->markersnr && b < dst_track->markersnr) { while (a < src_track->markersnr && b < dst_track->markersnr) {
@ -969,7 +971,7 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
/* count */ /* count */
track = tracksbase->first; track = tracksbase->first;
while (track) { while (track) {
if (TRACK_SELECTED(track) && (track->flag & (TRACK_LOCKED | TRACK_HIDDEN))==0) { if (TRACK_SELECTED(track) && (track->flag & (TRACK_LOCKED | TRACK_HIDDEN)) == 0) {
MovieTrackingMarker *marker = BKE_tracking_get_marker(track, user->framenr); MovieTrackingMarker *marker = BKE_tracking_get_marker(track, user->framenr);
if ((marker->flag & MARKER_DISABLED) == 0) if ((marker->flag & MARKER_DISABLED) == 0)
@ -1000,13 +1002,13 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
#ifdef WITH_LIBMV #ifdef WITH_LIBMV
{ {
float patx = (int)((track->pat_max[0]-track->pat_min[0])*width), float patx = (int)((track->pat_max[0] - track->pat_min[0]) * width),
paty = (int)((track->pat_max[1]-track->pat_min[1])*height); paty = (int)((track->pat_max[1] - track->pat_min[1]) * height);
float search_size_x = (track->search_max[0]-track->search_min[0])*width; float search_size_x = (track->search_max[0] - track->search_min[0]) * width;
float search_size_y = (track->search_max[1]-track->search_min[1])*height; float search_size_y = (track->search_max[1] - track->search_min[1]) * height;
float pattern_size_x = (track->pat_max[0]-track->pat_min[0])*width; float pattern_size_x = (track->pat_max[0] - track->pat_min[0]) * width;
float pattern_size_y = (track->pat_max[1]-track->pat_min[1])*height; float pattern_size_y = (track->pat_max[1] - track->pat_min[1]) * height;
int wndx = (int)patx / 2, wndy = (int)paty / 2; int wndx = (int)patx / 2, wndy = (int)paty / 2;
int half_wnd = MAX2(wndx, wndy); int half_wnd = MAX2(wndx, wndy);
@ -1021,17 +1023,20 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
* than the search size */ * than the search size */
int level = MIN2(track->pyramid_levels, max_pyramid_levels); int level = MIN2(track->pyramid_levels, max_pyramid_levels);
struct libmv_RegionTracker *region_tracker;
if (track->tracker == TRACKER_KLT) { if (track->tracker == TRACKER_KLT) {
track_context.region_tracker = region_tracker = libmv_pyramidRegionTrackerNew(100, level, half_wnd,
libmv_pyramidRegionTrackerNew(100, level, half_wnd, track->minimum_correlation); track->minimum_correlation);
} }
else if (track->tracker == TRACKER_HYBRID) { else if (track->tracker == TRACKER_HYBRID) {
track_context.region_tracker = region_tracker = libmv_hybridRegionTrackerNew(100, half_wnd, track->minimum_correlation);
libmv_hybridRegionTrackerNew(100, half_wnd, track->minimum_correlation);
} }
else if (track->tracker == TRACKER_SAD) { else if (track->tracker == TRACKER_SAD) {
track_context.region_tracker = libmv_bruteRegionTrackerNew(MAX2(wndx, wndy), track->minimum_correlation); region_tracker = libmv_bruteRegionTrackerNew(MAX2(wndx, wndy), track->minimum_correlation);
} }
track_context.region_tracker = region_tracker;
} }
#endif #endif
@ -1094,7 +1099,8 @@ void BKE_tracking_context_free(MovieTrackingContext *context)
/* zap channels from the imbuf that are disabled by the user. this can lead to /* zap channels from the imbuf that are disabled by the user. this can lead to
* better tracks sometimes. however, instead of simply zeroing the channels * better tracks sometimes. however, instead of simply zeroing the channels
* out, do a partial grayscale conversion so the display is better. */ * out, do a partial grayscale conversion so the display is better. */
void BKE_tracking_disable_imbuf_channels(ImBuf *ibuf, int disable_red, int disable_green, int disable_blue, int grayscale) void BKE_tracking_disable_imbuf_channels(ImBuf *ibuf, int disable_red, int disable_green, int disable_blue,
int grayscale)
{ {
int x, y; int x, y;
float scale; float scale;
@ -1181,13 +1187,13 @@ static ImBuf *get_area_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTracki
h = (max[1] - min[1]) * ibuf->y; h = (max[1] - min[1]) * ibuf->y;
/* dimensions should be odd */ /* dimensions should be odd */
w = w|1; w = w | 1;
h = h|1; h = h | 1;
x1 = x-(int)(w * (-min[0] / (max[0] - min[0]))); x1 = x - (int)(w * (-min[0] / (max[0] - min[0])));
y1 = y-(int)(h * (-min[1] / (max[1] - min[1]))); y1 = y - (int)(h * (-min[1] / (max[1] - min[1])));
tmpibuf = IMB_allocImBuf(w+margin*2, h+margin*2, 32, IB_rect); tmpibuf = IMB_allocImBuf(w + margin * 2, h + margin * 2, 32, IB_rect);
IMB_rectcpy(tmpibuf, ibuf, 0, 0, x1 - margin, y1 - margin, w + margin * 2, h + margin * 2); IMB_rectcpy(tmpibuf, ibuf, 0, 0, x1 - margin, y1 - margin, w + margin * 2, h + margin * 2);
if (pos != NULL) { if (pos != NULL) {
@ -1310,17 +1316,17 @@ static ImBuf *get_keyframed_ibuf(MovieTrackingContext *context, MovieTrackingTra
MovieTrackingMarker *marker, MovieTrackingMarker **marker_keyed) MovieTrackingMarker *marker, MovieTrackingMarker **marker_keyed)
{ {
int framenr = marker->framenr; int framenr = marker->framenr;
int a = marker-track->markers; int a = marker - track->markers;
*marker_keyed = marker; *marker_keyed = marker;
while (a >= 0 && a < track->markersnr) { while (a >= 0 && a < track->markersnr) {
int next = (context->backwards) ? a+1 : a-1; int next = (context->backwards) ? a + 1 : a - 1;
int is_keyframed = FALSE; int is_keyframed = FALSE;
MovieTrackingMarker *cur_marker = &track->markers[a]; MovieTrackingMarker *cur_marker = &track->markers[a];
MovieTrackingMarker *next_marker = NULL; MovieTrackingMarker *next_marker = NULL;
if (next>=0 && next<track->markersnr) if (next >= 0 && next < track->markersnr)
next_marker = &track->markers[next]; next_marker = &track->markers[next];
/* if next mrker is disabled, stop searching keyframe and use current frame as keyframe */ /* if next mrker is disabled, stop searching keyframe and use current frame as keyframe */
@ -1442,8 +1448,8 @@ int BKE_tracking_next(MovieTrackingContext *context)
margin[1] = MAX2(margin[1], (float)track->margin / ibuf_new->y); margin[1] = MAX2(margin[1], (float)track->margin / ibuf_new->y);
/* do not track markers which are too close to boundary */ /* do not track markers which are too close to boundary */
if (marker->pos[0]<margin[0] || marker->pos[0]>1.0f-margin[0] || if (marker->pos[0] < margin[0] || marker->pos[0] > 1.0f - margin[0] ||
marker->pos[1]<margin[1] || marker->pos[1]>1.0f-margin[1]) marker->pos[1] < margin[1] || marker->pos[1] > 1.0f - margin[1])
{ {
onbound = TRUE; onbound = TRUE;
} }
@ -1669,7 +1675,8 @@ static int retrieve_libmv_reconstruct_tracks(MovieReconstructContext *context, M
reconstruction->camnr = 0; reconstruction->camnr = 0;
reconstruction->cameras = NULL; reconstruction->cameras = NULL;
reconstructed = MEM_callocN((efra-sfra+1)*sizeof(MovieReconstructedCamera), "temp reconstructed camera"); reconstructed = MEM_callocN((efra - sfra + 1) * sizeof(MovieReconstructedCamera),
"temp reconstructed camera");
for (a = sfra; a <= efra; a++) { for (a = sfra; a <= efra; a++) {
double matd[4][4]; double matd[4][4];
@ -1704,8 +1711,9 @@ static int retrieve_libmv_reconstruct_tracks(MovieReconstructContext *context, M
} }
if (reconstruction->camnr) { if (reconstruction->camnr) {
reconstruction->cameras = MEM_callocN(reconstruction->camnr * sizeof(MovieReconstructedCamera), "reconstructed camera"); int size = reconstruction->camnr * sizeof(MovieReconstructedCamera);
memcpy(reconstruction->cameras, reconstructed, reconstruction->camnr * sizeof(MovieReconstructedCamera)); reconstruction->cameras = MEM_callocN(size, "reconstructed camera");
memcpy(reconstruction->cameras, reconstructed, size);
} }
if (origin_set) { if (origin_set) {
@ -1783,7 +1791,8 @@ int BKE_tracking_can_reconstruct(MovieTracking *tracking, MovieTrackingObject *o
return TRUE; return TRUE;
} }
else if (count_tracks_on_both_keyframes(tracking, tracksbase) < 8) { else if (count_tracks_on_both_keyframes(tracking, tracksbase) < 8) {
BLI_strncpy(error_msg, "At least 8 common tracks on both of keyframes are needed for reconstruction", error_size); BLI_strncpy(error_msg, "At least 8 common tracks on both of keyframes are needed for reconstruction",
error_size);
return FALSE; return FALSE;
} }
@ -1818,7 +1827,7 @@ MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *
track = tracksbase->first; track = tracksbase->first;
while (track) { while (track) {
int first = 0, last = track->markersnr-1; int first = 0, last = track->markersnr - 1;
MovieTrackingMarker *first_marker = &track->markers[0]; MovieTrackingMarker *first_marker = &track->markers[0];
MovieTrackingMarker *last_marker = &track->markers[track->markersnr - 1]; MovieTrackingMarker *last_marker = &track->markers[track->markersnr - 1];
@ -1834,7 +1843,7 @@ MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *
last_marker--; last_marker--;
} }
if (first<track->markersnr - 1) if (first < track->markersnr - 1)
sfra = MIN2(sfra, first_marker->framenr); sfra = MIN2(sfra, first_marker->framenr);
if (last >= 0) if (last >= 0)
@ -2010,21 +2019,21 @@ static int reconstruction_camera_index(MovieTrackingReconstruction *reconstructi
if (!reconstruction->camnr) if (!reconstruction->camnr)
return -1; return -1;
if (framenr<cameras[0].framenr) { if (framenr < cameras[0].framenr) {
if (nearest) if (nearest)
return 0; return 0;
else else
return -1; return -1;
} }
if (framenr>cameras[reconstruction->camnr - 1].framenr) { if (framenr > cameras[reconstruction->camnr - 1].framenr) {
if (nearest) if (nearest)
return reconstruction->camnr - 1; return reconstruction->camnr - 1;
else else
return -1; return -1;
} }
if (reconstruction->last_camera<reconstruction->camnr) if (reconstruction->last_camera < reconstruction->camnr)
a = reconstruction->last_camera; a = reconstruction->last_camera;
if (cameras[a].framenr >= framenr) if (cameras[a].framenr >= framenr)
@ -2106,9 +2115,9 @@ void BKE_tracking_get_interpolated_camera(MovieTracking *tracking, MovieTracking
} }
if (cameras[a].framenr != framenr && a > 0 && a < reconstruction->camnr - 1) { if (cameras[a].framenr != framenr && a > 0 && a < reconstruction->camnr - 1) {
float t = ((float)framenr-cameras[a].framenr) / (cameras[a + 1].framenr-cameras[a].framenr); float t = ((float)framenr - cameras[a].framenr) / (cameras[a + 1].framenr - cameras[a].framenr);
blend_m4_m4m4(mat, cameras[a].mat, cameras[a+1].mat, t); blend_m4_m4m4(mat, cameras[a].mat, cameras[a + 1].mat, t);
} }
else { else {
copy_m4_m4(mat, cameras[a].mat); copy_m4_m4(mat, cameras[a].mat);
@ -2135,8 +2144,8 @@ void BKE_get_tracking_mat(Scene *scene, Object *ob, float mat[4][4])
void BKE_tracking_camera_shift(MovieTracking *tracking, int winx, int winy, float *shiftx, float *shifty) void BKE_tracking_camera_shift(MovieTracking *tracking, int winx, int winy, float *shiftx, float *shifty)
{ {
/* indeed in both of cases it should be winx -- it's just how camera shift works for blender's camera */ /* indeed in both of cases it should be winx -- it's just how camera shift works for blender's camera */
*shiftx = (0.5f * winx-tracking->camera.principal[0]) / winx; *shiftx = (0.5f * winx - tracking->camera.principal[0]) / winx;
*shifty = (0.5f * winy-tracking->camera.principal[1]) / winx; *shifty = (0.5f * winy - tracking->camera.principal[1]) / winx;
} }
void BKE_tracking_camera_to_blender(MovieTracking *tracking, Scene *scene, Camera *camera, int width, int height) void BKE_tracking_camera_to_blender(MovieTracking *tracking, Scene *scene, Camera *camera, int width, int height)
@ -2145,9 +2154,9 @@ void BKE_tracking_camera_to_blender(MovieTracking *tracking, Scene *scene, Camer
camera->sensor_x = tracking->camera.sensor_width; camera->sensor_x = tracking->camera.sensor_width;
camera->sensor_fit = CAMERA_SENSOR_FIT_AUTO; camera->sensor_fit = CAMERA_SENSOR_FIT_AUTO;
camera->lens = focal*camera->sensor_x/width; camera->lens = focal * camera->sensor_x / width;
scene->r.xsch = width*tracking->camera.pixel_aspect; scene->r.xsch = width * tracking->camera.pixel_aspect;
scene->r.ysch = height; scene->r.ysch = height;
scene->r.xasp = 1.0f; scene->r.xasp = 1.0f;
@ -2160,7 +2169,7 @@ void BKE_tracking_projection_matrix(MovieTracking *tracking, MovieTrackingObject
int framenr, int winx, int winy, float mat[4][4]) int framenr, int winx, int winy, float mat[4][4])
{ {
MovieReconstructedCamera *camera; MovieReconstructedCamera *camera;
float lens = tracking->camera.focal*tracking->camera.sensor_width/(float)winx; float lens = tracking->camera.focal * tracking->camera.sensor_width / (float)winx;
float viewfac, pixsize, left, right, bottom, top, clipsta, clipend; float viewfac, pixsize, left, right, bottom, top, clipsta, clipend;
float winmat[4][4]; float winmat[4][4];
float ycor = 1.0f / tracking->camera.pixel_aspect; float ycor = 1.0f / tracking->camera.pixel_aspect;
@ -2172,11 +2181,11 @@ void BKE_tracking_projection_matrix(MovieTracking *tracking, MovieTrackingObject
clipend = 1000.0f; clipend = 1000.0f;
if (winx >= winy) if (winx >= winy)
viewfac = (lens*winx)/tracking->camera.sensor_width; viewfac = (lens * winx) / tracking->camera.sensor_width;
else else
viewfac = (ycor*lens*winy)/tracking->camera.sensor_width; viewfac = (ycor * lens * winy) / tracking->camera.sensor_width;
pixsize = clipsta/viewfac; pixsize = clipsta / viewfac;
left = -0.5f * (float)winx + shiftx * winside; left = -0.5f * (float)winx + shiftx * winside;
bottom = -0.5f * (ycor) * (float)winy + shifty * winside; bottom = -0.5f * (ycor) * (float)winy + shifty * winside;
@ -2278,7 +2287,7 @@ void BKE_tracking_apply_intrinsics(MovieTracking *tracking, float co[2], float n
#ifdef WITH_LIBMV #ifdef WITH_LIBMV
double x, y; double x, y;
float aspy = 1.0f/tracking->camera.pixel_aspect; float aspy = 1.0f / tracking->camera.pixel_aspect;
/* normalize coords */ /* normalize coords */
x = (co[0] - camera->principal[0]) / camera->focal; x = (co[0] - camera->principal[0]) / camera->focal;
@ -2326,7 +2335,7 @@ static int point_in_stroke(bGPDstroke *stroke, float x, float y)
prev = stroke->totpoints - 1; prev = stroke->totpoints - 1;
for (i = 0; i<stroke->totpoints; i++) { for (i = 0; i < stroke->totpoints; i++) {
if ((points[i].y < y && points[prev].y >= y) || (points[prev].y < y && points[i].y >= y)) { if ((points[i].y < y && points[prev].y >= y) || (points[prev].y < y && points[i].y >= y)) {
float fac = (y - points[i].y) / (points[prev].y - points[i].y); float fac = (y - points[i].y) / (points[prev].y - points[i].y);
@ -2507,7 +2516,7 @@ static void calculate_stabdata(MovieTracking *tracking, int framenr, float width
b[0] *= width; b[0] *= width;
b[1] *= height; b[1] *= height;
*angle = -atan2(a[0]*b[1]-a[1]*b[0], a[0]*b[0]+a[1]*b[1]); *angle = -atan2(a[0] * b[1] - a[1] * b[0], a[0] * b[0] + a[1] * b[1]);
*angle *= stab->rotinf; *angle *= stab->rotinf;
/* convert to rotation around image center */ /* convert to rotation around image center */
@ -2563,10 +2572,10 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
int j; int j;
float a[3] = {0.0f, 0.0f, 0.0f}, b[3]= {0.0f, 0.0f, 0.0f}; float a[3] = {0.0f, 0.0f, 0.0f}, b[3] = {0.0f, 0.0f, 0.0f};
copy_v3_v3(a, points[i]); copy_v3_v3(a, points[i]);
copy_v3_v3(b, points[(i+1)%4]); copy_v3_v3(b, points[(i + 1) % 4]);
mul_m4_v3(mat, a); mul_m4_v3(mat, a);
mul_m4_v3(mat, b); mul_m4_v3(mat, b);
@ -2622,7 +2631,7 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width,
stab->scale = scale; stab->scale = scale;
if (stab->maxscale>0.0f) if (stab->maxscale > 0.0f)
stab->scale = MIN2(stab->scale, stab->maxscale); stab->scale = MIN2(stab->scale, stab->maxscale);
} }
else { else {
@ -2663,7 +2672,8 @@ static ImBuf* stabilize_alloc_ibuf(ImBuf *cacheibuf, ImBuf *srcibuf, int fill)
return cacheibuf; return cacheibuf;
} }
void BKE_tracking_stabilization_data(MovieTracking *tracking, int framenr, int width, int height, float loc[2], float *scale, float *angle) void BKE_tracking_stabilization_data(MovieTracking *tracking, int framenr, int width, int height,
float loc[2], float *scale, float *angle)
{ {
float firstmedian[2], median[2]; float firstmedian[2], median[2];
MovieTrackingStabilization *stab = &tracking->stabilization; MovieTrackingStabilization *stab = &tracking->stabilization;
@ -2701,7 +2711,8 @@ void BKE_tracking_stabilization_data(MovieTracking *tracking, int framenr, int w
} }
} }
ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf, float loc[2], float *scale, float *angle) ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf,
float loc[2], float *scale, float *angle)
{ {
float tloc[2], tscale, tangle; float tloc[2], tscale, tangle;
MovieTrackingStabilization *stab = &tracking->stabilization; MovieTrackingStabilization *stab = &tracking->stabilization;
@ -2798,10 +2809,11 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf,
return tmpibuf; return tmpibuf;
} }
void BKE_tracking_stabdata_to_mat4(int width, int height, float aspect, float loc[2], float scale, float angle, float mat[4][4]) void BKE_tracking_stabdata_to_mat4(int width, int height, float aspect,
float loc[2], float scale, float angle, float mat[4][4])
{ {
float lmat[4][4], rmat[4][4], smat[4][4], cmat[4][4], icmat[4][4], amat[4][4], iamat[4][4]; float lmat[4][4], rmat[4][4], smat[4][4], cmat[4][4], icmat[4][4], amat[4][4], iamat[4][4];
float svec[3]= {scale, scale, scale}; float svec[3] = {scale, scale, scale};
unit_m4(rmat); unit_m4(rmat);
unit_m4(lmat); unit_m4(lmat);
@ -3013,7 +3025,7 @@ void BKE_tracking_remove_object(MovieTracking *tracking, MovieTrackingObject *ob
MovieTrackingTrack *track; MovieTrackingTrack *track;
int index = BLI_findindex(&tracking->objects, object); int index = BLI_findindex(&tracking->objects, object);
if (index<0) if (index < 0)
return; return;
if (object->flag & TRACKING_OBJECT_CAMERA) { if (object->flag & TRACKING_OBJECT_CAMERA) {
@ -3034,7 +3046,7 @@ void BKE_tracking_remove_object(MovieTracking *tracking, MovieTrackingObject *ob
tracking->tot_object--; tracking->tot_object--;
if (index>0) if (index > 0)
tracking->objectnr = index - 1; tracking->objectnr = index - 1;
else else
tracking->objectnr = 0; tracking->objectnr = 0;
@ -3042,7 +3054,8 @@ void BKE_tracking_remove_object(MovieTracking *tracking, MovieTrackingObject *ob
void BKE_tracking_object_unique_name(MovieTracking *tracking, MovieTrackingObject *object) void BKE_tracking_object_unique_name(MovieTracking *tracking, MovieTrackingObject *object)
{ {
BLI_uniquename(&tracking->objects, object, "Object", '.', offsetof(MovieTrackingObject, name), sizeof(object->name)); BLI_uniquename(&tracking->objects, object, "Object", '.',
offsetof(MovieTrackingObject, name), sizeof(object->name));
} }
MovieTrackingObject *BKE_tracking_named_object(MovieTracking *tracking, const char *name) MovieTrackingObject *BKE_tracking_named_object(MovieTracking *tracking, const char *name)

@ -165,9 +165,10 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname)
block = uiLayoutAbsoluteBlock(layout); 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 ************************/ /********************* Marker Template ************************/
@ -213,7 +214,7 @@ static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
marker->flag = cb->marker_flag; 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) 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); marker = BKE_tracking_ensure_marker(cb->track, cb->framenr);
if (event == B_MARKER_POS) { if (event == B_MARKER_POS) {
marker->pos[0] = cb->marker_pos[0]/width; marker->pos[0] = cb->marker_pos[0] / width;
marker->pos[1] = cb->marker_pos[1]/height; marker->pos[1] = cb->marker_pos[1] / height;
/* to update position of "parented" objects */ /* to update position of "parented" objects */
DAG_id_tag_update(&cb->clip->id, 0); 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; 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); sub_v2_v2v2(search_dim, cb->track->search_max, cb->track->search_min);
dim[0] = cb->track_search[0]/width; dim[0] = cb->track_search[0] / width;
dim[1] = cb->track_search[1]/height; dim[1] = cb->track_search[1] / height;
sub_v2_v2(dim, search_dim); sub_v2_v2(dim, search_dim);
mul_v2_fl(dim, 0.5f); mul_v2_fl(dim, 0.5f);
cb->track->search_min[0]-= dim[0]; cb->track->search_min[0] -= dim[0];
cb->track->search_min[1]-= dim[1]; cb->track->search_min[1] -= dim[1];
cb->track->search_max[0]+= dim[0]; cb->track->search_max[0] += dim[0];
cb->track->search_max[1]+= dim[1]; cb->track->search_max[1] += dim[1];
BKE_tracking_clamp_track(cb->track, CLAMP_SEARCH_DIM); 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 */ /* to update position of "parented" objects */
DAG_id_tag_update(&cb->clip->id, 0); 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; ok = TRUE;
} }
if (ok) 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; PropertyRNA *prop;
uiBlock *block; uiBlock *block;
@ -375,7 +377,8 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
else else
tip = "Marker is enabled at current frame"; 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); uiButSetNFunc(bt, marker_update_cb, cb, NULL);
} }
else { else {

@ -122,13 +122,13 @@ static void draw_keyframe_shape(float x, float y, float xscale, float yscale, sh
/* adjust view transform before starting */ /* adjust view transform before starting */
glTranslatef(x, y, 0.0f); 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 */ /* anti-aliased lines for more consistent appearance */
glEnable(GL_LINE_SMOOTH); glEnable(GL_LINE_SMOOTH);
if (sel) if (sel)
UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255*(1.0f-alpha)); UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255 * (1.0f - alpha));
else else
glColor4f(0.91f, 0.91f, 0.91f, alpha); glColor4f(0.91f, 0.91f, 0.91f, alpha);

@ -100,7 +100,7 @@ static int dopesheet_select_channel_exec(bContext *C, wmOperator *op)
current_channel_index++; 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; return OPERATOR_FINISHED;
} }
@ -129,7 +129,7 @@ void CLIP_OT_dopesheet_select_channel(wmOperatorType *ot)
ot->poll = dopesheet_select_channel_poll; ot->poll = dopesheet_select_channel_poll;
/* flags */ /* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */ /* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX,

@ -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); glRecti(x, y, x + font_dims[0] + 6.0f, y + font_dims[1] + 4.0f);
UI_ThemeColor(TH_TEXT); 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)); BLF_draw(fontid, numstr, sizeof(numstr));
} }
@ -128,7 +128,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
int framenr; int framenr;
MovieTrackingMarker *marker; MovieTrackingMarker *marker;
while (a<track->markersnr) { while (a < track->markersnr) {
if (track->markers[a].framenr >= i) if (track->markers[a].framenr >= i)
break; 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; x = (sc->user.framenr - sfra) / (efra - sfra + 1) * ar->winx;
UI_ThemeColor(TH_CFRAME); UI_ThemeColor(TH_CFRAME);
glRecti(x, 0, x+framelen, 8); glRecti(x, 0, x + framelen, 8);
clip_draw_curfra_label(sc, x, 8.0f); 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 */ * be binder fallback to simple draw pixels solution */
if (need_fallback) { if (need_fallback) {
/* set zoom */ /* 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); 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; b = count;
i = framenr; i = framenr;
while (i <= framenr+count) { while (i <= framenr + count) {
marker = BKE_tracking_get_marker(track, i); marker = BKE_tracking_get_marker(track, i);
if (!marker || marker->flag & MARKER_DISABLED) if (!marker || marker->flag & MARKER_DISABLED)
@ -357,7 +357,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
curindex = b; curindex = b;
add_v2_v2v2(path[b++], marker->pos, track->offset); 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 else
break; break;
@ -414,7 +414,8 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
glPointSize(1.0f); 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 tiny = sc->flag & SC_SHOW_TINY_MARKER;
int show_search = FALSE; 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); 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); if (tiny) glPointSize(3.0f);
else glPointSize(4.0f); else glPointSize(4.0f);
glBegin(GL_POINTS); 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 tiny = sc->flag & SC_SHOW_TINY_MARKER;
int show_search = 0; int show_search = 0;
@ -521,8 +523,8 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
track_colors(track, act, col, scol); track_colors(track, act, col, scol);
px[0]= 1.0f / width / sc->zoom; px[0] = 1.0f / width / sc->zoom;
px[1]= 1.0f / height / sc->zoom; px[1] = 1.0f / height / sc->zoom;
/* marker position and offset position */ /* marker position and offset position */
if ((track->flag & SELECT) == sel && (marker->flag & MARKER_DISABLED) == 0) { 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); add_v2_v2v2(pos, marker->pos, track->offset);
ED_clip_point_undistorted_pos(sc, pos, pos); 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) if (!tiny)
glPointSize(2.0f); glPointSize(2.0f);
@ -768,18 +770,18 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
} }
glBegin(GL_QUADS); 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(); glEnd();
/* search re-sizing triangle */ /* search re-sizing triangle */
x = track->search_max[0]; x = track->search_max[0];
y = track->search_min[1]; y = track->search_min[1];
tdx = searchdx*2.0f; tdx = searchdx * 2.0f;
tdy = searchdy*2.0f; tdy = searchdy * 2.0f;
if (outline) { if (outline) {
tdx += px[0]; tdx += px[0];
@ -788,12 +790,12 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
glBegin(GL_TRIANGLES); glBegin(GL_TRIANGLES);
glVertex3f(x, y, 0); glVertex3f(x, y, 0);
glVertex3f(x-tdx, y, 0); glVertex3f(x - tdx, y, 0);
glVertex3f(x, y+tdy, 0); glVertex3f(x, y + tdy, 0);
glEnd(); 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 (!outline) {
if (track->pat_flag & SELECT) if (track->pat_flag & SELECT)
glColor3fv(scol); glColor3fv(scol);
@ -814,10 +816,10 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
} }
glBegin(GL_QUADS); 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(); glEnd();
/* pattern re-sizing triangle */ /* pattern re-sizing triangle */
@ -834,8 +836,8 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
glBegin(GL_TRIANGLES); glBegin(GL_TRIANGLES);
glVertex3f(x, y, 0); glVertex3f(x, y, 0);
glVertex3f(x-tdx, y, 0); glVertex3f(x - tdx, y, 0);
glVertex3f(x, y+tdy, 0); glVertex3f(x, y + tdy, 0);
glEnd(); glEnd();
} }
@ -845,8 +847,8 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
glLineWidth(1.0f); glLineWidth(1.0f);
} }
static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, float marker_pos[2], int act, static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
int width, int height, float zoomx, float zoomy) float marker_pos[2], int act, int width, int height, float zoomx, float zoomy)
{ {
char str[128] = {0}, state[64] = {0}; char str[128] = {0}, state[64] = {0};
float dx = 0.0f, dy = 0.0f, fontsize, pos[3]; 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 */ /* count */
track = tracksbase->first; track = tracksbase->first;
while (track) { while (track) {
if ((track->flag & TRACK_HIDDEN)==0) { if ((track->flag & TRACK_HIDDEN) == 0) {
marker = BKE_tracking_get_marker(track, framenr); marker = BKE_tracking_get_marker(track, framenr);
if (MARKER_VISIBLE(sc, track, marker)) if (MARKER_VISIBLE(sc, track, marker))
@ -988,7 +990,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
track = tracksbase->first; track = tracksbase->first;
fp = marker_pos; fp = marker_pos;
while (track) { while (track) {
if ((track->flag & TRACK_HIDDEN)==0) { if ((track->flag & TRACK_HIDDEN) == 0) {
marker = BKE_tracking_get_marker(track, framenr); marker = BKE_tracking_get_marker(track, framenr);
if (MARKER_VISIBLE(sc, track, marker)) { 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) { if (sc->flag & SC_SHOW_TRACK_PATH) {
track = tracksbase->first; track = tracksbase->first;
while (track) { while (track) {
if ((track->flag & TRACK_HIDDEN)==0) if ((track->flag & TRACK_HIDDEN) == 0)
draw_track_path(sc, clip, track); draw_track_path(sc, clip, track);
track = track->next; track = track->next;
@ -1020,7 +1022,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
track = tracksbase->first; track = tracksbase->first;
fp = marker_pos; fp = marker_pos;
while (track) { while (track) {
if ((track->flag & TRACK_HIDDEN)==0) { if ((track->flag & TRACK_HIDDEN) == 0) {
marker = BKE_tracking_get_marker(track, framenr); marker = BKE_tracking_get_marker(track, framenr);
if (MARKER_VISIBLE(sc, track, marker)) { if (MARKER_VISIBLE(sc, track, marker)) {
@ -1044,7 +1046,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
track = tracksbase->first; track = tracksbase->first;
fp = marker_pos; fp = marker_pos;
while (track) { while (track) {
if ((track->flag & TRACK_HIDDEN)==0) { if ((track->flag & TRACK_HIDDEN) == 0) {
int act = track == act_track; int act = track == act_track;
marker = BKE_tracking_get_marker(track, framenr); 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 */ /* active marker would be displayed on top of everything else */
if (act_track) { 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); marker = BKE_tracking_get_marker(act_track, framenr);
if (MARKER_VISIBLE(sc, act_track, marker)) { 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)) { if (MARKER_VISIBLE(sc, track, marker)) {
float npos[2]; float npos[2];
copy_v4_v4(vec, track->bundle_pos); copy_v4_v4(vec, track->bundle_pos);
vec[3]=1; vec[3] = 1;
mul_v4_m4v4(pos, mat, vec); 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); sub_v2_v2(vec, npos);
if (len_v2(vec)< 3.0f) if (len_v2(vec) < 3.0f)
glColor3f(0.0f, 1.0f, 0.0f); glColor3f(0.0f, 1.0f, 0.0f);
else else
glColor3f(1.0f, 0.0f, 0.0f); 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); 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; float x, y;
const int n = 10; 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++) { for (a = 0; a < 4; a++) {
if (a < 2) if (a < 2)
val[a][a%2] = FLT_MAX; val[a][a % 2] = FLT_MAX;
else else
val[a][a%2] = -FLT_MAX; val[a][a % 2] = -FLT_MAX;
} }
zero_v2(pos); 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++) { for (a = 0; a < 4; a++) {
int ok; int ok;
if (a<2) if (a < 2)
ok = tpos[a%2] < val[a][a%2]; ok = tpos[a % 2] < val[a][a % 2];
else else
ok = tpos[a%2] > val[a][a%2]; ok = tpos[a % 2] > val[a][a % 2];
if (ok) { if (ok) {
copy_v2_v2(val[a], tpos); 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[0] = stroke->points[i].x * width;
pos[1] = stroke->points[i].y * height * aspy; pos[1] = stroke->points[i].y * height * aspy;
npos[0] = stroke->points[i+1].x * width; npos[0] = stroke->points[i + 1].x * width;
npos[1] = stroke->points[i+1].y * height * aspy; npos[1] = stroke->points[i + 1].y * height * aspy;
len = len_v2v2(pos, npos); len = len_v2v2(pos, npos);
steps = ceil(len/5.0f); steps = ceil(len / 5.0f);
/* we want to distort only long straight lines */ /* we want to distort only long straight lines */
if (stroke->totpoints == 2) { 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); 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++) { for (j = 0; j <= steps; j++) {
BKE_tracking_apply_intrinsics(tracking, pos, tpos); 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); add_v2_v2(pos, dpos);
} }
@ -1434,7 +1437,7 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d)
if (onlyv2d) { if (onlyv2d) {
/* if manual calibration is used then grease pencil data is already /* if manual calibration is used then grease pencil data is already
* drawed in draw_distortion */ * 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); ibuf = ED_space_clip_get_buffer(sc);
if (ibuf) { if (ibuf) {

@ -162,7 +162,7 @@ void ED_space_clip_set(bContext *C, bScreen *screen, SpaceClip *sc, MovieClip *c
} }
if (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) 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); 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); *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); *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) 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; return FALSE;
/* center view */ /* 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]; w = max[0] - min[0];
h = max[1] - min[1]; 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)); newzoom = 1.0f / power_of_2(1.0f / MIN2(zoomx, zoomy));
if (fit || sc->zoom>newzoom) if (fit || sc->zoom > newzoom)
sc->zoom = newzoom; sc->zoom = newzoom;
} }

@ -81,7 +81,7 @@ static void draw_curve_knot(float x, float y, float xscale, float yscale, float
glPushMatrix(); glPushMatrix();
glTranslatef(x, y, 0.0f); 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); glCallList(displist);
glPopMatrix(); glPopMatrix();
@ -166,7 +166,8 @@ static void draw_tracks_curves(View2D *v2d, SpaceClip *sc)
/* draw graph lines */ /* draw graph lines */
glEnable(GL_BLEND); 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); glDisable(GL_BLEND);
/* selected knot handles on top of curves */ /* 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); 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]; MovieReconstructedCamera *camera = &reconstruction->cameras[i];
if (lines && camera->framenr!=prevfra+1) { if (lines && camera->framenr != prevfra + 1) {
glEnd(); glEnd();
lines = 0; lines = 0;
} }

@ -144,7 +144,7 @@ static void find_nearest_tracking_knot_cb(void *userdata, MovieTrackingTrack *tr
float d = dx * dx + dy * dy; float d = dx * dx + dy * dy;
if (data->marker == NULL || d < data->min_dist) { if (data->marker == NULL || d < data->min_dist) {
float co[2]= {marker->framenr, val}; float co[2] = {marker->framenr, val};
data->track = track; data->track = track;
data->marker = marker; data->marker = marker;
@ -252,7 +252,7 @@ static int mouse_select(bContext *C, float co[2], int extend)
} }
if (sel) 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; 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); clip_graph_tracking_values_iterate_track(sc, act_track, &userdata, border_select_cb, NULL, NULL);
if (userdata.change) { 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; 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; return OPERATOR_FINISHED;
} }
@ -447,7 +447,7 @@ void CLIP_OT_graph_select_all_markers(wmOperatorType *ot)
ot->poll = ED_space_clip_graph_poll; ot->poll = ED_space_clip_graph_poll;
/* flags */ /* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_select_all(ot); 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; ot->poll = ED_space_clip_tracking_poll;
/* flags */ /* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
} }
/******************** delete knot operator ********************/ /******************** delete knot operator ********************/
@ -522,7 +522,7 @@ void CLIP_OT_graph_delete_knot(wmOperatorType *ot)
ot->poll = ED_space_clip_graph_poll; ot->poll = ED_space_clip_graph_poll;
/* flags */ /* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
} }
/******************** view all operator ********************/ /******************** view all operator ********************/
@ -662,7 +662,7 @@ static int graph_disable_markers_exec(bContext *C, wmOperator *op)
DAG_id_tag_update(&clip->id, 0); 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; return OPERATOR_FINISHED;
} }
@ -686,7 +686,7 @@ void CLIP_OT_graph_disable_markers(wmOperatorType *ot)
ot->poll = ED_space_clip_graph_poll; ot->poll = ED_space_clip_graph_poll;
/* flags */ /* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */ /* properties */
RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Disable action to execute"); RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Disable action to execute");

@ -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) { if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {
ED_space_clip_size(sc, &width, &height); ED_space_clip_size(sc, &width, &height);
sc->xof += ((location[0] - 0.5f) * width-sc->xof) * (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; 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) if (op->customdata)
MEM_freeN(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; return OPERATOR_CANCELLED;
} }
@ -188,7 +189,7 @@ static int open_exec(bContext *C, wmOperator *op)
ED_space_clip_set(C, screen, sc, clip); 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); MEM_freeN(op->customdata);
@ -233,10 +234,11 @@ void CLIP_OT_open(wmOperatorType *ot)
ot->cancel = open_cancel; ot->cancel = open_cancel;
/* flags */ /* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */ /* 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 *********************/ /******************* reload clip operator *********************/
@ -250,7 +252,7 @@ static int reload_exec(bContext *C, wmOperator *UNUSED(op))
BKE_movieclip_reload(clip); 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; return OPERATOR_FINISHED;
} }
@ -412,7 +414,7 @@ void CLIP_OT_view_pan(wmOperatorType *ot)
ot->poll = ED_space_clip_view_clip_poll; ot->poll = ED_space_clip_view_clip_poll;
/* flags */ /* flags */
ot->flag = OPTYPE_BLOCKING; ot->flag = OPTYPE _ BLOCKING;
/* properties */ /* properties */
RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX, 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) { switch (event->type) {
case MOUSEMOVE: 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); RNA_float_set(op->ptr, "factor", factor);
sclip_zoom_set(sc, ar, vpd->zoom * factor, vpd->location); sclip_zoom_set(sc, ar, vpd->zoom * factor, vpd->location);
ED_region_tag_redraw(CTX_wm_region(C)); 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; ot->poll = ED_space_clip_view_clip_poll;
/* flags */ /* flags */
ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER; ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER;
/* properties */ /* properties */
RNA_def_float(ot->srna, "factor", 0.0f, 0.0f, FLT_MAX, 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; ot->poll = ED_space_clip_view_clip_poll;
/* properties */ /* 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) 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; ot->poll = ED_space_clip_view_clip_poll;
/* properties */ /* 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 *********************/ /********************** view zoom ratio operator *********************/
@ -781,7 +785,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
/* do updates */ /* do updates */
sound_seek_scene(CTX_data_main(C), CTX_data_scene(C)); 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) 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; ot->poll = change_frame_poll;
/* flags */ /* flags */
ot->flag = OPTYPE_BLOCKING|OPTYPE_UNDO; ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO;
/* rna */ /* rna */
RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME); 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; int size_nr = undistort ? 1 : 0;
if (size_flag & size_flags[size_nr][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]) 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]) 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]) 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; 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) 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, 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) if (*stop || G.afbreek)
break; break;
@ -986,7 +991,7 @@ static void proxy_endjob(void *pjv)
BKE_movieclip_reload(pj->clip); 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)) 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_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); WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob);
G.afbreek = 0; G.afbreek = 0;
@ -1057,7 +1062,7 @@ static int mode_set_exec(bContext *C, wmOperator *op)
sc->mode = mode; 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; return OPERATOR_FINISHED;
} }
@ -1094,14 +1099,14 @@ void ED_operatormacros_clip(void)
wmOperatorTypeMacro *otmacro; wmOperatorTypeMacro *otmacro;
ot = WM_operatortype_append_macro("CLIP_OT_add_marker_move", "Add Marker and Move", 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"); WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_struct_idprops_unset(otmacro->ptr, "release_confirm"); RNA_struct_idprops_unset(otmacro->ptr, "release_confirm");
ot = WM_operatortype_append_macro("CLIP_OT_add_marker_slide", "Add Marker and Slide", 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", "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"); WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_boolean_set(otmacro->ptr, "release_confirm", TRUE); RNA_boolean_set(otmacro->ptr, "release_confirm", TRUE);

@ -151,7 +151,7 @@ static ARegion *clip_has_tools_region(ScrArea *sa)
BLI_insertlinkafter(&sa->regionbase, artool, arprops); BLI_insertlinkafter(&sa->regionbase, artool, arprops);
arprops->regiontype = RGN_TYPE_TOOL_PROPS; arprops->regiontype = RGN_TYPE_TOOL_PROPS;
arprops->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV; arprops->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
} }
return artool; return artool;

@ -190,20 +190,21 @@ void clip_delete_track(bContext *C, MovieClip *clip, ListBase *tracksbase, Movie
BKE_tracking_free_track(track); BKE_tracking_free_track(track);
BLI_freelinkN(tracksbase, 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) { if (update_stab) {
tracking->stabilization.ok = FALSE; 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); DAG_id_tag_update(&clip->id, 0);
if (has_bundle) 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) { if (track->markersnr == 1) {
clip_delete_track(C, clip, tracksbase, track); clip_delete_track(C, clip, tracksbase, track);
@ -211,7 +212,7 @@ void clip_delete_marker(bContext *C, MovieClip *clip, ListBase *tracksbase, Movi
else { else {
BKE_tracking_delete_marker(track, marker->framenr); 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 */ /* because the frame number text is subject to the same scaling as the contents of the view */
UI_view2d_getscale(v2d, &xscale, &yscale); 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); clip_draw_curfra_label(sc, (float)sc->user.framenr * xscale, 18);

@ -81,7 +81,7 @@ static void init_preview_region(const bContext *C, ARegion *ar)
if (sc->view == SC_VIEW_DOPESHEET) { if (sc->view == SC_VIEW_DOPESHEET) {
ar->v2d.tot.xmin = -10.0f; 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.xmax = (float)(sa->winx);
ar->v2d.tot.ymax = 0.0f; 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.minzoom = 0.01f;
ar->v2d.maxzoom = 50; 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.scroll |= (V2D_SCROLL_RIGHT);
ar->v2d.keepzoom = V2D_LOCKZOOM_Y; ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
ar->v2d.keepofs = V2D_KEEPOFS_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[0] = MAXFRAMEF;
ar->v2d.max[1] = FLT_MAX; ar->v2d.max[1] = FLT_MAX;
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_LEFT|V2D_SCROLL_SCALE_VERTICAL); ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL);
ar->v2d.minzoom = 0.0f; ar->v2d.minzoom = 0.0f;
ar->v2d.maxzoom = 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 = MEM_callocN(sizeof(SpaceClip), "initclip");
sc->spacetype = SPACE_CLIP; 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->zoom = 1.0f;
sc->path_length = 20; sc->path_length = 20;
sc->scopes.track_preview_height = 120; sc->scopes.track_preview_height = 120;
@ -256,7 +257,7 @@ static SpaceLink *clip_new(const bContext *C)
BLI_addtail(&sc->regionbase, ar); BLI_addtail(&sc->regionbase, ar);
ar->regiontype = RGN_TYPE_TOOL_PROPS; ar->regiontype = RGN_TYPE_TOOL_PROPS;
ar->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV; ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
/* properties view */ /* properties view */
ar = MEM_callocN(sizeof(ARegion), "properties for clip"); ar = MEM_callocN(sizeof(ARegion), "properties for clip");
@ -369,12 +370,12 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
} }
break; break;
case NC_SCREEN: case NC_SCREEN:
if (wmn->data ==ND_ANIMPLAY) { if (wmn->data == ND_ANIMPLAY) {
ED_area_tag_redraw(sa); ED_area_tag_redraw(sa);
} }
break; break;
case NC_SPACE: case NC_SPACE:
if (wmn->data ==ND_SPACE_CLIP) { if (wmn->data == ND_SPACE_CLIP) {
clip_scopes_tag_refresh(sa); clip_scopes_tag_refresh(sa);
clip_stabilization_tag_refresh(sa); clip_stabilization_tag_refresh(sa);
ED_area_tag_redraw(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); 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, "backwards", FALSE);
RNA_boolean_set(kmi->ptr, "sequence", TRUE); 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, "backwards", TRUE);
RNA_boolean_set(kmi->ptr, "sequence", 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); WM_keymap_add_item(keymap, "CLIP_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
/* jump to special frame */ /* 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); 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); 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); 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); RNA_enum_set(kmi->ptr, "position", 3);
/* "timeline" */ /* "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); 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_enum_set(kmi->ptr, "action", TRACK_CLEAR_UPTO);
RNA_boolean_set(kmi->ptr, "clear_active", FALSE); 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_enum_set(kmi->ptr, "action", TRACK_CLEAR_ALL);
RNA_boolean_set(kmi->ptr, "clear_active", FALSE); 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); 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_enum_set(kmi->ptr, "action", TRACK_CLEAR_UPTO);
RNA_boolean_set(kmi->ptr, "clear_active", TRUE); 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_enum_set(kmi->ptr, "action", TRACK_CLEAR_ALL);
RNA_boolean_set(kmi->ptr, "clear_active", TRUE); 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 */ 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) 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; ar_tool_props->v2d.flag &= ~V2D_IS_INITIALISED;
view_changed = TRUE; view_changed = TRUE;
} }
if (ar_tool_props && (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; ar_tool_props->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
view_changed = TRUE; view_changed = TRUE;
} }
} }
@ -984,8 +985,8 @@ static void movieclip_main_area_set_view2d(SpaceClip *sc, ARegion *ar)
ar->v2d.mask.ymax = winy; ar->v2d.mask.ymax = winy;
/* which part of the image space do we see? */ /* which part of the image space do we see? */
x1 = ar->winrct.xmin + (winx-sc->zoom * w) / 2.0f; x1 = ar->winrct.xmin + (winx - sc->zoom * w) / 2.0f;
y1 = ar->winrct.ymin + (winy-sc->zoom * h) / 2.0f; y1 = ar->winrct.ymin + (winy - sc->zoom * h) / 2.0f;
x1 -= sc->zoom * sc->xof; x1 -= sc->zoom * sc->xof;
y1 -= sc->zoom * sc->yof; y1 -= sc->zoom * sc->yof;
@ -1146,7 +1147,8 @@ static void dopesheet_area_draw(const bContext *C, ARegion *ar)
/* time grid */ /* time grid */
unit = (sc->flag & SC_SHOW_SECONDS)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; 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_draw(v2d, grid, V2D_GRIDLINES_ALL);
UI_view2d_grid_free(grid); UI_view2d_grid_free(grid);
@ -1298,11 +1300,11 @@ static void clip_properties_area_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */ /* context changes */
switch (wmn->category) { switch (wmn->category) {
case NC_SCREEN: case NC_SCREEN:
if (wmn->data ==ND_GPENCIL) if (wmn->data == ND_GPENCIL)
ED_region_tag_redraw(ar); ED_region_tag_redraw(ar);
break; break;
case NC_BRUSH: case NC_BRUSH:
if (wmn->action ==NA_EDITED) if (wmn->action == NA_EDITED)
ED_region_tag_redraw(ar); ED_region_tag_redraw(ar);
break; break;
} }
@ -1336,7 +1338,7 @@ void ED_spacetype_clip(void)
art->init = clip_main_area_init; art->init = clip_main_area_init;
art->draw = clip_main_area_draw; art->draw = clip_main_area_draw;
art->listener = clip_main_area_listener; 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); BLI_addhead(&st->regiontypes, art);
@ -1347,7 +1349,7 @@ void ED_spacetype_clip(void)
art->init = clip_preview_area_init; art->init = clip_preview_area_init;
art->draw = clip_preview_area_draw; art->draw = clip_preview_area_draw;
art->listener = clip_preview_area_listener; 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); BLI_addhead(&st->regiontypes, art);
@ -1355,7 +1357,7 @@ void ED_spacetype_clip(void)
art = MEM_callocN(sizeof(ARegionType), "spacetype clip region properties"); art = MEM_callocN(sizeof(ARegionType), "spacetype clip region properties");
art->regionid = RGN_TYPE_UI; art->regionid = RGN_TYPE_UI;
art->prefsizex = UI_COMPACT_PANEL_WIDTH; 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->init = clip_properties_area_init;
art->draw = clip_properties_area_draw; art->draw = clip_properties_area_draw;
art->listener = clip_properties_area_listener; 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 = MEM_callocN(sizeof(ARegionType), "spacetype clip region tools");
art->regionid = RGN_TYPE_TOOLS; art->regionid = RGN_TYPE_TOOLS;
art->prefsizex = UI_COMPACT_PANEL_WIDTH; 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->listener = clip_props_area_listener;
art->init = clip_tools_area_init; art->init = clip_tools_area_init;
art->draw = clip_tools_area_draw; art->draw = clip_tools_area_draw;
@ -1378,7 +1380,7 @@ void ED_spacetype_clip(void)
art->regionid = RGN_TYPE_TOOL_PROPS; art->regionid = RGN_TYPE_TOOL_PROPS;
art->prefsizex = 0; art->prefsizex = 0;
art->prefsizey = 120; 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->listener = clip_props_area_listener;
art->init = clip_tools_area_init; art->init = clip_tools_area_init;
art->draw = clip_tools_area_draw; art->draw = clip_tools_area_draw;
@ -1390,7 +1392,7 @@ void ED_spacetype_clip(void)
art = MEM_callocN(sizeof(ARegionType), "spacetype clip region"); art = MEM_callocN(sizeof(ARegionType), "spacetype clip region");
art->regionid = RGN_TYPE_HEADER; art->regionid = RGN_TYPE_HEADER;
art->prefsizey = HEADERY; 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->init = clip_header_area_init;
art->draw = clip_header_area_draw; 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 = MEM_callocN(sizeof(ARegionType), "spacetype clip channels region");
art->regionid = RGN_TYPE_CHANNELS; art->regionid = RGN_TYPE_CHANNELS;
art->prefsizex = UI_COMPACT_PANEL_WIDTH; 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->listener = clip_channels_area_listener;
art->init = clip_channels_area_init; art->init = clip_channels_area_init;
art->draw = clip_channels_area_draw; art->draw = clip_channels_area_draw;

File diff suppressed because it is too large Load Diff