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:
authorBrecht Van Lommel <brecht@blender.org>2022-03-11 19:50:57 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-03-21 18:38:13 +0300
commit6e4d2fa9140864a13356b07ffca082817822987f (patch)
treecb8894c3b6898e82410f3edffe2fb9d85a3a2399 /source/blender/editors
parent4abb8a14a2133f876c7718a8e09284baa62b1cf5 (diff)
Cleanup: add image_format.cc for functions related to ImageFormatData
Also fixes missing code to read/write/free/copy color management settings in various places. This can't be set through the UI currently, but still should be handled consistently.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/object/object_bake_api.c1
-rw-r--r--source/blender/editors/render/render_internal.cc1
-rw-r--r--source/blender/editors/render/render_opengl.cc1
-rw-r--r--source/blender/editors/screen/screendump.c3
-rw-r--r--source/blender/editors/space_image/image_buttons.c1
-rw-r--r--source/blender/editors/space_image/image_ops.c25
6 files changed, 22 insertions, 10 deletions
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index 3529574a3a4..efcb47f76ab 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -23,6 +23,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_image.h"
+#include "BKE_image_format.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
diff --git a/source/blender/editors/render/render_internal.cc b/source/blender/editors/render/render_internal.cc
index 6796eff29d4..e5d2a765ca1 100644
--- a/source/blender/editors/render/render_internal.cc
+++ b/source/blender/editors/render/render_internal.cc
@@ -31,6 +31,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_image.h"
+#include "BKE_image_format.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_node.h"
diff --git a/source/blender/editors/render/render_opengl.cc b/source/blender/editors/render/render_opengl.cc
index be66e87f2e5..872e2867696 100644
--- a/source/blender/editors/render/render_opengl.cc
+++ b/source/blender/editors/render/render_opengl.cc
@@ -34,6 +34,7 @@
#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_image.h"
+#include "BKE_image_format.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "BKE_report.h"
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index ff77f9910fb..5464d0a347d 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -24,6 +24,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_image.h"
+#include "BKE_image_format.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_screen.h"
@@ -71,7 +72,7 @@ static int screenshot_data_create(bContext *C, wmOperator *op, ScrArea *area)
scd->crop = area->totrct;
}
- BKE_imformat_defaults(&scd->im_format);
+ BKE_image_format_init(&scd->im_format, false);
op->customdata = scd;
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 0af32a717a4..abde5f52bb0 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -20,6 +20,7 @@
#include "BKE_context.h"
#include "BKE_image.h"
+#include "BKE_image_format.h"
#include "BKE_node.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 3721ea81c04..35be7ffdb8b 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -38,6 +38,7 @@
#include "BKE_global.h"
#include "BKE_icons.h"
#include "BKE_image.h"
+#include "BKE_image_format.h"
#include "BKE_image_save.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
@@ -1736,7 +1737,7 @@ static int image_save_options_init(Main *bmain,
if (ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
/* imtype */
- opts->im_format = scene->r.im_format;
+ BKE_image_format_copy(&opts->im_format, &scene->r.im_format);
is_depth_set = true;
if (!BKE_image_is_multiview(ima)) {
/* In case multiview is disabled,
@@ -1752,7 +1753,7 @@ static int image_save_options_init(Main *bmain,
opts->im_format.planes = ibuf->planes;
}
else {
- BKE_imbuf_to_image_format(&opts->im_format, ibuf);
+ BKE_image_format_from_imbuf(&opts->im_format, ibuf);
}
/* use the multiview image settings as the default */
@@ -1829,8 +1830,8 @@ static void image_save_options_from_op(Main *bmain,
ImageFormatData *imf)
{
if (imf) {
- BKE_color_managed_view_settings_free(&opts->im_format.view_settings);
- opts->im_format = *imf;
+ BKE_image_format_free(&opts->im_format);
+ BKE_image_format_copy(&opts->im_format, imf);
}
if (RNA_struct_property_is_set(op->ptr, "filepath")) {
@@ -1843,8 +1844,8 @@ static void image_save_options_to_op(ImageSaveOptions *opts, wmOperator *op)
{
if (op->customdata) {
ImageSaveData *isd = op->customdata;
- BKE_color_managed_view_settings_free(&isd->im_format.view_settings);
- isd->im_format = opts->im_format;
+ BKE_image_format_free(&isd->im_format);
+ BKE_image_format_copy(&isd->im_format, &opts->im_format);
}
RNA_string_set(op->ptr, "filepath", opts->filepath);
@@ -1878,7 +1879,7 @@ static void image_save_as_free(wmOperator *op)
{
if (op->customdata) {
ImageSaveData *isd = op->customdata;
- BKE_color_managed_view_settings_free(&isd->im_format.view_settings);
+ BKE_image_format_free(&isd->im_format);
MEM_freeN(op->customdata);
op->customdata = NULL;
@@ -1920,6 +1921,8 @@ static int image_save_as_exec(bContext *C, wmOperator *op)
BKE_image_free_packedfiles(image);
}
+ BKE_image_save_options_free(&opts);
+
image_save_as_free(op);
return OPERATOR_FINISHED;
@@ -1948,6 +1951,7 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
BKE_image_save_options_init(&opts, bmain, scene);
if (image_save_options_init(bmain, &opts, ima, iuser, true, save_as_render) == 0) {
+ BKE_image_save_options_free(&opts);
return OPERATOR_CANCELLED;
}
image_save_options_to_op(&opts, op);
@@ -1964,7 +1968,7 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
isd->image = ima;
isd->iuser = iuser;
- memcpy(&isd->im_format, &opts.im_format, sizeof(opts.im_format));
+ BKE_image_format_copy(&isd->im_format, &opts.im_format);
op->customdata = isd;
/* show multiview save options only if image has multiviews */
@@ -1974,6 +1978,7 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
RNA_property_boolean_set(op->ptr, prop, BKE_image_is_multiview(ima));
image_filesel(C, op, opts.filepath);
+ BKE_image_save_options_free(&opts);
return OPERATOR_RUNNING_MODAL;
}
@@ -2132,6 +2137,7 @@ static int image_save_exec(bContext *C, wmOperator *op)
BKE_image_save_options_init(&opts, bmain, scene);
if (image_save_options_init(bmain, &opts, image, iuser, false, false) == 0) {
+ BKE_image_save_options_free(&opts);
return OPERATOR_CANCELLED;
}
image_save_options_from_op(bmain, &opts, op, NULL);
@@ -2147,7 +2153,7 @@ static int image_save_exec(bContext *C, wmOperator *op)
ok = true;
}
- BKE_color_managed_view_settings_free(&opts.im_format.view_settings);
+ BKE_image_save_options_free(&opts);
if (ok) {
return OPERATOR_FINISHED;
@@ -2399,6 +2405,7 @@ bool ED_image_save_all_modified(const bContext *C, ReportList *reports)
bool saved_successfully = BKE_image_save(reports, bmain, ima, NULL, &opts);
ok = ok && saved_successfully;
}
+ BKE_image_save_options_free(&opts);
}
}
}