diff options
Diffstat (limited to 'source/blender/editors/space_image/image_ops.c')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 90e308ecfa2..93cb1acaa8b 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -156,7 +156,7 @@ static int space_image_file_exists_poll(bContext *C) SpaceImage *sima = CTX_wm_space_image(C); ImBuf *ibuf; void *lock; - int ret = FALSE; + int ret = false; char name[FILE_MAX]; ibuf = ED_space_image_acquire_buffer(sima, &lock); @@ -164,14 +164,14 @@ static int space_image_file_exists_poll(bContext *C) BLI_strncpy(name, ibuf->name, FILE_MAX); BLI_path_abs(name, bmain->name); - if (BLI_exists(name) == FALSE) { + if (BLI_exists(name) == false) { CTX_wm_operator_poll_msg_set(C, "image file not found"); } else if (!BLI_file_is_writable(name)) { CTX_wm_operator_poll_msg_set(C, "image path can't be written to"); } else { - ret = TRUE; + ret = true; } } ED_space_image_release_buffer(sima, ibuf, lock); @@ -223,16 +223,16 @@ static int image_sample_poll(bContext *C) if (obedit) { if (ED_space_image_show_uvedit(sima, obedit) && (toolsettings->use_uv_sculpt)) - return FALSE; + return false; } else if (sima->mode != SI_MODE_VIEW) { - return FALSE; + return false; } return space_image_main_area_poll(C); } else { - return FALSE; + return false; } } /********************** view pan operator *********************/ @@ -1459,11 +1459,11 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI if (ibuf) { ImBuf *colormanaged_ibuf; const char *relbase = ID_BLEND_PATH(CTX_data_main(C), &ima->id); - const short relative = (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path")); - const short save_copy = (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy")); + const bool relative = (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path")); + const bool save_copy = (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy")); const bool save_as_render = (RNA_struct_find_property(op->ptr, "save_as_render") && RNA_boolean_get(op->ptr, "save_as_render")); ImageFormatData *imf = &simopts->im_format; - short ok = FALSE; + bool ok = false; /* old global to ensure a 2nd save goes to same dir */ BLI_strncpy(G.ima, simopts->filepath, sizeof(G.ima)); @@ -1494,7 +1494,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI RenderResult *rr = BKE_image_acquire_renderresult(scene, ima); if (rr) { RE_WriteRenderResult(op->reports, rr, simopts->filepath, simopts->im_format.exr_codec); - ok = TRUE; + ok = true; } else { BKE_report(op->reports, RPT_ERROR, "Did not write, no Multilayer Image"); @@ -1503,7 +1503,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI } else { if (BKE_imbuf_write_as(colormanaged_ibuf, simopts->filepath, &simopts->im_format, save_copy)) { - ok = TRUE; + ok = true; } } @@ -1593,7 +1593,7 @@ static int image_save_as_exec(bContext *C, wmOperator *op) save_image_options_from_op(&simopts, op); - save_image_doit(C, sima, op, &simopts, TRUE); + save_image_doit(C, sima, op, &simopts, true); image_save_as_free(op); return OPERATOR_FINISHED; @@ -1625,7 +1625,7 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS /* enable save_copy by default for render results */ if (ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && !RNA_struct_property_is_set(op->ptr, "copy")) { - RNA_boolean_set(op->ptr, "copy", TRUE); + RNA_boolean_set(op->ptr, "copy", true); } RNA_boolean_set(op->ptr, "save_as_render", save_as_render); @@ -1663,7 +1663,7 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) /* image template */ RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &ptr); - uiTemplateImageSettings(layout, &ptr, FALSE); + uiTemplateImageSettings(layout, &ptr, false); /* main draw call */ RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); @@ -1680,12 +1680,12 @@ static int image_save_as_poll(bContext *C) if (ima->source == IMA_SRC_VIEWER) { CTX_wm_operator_poll_msg_set(C, "can't save image while rendering"); - return FALSE; + return false; } } - return TRUE; + return true; } - return FALSE; + return false; } void IMAGE_OT_save_as(wmOperatorType *ot) @@ -1730,7 +1730,7 @@ static int image_save_exec(bContext *C, wmOperator *op) save_image_options_from_op(&simopts, op); if (BLI_exists(simopts.filepath) && BLI_file_is_writable(simopts.filepath)) { - save_image_doit(C, sima, op, &simopts, FALSE); + save_image_doit(C, sima, op, &simopts, false); } else { BKE_reportf(op->reports, RPT_ERROR, "Cannot save image, path '%s' is not writable", simopts.filepath); @@ -2018,10 +2018,10 @@ static int image_invert_exec(bContext *C, wmOperator *op) bool support_undo = ((sima != NULL) && (sima->mode == SI_MODE_PAINT)); /* flags indicate if this channel should be inverted */ - const short r = RNA_boolean_get(op->ptr, "invert_r"); - const short g = RNA_boolean_get(op->ptr, "invert_g"); - const short b = RNA_boolean_get(op->ptr, "invert_b"); - const short a = RNA_boolean_get(op->ptr, "invert_a"); + const bool r = RNA_boolean_get(op->ptr, "invert_r"); + const bool g = RNA_boolean_get(op->ptr, "invert_g"); + const bool b = RNA_boolean_get(op->ptr, "invert_b"); + const bool a = RNA_boolean_get(op->ptr, "invert_a"); int i; @@ -2330,7 +2330,7 @@ bool ED_space_image_color_sample(SpaceImage *sima, ARegion *ar, int mval[2], flo if (ibuf == NULL) { ED_space_image_release_buffer(sima, ibuf, lock); - return FALSE; + return false; } UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &fx, &fy); @@ -2346,12 +2346,12 @@ bool ED_space_image_color_sample(SpaceImage *sima, ARegion *ar, int mval[2], flo if (ibuf->rect_float) { fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x)); linearrgb_to_srgb_v3_v3(r_col, fp); - ret = TRUE; + ret = true; } else if (ibuf->rect) { cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x); rgb_uchar_to_float(r_col, cp); - ret = TRUE; + ret = true; } } @@ -2397,7 +2397,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event info->zp = NULL; info->zfp = NULL; - info->use_default_view = (image->flag & IMA_VIEW_AS_RENDER) ? FALSE : TRUE; + info->use_default_view = (image->flag & IMA_VIEW_AS_RENDER) ? false : true; if (ibuf->rect) { cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x); @@ -2417,7 +2417,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event copy_v4_v4(info->linearcol, info->colf); IMB_colormanagement_colorspace_to_scene_linear_v4(info->linearcol, false, ibuf->rect_colorspace); - info->color_manage = TRUE; + info->color_manage = true; } if (ibuf->rect_float) { fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x)); @@ -2430,7 +2430,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event copy_v4_v4(info->linearcol, info->colf); - info->color_manage = TRUE; + info->color_manage = true; } if (ibuf->zbuf) { @@ -2827,7 +2827,7 @@ static int image_cycle_render_slot_exec(bContext *C, wmOperator *op) { Image *ima = CTX_data_edit_image(C); int a, slot, cur = ima->render_slot; - const short use_reverse = RNA_boolean_get(op->ptr, "reverse"); + const bool use_reverse = RNA_boolean_get(op->ptr, "reverse"); for (a = 1; a < IMA_MAX_RENDER_SLOT; a++) { slot = (cur + (use_reverse ? -a : a)) % IMA_MAX_RENDER_SLOT; |