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:
authorCampbell Barton <ideasman42@gmail.com>2019-03-26 13:16:47 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-26 13:16:47 +0300
commitce3b78c73a7ccc16fdccf7decedb5d1578dfdf0a (patch)
tree87f1a9c41ebe6f74806f1ae76206f1d328c85700 /source/blender/editors/space_image
parent5279d118c2ddee0e6fef66aaf78452c1b302dd42 (diff)
Cleanup: style, use braces for editor/spaces
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/image_buttons.c63
-rw-r--r--source/blender/editors/space_image/image_draw.c69
-rw-r--r--source/blender/editors/space_image/image_edit.c31
-rw-r--r--source/blender/editors/space_image/image_ops.c203
-rw-r--r--source/blender/editors/space_image/space_image.c67
5 files changed, 286 insertions, 147 deletions
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index b77c08736dc..47b3f9995c5 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -69,8 +69,9 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf,
size_t ofs = 0;
str[0] = 0;
- if (ima == NULL)
+ if (ima == NULL) {
return;
+ }
if (ibuf == NULL) {
ofs += BLI_strncpy_rlen(str + ofs, IFACE_("Can't Load Image"), len - ofs);
@@ -78,9 +79,10 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf,
else {
if (ima->source == IMA_SRC_MOVIE) {
ofs += BLI_strncpy_rlen(str + ofs, IFACE_("Movie"), len - ofs);
- if (BKE_image_has_anim(ima))
+ if (BKE_image_has_anim(ima)) {
ofs += BLI_snprintf(str + ofs, len - ofs, IFACE_(" %d frs"),
IMB_anim_get_duration(((ImageAnim *)ima->anims.first)->anim, IMB_TC_RECORD_RUN));
+ }
}
else {
ofs += BLI_strncpy_rlen(str, IFACE_("Image"), len - ofs);
@@ -92,26 +94,33 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf,
if (ibuf->channels != 4) {
ofs += BLI_snprintf(str + ofs, len - 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"), len - ofs);
- else
+ }
+ else {
ofs += BLI_strncpy_rlen(str + ofs, IFACE_(" RGB float"), len - 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"), len - ofs);
- else
+ }
+ else {
ofs += BLI_strncpy_rlen(str + ofs, IFACE_(" RGB byte"), len - ofs);
+ }
}
- if (ibuf->zbuf || ibuf->zbuf_float)
+ if (ibuf->zbuf || ibuf->zbuf_float) {
ofs += BLI_strncpy_rlen(str + ofs, IFACE_(" + Z"), len - ofs);
+ }
if (ima->source == IMA_SRC_SEQUENCE) {
const char *file = BLI_last_slash(ibuf->name);
- if (file == NULL)
+ if (file == NULL) {
file = ibuf->name;
- else
+ }
+ else {
file++;
+ }
ofs += BLI_snprintf(str + ofs, len - ofs, ", %s", file);
}
}
@@ -129,11 +138,15 @@ struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree)
{
bNode *node;
- if (ntree)
- for (node = ntree->nodes.first; node; node = node->next)
- if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
- if (node->flag & NODE_DO_OUTPUT)
+ if (ntree) {
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+ if (node->flag & NODE_DO_OUTPUT) {
return node->storage;
+ }
+ }
+ }
+ }
return NULL;
}
@@ -543,8 +556,9 @@ static bool ui_imageuser_layer_menu_step(bContext *C, int direction, void *rnd_p
else if (direction == 1) {
int tot = BLI_listbase_count(&rr->layers);
- if (RE_HasCombinedLayer(rr))
+ if (RE_HasCombinedLayer(rr)) {
tot++; /* fake compo/sequencer layer */
+ }
if (iuser->layer < tot - 1) {
iuser->layer++;
@@ -835,8 +849,9 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
void *lock;
- if (!ptr->data)
+ if (!ptr->data) {
return;
+ }
prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
@@ -921,10 +936,12 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
if (ima->source != IMA_SRC_GENERATED) {
row = uiLayoutRow(layout, true);
- if (BKE_image_has_packedfile(ima))
+ if (BKE_image_has_packedfile(ima)) {
uiItemO(row, "", ICON_PACKAGE, "image.unpack");
- else
+ }
+ else {
uiItemO(row, "", ICON_UGLYPACKAGE, "image.pack");
+ }
row = uiLayoutRow(row, true);
uiLayoutSetEnabled(row, BKE_image_has_packedfile(ima) == false);
@@ -1200,8 +1217,9 @@ void uiTemplateImageFormatViews(uiLayout *layout, PointerRNA *imfptr, PointerRNA
{
ImageFormatData *imf = imfptr->data;
- if (ptr == NULL)
+ if (ptr == NULL) {
return;
+ }
uiItemR(layout, ptr, "use_multiview", 0, NULL, ICON_NONE);
@@ -1247,8 +1265,9 @@ void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *i
char str[MAX_IMAGE_INFO_LEN];
void *lock;
- if (!ima || !iuser)
+ if (!ima || !iuser) {
return;
+ }
ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
@@ -1297,8 +1316,9 @@ static int image_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = image_has_buttons_region(sa);
- if (ar)
+ if (ar) {
ED_region_toggle_hidden(C, ar);
+ }
return OPERATOR_FINISHED;
}
@@ -1321,8 +1341,9 @@ static int image_scopes_toggle_exec(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = image_has_tools_region(sa);
- if (ar)
+ if (ar) {
ED_region_toggle_hidden(C, ar);
+ }
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index e3fd36347fc..ca0f9bd013f 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -282,15 +282,19 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
float rgba[4];
copy_v3_v3(rgba, linearcol);
- if (channels == 3)
+ if (channels == 3) {
rgba[3] = 1.0f;
- else
+ }
+ else {
rgba[3] = linearcol[3];
+ }
- if (use_default_view)
+ if (use_default_view) {
IMB_colormanagement_pixel_to_display_space_v4(rgba, rgba, NULL, &scene->display_settings);
- else
+ }
+ else {
IMB_colormanagement_pixel_to_display_space_v4(rgba, rgba, &scene->view_settings, &scene->display_settings);
+ }
SNPRINTF(str, " | CM R:%-.4f G:%-.4f B:%-.4f", rgba[0], rgba[1], rgba[2]);
BLF_position(blf_mono_font, dx, dy, 0);
@@ -325,10 +329,12 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
}
if (color_manage) {
- if (use_default_view)
+ if (use_default_view) {
IMB_colormanagement_pixel_to_display_space_v4(finalcol, col, NULL, &scene->display_settings);
- else
+ }
+ else {
IMB_colormanagement_pixel_to_display_space_v4(finalcol, col, &scene->view_settings, &scene->display_settings);
+ }
}
else {
copy_v4_v4(finalcol, col);
@@ -471,10 +477,12 @@ static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rec
rectf = MEM_mallocN(rectx * recty * sizeof(float), "temp");
for (a = rectx * recty - 1; a >= 0; a--) {
- if (rect_float[a] > clip_end)
+ if (rect_float[a] > clip_end) {
rectf[a] = 0.0f;
- else if (rect_float[a] < bias)
+ }
+ else if (rect_float[a] < bias) {
rectf[a] = 1.0f;
+ }
else {
rectf[a] = 1.0f - (rect_float[a] - bias) * scale;
rectf[a] *= rectf[a];
@@ -498,12 +506,15 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar,
/* this part is generic image display */
if (sima->flag & SI_SHOW_ZBUF && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1))) {
- if (ibuf->zbuf)
+ if (ibuf->zbuf) {
sima_draw_zbuf_pixels(x, y, ibuf->x, ibuf->y, ibuf->zbuf, zoomx, zoomy);
- else if (ibuf->zbuf_float)
+ }
+ else if (ibuf->zbuf_float) {
sima_draw_zbuffloat_pixels(scene, x, y, ibuf->x, ibuf->y, ibuf->zbuf_float, zoomx, zoomy);
- else if (ibuf->channels == 1)
+ }
+ else if (ibuf->channels == 1) {
sima_draw_zbuffloat_pixels(scene, x, y, ibuf->x, ibuf->y, ibuf->rect_float, zoomx, zoomy);
+ }
}
else {
int clip_max_x, clip_max_y;
@@ -531,14 +542,18 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar,
ColorManagedViewSettings *view_settings;
ColorManagedDisplaySettings *display_settings;
- if (sima->flag & SI_SHOW_R)
+ if (sima->flag & SI_SHOW_R) {
shuffle[0] = 1.0f;
- else if (sima->flag & SI_SHOW_G)
+ }
+ else if (sima->flag & SI_SHOW_G) {
shuffle[1] = 1.0f;
- else if (sima->flag & SI_SHOW_B)
+ }
+ else if (sima->flag & SI_SHOW_B) {
shuffle[2] = 1.0f;
- else if (sima->flag & SI_SHOW_ALPHA)
+ }
+ else if (sima->flag & SI_SHOW_ALPHA) {
shuffle[3] = 1.0f;
+ }
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform_ensure(state.shader, "shuffle"), 4, 1, shuffle);
@@ -554,8 +569,9 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar,
IMB_display_buffer_release(cache_handle);
}
- if (sima->flag & SI_USE_ALPHA)
+ if (sima->flag & SI_USE_ALPHA) {
GPU_blend(false);
+ }
}
}
@@ -573,8 +589,9 @@ static void draw_image_buffer_repeated(const bContext *C, SpaceImage *sima, AReg
draw_image_buffer(C, sima, ar, scene, ibuf, x, y, zoomx, zoomy);
/* only draw until running out of time */
- if ((PIL_check_seconds_timer() - time_current) > 0.25)
+ if ((PIL_check_seconds_timer() - time_current) > 0.25) {
return;
+ }
}
}
}
@@ -715,11 +732,13 @@ void draw_image_main(const bContext *C, ARegion *ar)
}
if (show_stereo3d) {
- if (show_multilayer)
+ if (show_multilayer) {
/* update multiindex and pass for the current eye */
BKE_image_multilayer_index(ima->rr, &sima->iuser);
- else
+ }
+ else {
BKE_image_multiview_index(ima, &sima->iuser);
+ }
}
ibuf = ED_space_image_acquire_buffer(sima, &lock);
@@ -729,10 +748,12 @@ void draw_image_main(const bContext *C, ARegion *ar)
ED_region_grid_draw(ar, zoomx, zoomy);
}
else {
- if (sima->flag & SI_DRAW_TILE)
+ if (sima->flag & SI_DRAW_TILE) {
draw_image_buffer_repeated(C, sima, ar, scene, ibuf, zoomx, zoomy);
- else
+ }
+ else {
draw_image_buffer(C, sima, ar, scene, ibuf, 0.0f, 0.0f, zoomx, zoomy);
+ }
if (sima->flag & SI_DRAW_METADATA) {
int x, y;
@@ -748,16 +769,18 @@ void draw_image_main(const bContext *C, ARegion *ar)
ED_space_image_release_buffer(sima, ibuf, lock);
/* paint helpers */
- if (show_paint)
+ if (show_paint) {
draw_image_paint_helpers(C, ar, scene, zoomx, zoomy);
+ }
if (show_viewer) {
BLI_thread_unlock(LOCK_DRAW_IMAGE);
}
/* render info */
- if (ima && show_render)
+ if (ima && show_render) {
draw_render_info(C, sima->iuser.scene, ima, ar, zoomx, zoomy);
+ }
}
bool ED_space_image_show_cache(SpaceImage *sima)
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c
index c8edccb0472..c838c6a87fe 100644
--- a/source/blender/editors/space_image/image_edit.c
+++ b/source/blender/editors/space_image/image_edit.c
@@ -74,13 +74,15 @@ void ED_space_image_set(Main *bmain, SpaceImage *sima, Object *obedit, Image *im
}
}
- if (sima->image)
+ if (sima->image) {
BKE_image_signal(bmain, sima->image, &sima->iuser, IMA_SIGNAL_USER_NEW_IMAGE);
+ }
id_us_ensure_real((ID *)sima->image);
- if (obedit)
+ if (obedit) {
WM_main_add_notifier(NC_GEOM | ND_DATA, obedit->data);
+ }
WM_main_add_notifier(NC_SPACE | ND_SPACE_IMAGE, NULL);
}
@@ -147,22 +149,25 @@ ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **r_lock)
ibuf = BKE_image_acquire_ibuf(sima->image, &sima->iuser, r_lock);
if (ibuf) {
- if (ibuf->rect || ibuf->rect_float)
+ if (ibuf->rect || ibuf->rect_float) {
return ibuf;
+ }
BKE_image_release_ibuf(sima->image, ibuf, *r_lock);
*r_lock = NULL;
}
}
- else
+ else {
*r_lock = NULL;
+ }
return NULL;
}
void ED_space_image_release_buffer(SpaceImage *sima, ImBuf *ibuf, void *lock)
{
- if (sima && sima->image)
+ if (sima && sima->image) {
BKE_image_release_ibuf(sima->image, ibuf, lock);
+ }
}
bool ED_space_image_has_buffer(SpaceImage *sima)
@@ -335,7 +340,9 @@ bool ED_image_slot_cycle(struct Image *image, int direction)
int num_slots = BLI_listbase_count(&image->renderslots);
for (i = 1; i < num_slots; i++) {
slot = (cur + ((direction == -1) ? -i : i)) % num_slots;
- if (slot < 0) slot += num_slots;
+ if (slot < 0) {
+ slot += num_slots;
+ }
RenderSlot *render_slot = BKE_image_get_renderslot(image, slot);
if ((render_slot && render_slot->render) || slot == image->last_render_slot) {
@@ -357,10 +364,12 @@ void ED_space_image_scopes_update(const struct bContext *C, struct SpaceImage *s
Object *ob = CTX_data_active_object(C);
/* scope update can be expensive, don't update during paint modes */
- if (sima->mode == SI_MODE_PAINT)
+ if (sima->mode == SI_MODE_PAINT) {
return;
- if (ob && ((ob->mode & (OB_MODE_TEXTURE_PAINT | OB_MODE_EDIT)) != 0))
+ }
+ if (ob && ((ob->mode & (OB_MODE_TEXTURE_PAINT | OB_MODE_EDIT)) != 0)) {
return;
+ }
/* We also don't update scopes of render result during render. */
if (G.is_rendering) {
@@ -382,8 +391,9 @@ bool ED_space_image_show_render(SpaceImage *sima)
bool ED_space_image_show_paint(SpaceImage *sima)
{
- if (ED_space_image_show_render(sima))
+ if (ED_space_image_show_render(sima)) {
return false;
+ }
return (sima->mode == SI_MODE_PAINT);
}
@@ -442,8 +452,9 @@ bool ED_space_image_paint_curve(const bContext *C)
if (sima && sima->mode == SI_MODE_PAINT) {
Brush *br = CTX_data_tool_settings(C)->imapaint.paint.brush;
- if (br && (br->flag & BRUSH_CURVE))
+ if (br && (br->flag & BRUSH_CURVE)) {
return true;
+ }
}
return false;
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 9cbb4263e23..831be935fa4 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -117,12 +117,15 @@ static void sima_zoom_set(SpaceImage *sima, ARegion *ar, float zoom, const float
width *= sima->zoom;
height *= sima->zoom;
- if ((width < 4) && (height < 4) && sima->zoom < oldzoom)
+ if ((width < 4) && (height < 4) && sima->zoom < oldzoom) {
sima->zoom = oldzoom;
- else if (BLI_rcti_size_x(&ar->winrct) <= sima->zoom)
+ }
+ else if (BLI_rcti_size_x(&ar->winrct) <= sima->zoom) {
sima->zoom = oldzoom;
- else if (BLI_rcti_size_y(&ar->winrct) <= sima->zoom)
+ }
+ else if (BLI_rcti_size_y(&ar->winrct) <= sima->zoom) {
sima->zoom = oldzoom;
+ }
}
if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {
@@ -489,8 +492,9 @@ static void image_view_zoom_exit(bContext *C, wmOperator *op, bool cancel)
ED_region_tag_redraw(CTX_wm_region(C));
}
- if (vpd->timer)
+ if (vpd->timer) {
WM_event_remove_timer(CTX_wm_manager(C), vpd->timer->win, vpd->timer);
+ }
WM_cursor_modal_restore(CTX_wm_window(C));
MEM_freeN(op->customdata);
@@ -534,8 +538,9 @@ static int image_view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
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);
@@ -582,8 +587,9 @@ static void image_zoom_apply(ViewZoomData *vpd, wmOperator *op, const int x, con
/* for now do the same things for scale and dolly */
float delta = x - vpd->origx + y - vpd->origy;
- if (zoom_invert)
+ if (zoom_invert) {
delta *= -1.0f;
+ }
factor = 1.0f + delta / 300.0f;
}
@@ -662,8 +668,9 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot)
static int image_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 {
SpaceImage *sima = CTX_wm_space_image(C);
ARegion *ar = CTX_wm_region(C);
@@ -747,8 +754,9 @@ static int image_view_all_exec(bContext *C, wmOperator *op)
/* find the zoom value that will fit the image in the image space */
sima_zoom_set(sima, ar, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), NULL);
}
- else
+ else {
sima_zoom_set(sima, ar, 1.0f, NULL);
+ }
}
sima->xof = sima->yof = 0.0f;
@@ -1138,8 +1146,12 @@ static int image_cmp_frame(const void *a, const void *b)
const ImageFrame *frame_a = a;
const ImageFrame *frame_b = b;
- if (frame_a->framenr < frame_b->framenr) return -1;
- if (frame_a->framenr > frame_b->framenr) return 1;
+ if (frame_a->framenr < frame_b->framenr) {
+ return -1;
+ }
+ if (frame_a->framenr > frame_b->framenr) {
+ return 1;
+ }
return 0;
}
@@ -1181,7 +1193,9 @@ static Image *image_open_single(
ima = BKE_image_load_exists_ex(bmain, filepath, &exists);
if (!ima) {
- if (op->customdata) MEM_freeN(op->customdata);
+ if (op->customdata) {
+ MEM_freeN(op->customdata);
+ }
BKE_reportf(op->reports, RPT_ERROR, "Cannot read '%s': %s",
filepath, errno ? strerror(errno) : TIP_("unsupported image format"));
return NULL;
@@ -1232,8 +1246,9 @@ static int image_open_exec(bContext *C, wmOperator *op)
const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path");
const bool use_multiview = RNA_boolean_get(op->ptr, "use_multiview");
- if (!op->customdata)
+ if (!op->customdata) {
image_open_init(C, op);
+ }
RNA_string_get(op->ptr, "filepath", filepath);
@@ -1361,8 +1376,9 @@ static int image_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
if (ima == NULL) {
Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
- if (tex && tex->type == TEX_IMAGE)
+ if (tex && tex->type == TEX_IMAGE) {
ima = tex->ima;
+ }
}
if (ima == NULL) {
@@ -1385,11 +1401,13 @@ static int image_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
}
}
- if (ima)
+ if (ima) {
path = ima->name;
+ }
- if (RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath")) {
return image_open_exec(C, op);
+ }
image_open_init(C, op);
@@ -1428,8 +1446,9 @@ static void image_open_draw(bContext *UNUSED(C), wmOperator *op)
RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &imf_ptr);
/* multiview template */
- if (RNA_boolean_get(op->ptr, "show_multiview"))
+ if (RNA_boolean_get(op->ptr, "show_multiview")) {
uiTemplateImageFormatViews(layout, &imf_ptr, op->ptr);
+ }
}
/* called by other space types too */
@@ -1481,12 +1500,14 @@ static int image_match_len_exec(bContext *C, wmOperator *UNUSED(op))
}
- if (!ima || !iuser || !BKE_image_has_anim(ima))
+ if (!ima || !iuser || !BKE_image_has_anim(ima)) {
return OPERATOR_CANCELLED;
+ }
struct anim *anim = ((ImageAnim *)ima->anims.first)->anim;
- if (!anim)
+ if (!anim) {
return OPERATOR_CANCELLED;
+ }
iuser->frames = IMB_anim_get_duration(anim, IMB_TC_RECORD_RUN);
BKE_image_user_frame_calc(iuser, scene->r.cfra);
@@ -1517,8 +1538,9 @@ static int image_replace_exec(bContext *C, wmOperator *op)
SpaceImage *sima = CTX_wm_space_image(C);
char str[FILE_MAX];
- if (!sima->image)
+ if (!sima->image) {
return OPERATOR_CANCELLED;
+ }
RNA_string_get(op->ptr, "filepath", str);
@@ -1530,10 +1552,12 @@ static int image_replace_exec(bContext *C, wmOperator *op)
BKE_image_signal(bmain, sima->image, &sima->iuser, IMA_SIGNAL_SRC_CHANGE);
}
- if (BLI_path_extension_check_array(str, imb_ext_movie))
+ if (BLI_path_extension_check_array(str, imb_ext_movie)) {
sima->image->source = IMA_SRC_MOVIE;
- else
+ }
+ else {
sima->image->source = IMA_SRC_FILE;
+ }
/* XXX unpackImage frees image buffers */
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
@@ -1549,14 +1573,17 @@ static int image_replace_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
{
SpaceImage *sima = CTX_wm_space_image(C);
- if (!sima->image)
+ if (!sima->image) {
return OPERATOR_CANCELLED;
+ }
- if (RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath")) {
return image_replace_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", BLI_path_is_rel(sima->image->name));
+ }
image_filesel(C, op, sima->image->name);
@@ -1604,18 +1631,18 @@ static char imtype_best_depth(ImBuf *ibuf, const char imtype)
const char depth_ok = BKE_imtype_valid_depths(imtype);
if (ibuf->rect_float) {
- if (depth_ok & R_IMF_CHAN_DEPTH_32) return R_IMF_CHAN_DEPTH_32;
- if (depth_ok & R_IMF_CHAN_DEPTH_24) return R_IMF_CHAN_DEPTH_24;
- if (depth_ok & R_IMF_CHAN_DEPTH_16) return R_IMF_CHAN_DEPTH_16;
- if (depth_ok & R_IMF_CHAN_DEPTH_12) return R_IMF_CHAN_DEPTH_12;
+ if (depth_ok & R_IMF_CHAN_DEPTH_32) { return R_IMF_CHAN_DEPTH_32; }
+ if (depth_ok & R_IMF_CHAN_DEPTH_24) { return R_IMF_CHAN_DEPTH_24; }
+ if (depth_ok & R_IMF_CHAN_DEPTH_16) { return R_IMF_CHAN_DEPTH_16; }
+ if (depth_ok & R_IMF_CHAN_DEPTH_12) { return R_IMF_CHAN_DEPTH_12; }
return R_IMF_CHAN_DEPTH_8;
}
else {
- if (depth_ok & R_IMF_CHAN_DEPTH_8) return R_IMF_CHAN_DEPTH_8;
- if (depth_ok & R_IMF_CHAN_DEPTH_12) return R_IMF_CHAN_DEPTH_12;
- if (depth_ok & R_IMF_CHAN_DEPTH_16) return R_IMF_CHAN_DEPTH_16;
- if (depth_ok & R_IMF_CHAN_DEPTH_24) return R_IMF_CHAN_DEPTH_24;
- if (depth_ok & R_IMF_CHAN_DEPTH_32) return R_IMF_CHAN_DEPTH_32;
+ if (depth_ok & R_IMF_CHAN_DEPTH_8) { return R_IMF_CHAN_DEPTH_8; }
+ if (depth_ok & R_IMF_CHAN_DEPTH_12) { return R_IMF_CHAN_DEPTH_12; }
+ if (depth_ok & R_IMF_CHAN_DEPTH_16) { return R_IMF_CHAN_DEPTH_16; }
+ if (depth_ok & R_IMF_CHAN_DEPTH_24) { return R_IMF_CHAN_DEPTH_24; }
+ if (depth_ok & R_IMF_CHAN_DEPTH_32) { return R_IMF_CHAN_DEPTH_32; }
return R_IMF_CHAN_DEPTH_8; /* fallback, should not get here */
}
}
@@ -1753,14 +1780,18 @@ static void save_image_post(
/* workaround to ensure the render result buffer is no longer used
* by this image, otherwise can crash when a new render result is
* created. */
- if (ibuf->rect && !(ibuf->mall & IB_rect))
+ if (ibuf->rect && !(ibuf->mall & IB_rect)) {
imb_freerectImBuf(ibuf);
- if (ibuf->rect_float && !(ibuf->mall & IB_rectfloat))
+ }
+ if (ibuf->rect_float && !(ibuf->mall & IB_rectfloat)) {
imb_freerectfloatImBuf(ibuf);
- if (ibuf->zbuf && !(ibuf->mall & IB_zbuf))
+ }
+ if (ibuf->zbuf && !(ibuf->mall & IB_zbuf)) {
IMB_freezbufImBuf(ibuf);
- if (ibuf->zbuf_float && !(ibuf->mall & IB_zbuffloat))
+ }
+ if (ibuf->zbuf_float && !(ibuf->mall & IB_zbuffloat)) {
IMB_freezbuffloatImBuf(ibuf);
+ }
}
if (ELEM(ima->source, IMA_SRC_GENERATED, IMA_SRC_VIEWER)) {
ima->source = IMA_SRC_FILE;
@@ -1932,10 +1963,12 @@ static bool save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
iuser.view = i;
iuser.flag &= ~IMA_SHOW_STEREO;
- if (rr)
+ if (rr) {
BKE_image_multilayer_index(rr, &iuser);
- else
+ }
+ else {
BKE_image_multiview_index(ima, &iuser);
+ }
ibuf = BKE_image_acquire_ibuf(sima->image, &iuser, &lock);
ibuf->planes = planes;
@@ -2087,13 +2120,15 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
PropertyRNA *prop;
const bool save_as_render = ((ima->source == IMA_SRC_VIEWER) || (ima->flag & IMA_VIEW_AS_RENDER));
- if (RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath")) {
return image_save_as_exec(C, op);
+ }
save_image_options_defaults(&simopts);
- if (save_image_options_init(bmain, &simopts, sima, scene, true, save_as_render) == 0)
+ if (save_image_options_init(bmain, &simopts, sima, scene, true, save_as_render) == 0) {
return OPERATOR_CANCELLED;
+ }
save_image_options_to_op(&simopts, op);
/* enable save_copy by default for render results */
@@ -2150,8 +2185,9 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op)
uiDefAutoButsRNA(layout, &ptr, image_save_as_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
/* multiview template */
- if (is_multiview)
+ if (is_multiview) {
uiTemplateImageFormatViews(layout, &imf_ptr, op->ptr);
+ }
}
static bool image_save_as_poll(bContext *C)
@@ -2209,8 +2245,9 @@ static int image_save_exec(bContext *C, wmOperator *op)
SaveImageOptions simopts;
save_image_options_defaults(&simopts);
- if (save_image_options_init(bmain, &simopts, sima, scene, false, false) == 0)
+ if (save_image_options_init(bmain, &simopts, sima, scene, false, false) == 0) {
return OPERATOR_CANCELLED;
+ }
save_image_options_from_op(bmain, &simopts, op);
if (BLI_exists(simopts.filepath) && BLI_file_is_writable(simopts.filepath)) {
@@ -2253,8 +2290,9 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op)
char di[FILE_MAX];
struct MovieCacheIter *iter;
- if (sima->image == NULL)
+ if (sima->image == NULL) {
return OPERATOR_CANCELLED;
+ }
if (sima->image->source != IMA_SRC_SEQUENCE) {
BKE_report(op->reports, RPT_ERROR, "Can only save sequence on image sequences");
@@ -2341,8 +2379,9 @@ static int image_reload_exec(bContext *C, wmOperator *UNUSED(op))
Image *ima = CTX_data_edit_image(C);
SpaceImage *sima = CTX_wm_space_image(C);
- if (!ima)
+ if (!ima) {
return OPERATOR_CANCELLED;
+ }
/* XXX unpackImage frees image buffers */
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
@@ -2437,8 +2476,9 @@ static int image_new_exec(bContext *C, wmOperator *op)
alpha = RNA_boolean_get(op->ptr, "alpha");
stereo3d = RNA_boolean_get(op->ptr, "use_stereo_3d");
- if (!alpha)
+ if (!alpha) {
color[3] = 1.0f;
+ }
ima = BKE_image_add_generated(bmain, width, height, name, alpha ? 32 : 24, floatbuf, gen_type, color, stereo3d);
@@ -2619,10 +2659,10 @@ static int image_invert_exec(bContext *C, wmOperator *op)
float *fp = (float *) ibuf->rect_float;
for (i = ((size_t)ibuf->x) * ibuf->y; i > 0; i--, fp += 4) {
- if (r) fp[0] = 1.0f - fp[0];
- if (g) fp[1] = 1.0f - fp[1];
- if (b) fp[2] = 1.0f - fp[2];
- if (a) fp[3] = 1.0f - fp[3];
+ if (r) { fp[0] = 1.0f - fp[0]; }
+ if (g) { fp[1] = 1.0f - fp[1]; }
+ if (b) { fp[2] = 1.0f - fp[2]; }
+ if (a) { fp[3] = 1.0f - fp[3]; }
}
if (ibuf->rect) {
@@ -2633,10 +2673,10 @@ static int image_invert_exec(bContext *C, wmOperator *op)
char *cp = (char *) ibuf->rect;
for (i = ((size_t)ibuf->x) * ibuf->y; i > 0; i--, cp += 4) {
- if (r) cp[0] = 255 - cp[0];
- if (g) cp[1] = 255 - cp[1];
- if (b) cp[2] = 255 - cp[2];
- if (a) cp[3] = 255 - cp[3];
+ if (r) { cp[0] = 255 - cp[0]; }
+ if (g) { cp[1] = 255 - cp[1]; }
+ if (b) { cp[2] = 255 - cp[2]; }
+ if (a) { cp[3] = 255 - cp[3]; }
}
}
else {
@@ -2646,8 +2686,9 @@ static int image_invert_exec(bContext *C, wmOperator *op)
ibuf->userflags |= IB_BITMAPDIRTY | IB_DISPLAY_BUFFER_INVALID;
- if (ibuf->mipmap[0])
+ if (ibuf->mipmap[0]) {
ibuf->userflags |= IB_MIPMAP_INVALID;
+ }
if (support_undo) {
ED_image_undo_push_end();
@@ -2697,10 +2738,12 @@ static bool image_pack_test(bContext *C, wmOperator *op)
Image *ima = CTX_data_edit_image(C);
const bool as_png = RNA_boolean_get(op->ptr, "as_png");
- if (!ima)
+ if (!ima) {
return 0;
- if (!as_png && BKE_image_has_packedfile(ima))
+ }
+ if (!as_png && BKE_image_has_packedfile(ima)) {
return 0;
+ }
if (ima->source == IMA_SRC_SEQUENCE || ima->source == IMA_SRC_MOVIE) {
BKE_report(op->reports, RPT_ERROR, "Packing movies or image sequences not supported");
@@ -2717,18 +2760,21 @@ static int image_pack_exec(bContext *C, wmOperator *op)
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
const bool as_png = RNA_boolean_get(op->ptr, "as_png");
- if (!image_pack_test(C, op))
+ if (!image_pack_test(C, op)) {
return OPERATOR_CANCELLED;
+ }
if (!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
BKE_report(op->reports, RPT_ERROR, "Cannot pack edited image from disk, only as internal PNG");
return OPERATOR_CANCELLED;
}
- if (as_png)
+ if (as_png) {
BKE_image_memorypack(ima);
- else
+ }
+ else {
BKE_image_packfiles(op->reports, ima, ID_BLEND_PATH(bmain, &ima->id));
+ }
WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
@@ -2745,8 +2791,9 @@ static int image_pack_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
uiLayout *layout;
const bool as_png = RNA_boolean_get(op->ptr, "as_png");
- if (!image_pack_test(C, op))
+ if (!image_pack_test(C, op)) {
return OPERATOR_CANCELLED;
+ }
ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
@@ -2797,19 +2844,23 @@ static int image_unpack_exec(bContext *C, wmOperator *op)
char imaname[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "id", imaname);
ima = BLI_findstring(&CTX_data_main(C)->images, imaname, offsetof(ID, name) + 2);
- if (!ima) ima = CTX_data_edit_image(C);
+ if (!ima) {
+ ima = CTX_data_edit_image(C);
+ }
}
- if (!ima || !BKE_image_has_packedfile(ima))
+ if (!ima || !BKE_image_has_packedfile(ima)) {
return OPERATOR_CANCELLED;
+ }
if (ima->source == IMA_SRC_SEQUENCE || ima->source == IMA_SRC_MOVIE) {
BKE_report(op->reports, RPT_ERROR, "Unpacking movies or image sequences not supported");
return OPERATOR_CANCELLED;
}
- if (G.fileflags & G_FILE_AUTOPACK)
+ if (G.fileflags & G_FILE_AUTOPACK) {
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
+ }
/* XXX unpackImage frees image buffers */
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
@@ -2825,19 +2876,22 @@ static int image_unpack_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
{
Image *ima = CTX_data_edit_image(C);
- if (RNA_struct_property_is_set(op->ptr, "id"))
+ if (RNA_struct_property_is_set(op->ptr, "id")) {
return image_unpack_exec(C, op);
+ }
- if (!ima || !BKE_image_has_packedfile(ima))
+ if (!ima || !BKE_image_has_packedfile(ima)) {
return OPERATOR_CANCELLED;
+ }
if (ima->source == IMA_SRC_SEQUENCE || ima->source == IMA_SRC_MOVIE) {
BKE_report(op->reports, RPT_ERROR, "Unpacking movies or image sequences not supported");
return OPERATOR_CANCELLED;
}
- if (G.fileflags & G_FILE_AUTOPACK)
+ if (G.fileflags & G_FILE_AUTOPACK) {
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
+ }
unpack_menu(C, "IMAGE_OT_unpack", ima->id.name + 2, ima->name, "textures", BKE_image_has_packedfile(ima) ? ((ImagePackedFile *)ima->packedfiles.first)->packedfile : NULL);
@@ -3209,8 +3263,9 @@ static int image_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event
}
}
- if (!ED_space_image_has_buffer(sima))
+ if (!ED_space_image_has_buffer(sima)) {
return OPERATOR_CANCELLED;
+ }
info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
@@ -3329,8 +3384,9 @@ static int image_sample_line_invoke(bContext *C, wmOperator *op, const wmEvent *
Histogram *hist = &sima->sample_line_hist;
hist->flag &= ~HISTO_FLAG_SAMPLELINE;
- if (!ED_space_image_has_buffer(sima))
+ if (!ED_space_image_has_buffer(sima)) {
return OPERATOR_CANCELLED;
+ }
return WM_gesture_straightline_invoke(C, op, event);
}
@@ -3559,8 +3615,9 @@ static int image_cycle_render_slot_exec(bContext *C, wmOperator *op)
/* no undo push for browsing existing */
RenderSlot *slot = BKE_image_get_renderslot(ima, ima->render_slot);
- if ((slot && slot->render) || ima->render_slot == ima->last_render_slot)
+ if ((slot && slot->render) || ima->render_slot == ima->last_render_slot) {
return OPERATOR_CANCELLED;
+ }
return OPERATOR_FINISHED;
}
@@ -3678,8 +3735,9 @@ void IMAGE_OT_remove_render_slot(wmOperatorType *ot)
static bool change_frame_poll(bContext *C)
{
/* prevent changes during render */
- if (G.is_rendering)
+ if (G.is_rendering) {
return 0;
+ }
return space_image_main_region_poll(C);
}
@@ -3761,8 +3819,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;
}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 7aa3ea57956..d5eb0b485a1 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -91,8 +91,9 @@ static void image_scopes_tag_refresh(ScrArea *sa)
/* only while histogram is visible */
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_TOOL_PROPS && ar->flag & RGN_FLAG_HIDDEN)
+ if (ar->regiontype == RGN_TYPE_TOOL_PROPS && ar->flag & RGN_FLAG_HIDDEN) {
return;
+ }
}
sima->scopes.ok = 0;
@@ -122,13 +123,17 @@ ARegion *image_has_buttons_region(ScrArea *sa)
ARegion *ar, *arnew;
ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if (ar) return 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) return NULL;
+ if (ar == NULL) {
+ return NULL;
+ }
arnew = MEM_callocN(sizeof(ARegion), "buttons for image");
@@ -146,13 +151,17 @@ ARegion *image_has_tools_region(ScrArea *sa)
ARegion *ar, *arnew;
ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
- if (ar) return ar;
+ if (ar) {
+ return ar;
+ }
/* add subdiv level; after buttons */
ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
/* is error! */
- if (ar == NULL) return NULL;
+ if (ar == NULL) {
+ return NULL;
+ }
arnew = MEM_callocN(sizeof(ARegion), "scopes for image");
@@ -371,15 +380,17 @@ static void image_listener(wmWindow *win, ScrArea *sa, wmNotifier *wmn, Scene *U
ED_area_tag_redraw(sa);
break;
case ND_MODE:
- if (wmn->subtype == NS_EDITMODE_MESH)
+ if (wmn->subtype == NS_EDITMODE_MESH) {
ED_area_tag_refresh(sa);
+ }
ED_area_tag_redraw(sa);
break;
case ND_RENDER_RESULT:
case ND_RENDER_OPTIONS:
case ND_COMPO_RESULT:
- if (ED_space_image_show_render(sima))
+ if (ED_space_image_show_render(sima)) {
image_scopes_tag_refresh(sa);
+ }
ED_area_tag_redraw(sa);
break;
}
@@ -532,8 +543,9 @@ static void image_main_region_set_view2d(SpaceImage *sima, ARegion *ar)
float w = width;
float h = height;
- if (ima)
+ if (ima) {
h *= ima->aspy / ima->aspx;
+ }
int winx = BLI_rcti_size_x(&ar->winrct) + 1;
int winy = BLI_rcti_size_y(&ar->winrct) + 1;
@@ -703,8 +715,9 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
ED_space_image_get_size(sima, &width, &height);
ED_space_image_get_aspect(sima, &aspx, &aspy);
- if (show_viewer)
+ if (show_viewer) {
BLI_thread_unlock(LOCK_DRAW_IMAGE);
+ }
ED_mask_draw_region(mask, ar,
sima->mask_info.draw_flag,
@@ -744,26 +757,31 @@ static void image_main_region_listener(
/* context changes */
switch (wmn->category) {
case NC_GEOM:
- if (ELEM(wmn->data, ND_DATA, ND_SELECT))
+ if (ELEM(wmn->data, ND_DATA, ND_SELECT)) {
WM_gizmomap_tag_refresh(ar->gizmo_map);
+ }
break;
case NC_GPENCIL:
- if (ELEM(wmn->action, NA_EDITED, NA_SELECTED))
+ if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
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;
case NC_IMAGE:
- if (wmn->action == NA_PAINTING)
+ if (wmn->action == NA_PAINTING) {
ED_region_tag_redraw(ar);
+ }
WM_gizmomap_tag_refresh(ar->gizmo_map);
break;
case NC_MATERIAL:
if (wmn->data == ND_SHADING_LINKS) {
SpaceImage *sima = sa->spacedata.first;
- if (sima->iuser.scene && (sima->iuser.scene->toolsettings->uv_flag & UV_SHOW_SAME_IMAGE))
+ if (sima->iuser.scene && (sima->iuser.scene->toolsettings->uv_flag & UV_SHOW_SAME_IMAGE)) {
ED_region_tag_redraw(ar);
+ }
}
break;
case NC_SCREEN:
@@ -803,10 +821,12 @@ static void image_buttons_region_draw(const bContext *C, ARegion *ar)
if (!sima->scopes.ok) {
BKE_histogram_update_sample_line(&sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings);
}
- if (sima->image->flag & IMA_VIEW_AS_RENDER)
+ if (sima->image->flag & IMA_VIEW_AS_RENDER) {
ED_space_image_scopes_update(C, sima, ibuf, true);
- else
+ }
+ else {
ED_space_image_scopes_update(C, sima, ibuf, false);
+ }
}
}
ED_space_image_release_buffer(sima, ibuf, lock);
@@ -836,15 +856,17 @@ static void image_buttons_region_listener(
}
break;
case NC_IMAGE:
- if (wmn->action != NA_PAINTING)
+ if (wmn->action != NA_PAINTING) {
ED_region_tag_redraw(ar);
+ }
break;
case NC_NODE:
ED_region_tag_redraw(ar);
break;
case NC_GPENCIL:
- if (ELEM(wmn->action, NA_EDITED, NA_SELECTED))
+ if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
ED_region_tag_redraw(ar);
+ }
break;
}
}
@@ -875,13 +897,15 @@ static void image_tools_region_listener(
/* context changes */
switch (wmn->category) {
case NC_GPENCIL:
- if (wmn->data == ND_DATA || ELEM(wmn->action, NA_EDITED, NA_SELECTED))
+ if (wmn->data == ND_DATA || ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
ED_region_tag_redraw(ar);
+ }
break;
case NC_BRUSH:
/* NA_SELECTED is used on brush changes */
- if (ELEM(wmn->action, NA_EDITED, NA_SELECTED))
+ if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
ED_region_tag_redraw(ar);
+ }
break;
case NC_SCENE:
switch (wmn->data) {
@@ -893,8 +917,9 @@ static void image_tools_region_listener(
}
break;
case NC_IMAGE:
- if (wmn->action != NA_PAINTING)
+ if (wmn->action != NA_PAINTING) {
ED_region_tag_redraw(ar);
+ }
break;
case NC_NODE:
ED_region_tag_redraw(ar);