diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-10-03 21:43:48 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-10-03 22:00:55 +0300 |
commit | 9b7c84f293b6ad5d855b175ba664d4bd0d72c18d (patch) | |
tree | ffb64e958b28e2745307bdeed8e865b898d29886 /source/blender/editors/space_image | |
parent | 0c7458604d06d2ff9f37bfe8d05c6a0cc23a9a18 (diff) |
Image: improve Save As Render tooltip, hide option when saving render result
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index dec4055c737..4155e84c013 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1871,8 +1871,7 @@ static ImageSaveData *image_save_as_init(bContext *C, wmOperator *op) } /* Enable save_copy by default for render results. */ - if (ELEM(image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && - !RNA_struct_property_is_set(op->ptr, "copy")) { + if (image->source == IMA_SRC_VIEWER && !RNA_struct_property_is_set(op->ptr, "copy")) { RNA_boolean_set(op->ptr, "copy", true); } @@ -1964,16 +1963,16 @@ static void image_save_as_cancel(bContext *UNUSED(C), wmOperator *op) image_save_as_free(op); } -static bool image_save_as_draw_check_prop(PointerRNA *ptr, - PropertyRNA *prop, - void *UNUSED(user_data)) +static bool image_save_as_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop, void *user_data) { + ImageSaveData *isd = user_data; const char *prop_id = RNA_property_identifier(prop); return !(STREQ(prop_id, "filepath") || STREQ(prop_id, "directory") || STREQ(prop_id, "filename") || /* when saving a copy, relative path has no effect */ - (STREQ(prop_id, "relative_path") && RNA_boolean_get(ptr, "copy"))); + (STREQ(prop_id, "relative_path") && RNA_boolean_get(ptr, "copy")) || + (STREQ(prop_id, "save_as_render") && isd->image->source == IMA_SRC_VIEWER)); } static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) @@ -1987,13 +1986,13 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); - /* main draw call */ + /* Operator settings. */ uiDefAutoButsRNA( - layout, op->ptr, image_save_as_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false); + layout, op->ptr, image_save_as_draw_check_prop, isd, NULL, UI_BUT_LABEL_ALIGN_NONE, false); uiItemS(layout); - /* image template */ + /* Image format settings. */ RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &isd->opts.im_format, &imf_ptr); uiTemplateImageSettings(layout, &imf_ptr, save_as_render); @@ -2004,7 +2003,7 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) uiItemR(col, &linear_settings_ptr, "name", 0, IFACE_("Color Space"), ICON_NONE); } - /* multiview template */ + /* Multiview settings. */ if (is_multiview) { uiTemplateImageFormatViews(layout, &imf_ptr, op->ptr); } @@ -2049,11 +2048,14 @@ void IMAGE_OT_save_as(wmOperatorType *ot) /* properties */ PropertyRNA *prop; - prop = RNA_def_boolean(ot->srna, - "save_as_render", - 0, - "Save As Render", - "Apply render part of display transform when saving byte image"); + prop = RNA_def_boolean( + ot->srna, + "save_as_render", + 0, + "Save As Render", + "Save image with render color management.\n" + "For display image formats like PNG, apply view and display transform.\n" + "For intermediate image formats like OpenEXR, use the default render output color space."); RNA_def_property_flag(prop, PROP_SKIP_SAVE); prop = RNA_def_boolean(ot->srna, "copy", |