Revision: 48960
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48960
Author:   nazgul
Date:     2012-07-16 10:51:02 +0000 (Mon, 16 Jul 2012)
Log Message:
-----------
Color management: display descriptions for color spaces

This descriptions are being read from ocio configuration and
exposed into UI via standard enum's tooltips.

Modified Paths:
--------------
    branches/soc-2011-tomato/intern/opencolorio/ocio_capi.cpp
    branches/soc-2011-tomato/intern/opencolorio/ocio_capi.h
    branches/soc-2011-tomato/release/datafiles/colormanagement/config.ocio
    
branches/soc-2011-tomato/source/blender/imbuf/intern/IMB_colormanagement_intern.h
    branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c

Modified: branches/soc-2011-tomato/intern/opencolorio/ocio_capi.cpp
===================================================================
--- branches/soc-2011-tomato/intern/opencolorio/ocio_capi.cpp   2012-07-16 
10:50:53 UTC (rev 48959)
+++ branches/soc-2011-tomato/intern/opencolorio/ocio_capi.cpp   2012-07-16 
10:51:02 UTC (rev 48960)
@@ -305,6 +305,11 @@
        return (*cs)->getName();
 }
 
+const char *OCIO_colorSpaceGetDescription(ConstColorSpaceRcPtr *cs)
+{
+       return (*cs)->getDescription();
+}
+
 const char *OCIO_colorSpaceGetFamily(ConstColorSpaceRcPtr *cs)
 {
        return (*cs)->getFamily();

Modified: branches/soc-2011-tomato/intern/opencolorio/ocio_capi.h
===================================================================
--- branches/soc-2011-tomato/intern/opencolorio/ocio_capi.h     2012-07-16 
10:50:53 UTC (rev 48959)
+++ branches/soc-2011-tomato/intern/opencolorio/ocio_capi.h     2012-07-16 
10:51:02 UTC (rev 48960)
@@ -87,8 +87,8 @@
 
 void OCIO_processorRelease(ConstProcessorRcPtr *p);
 
-
 const char *OCIO_colorSpaceGetName(ConstColorSpaceRcPtr *cs);
+const char *OCIO_colorSpaceGetDescription(ConstColorSpaceRcPtr *cs);
 const char *OCIO_colorSpaceGetFamily(ConstColorSpaceRcPtr *cs);
 
 DisplayTransformRcPtr *OCIO_createDisplayTransform(void);

Modified: branches/soc-2011-tomato/release/datafiles/colormanagement/config.ocio
===================================================================
--- branches/soc-2011-tomato/release/datafiles/colormanagement/config.ocio      
2012-07-16 10:50:53 UTC (rev 48959)
+++ branches/soc-2011-tomato/release/datafiles/colormanagement/config.ocio      
2012-07-16 10:51:02 UTC (rev 48960)
@@ -181,7 +181,7 @@
     equalitygroup: ""
     bitdepth: 32f
     description: |
-      Rec. 709 (Full Range) Display Space
+      Rec. 709 (Full Range), Blender native internal space
     isdata: false
     allocation: uniform
     allocationvars: [-0.125, 1.125]

Modified: 
branches/soc-2011-tomato/source/blender/imbuf/intern/IMB_colormanagement_intern.h
===================================================================
--- 
branches/soc-2011-tomato/source/blender/imbuf/intern/IMB_colormanagement_intern.h
   2012-07-16 10:50:53 UTC (rev 48959)
+++ 
branches/soc-2011-tomato/source/blender/imbuf/intern/IMB_colormanagement_intern.h
   2012-07-16 10:51:02 UTC (rev 48960)
@@ -39,6 +39,7 @@
        struct ColorSpace *next, *prev;
        int index;
        char name[64];
+       char description[64];
 } ColorSpace;
 
 typedef struct ColorManagedDisplay {
@@ -64,7 +65,7 @@
 struct ColorManagedView *colormanage_view_get_indexed(int index);
 struct ColorManagedView *colormanage_view_get_named(const char *name);
 
-struct ColorSpace *colormanage_colorspace_add(const char *name);
+struct ColorSpace *colormanage_colorspace_add(const char *name, const char 
*description);
 struct ColorSpace *colormanage_colorspace_get_named(const char *name);
 struct ColorSpace *colormanage_colorspace_get_indexed(int index);
 

Modified: branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c
===================================================================
--- branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c      
2012-07-16 10:50:53 UTC (rev 48959)
+++ branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c      
2012-07-16 10:51:02 UTC (rev 48960)
@@ -478,9 +478,17 @@
        /* load colorspaces */
        tot_colorspace = OCIO_configGetNumColorSpaces(config);
        for (index = 0 ; index < tot_colorspace; index++) {
+               ConstColorSpaceRcPtr *ocio_colorspace;
+               const char *description;
+
                name = OCIO_configGetColorSpaceNameByIndex(config, index);
 
-               colormanage_colorspace_add(name);
+               ocio_colorspace = OCIO_configGetColorSpace(config, name);
+               description = OCIO_colorSpaceGetDescription(ocio_colorspace);
+
+               colormanage_colorspace_add(name, description);
+
+               OCIO_colorSpaceRelease(ocio_colorspace);
        }
 
        /* load displays */
@@ -1620,8 +1628,28 @@
 
 /*********************** Color space functions *************************/
 
-ColorSpace *colormanage_colorspace_add(const char *name)
+static void colormanage_description_strip(char *description)
 {
+       int i, n;
+
+       for (i = strlen(description) - 1; i >= 0; i--) {
+               if (ELEM(description[i], '\r', '\n')) {
+                       description[i] = '\0';
+               }
+               else {
+                       break;
+               }
+       }
+
+       for (i = 0, n = strlen(description); i < n; i++) {
+               if (ELEM(description[i], '\r', '\n')) {
+                       description[i] = ' ';
+               }
+       }
+}
+
+ColorSpace *colormanage_colorspace_add(const char *name, const char 
*description)
+{
        ColorSpace *colorspace;
 
        colorspace = MEM_callocN(sizeof(ColorSpace), "ColorSpace");
@@ -1629,6 +1657,12 @@
 
        BLI_strncpy(colorspace->name, name, sizeof(colorspace->name));
 
+       if (description) {
+               BLI_strncpy(colorspace->description, description, 
sizeof(colorspace->description));
+
+               colormanage_description_strip(colorspace->description);
+       }
+
        BLI_addtail(&global_colorspaces, colorspace);
 
        global_tot_colorspace++;
@@ -1745,8 +1779,12 @@
                item.name = colorspace->name;
                item.identifier = colorspace->name;
                item.icon = 0;
-               item.description = "";
 
+               if (colorspace->description)
+                       item.description = colorspace->description;
+               else
+                       item.description = "";
+
                RNA_enum_item_add(items, totitem, &item);
        }
 }

Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c 
2012-07-16 10:50:53 UTC (rev 48959)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c 
2012-07-16 10:51:02 UTC (rev 48960)
@@ -38,12 +38,12 @@
 #include "WM_types.h"
 
 static EnumPropertyItem view_transform_items[] = {
-       {0, "NONE", 0, "None", ""},
+       {0, "NONE", 0, "None", "Do not perform any color transform on display, 
use old non-color managed technique for display"},
        {0, NULL, 0, NULL, NULL}
 };
 
 static EnumPropertyItem color_space_items[] = {
-       {0, "NONE", 0, "None", ""},
+       {0, "NONE", 0, "None", "Do not perform any color transform on load, 
treat colors as in scene linear space already"},
        {0, NULL, 0, NULL, NULL}
 };
 

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to