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/screen')
-rw-r--r--source/blender/editors/screen/area.c129
-rw-r--r--source/blender/editors/screen/glutil.c42
-rw-r--r--source/blender/editors/screen/screen_context.c48
-rw-r--r--source/blender/editors/screen/screen_edit.c123
-rw-r--r--source/blender/editors/screen/screen_geometry.c12
-rw-r--r--source/blender/editors/screen/screen_ops.c459
-rw-r--r--source/blender/editors/screen/screendump.c18
7 files changed, 554 insertions, 277 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index c38818f3032..5923d0373d5 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -151,16 +151,18 @@ void ED_region_do_listen(
/* generic notes first */
switch (note->category) {
case NC_WM:
- if (note->data == ND_FILEREAD)
+ if (note->data == ND_FILEREAD) {
ED_region_tag_redraw(ar);
+ }
break;
case NC_WINDOW:
ED_region_tag_redraw(ar);
break;
}
- if (ar->type && ar->type->listener)
+ if (ar->type && ar->type->listener) {
ar->type->listener(win, sa, ar, note, scene);
+ }
}
/* only exported for WM */
@@ -335,8 +337,9 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar)
{
AZone *az;
- if (!sa)
+ if (!sa) {
return;
+ }
GPU_line_width(1.0f);
GPU_blend(true);
@@ -529,8 +532,9 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
ARegionType *at = ar->type;
/* see BKE_spacedata_draw_locks() */
- if (at->do_lock)
+ if (at->do_lock) {
return;
+ }
ar->do_draw |= RGN_DRAWING;
@@ -657,8 +661,9 @@ void ED_region_tag_redraw(ARegion *ar)
void ED_region_tag_redraw_overlay(ARegion *ar)
{
- if (ar)
+ if (ar) {
ar->do_draw_overlay = RGN_DRAW;
+ }
}
void ED_region_tag_redraw_no_rebuild(ARegion *ar)
@@ -701,18 +706,22 @@ void ED_area_tag_redraw(ScrArea *sa)
{
ARegion *ar;
- if (sa)
- for (ar = sa->regionbase.first; ar; ar = ar->next)
+ if (sa) {
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
ED_region_tag_redraw(ar);
+ }
+ }
}
void ED_area_tag_redraw_no_rebuild(ScrArea *sa)
{
ARegion *ar;
- if (sa)
- for (ar = sa->regionbase.first; ar; ar = ar->next)
+ if (sa) {
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
ED_region_tag_redraw_no_rebuild(ar);
+ }
+ }
}
void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype)
@@ -730,8 +739,9 @@ void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype)
void ED_area_tag_refresh(ScrArea *sa)
{
- if (sa)
+ if (sa) {
sa->do_refresh = true;
+ }
}
/* *************************************************************** */
@@ -742,14 +752,16 @@ void ED_area_status_text(ScrArea *sa, const char *str)
ARegion *ar;
/* happens when running transform operators in background mode */
- if (sa == NULL)
+ if (sa == NULL) {
return;
+ }
for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_HEADER) {
if (str) {
- if (ar->headerstr == NULL)
+ if (ar->headerstr == NULL) {
ar->headerstr = MEM_mallocN(UI_MAX_DRAW_STR, "headerprint");
+ }
BLI_strncpy(ar->headerstr, str, UI_MAX_DRAW_STR);
BLI_str_rstrip(ar->headerstr);
}
@@ -768,12 +780,14 @@ void ED_workspace_status_text(bContext *C, const char *str)
WorkSpace *workspace = CTX_wm_workspace(C);
/* Can be NULL when running operators in background mode. */
- if (workspace == NULL)
+ if (workspace == NULL) {
return;
+ }
if (str) {
- if (workspace->status_text == NULL)
+ if (workspace->status_text == NULL) {
workspace->status_text = MEM_mallocN(UI_MAX_DRAW_STR, "headerprint");
+ }
BLI_strncpy(workspace->status_text, str, UI_MAX_DRAW_STR);
}
else if (workspace->status_text) {
@@ -866,8 +880,9 @@ static void fullscreen_azone_initialize(ScrArea *sa, ARegion *ar)
{
AZone *az;
- if (ED_area_is_global(sa) || (ar->regiontype != RGN_TYPE_WINDOW))
+ if (ED_area_is_global(sa) || (ar->regiontype != RGN_TYPE_WINDOW)) {
return;
+ }
az = (AZone *)MEM_callocN(sizeof(AZone), "fullscreen action zone");
BLI_addtail(&(sa->actionzones), az);
@@ -928,8 +943,9 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
const float tab_size_y = 0.4f * U.widget_unit;
for (azt = sa->actionzones.first; azt; azt = azt->next) {
- if (azt->edge == az->edge)
+ if (azt->edge == az->edge) {
tot++;
+ }
}
switch (az->edge) {
@@ -1057,14 +1073,18 @@ static void region_azones_add(const bScreen *screen, ScrArea *sa, ARegion *ar, c
}
/* edge code (t b l r) is along which area edge azone will be drawn */
- if (alignment == RGN_ALIGN_TOP)
+ if (alignment == RGN_ALIGN_TOP) {
region_azone_edge_initialize(sa, ar, AE_BOTTOM_TO_TOPLEFT, is_fullscreen);
- else if (alignment == RGN_ALIGN_BOTTOM)
+ }
+ else if (alignment == RGN_ALIGN_BOTTOM) {
region_azone_edge_initialize(sa, ar, AE_TOP_TO_BOTTOMRIGHT, is_fullscreen);
- else if (alignment == RGN_ALIGN_RIGHT)
+ }
+ else if (alignment == RGN_ALIGN_RIGHT) {
region_azone_edge_initialize(sa, ar, AE_LEFT_TO_TOPRIGHT, is_fullscreen);
- else if (alignment == RGN_ALIGN_LEFT)
+ }
+ else if (alignment == RGN_ALIGN_LEFT) {
region_azone_edge_initialize(sa, ar, AE_RIGHT_TO_TOPLEFT, is_fullscreen);
+ }
if (is_fullscreen) {
fullscreen_azone_initialize(sa, ar);
@@ -1191,8 +1211,9 @@ static void region_rect_recursive(
{
rcti *remainder_prev = remainder;
- if (ar == NULL)
+ if (ar == NULL) {
return;
+ }
int prev_winx = ar->winx;
int prev_winy = ar->winy;
@@ -1201,9 +1222,11 @@ static void region_rect_recursive(
BLI_rcti_init(&ar->winrct, 0, 0, 0, 0);
/* for test; allow split of previously defined region */
- if (ar->alignment & RGN_SPLIT_PREV)
- if (ar->prev)
+ if (ar->alignment & RGN_SPLIT_PREV) {
+ if (ar->prev) {
remainder = &ar->prev->winrct;
+ }
+ }
int alignment = ar->alignment & ~RGN_SPLIT_PREV;
@@ -1304,8 +1327,9 @@ static void region_rect_recursive(
else {
int fac = rct_fits(winrct, 'v', prefsizey);
- if (fac < 0)
+ if (fac < 0) {
prefsizey += fac;
+ }
ar->winrct = *winrct;
@@ -1328,8 +1352,9 @@ static void region_rect_recursive(
else {
int fac = rct_fits(winrct, 'h', prefsizex);
- if (fac < 0)
+ if (fac < 0) {
prefsizex += fac;
+ }
ar->winrct = *winrct;
@@ -1383,8 +1408,9 @@ static void region_rect_recursive(
if (count != 4) {
/* let's stop adding regions */
BLI_rcti_init(remainder, 0, 0, 0, 0);
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("region quadsplit failed\n");
+ }
}
else {
quad = 1;
@@ -1419,10 +1445,12 @@ static void region_rect_recursive(
/* if region opened normally, we store this for hide/reveal usage */
/* prevent rounding errors for UI_DPI_FAC mult and divide */
- if (ar->winx > 1)
+ if (ar->winx > 1) {
ar->sizex = (ar->winx + 0.5f) / UI_DPI_FAC;
- if (ar->winy > 1)
+ }
+ if (ar->winy > 1) {
ar->sizey = (ar->winy + 0.5f) / UI_DPI_FAC;
+ }
/* exception for multiple overlapping regions on same spot */
if (ar->overlap && (alignment != RGN_ALIGN_FLOAT)) {
@@ -1516,8 +1544,9 @@ static void region_subwindow(ARegion *ar)
{
bool hidden = (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) != 0;
- if ((ar->alignment & RGN_SPLIT_PREV) && ar->prev)
+ if ((ar->alignment & RGN_SPLIT_PREV) && ar->prev) {
hidden = hidden || (ar->prev->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL));
+ }
ar->visible = !hidden;
}
@@ -1690,8 +1719,9 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
sa->type = BKE_spacetype_from_id(sa->spacetype);
}
- for (ar = sa->regionbase.first; ar; ar = ar->next)
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
ar->type = BKE_regiontype_from_id_or_first(sa->type, ar->regiontype);
+ }
/* area sizes */
area_calc_totrct(sa, &window_rect);
@@ -1705,8 +1735,9 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
/* default area handlers */
ed_default_handlers(wm, sa, NULL, &sa->handlers, sa->type->keymapflag);
/* checks spacedata, adds own handlers */
- if (sa->type->init)
+ if (sa->type->init) {
sa->type->init(wm, sa);
+ }
/* clear all azones, add the area triangle widgets */
area_azone_initialize(win, screen, sa);
@@ -1787,8 +1818,9 @@ void ED_region_cursor_set(wmWindow *win, ScrArea *sa, ARegion *ar)
/* for use after changing visibility of regions */
void ED_region_visibility_change_update(bContext *C, ScrArea *sa, ARegion *ar)
{
- if (ar->flag & RGN_FLAG_HIDDEN)
+ if (ar->flag & RGN_FLAG_HIDDEN) {
WM_event_remove_handlers(C, &ar->handlers);
+ }
ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
ED_area_tag_redraw(sa);
@@ -1842,8 +1874,9 @@ void ED_area_data_copy(ScrArea *sa_dst, ScrArea *sa_src, const bool do_free)
/* regions */
if (do_free) {
st = BKE_spacetype_from_id(spacetype);
- for (ar = sa_dst->regionbase.first; ar; ar = ar->next)
+ for (ar = sa_dst->regionbase.first; ar; ar = ar->next) {
BKE_area_region_free(st, ar);
+ }
BLI_freelistN(&sa_dst->regionbase);
}
st = BKE_spacetype_from_id(sa_src->spacetype);
@@ -1940,9 +1973,11 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi
* (e.g. with properties editor) until space-data is properly created */
/* check previously stored space */
- for (sl = sa->spacedata.first; sl; sl = sl->next)
- if (sl->spacetype == type)
+ for (sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == type) {
break;
+ }
+ }
/* old spacedata... happened during work on 2.50, remove */
if (sl && BLI_listbase_is_empty(&sl->regionbase)) {
@@ -1973,8 +2008,9 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi
BLI_addhead(&sa->spacedata, sl);
/* swap regions */
- if (slold)
+ if (slold) {
slold->regionbase = sa->regionbase;
+ }
sa->regionbase = sl->regionbase;
BLI_listbase_clear(&sl->regionbase);
}
@@ -2269,8 +2305,9 @@ void ED_region_panels_layout_ex(
BLI_SMALLSTACK_DECLARE(pt_stack, PanelType *);
- if (contextnr != -1)
+ if (contextnr != -1) {
is_context_new = UI_view2d_tab_set(v2d, contextnr);
+ }
/* before setting the view */
if (vertical) {
@@ -2560,15 +2597,17 @@ void ED_region_header_layout(const bContext *C, ARegion *ar)
/* for view2d */
xco = uiLayoutGetWidth(layout);
- if (xco > maxco)
+ if (xco > maxco) {
maxco = xco;
+ }
}
UI_block_layout_resolve(block, &xco, &yco);
/* for view2d */
- if (xco > maxco)
+ if (xco > maxco) {
maxco = xco;
+ }
int new_sizex = (maxco + UI_HEADER_OFFSET) / UI_DPI_FAC;
@@ -2909,8 +2948,9 @@ static void metadata_draw_imbuf(ImBuf *ibuf, const rctf *rect, int fontid, const
do_newline = true;
}
- if (do_newline)
+ if (do_newline) {
ofs_y += vertical_offset;
+ }
} /* Strip */
else if (i == 1 || i == 2) {
len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[i + 1]);
@@ -3042,8 +3082,9 @@ void ED_region_image_metadata_draw(
rctf rect;
uiStyle *style = UI_style_get_dpi();
- if (!ibuf->metadata)
+ if (!ibuf->metadata) {
return;
+ }
/* find window pixel coordinates of origin */
GPU_matrix_push();
@@ -3145,8 +3186,9 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy)
/* gridsize adapted to zoom level */
gridsize = 0.5f * (zoomx + zoomy);
- if (gridsize <= 0.0f)
+ if (gridsize <= 0.0f) {
return;
+ }
if (gridsize < 1.0f) {
while (gridsize < 1.0f) {
@@ -3222,8 +3264,9 @@ void ED_region_visible_rect(ARegion *ar, rcti *rect)
ARegion *arn = ar;
/* allow function to be called without area */
- while (arn->prev)
+ while (arn->prev) {
arn = arn->prev;
+ }
*rect = ar->winrct;
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index a3273481829..fc771e0db77 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -172,12 +172,15 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
nsubparts_x = (img_w + (offset_x - 1)) / (offset_x);
nsubparts_y = (img_h + (offset_y - 1)) / (offset_y);
- if (format == GL_RGBA)
+ if (format == GL_RGBA) {
components = 4;
- else if (format == GL_RGB)
+ }
+ else if (format == GL_RGB) {
components = 3;
- else if (format == GL_RED)
+ }
+ else if (format == GL_RED) {
components = 1;
+ }
else {
BLI_assert(!"Incompatible format passed to glaDrawPixelsTexScaled");
return;
@@ -215,8 +218,9 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
float rast_x = x + subpart_x * offset_x * xzoom;
float rast_y = y + subpart_y * offset_y * yzoom;
/* check if we already got these because we always get 2 more when doing seamless */
- if (subpart_w <= seamless || subpart_h <= seamless)
+ if (subpart_w <= seamless || subpart_h <= seamless) {
continue;
+ }
if (use_clipping) {
if (rast_x + (float)(subpart_w - offset_right) * xzoom * scaleX < clip_min_x ||
@@ -242,7 +246,7 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
subpart_x * offset_x * components]);
/* add an extra border of pixels so linear looks ok at edges of full image */
- if (subpart_w < tex_w)
+ if (subpart_w < tex_w) {
glTexSubImage2D(GL_TEXTURE_2D,
0,
subpart_w,
@@ -253,7 +257,8 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
GL_FLOAT,
&f_rect[((size_t)subpart_y) * offset_y * img_w * components +
(subpart_x * offset_x + subpart_w - 1) * components]);
- if (subpart_h < tex_h)
+ }
+ if (subpart_h < tex_h) {
glTexSubImage2D(
GL_TEXTURE_2D,
0,
@@ -265,7 +270,8 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
GL_FLOAT,
&f_rect[(((size_t)subpart_y) * offset_y + subpart_h - 1) * img_w * components +
subpart_x * offset_x * components]);
- if (subpart_w < tex_w && subpart_h < tex_h)
+ }
+ if (subpart_w < tex_w && subpart_h < tex_h) {
glTexSubImage2D(
GL_TEXTURE_2D,
0,
@@ -277,6 +283,7 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
GL_FLOAT,
&f_rect[(((size_t)subpart_y) * offset_y + subpart_h - 1) * img_w * components +
(subpart_x * offset_x + subpart_w - 1) * components]);
+ }
}
else {
glTexSubImage2D(GL_TEXTURE_2D,
@@ -290,7 +297,7 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
&uc_rect[((size_t)subpart_y) * offset_y * img_w * components +
subpart_x * offset_x * components]);
- if (subpart_w < tex_w)
+ if (subpart_w < tex_w) {
glTexSubImage2D(GL_TEXTURE_2D,
0,
subpart_w,
@@ -301,7 +308,8 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
GL_UNSIGNED_BYTE,
&uc_rect[((size_t)subpart_y) * offset_y * img_w * components +
(subpart_x * offset_x + subpart_w - 1) * components]);
- if (subpart_h < tex_h)
+ }
+ if (subpart_h < tex_h) {
glTexSubImage2D(
GL_TEXTURE_2D,
0,
@@ -313,7 +321,8 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
GL_UNSIGNED_BYTE,
&uc_rect[(((size_t)subpart_y) * offset_y + subpart_h - 1) * img_w * components +
subpart_x * offset_x * components]);
- if (subpart_w < tex_w && subpart_h < tex_h)
+ }
+ if (subpart_w < tex_w && subpart_h < tex_h) {
glTexSubImage2D(
GL_TEXTURE_2D,
0,
@@ -325,6 +334,7 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
GL_UNSIGNED_BYTE,
&uc_rect[(((size_t)subpart_y) * offset_y + subpart_h - 1) * img_w * components +
(subpart_x * offset_x + subpart_w - 1) * components]);
+ }
}
immBegin(GPU_PRIM_TRI_FAN, 4);
@@ -552,8 +562,9 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf,
bool need_fallback = true;
/* Early out */
- if (ibuf->rect == NULL && ibuf->rect_float == NULL)
+ if (ibuf->rect == NULL && ibuf->rect_float == NULL) {
return;
+ }
/* Single channel images could not be transformed using GLSL yet */
force_fallback |= ibuf->channels == 1;
@@ -589,12 +600,15 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf,
if (ibuf->rect_float) {
int format = 0;
- if (ibuf->channels == 3)
+ if (ibuf->channels == 3) {
format = GL_RGB;
- else if (ibuf->channels == 4)
+ }
+ else if (ibuf->channels == 4) {
format = GL_RGBA;
- else
+ }
+ else {
BLI_assert(!"Incompatible number of channels for GLSL display");
+ }
if (format != 0) {
immDrawPixelsTex_clipping(&state,
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 00942a4d1b8..6dcb9f8a82c 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -276,8 +276,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
* We need to make sure that these mirrored copies are not selected, otherwise some
* bones will be operated on twice.
*/
- if (arm->flag & ARM_MIRROR_EDIT)
+ if (arm->flag & ARM_MIRROR_EDIT) {
flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
+ }
/* if we're filtering for editable too, use the check for that instead,
* as it has selection check too */
@@ -286,16 +287,18 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
if (EBONE_EDITABLE(ebone)) {
CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
- if ((flipbone) && !(flipbone->flag & BONE_SELECTED))
+ if ((flipbone) && !(flipbone->flag & BONE_SELECTED)) {
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
+ }
}
}
else {
/* only include bones if visible */
CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
- if ((flipbone) && EBONE_VISIBLE(arm, flipbone) == 0)
+ if ((flipbone) && EBONE_VISIBLE(arm, flipbone) == 0) {
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
+ }
}
}
}
@@ -330,8 +333,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
* We need to make sure that these mirrored copies are not selected, otherwise some
* bones will be operated on twice.
*/
- if (arm->flag & ARM_MIRROR_EDIT)
+ if (arm->flag & ARM_MIRROR_EDIT) {
flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
+ }
/* if we're filtering for editable too, use the check for that instead,
* as it has selection check too */
@@ -340,16 +344,18 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
if (EBONE_EDITABLE(ebone)) {
CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
- if ((flipbone) && !(flipbone->flag & BONE_SELECTED))
+ if ((flipbone) && !(flipbone->flag & BONE_SELECTED)) {
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
+ }
}
}
else {
/* only include bones if selected */
CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
- if ((flipbone) && !(flipbone->flag & BONE_SELECTED))
+ if ((flipbone) && !(flipbone->flag & BONE_SELECTED)) {
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
+ }
}
}
}
@@ -451,57 +457,66 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if (CTX_data_equals(member, "active_base")) {
- if (view_layer->basact)
+ if (view_layer->basact) {
CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, view_layer->basact);
+ }
return 1;
}
else if (CTX_data_equals(member, "active_object")) {
- if (obact)
+ if (obact) {
CTX_data_id_pointer_set(result, &obact->id);
+ }
return 1;
}
else if (CTX_data_equals(member, "object")) {
- if (obact)
+ if (obact) {
CTX_data_id_pointer_set(result, &obact->id);
+ }
return 1;
}
else if (CTX_data_equals(member, "edit_object")) {
/* convenience for now, 1 object per scene in editmode */
- if (obedit)
+ if (obedit) {
CTX_data_id_pointer_set(result, &obedit->id);
+ }
return 1;
}
else if (CTX_data_equals(member, "sculpt_object")) {
- if (obact && (obact->mode & OB_MODE_SCULPT))
+ if (obact && (obact->mode & OB_MODE_SCULPT)) {
CTX_data_id_pointer_set(result, &obact->id);
+ }
return 1;
}
else if (CTX_data_equals(member, "vertex_paint_object")) {
- if (obact && (obact->mode & OB_MODE_VERTEX_PAINT))
+ if (obact && (obact->mode & OB_MODE_VERTEX_PAINT)) {
CTX_data_id_pointer_set(result, &obact->id);
+ }
return 1;
}
else if (CTX_data_equals(member, "weight_paint_object")) {
- if (obact && (obact->mode & OB_MODE_WEIGHT_PAINT))
+ if (obact && (obact->mode & OB_MODE_WEIGHT_PAINT)) {
CTX_data_id_pointer_set(result, &obact->id);
+ }
return 1;
}
else if (CTX_data_equals(member, "image_paint_object")) {
- if (obact && (obact->mode & OB_MODE_TEXTURE_PAINT))
+ if (obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) {
CTX_data_id_pointer_set(result, &obact->id);
+ }
return 1;
}
else if (CTX_data_equals(member, "particle_edit_object")) {
- if (obact && (obact->mode & OB_MODE_PARTICLE_EDIT))
+ if (obact && (obact->mode & OB_MODE_PARTICLE_EDIT)) {
CTX_data_id_pointer_set(result, &obact->id);
+ }
return 1;
}
@@ -730,8 +745,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale = anim_data.first; ale; ale = ale->next) {
- if (ale->type == ANIMTYPE_FCURVE)
+ if (ale->type == ANIMTYPE_FCURVE) {
CTX_data_list_add(result, ale->id, &RNA_FCurve, ale->data);
+ }
}
ANIM_animdata_freelist(&anim_data);
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index d9e7a50c646..95bade1da64 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -113,14 +113,16 @@ ScrArea *area_split(const wmWindow *win, bScreen *sc, ScrArea *sa, char dir, flo
short split;
rcti window_rect;
- if (sa == NULL)
+ if (sa == NULL) {
return NULL;
+ }
WM_window_rect_calc(win, &window_rect);
split = screen_geom_find_area_split_point(sa, &window_rect, dir, fac);
- if (split == 0)
+ if (split == 0) {
return NULL;
+ }
/* note regarding (fac > 0.5f) checks below.
* normally it shouldn't matter which is used since the copy should match the original
@@ -190,8 +192,9 @@ ScrArea *area_split(const wmWindow *win, bScreen *sc, ScrArea *sa, char dir, flo
}
/* remove double vertices en edges */
- if (merge)
+ if (merge) {
BKE_screen_remove_double_scrverts(sc);
+ }
BKE_screen_remove_double_scredges(sc);
BKE_screen_remove_unused_scredges(sc);
@@ -269,8 +272,9 @@ void screen_data_copy(bScreen *to, bScreen *from)
}
/* put at zero (needed?) */
- for (s1 = from->vertbase.first; s1; s1 = s1->next)
+ for (s1 = from->vertbase.first; s1; s1 = s1->next) {
s1->newv = NULL;
+ }
}
/**
@@ -291,8 +295,9 @@ int area_getorientation(ScrArea *sa, ScrArea *sb)
ScrVert *sav1, *sav2, *sav3, *sav4;
ScrVert *sbv1, *sbv2, *sbv3, *sbv4;
- if (sa == NULL || sb == NULL)
+ if (sa == NULL || sb == NULL) {
return -1;
+ }
sav1 = sa->v1;
sav2 = sa->v2;
@@ -399,19 +404,22 @@ void ED_screen_do_listen(bContext *C, wmNotifier *note)
/* generic notes */
switch (note->category) {
case NC_WM:
- if (note->data == ND_FILEREAD)
+ if (note->data == ND_FILEREAD) {
screen->do_draw = true;
+ }
break;
case NC_WINDOW:
screen->do_draw = true;
break;
case NC_SCREEN:
- if (note->action == NA_EDITED)
+ if (note->action == NA_EDITED) {
screen->do_draw = screen->do_refresh = true;
+ }
break;
case NC_SCENE:
- if (note->data == ND_MODE)
+ if (note->data == ND_MODE) {
region_cursor_set(win, true);
+ }
break;
}
}
@@ -425,16 +433,19 @@ static void screen_refresh_headersizes(void)
for (st = lb->first; st; st = st->next) {
ARegionType *art;
art = BKE_regiontype_from_id(st, RGN_TYPE_HEADER);
- if (art)
+ if (art) {
art->prefsizey = ED_area_headersize();
+ }
art = BKE_regiontype_from_id(st, RGN_TYPE_TOOL_HEADER);
- if (art)
+ if (art) {
art->prefsizey = ED_area_headersize();
+ }
art = BKE_regiontype_from_id(st, RGN_TYPE_FOOTER);
- if (art)
+ if (art) {
art->prefsizey = ED_area_headersize();
+ }
}
}
@@ -462,8 +473,9 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
}
/* wake up animtimer */
- if (screen->animtimer)
+ if (screen->animtimer) {
WM_event_timer_sleep(wm, win, screen->animtimer, false);
+ }
}
if (G.debug & G_DEBUG_EVENTS) {
@@ -514,8 +526,9 @@ void ED_region_exit(bContext *C, ARegion *ar)
wmWindow *win = CTX_wm_window(C);
ARegion *prevar = CTX_wm_region(C);
- if (ar->type && ar->type->exit)
+ if (ar->type && ar->type->exit) {
ar->type->exit(wm, ar);
+ }
CTX_wm_region_set(C, ar);
@@ -545,13 +558,15 @@ void ED_area_exit(bContext *C, ScrArea *sa)
ScrArea *prevsa = CTX_wm_area(C);
ARegion *ar;
- if (sa->type && sa->type->exit)
+ if (sa->type && sa->type->exit) {
sa->type->exit(wm, sa);
+ }
CTX_wm_area_set(C, sa);
- for (ar = sa->regionbase.first; ar; ar = ar->next)
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
ED_region_exit(C, ar);
+ }
WM_event_remove_handlers(C, &sa->handlers);
WM_event_modal_handler_area_replace(win, sa, NULL);
@@ -566,8 +581,9 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
CTX_wm_window_set(C, window);
- if (screen->animtimer)
+ if (screen->animtimer) {
WM_event_remove_timer(wm, window, screen->animtimer);
+ }
screen->animtimer = NULL;
screen->scrubbing = false;
@@ -606,31 +622,39 @@ static void screen_cursor_set(wmWindow *win, const int xy[2])
AZone *az = NULL;
ScrArea *sa;
- for (sa = screen->areabase.first; sa; sa = sa->next)
- if ((az = ED_area_actionzone_find_xy(sa, xy)))
+ for (sa = screen->areabase.first; sa; sa = sa->next) {
+ if ((az = ED_area_actionzone_find_xy(sa, xy))) {
break;
+ }
+ }
if (sa) {
- if (az->type == AZONE_AREA)
+ if (az->type == AZONE_AREA) {
WM_cursor_set(win, CURSOR_EDIT);
+ }
else if (az->type == AZONE_REGION) {
- if (az->edge == AE_LEFT_TO_TOPRIGHT || az->edge == AE_RIGHT_TO_TOPLEFT)
+ if (az->edge == AE_LEFT_TO_TOPRIGHT || az->edge == AE_RIGHT_TO_TOPLEFT) {
WM_cursor_set(win, CURSOR_X_MOVE);
- else
+ }
+ else {
WM_cursor_set(win, CURSOR_Y_MOVE);
+ }
}
}
else {
ScrEdge *actedge = screen_geom_find_active_scredge(win, screen, xy[0], xy[1]);
if (actedge) {
- if (screen_geom_edge_is_horizontal(actedge))
+ if (screen_geom_edge_is_horizontal(actedge)) {
WM_cursor_set(win, CURSOR_Y_MOVE);
- else
+ }
+ else {
WM_cursor_set(win, CURSOR_X_MOVE);
+ }
}
- else
+ else {
WM_cursor_set(win, CURSOR_STD);
+ }
}
}
@@ -665,8 +689,9 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
}
}
}
- else
+ else {
scr->active_region = NULL;
+ }
/* check for redraw headers */
if (old_ar != scr->active_region) {
@@ -707,8 +732,9 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
UI_screen_free_active_but(C, scr);
}
}
- else
+ else {
region_cursor_set(win, false);
+ }
}
}
}
@@ -723,12 +749,15 @@ int ED_screen_area_active(const bContext *C)
AZone *az = ED_area_actionzone_find_xy(sa, &win->eventstate->x);
ARegion *ar;
- if (az && az->type == AZONE_REGION)
+ if (az && az->type == AZONE_REGION) {
return 1;
+ }
- for (ar = sa->regionbase.first; ar; ar = ar->next)
- if (ar == sc->active_region)
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar == sc->active_region) {
return 1;
+ }
+ }
}
return 0;
}
@@ -994,10 +1023,12 @@ static void screen_set_3dview_camera(Scene *scene, ViewLayer *view_layer, ScrAre
ListBase *regionbase;
/* regionbase is in different place depending if space is active */
- if (v3d == sa->spacedata.first)
+ if (v3d == sa->spacedata.first) {
regionbase = &sa->regionbase;
- else
+ }
+ else {
regionbase = &v3d->regionbase;
+ }
for (ar = regionbase->first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_WINDOW) {
@@ -1194,8 +1225,9 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s
sa->full = NULL;
if (fullsa == NULL) {
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("%s: something wrong in areafullscreen\n", __func__);
+ }
return NULL;
}
@@ -1310,9 +1342,10 @@ void ED_refresh_viewport_fps(bContext *C)
ScreenFrameRateInfo *fpsi = scene->fps_info;
/* if there isn't any info, init it first */
- if (fpsi == NULL)
+ if (fpsi == NULL) {
fpsi = scene->fps_info = MEM_callocN(sizeof(ScreenFrameRateInfo),
"refresh_viewport_fps fps_info");
+ }
/* update the values */
fpsi->redrawtime = fpsi->lredrawtime;
@@ -1320,8 +1353,9 @@ void ED_refresh_viewport_fps(bContext *C)
}
else {
/* playback stopped or shouldn't be running */
- if (scene->fps_info)
+ if (scene->fps_info) {
MEM_freeN(scene->fps_info);
+ }
scene->fps_info = NULL;
}
}
@@ -1355,16 +1389,18 @@ void ED_screen_animation_timer(bContext *C, int redraws, int refresh, int sync,
sad->sfra = scene->r.cfra;
scene->r.cfra = scene->r.psfra;
}
- else
+ else {
sad->sfra = scene->r.cfra;
+ }
}
else {
if (scene->r.sfra > scene->r.cfra) {
sad->sfra = scene->r.cfra;
scene->r.cfra = scene->r.sfra;
}
- else
+ else {
sad->sfra = scene->r.cfra;
+ }
}
sad->redraws = redraws;
sad->refresh = refresh;
@@ -1375,8 +1411,9 @@ void ED_screen_animation_timer(bContext *C, int redraws, int refresh, int sync,
char spacetype = -1;
- if (sa)
+ if (sa) {
spacetype = sa->spacetype;
+ }
sad->from_anim_edit = (ELEM(spacetype, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA));
@@ -1420,8 +1457,9 @@ void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh)
sad->redraws = redraws;
sad->refresh = refresh;
sad->ar = NULL;
- if (redraws & TIME_REGION)
+ if (redraws & TIME_REGION) {
sad->ar = time_top_left_3dwindow(screen);
+ }
}
}
@@ -1462,8 +1500,9 @@ bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene)
case SPACE_VIEW3D: {
View3D *v3d;
- if (!is_multiview)
+ if (!is_multiview) {
continue;
+ }
v3d = sa->spacedata.first;
if (v3d->camera && v3d->stereo3d_camera == STEREO_3D_ID) {
@@ -1494,8 +1533,9 @@ bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene)
case SPACE_NODE: {
SpaceNode *snode;
- if (!is_multiview)
+ if (!is_multiview) {
continue;
+ }
snode = sa->spacedata.first;
if ((snode->flag & SNODE_BACKDRAW) && ED_node_is_compositor(snode)) {
@@ -1506,8 +1546,9 @@ bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene)
case SPACE_SEQ: {
SpaceSeq *sseq;
- if (!is_multiview)
+ if (!is_multiview) {
continue;
+ }
sseq = sa->spacedata.first;
if (ELEM(sseq->view, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE_PREVIEW)) {
diff --git a/source/blender/editors/screen/screen_geometry.c b/source/blender/editors/screen/screen_geometry.c
index a9aebca7724..a0d9c232195 100644
--- a/source/blender/editors/screen/screen_geometry.c
+++ b/source/blender/editors/screen/screen_geometry.c
@@ -103,8 +103,9 @@ ScrEdge *screen_geom_area_map_find_active_scredge(const ScrAreaMap *area_map,
min = MIN2(se->v1->vec.x, se->v2->vec.x);
max = MAX2(se->v1->vec.x, se->v2->vec.x);
- if (abs(my - se->v1->vec.y) <= safety && mx >= min && mx <= max)
+ if (abs(my - se->v1->vec.y) <= safety && mx >= min && mx <= max) {
return se;
+ }
}
}
else {
@@ -113,8 +114,9 @@ ScrEdge *screen_geom_area_map_find_active_scredge(const ScrAreaMap *area_map,
min = MIN2(se->v1->vec.y, se->v2->vec.y);
max = MAX2(se->v1->vec.y, se->v2->vec.y);
- if (abs(mx - se->v1->vec.x) <= safety && my >= min && my <= max)
+ if (abs(mx - se->v1->vec.x) <= safety && my >= min && my <= max) {
return se;
+ }
}
}
}
@@ -200,10 +202,12 @@ void screen_geom_vertices_scale(const wmWindow *win, bScreen *sc)
int headery = headery_init;
/* adjust headery if verts are along the edge of window */
- if (sa->v1->vec.y > window_rect.ymin)
+ if (sa->v1->vec.y > window_rect.ymin) {
headery += U.pixelsize;
- if (sa->v2->vec.y < (window_rect.ymax - 1))
+ }
+ if (sa->v2->vec.y < (window_rect.ymax - 1)) {
headery += U.pixelsize;
+ }
if (screen_geom_area_height(sa) < headery) {
/* lower edge */
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index cb2effd6657..27fd7c37dee 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -102,44 +102,55 @@
bool ED_operator_regionactive(bContext *C)
{
- if (CTX_wm_window(C) == NULL)
+ if (CTX_wm_window(C) == NULL) {
return 0;
- if (CTX_wm_screen(C) == NULL)
+ }
+ if (CTX_wm_screen(C) == NULL) {
return 0;
- if (CTX_wm_region(C) == NULL)
+ }
+ if (CTX_wm_region(C) == NULL) {
return 0;
+ }
return 1;
}
bool ED_operator_areaactive(bContext *C)
{
- if (CTX_wm_window(C) == NULL)
+ if (CTX_wm_window(C) == NULL) {
return 0;
- if (CTX_wm_screen(C) == NULL)
+ }
+ if (CTX_wm_screen(C) == NULL) {
return 0;
- if (CTX_wm_area(C) == NULL)
+ }
+ if (CTX_wm_area(C) == NULL) {
return 0;
+ }
return 1;
}
bool ED_operator_screenactive(bContext *C)
{
- if (CTX_wm_window(C) == NULL)
+ if (CTX_wm_window(C) == NULL) {
return 0;
- if (CTX_wm_screen(C) == NULL)
+ }
+ if (CTX_wm_screen(C) == NULL) {
return 0;
+ }
return 1;
}
/* XXX added this to prevent anim state to change during renders */
static bool ED_operator_screenactive_norender(bContext *C)
{
- if (G.is_rendering)
+ if (G.is_rendering) {
return 0;
- if (CTX_wm_window(C) == NULL)
+ }
+ if (CTX_wm_window(C) == NULL) {
return 0;
- if (CTX_wm_screen(C) == NULL)
+ }
+ if (CTX_wm_screen(C) == NULL) {
return 0;
+ }
return 1;
}
@@ -147,29 +158,34 @@ static bool ED_operator_screenactive_norender(bContext *C)
bool ED_operator_screen_mainwinactive(bContext *C)
{
bScreen *screen;
- if (CTX_wm_window(C) == NULL)
+ if (CTX_wm_window(C) == NULL) {
return 0;
+ }
screen = CTX_wm_screen(C);
- if (screen == NULL)
+ if (screen == NULL) {
return 0;
- if (screen->active_region != NULL)
+ }
+ if (screen->active_region != NULL) {
return 0;
+ }
return 1;
}
bool ED_operator_scene(bContext *C)
{
Scene *scene = CTX_data_scene(C);
- if (scene)
+ if (scene) {
return 1;
+ }
return 0;
}
bool ED_operator_scene_editable(bContext *C)
{
Scene *scene = CTX_data_scene(C);
- if (scene && !ID_IS_LINKED(scene))
+ if (scene && !ID_IS_LINKED(scene)) {
return 1;
+ }
return 0;
}
@@ -178,14 +194,17 @@ bool ED_operator_objectmode(bContext *C)
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
- if (scene == NULL || ID_IS_LINKED(scene))
+ if (scene == NULL || ID_IS_LINKED(scene)) {
return 0;
- if (CTX_data_edit_object(C))
+ }
+ if (CTX_data_edit_object(C)) {
return 0;
+ }
/* add a check for ob->mode too? */
- if (obact && (obact->mode != OB_MODE_OBJECT))
+ if (obact && (obact->mode != OB_MODE_OBJECT)) {
return 0;
+ }
return 1;
}
@@ -206,8 +225,9 @@ bool ED_operator_view3d_active(bContext *C)
bool ED_operator_region_view3d_active(bContext *C)
{
- if (CTX_wm_region_view3d(C))
+ if (CTX_wm_region_view3d(C)) {
return true;
+ }
CTX_wm_operator_poll_msg_set(C, "expected a view3d region");
return false;
@@ -218,8 +238,9 @@ bool ED_operator_animview_active(bContext *C)
{
if (ED_operator_areaactive(C)) {
SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C);
- if (sl && (ELEM(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_GRAPH)))
+ if (sl && (ELEM(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_GRAPH))) {
return true;
+ }
}
CTX_wm_operator_poll_msg_set(C, "expected a timeline/animation area to be active");
@@ -236,10 +257,12 @@ bool ED_operator_outliner_active_no_editobject(bContext *C)
if (ed_spacetype_test(C, SPACE_OUTLINER)) {
Object *ob = ED_object_active_context(C);
Object *obedit = CTX_data_edit_object(C);
- if (ob && ob == obedit)
+ if (ob && ob == obedit) {
return 0;
- else
+ }
+ else {
return 1;
+ }
}
return 0;
}
@@ -263,8 +286,9 @@ bool ED_operator_node_active(bContext *C)
{
SpaceNode *snode = CTX_wm_space_node(C);
- if (snode && snode->edittree)
+ if (snode && snode->edittree) {
return 1;
+ }
return 0;
}
@@ -273,8 +297,9 @@ bool ED_operator_node_editable(bContext *C)
{
SpaceNode *snode = CTX_wm_space_node(C);
- if (snode && snode->edittree && !ID_IS_LINKED(snode->edittree))
+ if (snode && snode->edittree && !ID_IS_LINKED(snode->edittree)) {
return 1;
+ }
return 0;
}
@@ -348,8 +373,9 @@ bool ED_operator_object_active_editable_font(bContext *C)
bool ED_operator_editmesh(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
- if (obedit && obedit->type == OB_MESH)
+ if (obedit && obedit->type == OB_MESH) {
return NULL != BKE_editmesh_from_object(obedit);
+ }
return 0;
}
@@ -360,8 +386,9 @@ bool ED_operator_editmesh_view3d(bContext *C)
bool ED_operator_editmesh_region_view3d(bContext *C)
{
- if (ED_operator_editmesh(C) && CTX_wm_region_view3d(C))
+ if (ED_operator_editmesh(C) && CTX_wm_region_view3d(C)) {
return 1;
+ }
CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editmesh");
return 0;
@@ -379,8 +406,9 @@ bool ED_operator_editmesh_auto_smooth(bContext *C)
bool ED_operator_editarmature(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
- if (obedit && obedit->type == OB_ARMATURE)
+ if (obedit && obedit->type == OB_ARMATURE) {
return NULL != ((bArmature *)obedit->data)->edbo;
+ }
return 0;
}
@@ -482,15 +510,17 @@ bool ED_operator_uvmap(bContext *C)
bool ED_operator_editsurfcurve(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
- if (obedit && ELEM(obedit->type, OB_CURVE, OB_SURF))
+ if (obedit && ELEM(obedit->type, OB_CURVE, OB_SURF)) {
return NULL != ((Curve *)obedit->data)->editnurb;
+ }
return 0;
}
bool ED_operator_editsurfcurve_region_view3d(bContext *C)
{
- if (ED_operator_editsurfcurve(C) && CTX_wm_region_view3d(C))
+ if (ED_operator_editsurfcurve(C) && CTX_wm_region_view3d(C)) {
return 1;
+ }
CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editcurve");
return 0;
@@ -499,8 +529,9 @@ bool ED_operator_editsurfcurve_region_view3d(bContext *C)
bool ED_operator_editcurve(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
- if (obedit && obedit->type == OB_CURVE)
+ if (obedit && obedit->type == OB_CURVE) {
return NULL != ((Curve *)obedit->data)->editnurb;
+ }
return 0;
}
@@ -518,32 +549,36 @@ bool ED_operator_editcurve_3d(bContext *C)
bool ED_operator_editsurf(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
- if (obedit && obedit->type == OB_SURF)
+ if (obedit && obedit->type == OB_SURF) {
return NULL != ((Curve *)obedit->data)->editnurb;
+ }
return 0;
}
bool ED_operator_editfont(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
- if (obedit && obedit->type == OB_FONT)
+ if (obedit && obedit->type == OB_FONT) {
return NULL != ((Curve *)obedit->data)->editfont;
+ }
return 0;
}
bool ED_operator_editlattice(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
- if (obedit && obedit->type == OB_LATTICE)
+ if (obedit && obedit->type == OB_LATTICE) {
return NULL != ((Lattice *)obedit->data)->editlatt;
+ }
return 0;
}
bool ED_operator_editmball(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
- if (obedit && obedit->type == OB_MBALL)
+ if (obedit && obedit->type == OB_MBALL) {
return NULL != ((MetaBall *)obedit->data)->editelems;
+ }
return 0;
}
@@ -588,8 +623,9 @@ static bool screen_active_editable(bContext *C)
{
if (ED_operator_screenactive(C)) {
/* no full window splitting allowed */
- if (CTX_wm_screen(C)->state != SCREENNORMAL)
+ if (CTX_wm_screen(C)->state != SCREENNORMAL) {
return 0;
+ }
return 1;
}
return 0;
@@ -658,9 +694,11 @@ static bool actionzone_area_poll(bContext *C)
AZone *az;
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
- for (az = sa->actionzones.first; az; az = az->next)
- if (BLI_rcti_isect_pt_v(&az->rect, xy))
+ for (az = sa->actionzones.first; az; az = az->next) {
+ if (BLI_rcti_isect_pt_v(&az->rect, xy)) {
return 1;
+ }
+ }
}
}
return 0;
@@ -867,8 +905,9 @@ AZone *ED_area_azones_update(ScrArea *sa, const int xy[2])
static void actionzone_exit(wmOperator *op)
{
- if (op->customdata)
+ if (op->customdata) {
MEM_freeN(op->customdata);
+ }
op->customdata = NULL;
}
@@ -883,12 +922,15 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type)
wm_event_init_from_window(win, &event);
- if (type == AZONE_AREA)
+ if (type == AZONE_AREA) {
event.type = EVT_ACTIONZONE_AREA;
- else if (type == AZONE_FULLSCREEN)
+ }
+ else if (type == AZONE_FULLSCREEN) {
event.type = EVT_ACTIONZONE_FULLSCREEN;
- else
+ }
+ else {
event.type = EVT_ACTIONZONE_REGION;
+ }
event.val = KM_NOTHING;
event.customdata = op->customdata;
@@ -905,8 +947,9 @@ static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
sActionzoneData *sad;
/* quick escape - Scroll azones only hide/unhide the scroll-bars, they have their own handling. */
- if (az == NULL || ELEM(az->type, AZONE_REGION_SCROLL))
+ if (az == NULL || ELEM(az->type, AZONE_REGION_SCROLL)) {
return OPERATOR_PASS_THROUGH;
+ }
/* ok we do the action-zone */
sad = op->customdata = MEM_callocN(sizeof(sActionzoneData), "sActionzoneData");
@@ -950,14 +993,18 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
const int area_threshold = (0.1 * U.widget_unit);
/* Calculate gesture cardinal direction. */
- if (delta_y > ABS(delta_x))
+ if (delta_y > ABS(delta_x)) {
sad->gesture_dir = 'n';
- else if (delta_x >= ABS(delta_y))
+ }
+ else if (delta_x >= ABS(delta_y)) {
sad->gesture_dir = 'e';
- else if (delta_y < -ABS(delta_x))
+ }
+ else if (delta_y < -ABS(delta_x)) {
sad->gesture_dir = 's';
- else
+ }
+ else {
sad->gesture_dir = 'w';
+ }
if (sad->az->type == AZONE_AREA) {
wmWindow *win = CTX_wm_window(C);
@@ -978,14 +1025,18 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
else {
/* Different area, so posible join. */
- if (sad->gesture_dir == 'n')
+ if (sad->gesture_dir == 'n') {
WM_cursor_set(win, BC_N_ARROWCURSOR);
- else if (sad->gesture_dir == 's')
+ }
+ else if (sad->gesture_dir == 's') {
WM_cursor_set(win, BC_S_ARROWCURSOR);
- else if (sad->gesture_dir == 'e')
+ }
+ else if (sad->gesture_dir == 'e') {
WM_cursor_set(win, BC_E_ARROWCURSOR);
- else
+ }
+ else {
WM_cursor_set(win, BC_W_ARROWCURSOR);
+ }
is_gesture = (delta_max > join_threshold);
}
}
@@ -1079,8 +1130,9 @@ static int area_swap_init(wmOperator *op, const wmEvent *event)
sAreaSwapData *sd = NULL;
sActionzoneData *sad = event->customdata;
- if (sad == NULL || sad->sa1 == NULL)
+ if (sad == NULL || sad->sa1 == NULL) {
return 0;
+ }
sd = MEM_callocN(sizeof(sAreaSwapData), "sAreaSwapData");
sd->sa1 = sad->sa1;
@@ -1093,8 +1145,9 @@ static int area_swap_init(wmOperator *op, const wmEvent *event)
static void area_swap_exit(bContext *C, wmOperator *op)
{
WM_cursor_modal_restore(CTX_wm_window(C));
- if (op->customdata)
+ if (op->customdata) {
MEM_freeN(op->customdata);
+ }
op->customdata = NULL;
}
@@ -1106,8 +1159,9 @@ static void area_swap_cancel(bContext *C, wmOperator *op)
static int area_swap_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- if (!area_swap_init(op, event))
+ if (!area_swap_init(op, event)) {
return OPERATOR_PASS_THROUGH;
+ }
/* add modal handler */
WM_cursor_modal_set(CTX_wm_window(C), BC_SWAPAREA_CURSOR);
@@ -1195,8 +1249,9 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if (event->type == EVT_ACTIONZONE_AREA) {
sActionzoneData *sad = event->customdata;
- if (sad == NULL)
+ if (sad == NULL) {
return OPERATOR_PASS_THROUGH;
+ }
sa = sad->sa1;
}
@@ -1233,8 +1288,9 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event)
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
finally:
- if (event->type == EVT_ACTIONZONE_AREA)
+ if (event->type == EVT_ACTIONZONE_AREA) {
actionzone_exit(op);
+ }
if (newwin) {
return OPERATOR_FINISHED;
@@ -1365,35 +1421,43 @@ static void area_move_set_limits(
int y1;
areamin = areaminy;
- if (sa->v1->vec.y > window_rect.ymin)
+ if (sa->v1->vec.y > window_rect.ymin) {
areamin += U.pixelsize;
- if (sa->v2->vec.y < (window_rect.ymax - 1))
+ }
+ if (sa->v2->vec.y < (window_rect.ymax - 1)) {
areamin += U.pixelsize;
+ }
y1 = screen_geom_area_height(sa) - areamin;
/* if top or down edge selected, test height */
- if (sa->v1->editflag && sa->v4->editflag)
+ if (sa->v1->editflag && sa->v4->editflag) {
*bigger = min_ii(*bigger, y1);
- else if (sa->v2->editflag && sa->v3->editflag)
+ }
+ else if (sa->v2->editflag && sa->v3->editflag) {
*smaller = min_ii(*smaller, y1);
+ }
}
else {
int x1;
areamin = AREAMINX;
- if (sa->v1->vec.x > window_rect.xmin)
+ if (sa->v1->vec.x > window_rect.xmin) {
areamin += U.pixelsize;
- if (sa->v4->vec.x < (window_rect.xmax - 1))
+ }
+ if (sa->v4->vec.x < (window_rect.xmax - 1)) {
areamin += U.pixelsize;
+ }
x1 = screen_geom_area_width(sa) - areamin;
/* if left or right edge selected, test width */
- if (sa->v1->editflag && sa->v2->editflag)
+ if (sa->v1->editflag && sa->v2->editflag) {
*bigger = min_ii(*bigger, x1);
- else if (sa->v3->editflag && sa->v4->editflag)
+ }
+ else if (sa->v3->editflag && sa->v4->editflag) {
*smaller = min_ii(*smaller, x1);
+ }
}
}
}
@@ -1414,17 +1478,20 @@ static int area_move_init(bContext *C, wmOperator *op)
/* setup */
actedge = screen_geom_find_active_scredge(win, sc, x, y);
- if (actedge == NULL)
+ if (actedge == NULL) {
return 0;
+ }
md = MEM_callocN(sizeof(sAreaMoveData), "sAreaMoveData");
op->customdata = md;
md->dir = screen_geom_edge_is_horizontal(actedge) ? 'h' : 'v';
- if (md->dir == 'h')
+ if (md->dir == 'h') {
md->origval = actedge->v1->vec.y;
- else
+ }
+ else {
md->origval = actedge->v1->vec.x;
+ }
screen_geom_select_connected_edge(win, actedge);
/* now all vertices with 'flag == 1' are the ones that can be moved. Move this to editflag */
@@ -1623,8 +1690,9 @@ static void area_move_apply(bContext *C, wmOperator *op)
static void area_move_exit(bContext *C, wmOperator *op)
{
- if (op->customdata)
+ if (op->customdata) {
MEM_freeN(op->customdata);
+ }
op->customdata = NULL;
/* this makes sure aligned edges will result in aligned grabbing */
@@ -1636,8 +1704,9 @@ static void area_move_exit(bContext *C, wmOperator *op)
static int area_move_exec(bContext *C, wmOperator *op)
{
- if (!area_move_init(C, op))
+ if (!area_move_init(C, op)) {
return OPERATOR_CANCELLED;
+ }
area_move_apply(C, op);
area_move_exit(C, op);
@@ -1651,8 +1720,9 @@ static int area_move_invoke(bContext *C, wmOperator *op, const wmEvent *event)
RNA_int_set(op->ptr, "x", event->x);
RNA_int_set(op->ptr, "y", event->y);
- if (!area_move_init(C, op))
+ if (!area_move_init(C, op)) {
return OPERATOR_PASS_THROUGH;
+ }
G.moving |= G_TRANSFORM_WM;
@@ -1830,17 +1900,20 @@ static int area_split_init(bContext *C, wmOperator *op)
int dir;
/* required context */
- if (sa == NULL)
+ if (sa == NULL) {
return 0;
+ }
/* required properties */
dir = RNA_enum_get(op->ptr, "direction");
/* minimal size */
- if (dir == 'v' && sa->winx < 2 * AREAMINX)
+ if (dir == 'v' && sa->winx < 2 * AREAMINX) {
return 0;
- if (dir == 'h' && sa->winy < 2 * areaminy)
+ }
+ if (dir == 'h' && sa->winy < 2 * areaminy) {
return 0;
+ }
/* custom data */
sd = (sAreaSplitData *)MEM_callocN(sizeof(sAreaSplitData), "op_area_split");
@@ -1914,10 +1987,12 @@ static int area_split_apply(bContext *C, wmOperator *op)
sd->nedge->v1->editflag = 1;
sd->nedge->v2->editflag = 1;
- if (dir == 'h')
+ if (dir == 'h') {
sd->origval = sd->nedge->v1->vec.y;
- else
+ }
+ else {
sd->origval = sd->nedge->v1->vec.x;
+ }
ED_area_tag_redraw(sd->sarea);
ED_area_tag_redraw(sd->narea);
@@ -1936,13 +2011,16 @@ static void area_split_exit(bContext *C, wmOperator *op)
{
if (op->customdata) {
sAreaSplitData *sd = (sAreaSplitData *)op->customdata;
- if (sd->sarea)
+ if (sd->sarea) {
ED_area_tag_redraw(sd->sarea);
- if (sd->narea)
+ }
+ if (sd->narea) {
ED_area_tag_redraw(sd->narea);
+ }
- if (sd->draw_callback)
+ if (sd->draw_callback) {
WM_draw_cb_exit(CTX_wm_window(C), sd->draw_callback);
+ }
MEM_freeN(op->customdata);
op->customdata = NULL;
@@ -1986,12 +2064,14 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
/* verify *sad itself */
- if (sad->sa1 == NULL || sad->az == NULL)
+ if (sad->sa1 == NULL || sad->az == NULL) {
return OPERATOR_PASS_THROUGH;
+ }
/* is this our *sad? if areas not equal it should be passed on */
- if (CTX_wm_area(C) != sad->sa1 || sad->sa1 != sad->sa2)
+ if (CTX_wm_area(C) != sad->sa1 || sad->sa1 != sad->sa2) {
return OPERATOR_PASS_THROUGH;
+ }
/* The factor will be close to 1.0f when near the top-left and the bottom-right corners. */
const float factor_v = ((float)(event->y - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy;
@@ -2106,8 +2186,9 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int area_split_exec(bContext *C, wmOperator *op)
{
- if (!area_split_init(C, op))
+ if (!area_split_init(C, op)) {
return OPERATOR_CANCELLED;
+ }
area_split_apply(C, op);
area_split_exit(C, op);
@@ -2327,8 +2408,9 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
/* subtractwidth of regions on opposite side
* prevents dragging regions into other opposite regions */
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar == scalear)
+ if (ar == scalear) {
continue;
+ }
if (scalear->alignment == RGN_ALIGN_LEFT && ar->alignment == RGN_ALIGN_RIGHT) {
dist -= ar->winx;
@@ -2379,10 +2461,12 @@ static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event
rmd->maxsize = area_max_regionsize(rmd->sa, rmd->ar, rmd->edge);
/* if not set we do now, otherwise it uses type */
- if (rmd->ar->sizex == 0)
+ if (rmd->ar->sizex == 0) {
rmd->ar->sizex = rmd->ar->winx;
- if (rmd->ar->sizey == 0)
+ }
+ if (rmd->ar->sizey == 0) {
rmd->ar->sizey = rmd->ar->winy;
+ }
/* now copy to regionmovedata */
if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) {
@@ -2408,15 +2492,18 @@ static void region_scale_validate_size(RegionMoveData *rmd)
if ((rmd->ar->flag & RGN_FLAG_HIDDEN) == 0) {
short *size, maxsize = -1;
- if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT)
+ if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) {
size = &rmd->ar->sizex;
- else
+ }
+ else {
size = &rmd->ar->sizey;
+ }
maxsize = rmd->maxsize - (UI_UNIT_Y / UI_DPI_FAC);
- if (*size > maxsize && maxsize > 0)
+ if (*size > maxsize && maxsize > 0) {
*size = maxsize;
+ }
}
}
@@ -2457,8 +2544,9 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
const int snap_size_threshold = (U.widget_unit * 2) / aspect;
if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) {
delta = event->x - rmd->origx;
- if (rmd->edge == AE_LEFT_TO_TOPRIGHT)
+ if (rmd->edge == AE_LEFT_TO_TOPRIGHT) {
delta = -delta;
+ }
/* region sizes now get multiplied */
delta /= UI_DPI_FAC;
@@ -2475,8 +2563,9 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (rmd->ar->sizex < UI_UNIT_X) {
rmd->ar->sizex = rmd->origval;
- if (!(rmd->ar->flag & RGN_FLAG_HIDDEN))
+ if (!(rmd->ar->flag & RGN_FLAG_HIDDEN)) {
region_scale_toggle_hidden(C, rmd);
+ }
}
else if (rmd->ar->flag & RGN_FLAG_HIDDEN) {
region_scale_toggle_hidden(C, rmd);
@@ -2487,8 +2576,9 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
else {
delta = event->y - rmd->origy;
- if (rmd->edge == AE_BOTTOM_TO_TOPLEFT)
+ if (rmd->edge == AE_BOTTOM_TO_TOPLEFT) {
delta = -delta;
+ }
/* region sizes now get multiplied */
delta /= UI_DPI_FAC;
@@ -2508,8 +2598,9 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
* otherwise its too easy to do this by accident */
if (rmd->ar->sizey < UI_UNIT_Y / 4) {
rmd->ar->sizey = rmd->origval;
- if (!(rmd->ar->flag & RGN_FLAG_HIDDEN))
+ if (!(rmd->ar->flag & RGN_FLAG_HIDDEN)) {
region_scale_toggle_hidden(C, rmd);
+ }
}
else if (rmd->ar->flag & RGN_FLAG_HIDDEN) {
region_scale_toggle_hidden(C, rmd);
@@ -2679,16 +2770,20 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
sad->flag |= ANIMPLAY_FLAG_USE_NEXT_FRAME;
- if (RNA_boolean_get(op->ptr, "end"))
+ if (RNA_boolean_get(op->ptr, "end")) {
sad->nextfra = PEFRA;
- else
+ }
+ else {
sad->nextfra = PSFRA;
+ }
}
else {
- if (RNA_boolean_get(op->ptr, "end"))
+ if (RNA_boolean_get(op->ptr, "end")) {
CFRA = PEFRA;
- else
+ }
+ else {
CFRA = PSFRA;
+ }
areas_do_frame_follow(C, true);
@@ -2736,8 +2831,9 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
bool done = false;
/* sanity checks */
- if (scene == NULL)
+ if (scene == NULL) {
return OPERATOR_CANCELLED;
+ }
cfra = (float)(CFRA);
@@ -2771,10 +2867,12 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
}
/* find matching keyframe in the right direction */
- if (next)
+ if (next) {
ak = (ActKeyColumn *)BLI_dlrbTree_search_next(&keys, compare_ak_cfraPtr, &cfra);
- else
+ }
+ else {
ak = (ActKeyColumn *)BLI_dlrbTree_search_prev(&keys, compare_ak_cfraPtr, &cfra);
+ }
while ((ak != NULL) && (done == false)) {
if (CFRA != (int)ak->cfra) {
@@ -2944,8 +3042,9 @@ static int screen_maximize_area_exec(bContext *C, wmOperator *op)
/* search current screen for 'fullscreen' areas */
/* prevents restoring info header, when mouse is over it */
for (sa = screen->areabase.first; sa; sa = sa->next) {
- if (sa->full)
+ if (sa->full) {
break;
+ }
}
if (sa == NULL) {
@@ -3094,8 +3193,9 @@ static int area_join_init(bContext *C, wmOperator *op)
static int area_join_apply(bContext *C, wmOperator *op)
{
sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
- if (!jd)
+ if (!jd) {
return 0;
+ }
if (!screen_area_join(C, CTX_wm_screen(C), jd->sa1, jd->sa2)) {
return 0;
@@ -3114,8 +3214,9 @@ static void area_join_exit(bContext *C, wmOperator *op)
sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
if (jd) {
- if (jd->draw_callback)
+ if (jd->draw_callback) {
WM_draw_cb_exit(CTX_wm_window(C), jd->draw_callback);
+ }
MEM_freeN(jd);
op->customdata = NULL;
@@ -3129,8 +3230,9 @@ static void area_join_exit(bContext *C, wmOperator *op)
static int area_join_exec(bContext *C, wmOperator *op)
{
- if (!area_join_init(C, op))
+ if (!area_join_init(C, op)) {
return OPERATOR_CANCELLED;
+ }
area_join_apply(C, op);
area_join_exit(C, op);
@@ -3150,12 +3252,14 @@ static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
/* verify *sad itself */
- if (sad->sa1 == NULL || sad->sa2 == NULL)
+ if (sad->sa1 == NULL || sad->sa2 == NULL) {
return OPERATOR_PASS_THROUGH;
+ }
/* is this our *sad? if areas equal it should be passed on */
- if (sad->sa1 == sad->sa2)
+ if (sad->sa1 == sad->sa2) {
return OPERATOR_PASS_THROUGH;
+ }
/* prepare operator state vars */
RNA_int_set(op->ptr, "min_x", sad->sa1->totrct.xmin);
@@ -3164,8 +3268,9 @@ static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event)
RNA_int_set(op->ptr, "max_y", sad->sa2->totrct.ymin);
}
- if (!area_join_init(C, op))
+ if (!area_join_init(C, op)) {
return OPERATOR_CANCELLED;
+ }
/* add temp handler */
WM_event_add_modal_handler(C, op);
@@ -3237,16 +3342,21 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
}
- if (dir == 1)
+ if (dir == 1) {
WM_cursor_set(win, BC_N_ARROWCURSOR);
- else if (dir == 3)
+ }
+ else if (dir == 3) {
WM_cursor_set(win, BC_S_ARROWCURSOR);
- else if (dir == 2)
+ }
+ else if (dir == 2) {
WM_cursor_set(win, BC_E_ARROWCURSOR);
- else if (dir == 0)
+ }
+ else if (dir == 0) {
WM_cursor_set(win, BC_W_ARROWCURSOR);
- else
+ }
+ else {
WM_cursor_set(win, BC_STOPCURSOR);
+ }
break;
}
@@ -3316,8 +3426,9 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent
actedge = screen_geom_area_map_find_active_scredge(
AREAMAP_FROM_SCREEN(sc), &window_rect, event->x, event->y);
- if (actedge == NULL)
+ if (actedge == NULL) {
return OPERATOR_CANCELLED;
+ }
pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE);
layout = UI_popup_menu_layout(pup);
@@ -3454,17 +3565,19 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNU
int items, i;
items = BLI_listbase_count(&wm->operators);
- if (items == 0)
+ if (items == 0) {
return OPERATOR_CANCELLED;
+ }
pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE);
layout = UI_popup_menu_layout(pup);
- for (i = items - 1, lastop = wm->operators.last; lastop; lastop = lastop->prev, i--)
+ for (i = items - 1, lastop = wm->operators.last; lastop; lastop = lastop->prev, i--) {
if ((lastop->type->flag & OPTYPE_REGISTER) && WM_operator_repeat_check(C, lastop)) {
uiItemIntO(
layout, RNA_struct_ui_name(lastop->type->srna), ICON_NONE, op->type->idname, "index", i);
}
+ }
UI_popup_menu_end(C, pup);
@@ -3513,8 +3626,9 @@ static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *
{
wmOperator *lastop = WM_operator_last_redo(C);
- if (lastop)
+ if (lastop) {
WM_operator_redo_popup(C, lastop);
+ }
return OPERATOR_CANCELLED;
}
@@ -3711,17 +3825,22 @@ static int region_flip_exec(bContext *C, wmOperator *UNUSED(op))
{
ARegion *ar = CTX_wm_region(C);
- if (!ar)
+ if (!ar) {
return OPERATOR_CANCELLED;
+ }
- if (ar->alignment == RGN_ALIGN_TOP)
+ if (ar->alignment == RGN_ALIGN_TOP) {
ar->alignment = RGN_ALIGN_BOTTOM;
- else if (ar->alignment == RGN_ALIGN_BOTTOM)
+ }
+ else if (ar->alignment == RGN_ALIGN_BOTTOM) {
ar->alignment = RGN_ALIGN_TOP;
- else if (ar->alignment == RGN_ALIGN_LEFT)
+ }
+ else if (ar->alignment == RGN_ALIGN_LEFT) {
ar->alignment = RGN_ALIGN_RIGHT;
- else if (ar->alignment == RGN_ALIGN_RIGHT)
+ }
+ else if (ar->alignment == RGN_ALIGN_RIGHT) {
ar->alignment = RGN_ALIGN_LEFT;
+ }
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_mousemove(C);
@@ -4002,8 +4121,9 @@ static int match_area_with_refresh(int spacetype, int refresh)
{
switch (spacetype) {
case SPACE_TIME:
- if (refresh & SPACE_TIME)
+ if (refresh & SPACE_TIME) {
return 1;
+ }
break;
}
@@ -4019,40 +4139,48 @@ static int match_region_with_redraws(int spacetype,
switch (spacetype) {
case SPACE_VIEW3D:
- if ((redraws & TIME_ALL_3D_WIN) || from_anim_edit)
+ if ((redraws & TIME_ALL_3D_WIN) || from_anim_edit) {
return 1;
+ }
break;
case SPACE_GRAPH:
case SPACE_NLA:
- if ((redraws & TIME_ALL_ANIM_WIN) || from_anim_edit)
+ if ((redraws & TIME_ALL_ANIM_WIN) || from_anim_edit) {
return 1;
+ }
break;
case SPACE_ACTION:
/* if only 1 window or 3d windows, we do timeline too
* NOTE: Now we do do action editor in all these cases, since timeline is here
*/
- if ((redraws & (TIME_ALL_ANIM_WIN | TIME_REGION | TIME_ALL_3D_WIN)) || from_anim_edit)
+ if ((redraws & (TIME_ALL_ANIM_WIN | TIME_REGION | TIME_ALL_3D_WIN)) || from_anim_edit) {
return 1;
+ }
break;
case SPACE_PROPERTIES:
- if (redraws & TIME_ALL_BUTS_WIN)
+ if (redraws & TIME_ALL_BUTS_WIN) {
return 1;
+ }
break;
case SPACE_SEQ:
- if ((redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN)) || from_anim_edit)
+ if ((redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN)) || from_anim_edit) {
return 1;
+ }
break;
case SPACE_NODE:
- if (redraws & (TIME_NODES))
+ if (redraws & (TIME_NODES)) {
return 1;
+ }
break;
case SPACE_IMAGE:
- if ((redraws & TIME_ALL_IMAGE_WIN) || from_anim_edit)
+ if ((redraws & TIME_ALL_IMAGE_WIN) || from_anim_edit) {
return 1;
+ }
break;
case SPACE_CLIP:
- if ((redraws & TIME_CLIPS) || from_anim_edit)
+ if ((redraws & TIME_CLIPS) || from_anim_edit) {
return 1;
+ }
break;
}
}
@@ -4061,8 +4189,9 @@ static int match_region_with_redraws(int spacetype,
case SPACE_GRAPH:
case SPACE_ACTION:
case SPACE_NLA:
- if (redraws & TIME_ALL_ANIM_WIN)
+ if (redraws & TIME_ALL_ANIM_WIN) {
return 1;
+ }
break;
}
}
@@ -4076,18 +4205,21 @@ static int match_region_with_redraws(int spacetype,
return 1;
}
- if (redraws & TIME_ALL_BUTS_WIN)
+ if (redraws & TIME_ALL_BUTS_WIN) {
return 1;
+ }
}
else if (ELEM(regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
- if (spacetype == SPACE_ACTION)
+ if (spacetype == SPACE_ACTION) {
return 1;
+ }
}
else if (regiontype == RGN_TYPE_PREVIEW) {
switch (spacetype) {
case SPACE_SEQ:
- if (redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN))
+ if (redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN)) {
return 1;
+ }
break;
case SPACE_CLIP:
return 1;
@@ -4120,22 +4252,27 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
float time;
/* sync, don't sync, or follow scene setting */
- if (sad->flag & ANIMPLAY_FLAG_SYNC)
+ if (sad->flag & ANIMPLAY_FLAG_SYNC) {
sync = 1;
- else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC)
+ }
+ else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) {
sync = 0;
- else
+ }
+ else {
sync = (scene->flag & SCE_FRAME_DROP);
+ }
if ((scene->audio.flag & AUDIO_SYNC) && (sad->flag & ANIMPLAY_FLAG_REVERSE) == false &&
isfinite(time = BKE_sound_sync_scene(scene))) {
double newfra = (double)time * FPS;
/* give some space here to avoid jumps */
- if (newfra + 0.5 > scene->r.cfra && newfra - 0.5 < scene->r.cfra)
+ if (newfra + 0.5 > scene->r.cfra && newfra - 0.5 < scene->r.cfra) {
scene->r.cfra++;
- else
+ }
+ else {
scene->r.cfra = newfra + 0.5;
+ }
#ifdef PROFILE_AUDIO_SYNCH
newfra_int = scene->r.cfra;
@@ -4157,17 +4294,21 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
const int step = max_ii(1, floor((wt->duration - sad->last_duration) * FPS));
/* skip frames */
- if (sad->flag & ANIMPLAY_FLAG_REVERSE)
+ if (sad->flag & ANIMPLAY_FLAG_REVERSE) {
scene->r.cfra -= step;
- else
+ }
+ else {
scene->r.cfra += step;
+ }
}
else {
/* one frame +/- */
- if (sad->flag & ANIMPLAY_FLAG_REVERSE)
+ if (sad->flag & ANIMPLAY_FLAG_REVERSE) {
scene->r.cfra--;
- else
+ }
+ else {
scene->r.cfra++;
+ }
}
}
@@ -4260,8 +4401,9 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
}
}
- if (match_area_with_refresh(sa->spacetype, sad->refresh))
+ if (match_area_with_refresh(sa->spacetype, sad->refresh)) {
ED_area_tag_refresh(sa);
+ }
}
}
@@ -4348,8 +4490,9 @@ int ED_screen_animation_play(bContext *C, int sync, int mode)
/* these settings are currently only available from a menu in the TimeLine */
int refresh = SPACE_ACTION;
- if (mode == 1) /* XXX only play audio forwards!? */
+ if (mode == 1) { /* XXX only play audio forwards!? */
BKE_sound_play_scene(scene);
+ }
ED_screen_animation_timer(C, screen->redraws_flag, refresh, sync, mode);
@@ -4369,8 +4512,9 @@ static int screen_animation_play_exec(bContext *C, wmOperator *op)
int mode = (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1;
int sync = -1;
- if (RNA_struct_property_is_set(op->ptr, "sync"))
+ if (RNA_struct_property_is_set(op->ptr, "sync")) {
sync = (RNA_boolean_get(op->ptr, "sync"));
+ }
return ED_screen_animation_play(C, sync, mode);
}
@@ -4519,8 +4663,9 @@ static int fullscreen_back_exec(bContext *C, wmOperator *op)
/* search current screen for 'fullscreen' areas */
for (sa = screen->areabase.first; sa; sa = sa->next) {
- if (sa->full)
+ if (sa->full) {
break;
+ }
}
if (!sa) {
BKE_report(op->reports, RPT_ERROR, "No fullscreen areas were found");
@@ -4741,8 +4886,9 @@ float ED_region_blend_alpha(ARegion *ar)
alpha = (float)ar->regiontimer->duration / TIMEOUT;
/* makes sure the blend out works 100% - without area redraws */
- if (rgi->hidden)
+ if (rgi->hidden) {
alpha = 0.9f - TIMESTEP - alpha;
+ }
CLAMP(alpha, 0.0f, 1.0f);
return alpha;
@@ -4757,13 +4903,15 @@ static void region_blend_end(bContext *C, ARegion *ar, const bool is_running)
/* always send redraw */
ED_region_tag_redraw(ar);
- if (rgi->child_ar)
+ if (rgi->child_ar) {
ED_region_tag_redraw(rgi->child_ar);
+ }
/* if running timer was hiding, the flag toggle went wrong */
if (is_running) {
- if (rgi->hidden)
+ if (rgi->hidden) {
rgi->ar->flag &= ~RGN_FLAG_HIDDEN;
+ }
}
else {
if (rgi->hidden) {
@@ -4796,10 +4944,12 @@ void ED_region_visibility_change_update_animated(bContext *C, ScrArea *sa, ARegi
ar->flag &= ~RGN_FLAG_HIDDEN;
/* blend in, reinitialize regions because it got unhidden */
- if (rgi->hidden == 0)
+ if (rgi->hidden == 0) {
ED_area_initialize(wm, win, sa);
- else
+ }
+ else {
WM_event_remove_handlers(C, &ar->handlers);
+ }
if (ar->next) {
if (ar->next->alignment & RGN_SPLIT_PREV) {
@@ -4819,15 +4969,17 @@ static int region_blend_invoke(bContext *C, wmOperator *UNUSED(op), const wmEven
wmTimer *timer = event->customdata;
/* event type is TIMERREGION, but we better check */
- if (event->type != TIMERREGION || timer == NULL)
+ if (event->type != TIMERREGION || timer == NULL) {
return OPERATOR_PASS_THROUGH;
+ }
rgi = timer->customdata;
/* always send redraws */
ED_region_tag_redraw(rgi->ar);
- if (rgi->child_ar)
+ if (rgi->child_ar) {
ED_region_tag_redraw(rgi->child_ar);
+ }
/* end timer? */
if (rgi->ar->regiontimer->duration > (double)TIMEOUT) {
@@ -5170,8 +5322,9 @@ static bool blend_file_drop_poll(bContext *UNUSED(C),
const char **UNUSED(tooltip))
{
if (drag->type == WM_DRAG_PATH) {
- if (drag->icon == ICON_FILE_BLEND)
+ if (drag->icon == ICON_FILE_BLEND) {
return 1;
+ }
}
return 0;
}
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 37ffdef0b9b..3b763c7d47a 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -71,8 +71,9 @@ static void screenshot_read_pixels(int x, int y, int w, int h, unsigned char *re
glFinish();
/* clear alpha, it is not set to a meaningful value in opengl */
- for (i = 0, rect += 3; i < w * h; i++, rect += 4)
+ for (i = 0, rect += 3; i < w * h; i++, rect += 4) {
*rect = 255;
+ }
}
/* get shot from frontbuffer */
@@ -137,8 +138,9 @@ static void screenshot_data_free(wmOperator *op)
ScreenshotData *scd = op->customdata;
if (scd) {
- if (scd->dumprect)
+ if (scd->dumprect) {
MEM_freeN(scd->dumprect);
+ }
MEM_freeN(scd);
op->customdata = NULL;
}
@@ -153,8 +155,9 @@ static void screenshot_crop(ImBuf *ibuf, rcti crop)
int y;
if (crop_x > 0 && crop_y > 0) {
- for (y = 0; y < crop_y; y++, to += crop_x, from += ibuf->x)
+ for (y = 0; y < crop_y; y++, to += crop_x, from += ibuf->x) {
memmove(to, from, sizeof(unsigned int) * crop_x);
+ }
ibuf->x = crop_x;
ibuf->y = crop_y;
@@ -185,8 +188,9 @@ static int screenshot_exec(bContext *C, wmOperator *op)
ibuf->rect = scd->dumprect;
/* crop to show only single editor */
- if (!RNA_boolean_get(op->ptr, "full"))
+ if (!RNA_boolean_get(op->ptr, "full")) {
screenshot_crop(ibuf, scd->crop);
+ }
if (scd->im_format.planes == R_IMF_PLANES_BW) {
/* bw screenshot? - users will notice if it fails! */
@@ -211,8 +215,9 @@ static int screenshot_exec(bContext *C, wmOperator *op)
static int screenshot_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
if (screenshot_data_create(C, op)) {
- if (RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath")) {
return screenshot_exec(C, op);
+ }
/* extension is added by 'screenshot_check' after */
char filepath[FILE_MAX] = "//screen";
@@ -267,8 +272,9 @@ static void screenshot_draw(bContext *UNUSED(C), wmOperator *op)
static bool screenshot_poll(bContext *C)
{
- if (G.background)
+ if (G.background) {
return false;
+ }
return WM_operator_winactive(C);
}