Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c57
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_draw.c9
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_ops.c12
-rw-r--r--source/blender/editors/space_clip/clip_draw.c117
-rw-r--r--source/blender/editors/space_clip/clip_editor.c66
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c6
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c51
-rw-r--r--source/blender/editors/space_clip/clip_ops.c93
-rw-r--r--source/blender/editors/space_clip/clip_toolbar.c6
-rw-r--r--source/blender/editors/space_clip/clip_utils.c24
-rw-r--r--source/blender/editors/space_clip/space_clip.c90
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c6
-rw-r--r--source/blender/editors/space_clip/tracking_ops_orient.c6
-rw-r--r--source/blender/editors/space_clip/tracking_ops_solve.c3
-rw-r--r--source/blender/editors/space_clip/tracking_select.c45
15 files changed, 394 insertions, 197 deletions
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index 6f950ec5bc4..c985d61a8b8 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -110,8 +110,9 @@ void uiTemplateMovieClip(
uiLayout *row, *split;
uiBlock *block;
- if (!ptr->data)
+ if (!ptr->data) {
return;
+ }
prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
@@ -133,9 +134,10 @@ void uiTemplateMovieClip(
uiLayoutSetContextPointer(layout, "edit_movieclip", &clipptr);
- if (!compact)
+ if (!compact) {
uiTemplateID(
layout, C, ptr, propname, NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false);
+ }
if (clip) {
uiLayout *col;
@@ -166,8 +168,9 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname)
uiLayout *col;
MovieClipScopes *scopes;
- if (!ptr->data)
+ if (!ptr->data) {
return;
+ }
prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
@@ -274,8 +277,9 @@ static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
MarkerUpdateCb *cb = (MarkerUpdateCb *)arg_cb;
MovieTrackingMarker *marker;
- if (!cb->compact)
+ if (!cb->compact) {
return;
+ }
marker = BKE_tracking_marker_ensure(cb->track, cb->framenr);
@@ -381,8 +385,9 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
sub_v2_v2v2(delta, offset, cb->track->offset);
copy_v2_v2(cb->track->offset, offset);
- for (i = 0; i < cb->track->markersnr; i++)
+ for (i = 0; i < cb->track->markersnr; i++) {
sub_v2_v2(cb->track->markers[i].pos, delta);
+ }
/* to update position of "parented" objects */
DEG_id_tag_update(&cb->clip->id, 0);
@@ -391,8 +396,9 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
ok = true;
}
- if (ok)
+ if (ok) {
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, cb->clip);
+ }
}
void uiTemplateMarker(uiLayout *layout,
@@ -414,8 +420,9 @@ void uiTemplateMarker(uiLayout *layout,
const char *tip;
float pat_min[2], pat_max[2];
- if (!ptr->data)
+ if (!ptr->data) {
return;
+ }
prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
@@ -451,10 +458,12 @@ void uiTemplateMarker(uiLayout *layout,
if (compact) {
block = uiLayoutGetBlock(layout);
- if (cb->marker_flag & MARKER_DISABLED)
+ if (cb->marker_flag & MARKER_DISABLED) {
tip = TIP_("Marker is disabled at current frame");
- else
+ }
+ else {
tip = TIP_("Marker is enabled at current frame");
+ }
bt = uiDefIconButBitI(block,
UI_BTYPE_TOGGLE_N,
@@ -525,10 +534,12 @@ void uiTemplateMarker(uiLayout *layout,
UI_block_func_handle_set(block, marker_block_handler, cb);
UI_block_funcN_set(block, marker_update_cb, cb, NULL);
- if (cb->marker_flag & MARKER_DISABLED)
+ if (cb->marker_flag & MARKER_DISABLED) {
tip = TIP_("Marker is disabled at current frame");
- else
+ }
+ else {
tip = TIP_("Marker is enabled at current frame");
+ }
uiDefButBitI(block,
UI_BTYPE_CHECKBOX_N,
@@ -773,8 +784,9 @@ void uiTemplateMovieclipInformation(uiLayout *layout,
ImBuf *ibuf;
size_t ofs = 0;
- if (!ptr->data)
+ if (!ptr->data) {
return;
+ }
prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
@@ -805,19 +817,24 @@ void uiTemplateMovieclipInformation(uiLayout *layout,
if (ibuf) {
if (ibuf->rect_float) {
- if (ibuf->channels != 4)
+ if (ibuf->channels != 4) {
ofs += BLI_snprintf(
str + ofs, sizeof(str) - ofs, IFACE_(", %d float channel(s)"), ibuf->channels);
- else if (ibuf->planes == R_IMF_PLANES_RGBA)
+ }
+ else if (ibuf->planes == R_IMF_PLANES_RGBA) {
ofs += BLI_strncpy_rlen(str + ofs, IFACE_(", RGBA float"), sizeof(str) - ofs);
- else
+ }
+ else {
ofs += BLI_strncpy_rlen(str + ofs, IFACE_(", RGB float"), sizeof(str) - ofs);
+ }
}
else {
- if (ibuf->planes == R_IMF_PLANES_RGBA)
+ if (ibuf->planes == R_IMF_PLANES_RGBA) {
ofs += BLI_strncpy_rlen(str + ofs, IFACE_(", RGBA byte"), sizeof(str) - ofs);
- else
+ }
+ else {
ofs += BLI_strncpy_rlen(str + ofs, IFACE_(", RGB byte"), sizeof(str) - ofs);
+ }
}
if (clip->anim != NULL) {
@@ -837,10 +854,12 @@ void uiTemplateMovieclipInformation(uiLayout *layout,
/* Display current frame number. */
framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, user->framenr);
- if (framenr <= clip->len)
+ if (framenr <= clip->len) {
BLI_snprintf(str, sizeof(str), IFACE_("Frame: %d / %d"), framenr, clip->len);
- else
+ }
+ else {
BLI_snprintf(str, sizeof(str), IFACE_("Frame: - / %d"), clip->len);
+ }
uiItemL(col, str, ICON_NONE);
/* Display current file name if it's a sequence clip. */
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c
index 8ac0870f7f1..0f6e7947482 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c
@@ -59,10 +59,12 @@ static void track_channel_color(MovieTrackingTrack *track, float default_color[3
interp_v3_v3v3(color, track->color, bg, 0.5);
}
else {
- if (default_color)
+ if (default_color) {
copy_v3_v3(color, default_color);
- else
+ }
+ else {
UI_GetThemeColor3fv(TH_HEADER, color);
+ }
}
}
@@ -297,8 +299,9 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
uiStyle *style = UI_style_get();
int fontid = style->widget.uifont_id;
- if (!clip)
+ if (!clip) {
return;
+ }
MovieTracking *tracking = &clip->tracking;
MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
diff --git a/source/blender/editors/space_clip/clip_dopesheet_ops.c b/source/blender/editors/space_clip/clip_dopesheet_ops.c
index e7f0f8c3fcc..785ced96b13 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_ops.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_ops.c
@@ -66,8 +66,9 @@ static bool dopesheet_select_channel_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- if (sc && sc->clip)
+ if (sc && sc->clip) {
return sc->view == SC_VIEW_DOPESHEET;
+ }
return false;
}
@@ -93,10 +94,12 @@ static int dopesheet_select_channel_exec(bContext *C, wmOperator *op)
MovieTrackingTrack *track = channel->track;
if (current_channel_index == channel_index) {
- if (extend)
+ if (extend) {
track->flag ^= TRACK_DOPE_SEL;
- else
+ }
+ else {
track->flag |= TRACK_DOPE_SEL;
+ }
if (track->flag & TRACK_DOPE_SEL) {
tracking->act_track = track;
@@ -106,8 +109,9 @@ static int dopesheet_select_channel_exec(bContext *C, wmOperator *op)
BKE_tracking_track_deselect(track, TRACK_AREA_ALL);
}
}
- else if (!extend)
+ else if (!extend) {
track->flag &= ~TRACK_DOPE_SEL;
+ }
current_channel_index++;
}
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index dbc37fc6727..99f9a91775e 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -178,12 +178,14 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
while (a < markersnr) {
int marker_framenr = generic_track_get_marker_framenr(act_track, act_plane_track, a);
- if (marker_framenr >= i)
+ if (marker_framenr >= i) {
break;
+ }
if (a < markersnr - 1 &&
- generic_track_get_marker_framenr(act_track, act_plane_track, a + 1) > i)
+ generic_track_get_marker_framenr(act_track, act_plane_track, a + 1) > i) {
break;
+ }
a++;
}
@@ -284,8 +286,9 @@ static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar)
full_redraw = true;
}
else {
- if (sc->flag & SC_LOCK_SELECTION)
+ if (sc->flag & SC_LOCK_SELECTION) {
strcpy(str, "Locked");
+ }
}
if (str[0]) {
@@ -411,14 +414,16 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
int tiny = sc->flag & SC_SHOW_TINY_MARKER, framenr, start_frame;
MovieTrackingMarker *marker;
- if (count == 0)
+ if (count == 0) {
return;
+ }
start_frame = framenr = ED_space_clip_get_clip_frame_number(sc);
marker = BKE_tracking_marker_get(track, framenr);
- if (marker->framenr != framenr || marker->flag & MARKER_DISABLED)
+ if (marker->framenr != framenr || marker->flag & MARKER_DISABLED) {
return;
+ }
if (count < MAX_STATIC_PATH) {
path = path_static;
@@ -432,15 +437,17 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
while (i >= framenr - count) {
marker = BKE_tracking_marker_get(track, i);
- if (!marker || marker->flag & MARKER_DISABLED)
+ if (!marker || marker->flag & MARKER_DISABLED) {
break;
+ }
if (marker->framenr == i) {
add_v2_v2v2(path[--a], marker->pos, track->offset);
ED_clip_point_undistorted_pos(sc, path[a], path[a]);
- if (marker->framenr == start_frame)
+ if (marker->framenr == start_frame) {
curindex = a;
+ }
}
else {
break;
@@ -454,18 +461,21 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
while (i <= framenr + count) {
marker = BKE_tracking_marker_get(track, i);
- if (!marker || marker->flag & MARKER_DISABLED)
+ if (!marker || marker->flag & MARKER_DISABLED) {
break;
+ }
if (marker->framenr == i) {
- if (marker->framenr == start_frame)
+ if (marker->framenr == start_frame) {
curindex = b;
+ }
add_v2_v2v2(path[b++], marker->pos, track->offset);
ED_clip_point_undistorted_pos(sc, path[b - 1], path[b - 1]);
}
- else
+ else {
break;
+ }
i++;
}
@@ -658,20 +668,24 @@ static void draw_marker_outline(SpaceClip *sc,
static void track_colors(MovieTrackingTrack *track, int act, float col[3], float scol[3])
{
if (track->flag & TRACK_CUSTOMCOLOR) {
- if (act)
+ if (act) {
UI_GetThemeColor3fv(TH_ACT_MARKER, scol);
- else
+ }
+ else {
copy_v3_v3(scol, track->color);
+ }
mul_v3_v3fl(col, track->color, 0.5f);
}
else {
UI_GetThemeColor3fv(TH_MARKER, col);
- if (act)
+ if (act) {
UI_GetThemeColor3fv(TH_ACT_MARKER, scol);
- else
+ }
+ else {
UI_GetThemeColor3fv(TH_SEL_MARKER, scol);
+ }
}
}
@@ -923,11 +937,13 @@ static void draw_marker_slide_zones(SpaceClip *sc,
int tiny = sc->flag & SC_SHOW_TINY_MARKER;
float col[3], scol[3], px[2], side;
- if ((tiny && outline) || (marker->flag & MARKER_DISABLED))
+ if ((tiny && outline) || (marker->flag & MARKER_DISABLED)) {
return;
+ }
- if (!TRACK_VIEW_SELECTED(sc, track) || track->flag & TRACK_LOCKED)
+ if (!TRACK_VIEW_SELECTED(sc, track) || track->flag & TRACK_LOCKED) {
return;
+ }
track_colors(track, act, col, scol);
@@ -1020,8 +1036,9 @@ static void draw_marker_texts(SpaceClip *sc,
uiStyle *style = U.uistyles.first;
int fontid = style->widget.uifont_id;
- if (!TRACK_VIEW_SELECTED(sc, track))
+ if (!TRACK_VIEW_SELECTED(sc, track)) {
return;
+ }
BLF_size(fontid, 11.0f * U.pixelsize, U.dpi);
fontsize = BLF_height_max(fontid);
@@ -1062,19 +1079,25 @@ static void draw_marker_texts(SpaceClip *sc,
pos[0] = pos[0] * zoomx;
pos[1] = pos[1] * zoomy - fontsize;
- if (marker->flag & MARKER_DISABLED)
+ if (marker->flag & MARKER_DISABLED) {
strcpy(state, "disabled");
- else if (marker->framenr != ED_space_clip_get_clip_frame_number(sc))
+ }
+ else if (marker->framenr != ED_space_clip_get_clip_frame_number(sc)) {
strcpy(state, "estimated");
- else if (marker->flag & MARKER_TRACKED)
+ }
+ else if (marker->flag & MARKER_TRACKED) {
strcpy(state, "tracked");
- else
+ }
+ else {
strcpy(state, "keyframed");
+ }
- if (state[0])
+ if (state[0]) {
BLI_snprintf(str, sizeof(str), "%s: %s", track->name, state);
- else
+ }
+ else {
BLI_strncpy(str, track->name, sizeof(str));
+ }
BLF_position(fontid, pos[0], pos[1], 0.0f);
BLF_draw(fontid, str, sizeof(str));
@@ -1479,8 +1502,9 @@ static void draw_tracking_tracks(SpaceClip *sc,
if ((track->flag & TRACK_HIDDEN) == 0) {
marker = BKE_tracking_marker_get(track, framenr);
- if (MARKER_VISIBLE(sc, track, marker))
+ if (MARKER_VISIBLE(sc, track, marker)) {
count++;
+ }
}
track = track->next;
@@ -1499,8 +1523,9 @@ static void draw_tracking_tracks(SpaceClip *sc,
if (MARKER_VISIBLE(sc, track, marker)) {
ED_clip_point_undistorted_pos(sc, marker->pos, fp);
- if (track == act_track)
+ if (track == act_track) {
active_pos = fp;
+ }
fp += 2;
}
@@ -1514,8 +1539,9 @@ static void draw_tracking_tracks(SpaceClip *sc,
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;
}
@@ -1541,8 +1567,9 @@ static void draw_tracking_tracks(SpaceClip *sc,
draw_marker_slide_zones(sc, track, marker, cur_pos, 1, 0, 0, width, height, position);
draw_marker_slide_zones(sc, track, marker, cur_pos, 0, 0, 0, width, height, position);
- if (fp)
+ if (fp) {
fp += 2;
+ }
}
}
@@ -1566,8 +1593,9 @@ static void draw_tracking_tracks(SpaceClip *sc,
draw_marker_slide_zones(sc, track, marker, cur_pos, 0, 1, 0, width, height, position);
}
- if (fp)
+ if (fp) {
fp += 2;
+ }
}
}
@@ -1664,8 +1692,9 @@ static void draw_tracking_tracks(SpaceClip *sc,
draw_marker_texts(sc, track, marker, cur_pos, act, width, height, zoomx, zoomy);
- if (fp)
+ if (fp) {
fp += 2;
+ }
}
}
@@ -1675,8 +1704,9 @@ static void draw_tracking_tracks(SpaceClip *sc,
GPU_matrix_pop();
- if (marker_pos)
+ if (marker_pos) {
MEM_freeN(marker_pos);
+ }
}
static void draw_distortion(
@@ -1692,11 +1722,13 @@ static void draw_distortion(
float dx = (float)width / n, dy = (float)height / n * aspy;
float offsx = 0.0f, offsy = 0.0f;
- if (!tracking->camera.focal)
+ if (!tracking->camera.focal) {
return;
+ }
- if ((sc->flag & SC_SHOW_GRID) == 0 && (sc->flag & SC_MANUAL_CALIBRATION) == 0)
+ if ((sc->flag & SC_SHOW_GRID) == 0 && (sc->flag & SC_MANUAL_CALIBRATION) == 0) {
return;
+ }
UI_view2d_view_to_region_fl(&ar->v2d, 0.0f, 0.0f, &x, &y);
@@ -1717,10 +1749,12 @@ static void draw_distortion(
float min[2], max[2];
for (a = 0; a < 4; a++) {
- if (a < 2)
+ if (a < 2) {
val[a][a % 2] = FLT_MAX;
- else
+ }
+ else {
val[a][a % 2] = -FLT_MAX;
+ }
}
zero_v2(pos);
@@ -1732,10 +1766,12 @@ static void draw_distortion(
for (a = 0; a < 4; a++) {
int ok;
- if (a < 2)
+ if (a < 2) {
ok = tpos[a % 2] < val[a][a % 2];
- else
+ }
+ else {
ok = tpos[a % 2] > val[a][a % 2];
+ }
if (ok) {
copy_v2_v2(val[a], tpos);
@@ -1912,10 +1948,12 @@ void clip_draw_main(const bContext *C, SpaceClip *sc, ARegion *ar)
ibuf = ED_space_clip_get_stable_buffer(sc, sc->loc, &sc->scale, &sc->angle);
}
- if (ibuf != NULL && width != ibuf->x)
+ if (ibuf != NULL && width != ibuf->x) {
mul_v2_v2fl(translation, sc->loc, (float)width / ibuf->x);
- else
+ }
+ else {
copy_v2_v2(translation, sc->loc);
+ }
BKE_tracking_stabilization_data_to_mat4(
width, height, aspect, translation, sc->scale, sc->angle, sc->stabmat);
@@ -1970,8 +2008,9 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d)
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
- if (!clip)
+ if (!clip) {
return;
+ }
if (onlyv2d) {
bool is_track_source = sc->gpencil_src == SC_GPENCIL_SRC_TRACK;
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 8351f79aac7..b0b6aa47df1 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -72,8 +72,9 @@ bool ED_space_clip_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- if (sc && sc->clip)
+ if (sc && sc->clip) {
return true;
+ }
return false;
}
@@ -93,8 +94,9 @@ bool ED_space_clip_tracking_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- if (sc && sc->clip)
+ if (sc && sc->clip) {
return ED_space_clip_check_show_trackedit(sc);
+ }
return false;
}
@@ -159,10 +161,12 @@ void ED_space_clip_get_aspect(SpaceClip *sc, float *aspx, float *aspy)
{
MovieClip *clip = ED_space_clip_get_clip(sc);
- if (clip)
+ if (clip) {
BKE_movieclip_get_aspect(clip, aspx, aspy);
- else
+ }
+ else {
*aspx = *aspy = 1.0f;
+ }
if (*aspx < *aspy) {
*aspy = *aspy / *aspx;
@@ -224,11 +228,13 @@ ImBuf *ED_space_clip_get_buffer(SpaceClip *sc)
ibuf = BKE_movieclip_get_postprocessed_ibuf(sc->clip, &sc->user, sc->postproc_flag);
- if (ibuf && (ibuf->rect || ibuf->rect_float))
+ if (ibuf && (ibuf->rect || ibuf->rect_float)) {
return ibuf;
+ }
- if (ibuf)
+ if (ibuf) {
IMB_freeImBuf(ibuf);
+ }
}
return NULL;
@@ -242,11 +248,13 @@ ImBuf *ED_space_clip_get_stable_buffer(SpaceClip *sc, float loc[2], float *scale
ibuf = BKE_movieclip_get_stable_ibuf(
sc->clip, &sc->user, loc, scale, angle, sc->postproc_flag);
- if (ibuf && (ibuf->rect || ibuf->rect_float))
+ if (ibuf && (ibuf->rect || ibuf->rect_float)) {
return ibuf;
+ }
- if (ibuf)
+ if (ibuf) {
IMB_freeImBuf(ibuf);
+ }
}
return NULL;
@@ -395,11 +403,13 @@ bool ED_clip_view_selection(const bContext *C, ARegion *ar, bool fit)
ED_space_clip_get_size(sc, &frame_width, &frame_height);
- if ((frame_width == 0) || (frame_height == 0) || (sc->clip == NULL))
+ if ((frame_width == 0) || (frame_height == 0) || (sc->clip == NULL)) {
return false;
+ }
- if (!selected_boundbox(C, min, max))
+ if (!selected_boundbox(C, min, max)) {
return false;
+ }
/* center view */
clip_view_center_to_point(
@@ -423,8 +433,9 @@ bool ED_clip_view_selection(const bContext *C, ARegion *ar, bool fit)
newzoom = 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy));
- if (fit || sc->zoom > newzoom)
+ if (fit || sc->zoom > newzoom) {
sc->zoom = newzoom;
+ }
}
return true;
@@ -489,8 +500,9 @@ void ED_clip_select_all(SpaceClip *sc, int action, bool *r_has_selection)
}
}
- if (TRACK_VIEW_SELECTED(sc, track))
+ if (TRACK_VIEW_SELECTED(sc, track)) {
has_selection = true;
+ }
}
for (plane_track = plane_tracks_base->first; plane_track; plane_track = plane_track->next) {
@@ -635,8 +647,9 @@ void ED_space_clip_set_clip(bContext *C, bScreen *screen, SpaceClip *sc, MovieCl
MovieClip *old_clip;
bool old_clip_visible = false;
- if (!screen && C)
+ if (!screen && C) {
screen = CTX_wm_screen(C);
+ }
old_clip = sc->clip;
sc->clip = clip;
@@ -654,8 +667,9 @@ void ED_space_clip_set_clip(bContext *C, bScreen *screen, SpaceClip *sc, MovieCl
if (cur_sc != sc) {
if (cur_sc->view == SC_VIEW_CLIP) {
- if (cur_sc->clip == old_clip)
+ if (cur_sc->clip == old_clip) {
old_clip_visible = true;
+ }
}
else {
if (cur_sc->clip == old_clip || cur_sc->clip == NULL) {
@@ -673,8 +687,9 @@ void ED_space_clip_set_clip(bContext *C, bScreen *screen, SpaceClip *sc, MovieCl
BKE_movieclip_clear_cache(old_clip);
}
- if (C)
+ if (C) {
WM_event_add_notifier(C, NC_MOVIECLIP | NA_SELECTED, sc->clip);
+ }
}
/* ******** masking editing functions ******** */
@@ -785,16 +800,18 @@ static int prefetch_find_uncached_frame(MovieClip *clip,
for (current_frame = from_frame; current_frame <= end_frame; current_frame++) {
user.framenr = current_frame;
- if (!BKE_movieclip_has_cached_frame(clip, &user))
+ if (!BKE_movieclip_has_cached_frame(clip, &user)) {
break;
+ }
}
}
else {
for (current_frame = from_frame; current_frame >= end_frame; current_frame--) {
user.framenr = current_frame;
- if (!BKE_movieclip_has_cached_frame(clip, &user))
+ if (!BKE_movieclip_has_cached_frame(clip, &user)) {
break;
+ }
}
}
@@ -956,8 +973,9 @@ static bool prefetch_movie_frame(
MovieClipUser user = {0};
ImBuf *ibuf;
- if (check_prefetch_break() || *stop)
+ if (check_prefetch_break() || *stop) {
return false;
+ }
user.framenr = frame;
user.render_size = render_size;
@@ -1002,8 +1020,9 @@ static void do_prefetch_movie(MovieClip *clip,
/* read frames starting from current frame up to scene end frame */
for (frame = current_frame; frame <= end_frame; frame++) {
- if (!prefetch_movie_frame(clip, frame, render_size, render_flag, stop))
+ if (!prefetch_movie_frame(clip, frame, render_size, render_flag, stop)) {
return;
+ }
frames_processed++;
@@ -1013,8 +1032,9 @@ static void do_prefetch_movie(MovieClip *clip,
/* read frames starting from current frame up to scene start frame */
for (frame = current_frame; frame >= start_frame; frame--) {
- if (!prefetch_movie_frame(clip, frame, render_size, render_flag, stop))
+ if (!prefetch_movie_frame(clip, frame, render_size, render_flag, stop)) {
return;
+ }
frames_processed++;
@@ -1113,8 +1133,9 @@ static bool prefetch_check_early_out(const bContext *C)
first_uncached_frame = prefetch_find_uncached_frame(
clip, sc->user.framenr, start_frame, sc->user.render_size, sc->user.render_flag, -1);
- if (first_uncached_frame < start_frame)
+ if (first_uncached_frame < start_frame) {
return true;
+ }
}
return false;
@@ -1126,8 +1147,9 @@ void clip_start_prefetch_job(const bContext *C)
PrefetchJob *pj;
SpaceClip *sc = CTX_wm_space_clip(C);
- if (prefetch_check_early_out(C))
+ if (prefetch_check_early_out(C)) {
return;
+ }
wm_job = WM_jobs_get(CTX_wm_manager(C),
CTX_wm_window(C),
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index c7602907954..8a5f48d11d2 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -111,8 +111,9 @@ static void tracking_segment_knot_cb(void *userdata,
TrackMotionCurveUserData *data = (TrackMotionCurveUserData *)userdata;
int sel = 0, sel_flag;
- if (track != data->act_track)
+ if (track != data->act_track) {
return;
+ }
sel_flag = coord == 0 ? MARKER_GRAPH_SEL_X : MARKER_GRAPH_SEL_Y;
sel = (marker->flag & sel_flag) ? 1 : 0;
@@ -140,8 +141,9 @@ static void draw_tracks_motion_curves(View2D *v2d, SpaceClip *sc, unsigned int p
BKE_movieclip_get_size(clip, &sc->user, &width, &height);
- if (!width || !height)
+ if (!width || !height) {
return;
+ }
/* non-selected knot handles */
userdata.hsize = UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE);
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index 7a61aced8b5..a3722433e33 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -200,16 +200,20 @@ static bool mouse_select_knot(bContext *C, float co[2], bool extend)
}
if (userdata.coord == 0) {
- if (extend && (userdata.marker->flag & MARKER_GRAPH_SEL_X) != 0)
+ if (extend && (userdata.marker->flag & MARKER_GRAPH_SEL_X) != 0) {
userdata.marker->flag &= ~MARKER_GRAPH_SEL_X;
- else
+ }
+ else {
userdata.marker->flag |= MARKER_GRAPH_SEL_X;
+ }
}
else {
- if (extend && (userdata.marker->flag & MARKER_GRAPH_SEL_Y) != 0)
+ if (extend && (userdata.marker->flag & MARKER_GRAPH_SEL_Y) != 0) {
userdata.marker->flag &= ~MARKER_GRAPH_SEL_Y;
- else
+ }
+ else {
userdata.marker->flag |= MARKER_GRAPH_SEL_Y;
+ }
}
return true;
@@ -281,8 +285,9 @@ static int mouse_select(bContext *C, float co[2], bool extend)
sel = mouse_select_curve(C, co, extend);
}
- if (sel)
+ if (sel) {
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
+ }
return OPERATOR_FINISHED;
}
@@ -360,10 +365,12 @@ static void box_select_cb(void *userdata,
if (BLI_rctf_isect_pt(&data->rect, scene_framenr, val)) {
int flag = 0;
- if (coord == 0)
+ if (coord == 0) {
flag = MARKER_GRAPH_SEL_X;
- else
+ }
+ else {
flag = MARKER_GRAPH_SEL_Y;
+ }
if (data->select) {
marker->flag |= flag;
@@ -444,8 +451,9 @@ static int graph_select_all_markers_exec(bContext *C, wmOperator *op)
int action = RNA_enum_get(op->ptr, "action");
int a;
- if (!act_track)
+ if (!act_track) {
return OPERATOR_CANCELLED;
+ }
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
@@ -507,8 +515,9 @@ static int delete_curve_exec(bContext *C, wmOperator *UNUSED(op))
MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking);
- if (!act_track)
+ if (!act_track) {
return OPERATOR_CANCELLED;
+ }
clip_delete_track(C, clip, act_track);
@@ -546,10 +555,12 @@ static int delete_knot_exec(bContext *C, wmOperator *UNUSED(op))
while (a < act_track->markersnr) {
MovieTrackingMarker *marker = &act_track->markers[a];
- if (marker->flag & MARKER_GRAPH_SEL)
+ if (marker->flag & MARKER_GRAPH_SEL) {
clip_delete_marker(C, clip, act_track, marker);
- else
+ }
+ else {
a++;
+ }
}
}
@@ -586,11 +597,13 @@ static void view_all_cb(void *userdata,
{
ViewAllUserData *data = (ViewAllUserData *)userdata;
- if (val < data->min)
+ if (val < data->min) {
data->min = val;
+ }
- if (val > data->max)
+ if (val > data->max) {
data->max = val;
+ }
}
static int view_all_exec(bContext *C, wmOperator *UNUSED(op))
@@ -700,19 +713,23 @@ static int graph_disable_markers_exec(bContext *C, wmOperator *op)
int action = RNA_enum_get(op->ptr, "action");
int a;
- if (!act_track || (act_track->flag & TRACK_LOCKED))
+ if (!act_track || (act_track->flag & TRACK_LOCKED)) {
return OPERATOR_CANCELLED;
+ }
for (a = 0; a < act_track->markersnr; a++) {
marker = &act_track->markers[a];
if (marker->flag & MARKER_GRAPH_SEL) {
- if (action == 0)
+ if (action == 0) {
marker->flag |= MARKER_DISABLED;
- else if (action == 1)
+ }
+ else if (action == 1) {
marker->flag &= ~MARKER_DISABLED;
- else
+ }
+ else {
marker->flag ^= MARKER_DISABLED;
+ }
}
}
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 3cebb53d31e..3f971c4444a 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -97,12 +97,15 @@ static void sclip_zoom_set(const bContext *C, float zoom, float location[2])
width *= sc->zoom;
height *= sc->zoom;
- if ((width < 4) && (height < 4) && sc->zoom < oldzoom)
+ if ((width < 4) && (height < 4) && sc->zoom < oldzoom) {
sc->zoom = oldzoom;
- else if (BLI_rcti_size_x(&ar->winrct) <= sc->zoom)
+ }
+ else if (BLI_rcti_size_x(&ar->winrct) <= sc->zoom) {
sc->zoom = oldzoom;
- else if (BLI_rcti_size_y(&ar->winrct) <= sc->zoom)
+ }
+ else if (BLI_rcti_size_y(&ar->winrct) <= sc->zoom) {
sc->zoom = oldzoom;
+ }
}
if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {
@@ -216,8 +219,9 @@ static int open_exec(bContext *C, wmOperator *op)
clip = BKE_movieclip_file_add_exists(bmain, str);
if (!clip) {
- if (op->customdata)
+ if (op->customdata) {
MEM_freeN(op->customdata);
+ }
BKE_reportf(op->reports,
RPT_ERROR,
@@ -228,8 +232,9 @@ static int open_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- if (!op->customdata)
+ if (!op->customdata) {
open_init(C, op);
+ }
/* hook into UI */
pprop = op->customdata;
@@ -261,8 +266,9 @@ static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)
char path[FILE_MAX];
MovieClip *clip = NULL;
- if (sc)
+ if (sc) {
clip = ED_space_clip_get_clip(sc);
+ }
if (clip) {
BLI_strncpy(path, clip->name, sizeof(path));
@@ -274,11 +280,13 @@ static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)
BLI_strncpy(path, U.textudir, sizeof(path));
}
- if (RNA_struct_property_is_set(op->ptr, "files"))
+ if (RNA_struct_property_is_set(op->ptr, "files")) {
return open_exec(C, op);
+ }
- if (!RNA_struct_property_is_set(op->ptr, "relative_path"))
+ if (!RNA_struct_property_is_set(op->ptr, "relative_path")) {
RNA_boolean_set(op->ptr, "relative_path", (U.flag & USER_RELPATHS) != 0);
+ }
open_init(C, op);
@@ -318,8 +326,9 @@ static int reload_exec(bContext *C, wmOperator *UNUSED(op))
{
MovieClip *clip = CTX_data_edit_movieclip(C);
- if (!clip)
+ if (!clip) {
return OPERATOR_CANCELLED;
+ }
WM_jobs_kill_type(CTX_wm_manager(C), NULL, WM_JOB_TYPE_CLIP_PREFETCH);
BKE_movieclip_reload(CTX_data_main(C), clip);
@@ -360,10 +369,12 @@ static void view_pan_init(bContext *C, wmOperator *op, const wmEvent *event)
vpd->x = event->x;
vpd->y = event->y;
- if (sc->flag & SC_LOCK_SELECTION)
+ if (sc->flag & SC_LOCK_SELECTION) {
vpd->vec = &sc->xlockof;
- else
+ }
+ else {
vpd->vec = &sc->xof;
+ }
copy_v2_v2(&vpd->xof, vpd->vec);
copy_v2_v2(&vpd->xorig, &vpd->xof);
@@ -569,8 +580,9 @@ static int view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
delta = event->prevx - event->x + event->prevy - event->y;
- if (U.uiflag & USER_ZOOM_INVERT)
+ if (U.uiflag & USER_ZOOM_INVERT) {
delta *= -1;
+ }
factor = 1.0f + delta / 300.0f;
RNA_float_set(op->ptr, "factor", factor);
@@ -879,8 +891,9 @@ static int view_all_exec(bContext *C, wmOperator *op)
/* find the zoom value that will fit the image in the image space */
sclip_zoom_set(C, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), NULL);
}
- else
+ else {
sclip_zoom_set(C, 1.0f, NULL);
+ }
}
sc->xof = sc->yof = 0.0f;
@@ -941,8 +954,9 @@ void CLIP_OT_view_selected(wmOperatorType *ot)
static bool change_frame_poll(bContext *C)
{
/* prevent changes during render */
- if (G.is_rendering)
+ if (G.is_rendering) {
return 0;
+ }
return ED_space_clip_poll(C);
}
@@ -995,8 +1009,9 @@ static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event
ARegion *ar = CTX_wm_region(C);
if (ar->regiontype == RGN_TYPE_WINDOW) {
- if (event->mval[1] > 16)
+ if (event->mval[1] > 16) {
return OPERATOR_PASS_THROUGH;
+ }
}
RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
@@ -1022,8 +1037,9 @@ static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
case LEFTMOUSE:
case RIGHTMOUSE:
- if (event->val == KM_RELEASE)
+ if (event->val == KM_RELEASE) {
return OPERATOR_FINISHED;
+ }
break;
}
@@ -1079,17 +1095,21 @@ static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undisto
MCLIP_PROXY_UNDISTORTED_SIZE_100}};
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;
+ }
- 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;
+ }
- 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;
+ }
- 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;
+ }
return build_count;
}
@@ -1110,12 +1130,14 @@ static void do_movie_proxy(void *pjv,
struct MovieDistortion *distortion = NULL;
int cfra, sfra = SFRA, efra = EFRA;
- if (pj->index_context)
+ if (pj->index_context) {
IMB_anim_index_rebuild(pj->index_context, stop, do_update, progress);
+ }
if (!build_undistort_count) {
- if (*stop)
+ if (*stop) {
pj->stop = 1;
+ }
return;
}
@@ -1138,18 +1160,21 @@ static void do_movie_proxy(void *pjv,
BKE_movieclip_build_proxy_frame(
clip, pj->clip_flag, distortion, cfra, build_undistort_sizes, build_undistort_count, 1);
- if (*stop || G.is_break)
+ if (*stop || G.is_break) {
break;
+ }
*do_update = true;
*progress = ((float)cfra - sfra) / (efra - sfra);
}
- if (distortion)
+ if (distortion) {
BKE_tracking_distortion_free(distortion);
+ }
- if (*stop)
+ if (*stop) {
pj->stop = 1;
+ }
}
/* *****
@@ -1371,11 +1396,13 @@ static void proxy_endjob(void *pjv)
{
ProxyJob *pj = pjv;
- if (pj->clip->anim)
+ if (pj->clip->anim) {
IMB_close_anim_proxies(pj->clip->anim);
+ }
- if (pj->index_context)
+ if (pj->index_context) {
IMB_anim_index_rebuild_finish(pj->index_context, pj->stop);
+ }
if (pj->clip->source == MCLIP_SRC_MOVIE) {
/* Timecode might have changed, so do a full reload to deal with this. */
@@ -1398,8 +1425,9 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
- if ((clip->flag & MCLIP_USE_PROXY) == 0)
+ if ((clip->flag & MCLIP_USE_PROXY) == 0) {
return OPERATOR_CANCELLED;
+ }
wm_job = WM_jobs_get(CTX_wm_manager(C),
CTX_wm_window(C),
@@ -1491,8 +1519,9 @@ void CLIP_OT_mode_set(wmOperatorType *ot)
static int clip_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
- if (event->type != NDOF_MOTION)
+ if (event->type != NDOF_MOTION) {
return OPERATOR_CANCELLED;
+ }
else {
SpaceClip *sc = CTX_wm_space_clip(C);
ARegion *ar = CTX_wm_region(C);
@@ -1534,8 +1563,9 @@ void CLIP_OT_view_ndof(wmOperatorType *ot)
static int clip_prefetch_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
/* no running blender, remove handler and pass through */
- if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_CLIP_PREFETCH))
+ if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_CLIP_PREFETCH)) {
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
+ }
/* running render */
switch (event->type) {
@@ -1577,8 +1607,9 @@ static int clip_set_scene_frames_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene = CTX_data_scene(C);
int clip_length;
- if (ELEM(NULL, scene, clip))
+ if (ELEM(NULL, scene, clip)) {
return OPERATOR_CANCELLED;
+ }
clip_length = BKE_movieclip_get_duration(clip);
diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c
index d54a6da9a3c..fb0362fffd3 100644
--- a/source/blender/editors/space_clip/clip_toolbar.c
+++ b/source/blender/editors/space_clip/clip_toolbar.c
@@ -58,15 +58,17 @@ ARegion *ED_clip_has_properties_region(ScrArea *sa)
ARegion *ar, *arnew;
ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if (ar)
+ if (ar) {
return ar;
+ }
/* add subdiv level; after header */
ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if (ar == NULL)
+ if (ar == NULL) {
return NULL;
+ }
arnew = MEM_callocN(sizeof(ARegion), "clip properties region");
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index 37a28e6189a..3dfe529f8e8 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -81,8 +81,9 @@ void clip_graph_tracking_values_iterate_track(
if (marker->flag & MARKER_DISABLED) {
if (open) {
- if (segment_end)
+ if (segment_end) {
segment_end(userdata, coord);
+ }
open = false;
}
@@ -119,8 +120,9 @@ void clip_graph_tracking_values_iterate_track(
}
if (open) {
- if (segment_end)
+ if (segment_end) {
segment_end(userdata, coord);
+ }
}
}
}
@@ -145,11 +147,13 @@ void clip_graph_tracking_values_iterate(
MovieTrackingTrack *track;
for (track = tracksbase->first; track; track = track->next) {
- if (!include_hidden && (track->flag & TRACK_HIDDEN) != 0)
+ if (!include_hidden && (track->flag & TRACK_HIDDEN) != 0) {
continue;
+ }
- if (selected_only && !TRACK_SELECTED(track))
+ if (selected_only && !TRACK_SELECTED(track)) {
continue;
+ }
clip_graph_tracking_values_iterate_track(
sc, track, userdata, func, segment_start, segment_end);
@@ -170,20 +174,24 @@ void clip_graph_tracking_iterate(SpaceClip *sc,
for (track = tracksbase->first; track; track = track->next) {
int i;
- if (!include_hidden && (track->flag & TRACK_HIDDEN) != 0)
+ if (!include_hidden && (track->flag & TRACK_HIDDEN) != 0) {
continue;
+ }
- if (selected_only && !TRACK_SELECTED(track))
+ if (selected_only && !TRACK_SELECTED(track)) {
continue;
+ }
for (i = 0; i < track->markersnr; i++) {
MovieTrackingMarker *marker = &track->markers[i];
- if (marker->flag & MARKER_DISABLED)
+ if (marker->flag & MARKER_DISABLED) {
continue;
+ }
- if (func)
+ if (func) {
func(userdata, marker);
+ }
}
}
}
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index d12e6634987..f176763abf5 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -136,12 +136,14 @@ static void reinit_preview_region(const bContext *C, ARegion *ar)
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc->view == SC_VIEW_DOPESHEET) {
- if ((ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) == 0)
+ if ((ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) == 0) {
init_preview_region(scene, sa, sc, ar);
+ }
}
else {
- if (ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL)
+ if (ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) {
init_preview_region(scene, sa, sc, ar);
+ }
}
}
@@ -150,15 +152,17 @@ static ARegion *ED_clip_has_preview_region(const bContext *C, ScrArea *sa)
ARegion *ar, *arnew;
ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
- if (ar)
+ if (ar) {
return ar;
+ }
/* add subdiv level; after header */
ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
/* is error! */
- if (ar == NULL)
+ if (ar == NULL) {
return NULL;
+ }
arnew = MEM_callocN(sizeof(ARegion), "clip preview region");
@@ -173,15 +177,17 @@ static ARegion *ED_clip_has_channels_region(ScrArea *sa)
ARegion *ar, *arnew;
ar = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
- if (ar)
+ if (ar) {
return ar;
+ }
/* add subdiv level; after header */
ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
/* is error! */
- if (ar == NULL)
+ if (ar == NULL) {
return NULL;
+ }
arnew = MEM_callocN(sizeof(ARegion), "clip channels region");
@@ -200,13 +206,15 @@ static void clip_scopes_tag_refresh(ScrArea *sa)
SpaceClip *sc = (SpaceClip *)sa->spacedata.first;
ARegion *ar;
- if (sc->mode != SC_MODE_TRACKING)
+ if (sc->mode != SC_MODE_TRACKING) {
return;
+ }
/* only while properties are visible */
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_UI && ar->flag & RGN_FLAG_HIDDEN)
+ if (ar->regiontype == RGN_TYPE_UI && ar->flag & RGN_FLAG_HIDDEN) {
return;
+ }
}
sc->scopes.ok = false;
@@ -296,11 +304,13 @@ static void clip_free(SpaceLink *sl)
sc->clip = NULL;
- if (sc->scopes.track_preview)
+ if (sc->scopes.track_preview) {
IMB_freeImBuf(sc->scopes.track_preview);
+ }
- if (sc->scopes.track_search)
+ if (sc->scopes.track_search) {
IMB_freeImBuf(sc->scopes.track_search);
+ }
}
/* spacetype; init callback */
@@ -565,13 +575,15 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul
return true;
}
else if (CTX_data_equals(member, "edit_movieclip")) {
- if (sc->clip)
+ if (sc->clip) {
CTX_data_id_pointer_set(result, &sc->clip->id);
+ }
return true;
}
else if (CTX_data_equals(member, "edit_mask")) {
- if (sc->mask_info.mask)
+ if (sc->mask_info.mask) {
CTX_data_id_pointer_set(result, &sc->mask_info.mask->id);
+ }
return true;
}
@@ -868,8 +880,9 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar)
/* if tracking is in progress, we should synchronize framenr from clipuser
* so latest tracked frame would be shown */
- if (clip && clip->tracking_context)
+ if (clip && clip->tracking_context) {
BKE_autotrack_context_sync_user(clip->tracking_context, &sc->user);
+ }
if (sc->flag & SC_LOCK_SELECTION) {
ImBuf *tmpibuf = NULL;
@@ -883,8 +896,9 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar)
sc->yof += sc->ylockof;
}
- if (tmpibuf)
+ if (tmpibuf) {
IMB_freeImBuf(tmpibuf);
+ }
}
/* clear and setup matrix */
@@ -968,10 +982,12 @@ static void clip_main_region_listener(wmWindow *UNUSED(win),
/* context changes */
switch (wmn->category) {
case NC_GPENCIL:
- if (wmn->action == NA_EDITED)
+ if (wmn->action == NA_EDITED) {
ED_region_tag_redraw(ar);
- else if (wmn->data & ND_GPENCIL_EDITMODE)
+ }
+ else if (wmn->data & ND_GPENCIL_EDITMODE) {
ED_region_tag_redraw(ar);
+ }
break;
}
}
@@ -1004,8 +1020,9 @@ static void graph_region_draw(const bContext *C, ARegion *ar)
short unitx, unity;
short cfra_flag = 0;
- if (sc->flag & SC_LOCK_TIMECURSOR)
+ if (sc->flag & SC_LOCK_TIMECURSOR) {
ED_clip_graph_center_current_frame(scene, ar);
+ }
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
@@ -1017,8 +1034,9 @@ static void graph_region_draw(const bContext *C, ARegion *ar)
clip_draw_graph(sc, ar, scene);
/* current frame indicator line */
- if (sc->flag & SC_SHOW_SECONDS)
+ if (sc->flag & SC_SHOW_SECONDS) {
cfra_flag |= DRAWCFRA_UNIT_SECONDS;
+ }
ANIM_draw_cfra(C, v2d, cfra_flag);
/* reset view matrix */
@@ -1033,8 +1051,9 @@ static void graph_region_draw(const bContext *C, ARegion *ar)
UI_view2d_scrollers_free(scrollers);
/* current frame indicator */
- if (sc->flag & SC_SHOW_SECONDS)
+ if (sc->flag & SC_SHOW_SECONDS) {
cfra_flag |= DRAWCFRA_UNIT_SECONDS;
+ }
UI_view2d_view_orthoSpecial(ar, v2d, 1);
ANIM_draw_cfra_number(C, v2d, cfra_flag);
}
@@ -1049,8 +1068,9 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar)
View2DScrollers *scrollers;
short unit = 0, cfra_flag = 0;
- if (clip)
+ if (clip) {
BKE_tracking_dopesheet_update(&clip->tracking);
+ }
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
@@ -1069,8 +1089,9 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar)
clip_draw_dopesheet_main(sc, ar, scene);
/* current frame indicator line */
- if (sc->flag & SC_SHOW_SECONDS)
+ if (sc->flag & SC_SHOW_SECONDS) {
cfra_flag |= DRAWCFRA_UNIT_SECONDS;
+ }
ANIM_draw_cfra(C, v2d, cfra_flag);
/* reset view matrix */
@@ -1091,10 +1112,12 @@ static void clip_preview_region_draw(const bContext *C, ARegion *ar)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- if (sc->view == SC_VIEW_GRAPH)
+ if (sc->view == SC_VIEW_GRAPH) {
graph_region_draw(C, ar);
- else if (sc->view == SC_VIEW_DOPESHEET)
+ }
+ else if (sc->view == SC_VIEW_DOPESHEET) {
dopesheet_region_draw(C, ar);
+ }
}
static void clip_preview_region_listener(wmWindow *UNUSED(win),
@@ -1126,8 +1149,9 @@ static void clip_channels_region_draw(const bContext *C, ARegion *ar)
MovieClip *clip = ED_space_clip_get_clip(sc);
View2D *v2d = &ar->v2d;
- if (clip)
+ if (clip) {
BKE_tracking_dopesheet_update(&clip->tracking);
+ }
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
@@ -1215,20 +1239,24 @@ static void clip_props_region_listener(wmWindow *UNUSED(win),
/* context changes */
switch (wmn->category) {
case NC_WM:
- if (wmn->data == ND_HISTORY)
+ if (wmn->data == ND_HISTORY) {
ED_region_tag_redraw(ar);
+ }
break;
case NC_SCENE:
- if (wmn->data == ND_MODE)
+ if (wmn->data == ND_MODE) {
ED_region_tag_redraw(ar);
+ }
break;
case NC_SPACE:
- if (wmn->data == ND_SPACE_CLIP)
+ if (wmn->data == ND_SPACE_CLIP) {
ED_region_tag_redraw(ar);
+ }
break;
case NC_GPENCIL:
- if (wmn->action == NA_EDITED)
+ if (wmn->action == NA_EDITED) {
ED_region_tag_redraw(ar);
+ }
break;
}
}
@@ -1264,12 +1292,14 @@ static void clip_properties_region_listener(wmWindow *UNUSED(win),
/* context changes */
switch (wmn->category) {
case NC_GPENCIL:
- if (ELEM(wmn->data, ND_DATA, ND_GPENCIL_EDITMODE))
+ if (ELEM(wmn->data, ND_DATA, ND_GPENCIL_EDITMODE)) {
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;
}
}
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index ce1ade80823..18d48b426e0 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -512,8 +512,9 @@ static bool slide_check_corners(float (*corners)[2])
float cross = 0.0f;
float p[2] = {0.0f, 0.0f};
- if (!isect_point_quad_v2(p, corners[0], corners[1], corners[2], corners[3]))
+ if (!isect_point_quad_v2(p, corners[0], corners[1], corners[2], corners[3])) {
return false;
+ }
for (i = 0; i < 4; i++) {
float v1[2], v2[2], cur_cross;
@@ -562,8 +563,9 @@ MovieTrackingTrack *tracking_marker_check_slide(
ED_space_clip_get_size(sc, &width, &height);
- if (width == 0 || height == 0)
+ if (width == 0 || height == 0) {
return NULL;
+ }
ED_clip_mouse_pos(sc, ar, event->mval, co);
diff --git a/source/blender/editors/space_clip/tracking_ops_orient.c b/source/blender/editors/space_clip/tracking_ops_orient.c
index 6efc80c5c05..61991993b10 100644
--- a/source/blender/editors/space_clip/tracking_ops_orient.c
+++ b/source/blender/editors/space_clip/tracking_ops_orient.c
@@ -679,8 +679,9 @@ static int do_set_scale(bContext *C, wmOperator *op, bool scale_solution, bool a
DEG_id_tag_update(&clip->id, 0);
- if (object)
+ if (object) {
DEG_id_tag_update(&object->id, ID_RECALC_TRANSFORM);
+ }
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
@@ -700,8 +701,9 @@ static int set_scale_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
- if (!RNA_struct_property_is_set(op->ptr, "distance"))
+ if (!RNA_struct_property_is_set(op->ptr, "distance")) {
RNA_float_set(op->ptr, "distance", clip->tracking.settings.dist);
+ }
return set_scale_exec(C, op);
}
diff --git a/source/blender/editors/space_clip/tracking_ops_solve.c b/source/blender/editors/space_clip/tracking_ops_solve.c
index ca57b3ea57f..4490655393e 100644
--- a/source/blender/editors/space_clip/tracking_ops_solve.c
+++ b/source/blender/editors/space_clip/tracking_ops_solve.c
@@ -239,8 +239,9 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
static int solve_camera_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
/* No running solver, remove handler and pass through. */
- if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY))
+ if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY)) {
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
+ }
/* Running solver. */
switch (event->type) {
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index 24282ce0e96..207a0f1aff6 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -58,11 +58,13 @@ static float dist_to_crns(float co[2], float pos[2], float crns[4][2]);
static int mouse_on_side(
float co[2], float x1, float y1, float x2, float y2, float epsx, float epsy)
{
- if (x1 > x2)
+ if (x1 > x2) {
SWAP(float, x1, x2);
+ }
- if (y1 > y2)
+ if (y1 > y2) {
SWAP(float, y1, y2);
+ }
return (co[0] >= x1 - epsx && co[0] <= x2 + epsx) && (co[1] >= y1 - epsy && co[1] <= y2 + epsy);
}
@@ -115,14 +117,17 @@ static int track_mouse_area(const bContext *C, float co[2], MovieTrackingTrack *
epsy = max_ff(epsy, 2.0f / height);
if (sc->flag & SC_SHOW_MARKER_SEARCH) {
- if (mouse_on_rect(co, marker->pos, marker->search_min, marker->search_max, epsx, epsy))
+ if (mouse_on_rect(co, marker->pos, marker->search_min, marker->search_max, epsx, epsy)) {
return TRACK_AREA_SEARCH;
+ }
}
if ((marker->flag & MARKER_DISABLED) == 0) {
- if (sc->flag & SC_SHOW_MARKER_PATTERN)
- if (mouse_on_crns(co, marker->pos, marker->pattern_corners, epsx, epsy))
+ if (sc->flag & SC_SHOW_MARKER_PATTERN) {
+ if (mouse_on_crns(co, marker->pos, marker->pattern_corners, epsx, epsy)) {
return TRACK_AREA_PAT;
+ }
+ }
epsx = 12.0f / width;
epsy = 12.0f / height;
@@ -204,12 +209,14 @@ static MovieTrackingTrack *find_nearest_track(SpaceClip *sc,
(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)
+ if (sc->flag & SC_SHOW_MARKER_PATTERN) {
d2 = dist_to_crns(co, marker->pos, marker->pattern_corners);
+ }
/* distance to search boundbox */
- if (sc->flag & SC_SHOW_MARKER_SEARCH && TRACK_VIEW_SELECTED(sc, cur))
+ if (sc->flag & SC_SHOW_MARKER_SEARCH && TRACK_VIEW_SELECTED(sc, cur)) {
d3 = dist_to_rect(co, marker->pos, marker->search_min, marker->search_max);
+ }
/* choose minimal distance. useful for cases of overlapped markers. */
dist = min_fff(d1, d2, d3);
@@ -305,8 +312,9 @@ static int mouse_select(bContext *C, float co[2], int extend)
if (track) {
int area = track_mouse_area(C, co, track);
- if (!extend || !TRACK_VIEW_SELECTED(sc, track))
+ if (!extend || !TRACK_VIEW_SELECTED(sc, track)) {
area = TRACK_AREA_ALL;
+ }
if (extend && TRACK_AREA_SELECTED(track, area)) {
if (track == act_track) {
@@ -318,8 +326,9 @@ static int mouse_select(bContext *C, float co[2], int extend)
}
}
else {
- if (area == TRACK_AREA_POINT)
+ if (area == TRACK_AREA_POINT) {
area = TRACK_AREA_ALL;
+ }
BKE_tracking_track_select(tracksbase, track, area, extend);
clip->tracking.act_track = track;
@@ -584,10 +593,12 @@ static int do_lasso_select_marker(bContext *C,
if (BLI_rcti_isect_pt(&rect, screen_co[0], screen_co[1]) &&
BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], V2D_IS_CLIPPED)) {
- if (select)
+ if (select) {
BKE_tracking_track_flag_set(track, TRACK_AREA_ALL, SELECT);
- else
+ }
+ else {
BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT);
+ }
}
changed = true;
@@ -820,8 +831,9 @@ static int select_all_exec(bContext *C, wmOperator *op)
ED_clip_select_all(sc, action, &has_selection);
- if (!has_selection)
+ if (!has_selection) {
sc->flag &= ~SC_LOCK_SELECTION;
+ }
BKE_tracking_dopesheet_tag_update(tracking);
@@ -888,8 +900,9 @@ static int select_grouped_exec(bContext *C, wmOperator *op)
if (act_track) {
ok = (track->flag & TRACK_CUSTOMCOLOR) == (act_track->flag & TRACK_CUSTOMCOLOR);
- if (ok && track->flag & TRACK_CUSTOMCOLOR)
+ if (ok && track->flag & TRACK_CUSTOMCOLOR) {
ok = equals_v3v3(track->color, act_track->color);
+ }
}
}
else if (group == 6) { /* failed */
@@ -898,10 +911,12 @@ static int select_grouped_exec(bContext *C, wmOperator *op)
if (ok) {
track->flag |= SELECT;
- if (sc->flag & SC_SHOW_MARKER_PATTERN)
+ if (sc->flag & SC_SHOW_MARKER_PATTERN) {
track->pat_flag |= SELECT;
- if (sc->flag & SC_SHOW_MARKER_SEARCH)
+ }
+ if (sc->flag & SC_SHOW_MARKER_SEARCH) {
track->search_flag |= SELECT;
+ }
}
track = track->next;