svn merge ^/trunk/blender -r50091:50107
[blender.git] / source / blender / editors / space_image / image_buttons.c
index 40f0683a8524e87b1fc8c8886b232d17f4355d7e..bc22a220adf8ca88897bdc2d8bca1cea95d0b811 100644 (file)
@@ -611,6 +611,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
        uiLayout *row, *split, *col;
        uiBlock *block;
        char str[128];
+
        void *lock;
 
        if (!ptr->data)
@@ -728,8 +729,11 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
                                        uiItemL(layout, str, ICON_NONE);
                                }
                        }
-                       
+
                        if (ima->source != IMA_SRC_GENERATED) {
+                               col = uiLayoutColumn(layout, FALSE);
+                               uiTemplateColorspaceSettings(col, &imaptr, "colorspace_settings");
+
                                if (compact == 0) { /* background image view doesnt need these */
                                        uiItemS(layout);
 
@@ -798,11 +802,14 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
 {
        ImageFormatData *imf = imfptr->data;
        ID *id = imfptr->id.data;
+       PointerRNA display_settings_ptr;
+       PropertyRNA *prop;
        const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
        /* some settings depend on this being a scene thats rendered */
        const short is_render_out = (id && GS(id->name) == ID_SCE);
 
        uiLayout *col, *row, *split, *sub;
+       int show_preview = FALSE;
 
        col = uiLayoutColumn(layout, FALSE);
 
@@ -843,6 +850,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
        }
 
        if (is_render_out && (imf->imtype == R_IMF_IMTYPE_OPENEXR)) {
+               show_preview = TRUE;
                uiItemR(row, imfptr, "use_preview", 0, NULL, ICON_NONE);
        }
 
@@ -864,6 +872,21 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
                uiItemR(col, imfptr, "cineon_gamma", 0, NULL, ICON_NONE);
 #endif
        }
+
+       /* color management */
+       if (!BKE_imtype_supports_float(imf->imtype) ||
+           (show_preview && imf->flag & R_IMF_FLAG_PREVIEW_JPG))
+       {
+               prop = RNA_struct_find_property(imfptr, "display_settings");
+               display_settings_ptr = RNA_property_pointer_get(imfptr, prop);
+
+               col = uiLayoutColumn(layout, FALSE);
+               uiItemL(col, IFACE_("Color Management"), ICON_NONE);
+
+               uiItemR(col, &display_settings_ptr, "display_device", 0, NULL, ICON_NONE);
+
+               uiTemplateColormanagedViewSettings(col, NULL, imfptr, "view_settings", FALSE);
+       }
 }
 
 void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)