Send color managed signal if input spaces changes during image saving

We're currently only supporting save to a default format color space, which
makes it a bit tricky to prevent ImBuf from being changed.

For until when saving to a custom colorspace works we'll just reload image
if the space changes.
This commit is contained in:
Sergey Sharybin 2015-05-20 15:33:30 +05:00
parent 28b2977be9
commit f4d064a5b2
3 changed files with 17 additions and 2 deletions

View File

@ -103,5 +103,6 @@ void BKE_color_managed_view_settings_free(struct ColorManagedViewSettings *setti
void BKE_color_managed_colorspace_settings_init(struct ColorManagedColorspaceSettings *colorspace_settings);
void BKE_color_managed_colorspace_settings_copy(struct ColorManagedColorspaceSettings *colorspace_settings,
const struct ColorManagedColorspaceSettings *settings);
bool BKE_color_managed_colorspace_settings_equals(const struct ColorManagedColorspaceSettings *settings1,
const struct ColorManagedColorspaceSettings *settings2);
#endif

View File

@ -1303,3 +1303,9 @@ void BKE_color_managed_colorspace_settings_copy(ColorManagedColorspaceSettings *
{
BLI_strncpy(colorspace_settings->name, settings->name, sizeof(colorspace_settings->name));
}
bool BKE_color_managed_colorspace_settings_equals(const ColorManagedColorspaceSettings *settings1,
const ColorManagedColorspaceSettings *settings2)
{
return STREQ(settings1->name, settings2->name);
}

View File

@ -1537,6 +1537,8 @@ static void save_image_post(wmOperator *op, ImBuf *ibuf, Image *ima, int ok, int
{
if (ok) {
if (!save_copy) {
ColorManagedColorspaceSettings old_colorspace_settings;
if (do_newpath) {
BLI_strncpy(ibuf->name, filepath, sizeof(ibuf->name));
BLI_strncpy(ima->name, filepath, sizeof(ima->name));
@ -1570,8 +1572,14 @@ static void save_image_post(wmOperator *op, ImBuf *ibuf, Image *ima, int ok, int
BLI_path_rel(ima->name, relbase); /* only after saving */
}
BKE_color_managed_colorspace_settings_copy(&old_colorspace_settings,
&ima->colorspace_settings);
IMB_colormanagment_colorspace_from_ibuf_ftype(&ima->colorspace_settings, ibuf);
if (!BKE_color_managed_colorspace_settings_equals(&old_colorspace_settings,
&ima->colorspace_settings))
{
BKE_image_signal(ima, NULL, IMA_SIGNAL_COLORMANAGE);
}
}
}
else {