[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48961] branches/soc-2011-tomato: Color management: resolve some of current TODOs

Sergey Sharybin sergey.vfx at gmail.com
Mon Jul 16 12:51:14 CEST 2012


Revision: 48961
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48961
Author:   nazgul
Date:     2012-07-16 10:51:14 +0000 (Mon, 16 Jul 2012)
Log Message:
-----------
Color management: resolve some of current TODOs

- Some of TODO notes were laying around but they in fact
  were resolved a while ago, removed this notes form the code.

- De-duplicate input color space settings drawing in clip and
  image spaces. Moved this stuff to a template which could also
  be used in Python.

- Replace py-defined view transform settings panel with a
  C-defined template as well. Use it in space panels and
  image format settings.

- Remove display settings from color management settings
  panels used by different spaces. Use window settings
  instead.

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_image.py
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_node.py
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_sequencer.py
    branches/soc-2011-tomato/source/blender/editors/include/UI_interface.h
    branches/soc-2011-tomato/source/blender/editors/interface/interface_templates.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_buttons.c
    branches/soc-2011-tomato/source/blender/editors/space_image/image_buttons.c
    branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c
    branches/soc-2011-tomato/source/blender/makesrna/RNA_access.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_ui_api.c
    branches/soc-2011-tomato/source/blenderplayer/bad_level_call_stubs/stubs.c

Removed Paths:
-------------
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_color_management.py

Deleted: branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_color_management.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_color_management.py	2012-07-16 10:51:02 UTC (rev 48960)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_color_management.py	2012-07-16 10:51:14 UTC (rev 48961)
@@ -1,45 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2
-#  of the License, or (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program; if not, write to the Free Software Foundation,
-#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
-
-class ColorManagedViewSettingsPanel:
-
-    def draw(self, context):
-        layout = self.layout
-
-        space = context.space_data
-        window = context.window
-        display_settings = context.window.display_settings
-        space_view_settings = space.view_settings
-
-        if space_view_settings.use_global_settings:
-            view_settings = window.view_settings
-        else:
-            view_settings = space.view_settings
-
-        col = layout.column()
-        col.prop(space_view_settings, "use_global_settings")
-        col.prop(display_settings, "display_device", text="Display")
-        col.prop(view_settings, "view_transform", text="View")
-
-        col = layout.column()
-        col.active = view_settings.view_transform not in {'ACES ODT Tonecurve', 'NONE'}
-        col.prop(view_settings, "exposure")
-        col.prop(view_settings, "gamma")
-

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2012-07-16 10:51:02 UTC (rev 48960)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2012-07-16 10:51:14 UTC (rev 48961)
@@ -20,7 +20,6 @@
 
 import bpy
 from bpy.types import Panel, Header, Menu
-from bl_ui.properties_color_management import ColorManagedViewSettingsPanel
 
 
 class CLIP_HT_header(Header):
@@ -1016,13 +1015,19 @@
         col.prop(sc.clip_user, "use_render_undistorted")
 
 
-class CLIP_PT_display_properties(Panel, ColorManagedViewSettingsPanel):
+class CLIP_PT_display_properties(Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'
     bl_label = "Display Properties"
     bl_options = {'DEFAULT_CLOSED'}
 
+    def draw(self, context):
+        layout = self.layout
+        space = context.space_data
 
+        layout.template_colormanaged_view_settings(space, "view_settings", True)
+
+
 class CLIP_PT_footage(CLIP_PT_clip_view_panel, Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_image.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_image.py	2012-07-16 10:51:02 UTC (rev 48960)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_image.py	2012-07-16 10:51:14 UTC (rev 48961)
@@ -20,7 +20,6 @@
 import bpy
 from bpy.types import Header, Menu, Panel
 from bl_ui.properties_paint_common import UnifiedPaintPanel
-from bl_ui.properties_color_management import ColorManagedViewSettingsPanel
 
 
 class ImagePaintPanel(UnifiedPaintPanel):
@@ -428,12 +427,18 @@
             layout.prop(sima, "use_realtime_update", text="", icon_only=True, icon='LOCKED')
 
 
-class IMAGE_PT_display_properties(Panel, ColorManagedViewSettingsPanel):
+class IMAGE_PT_display_properties(Panel):
     bl_space_type = 'IMAGE_EDITOR'
     bl_region_type = 'UI'
     bl_label = "Display Properties"
 
+    def draw(self, context):
+        layout = self.layout
+        space = context.space_data
 
+        layout.template_colormanaged_view_settings(space, "view_settings", True)
+
+
 class IMAGE_PT_image_properties(Panel):
     bl_space_type = 'IMAGE_EDITOR'
     bl_region_type = 'UI'

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_node.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_node.py	2012-07-16 10:51:02 UTC (rev 48960)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_node.py	2012-07-16 10:51:14 UTC (rev 48961)
@@ -19,7 +19,6 @@
 # <pep8 compliant>
 import bpy
 from bpy.types import Header, Menu, Panel
-from bl_ui.properties_color_management import ColorManagedViewSettingsPanel
 
 
 class NODE_HT_header(Header):
@@ -185,12 +184,18 @@
         layout.operator("node.read_fullsamplelayers")
 
 
-class NODE_PT_display_properties(Panel, ColorManagedViewSettingsPanel):
+class NODE_PT_display_properties(Panel):
     bl_space_type = 'NODE_EDITOR'
     bl_region_type = 'UI'
     bl_label = "Display Properties"
 
+    def draw(self, context):
+        layout = self.layout
+        space = context.space_data
 
+        layout.template_colormanaged_view_settings(space, "view_settings", True)
+
+
 # Node Backdrop options
 class NODE_PT_properties(Panel):
     bl_space_type = 'NODE_EDITOR'

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_sequencer.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_sequencer.py	2012-07-16 10:51:02 UTC (rev 48960)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_sequencer.py	2012-07-16 10:51:14 UTC (rev 48961)
@@ -19,7 +19,6 @@
 # <pep8 compliant>
 import bpy
 from bpy.types import Header, Menu, Panel
-from bl_ui.properties_color_management import ColorManagedViewSettingsPanel
 
 
 def act_strip(context):
@@ -861,8 +860,11 @@
             col.prop(st, "show_separate_color")
         col.prop(st, "proxy_render_size")
 
-class SEQUENCER_PT_display_properties(SequencerButtonsPanel_Output, Panel, ColorManagedViewSettingsPanel):
-    bl_label = "Display Properties"
+        col = layout.column()
+        col.separator()
+        col.label(text="Color Management:")
+        col.template_colormanaged_view_settings(st, "view_settings", True)
 
+
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)

Modified: branches/soc-2011-tomato/source/blender/editors/include/UI_interface.h
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/include/UI_interface.h	2012-07-16 10:51:02 UTC (rev 48960)
+++ branches/soc-2011-tomato/source/blender/editors/include/UI_interface.h	2012-07-16 10:51:14 UTC (rev 48961)
@@ -822,6 +822,9 @@
 void uiTemplateTrack(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname);
 void uiTemplateMarker(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *trackptr, int cmpact);
 
+void uiTemplateColorspaceSettings(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname);
+void uiTemplateColormanagedViewSettings(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, int show_global_settings);
+
 /* items */
 void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname);
 void uiItemEnumO_ptr(uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, const char *propname, int value);

Modified: branches/soc-2011-tomato/source/blender/editors/interface/interface_templates.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/interface/interface_templates.c	2012-07-16 10:51:02 UTC (rev 48960)
+++ branches/soc-2011-tomato/source/blender/editors/interface/interface_templates.c	2012-07-16 10:51:14 UTC (rev 48961)
@@ -2768,3 +2768,66 @@
 	}
 }
 
+/********************************* Color management *************************************/
+
+void uiTemplateColorspaceSettings(uiLayout *layout, PointerRNA *ptr, const char *propname)
+{
+	PropertyRNA *prop;
+	PointerRNA colorspace_settings_ptr;
+
+	prop = RNA_struct_find_property(ptr, propname);
+
+	if (!prop) {
+		printf("%s: property not found: %s.%s\n",
+		       __func__, RNA_struct_identifier(ptr->type), propname);
+		return;
+	}
+
+	colorspace_settings_ptr = RNA_property_pointer_get(ptr, prop);
+
+	uiItemL(layout, "Color Space:", ICON_NONE);
+	uiItemR(layout, &colorspace_settings_ptr, "name", 0, "", ICON_NONE);
+}
+
+void uiTemplateColormanagedViewSettings(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, int show_global_settings)
+{
+	PropertyRNA *prop;
+	PointerRNA view_transform_ptr;
+	uiLayout *col;
+	ColorManagedViewSettings *view_settings;
+
+	prop = RNA_struct_find_property(ptr, propname);
+
+	if (!prop) {
+		printf("%s: property not found: %s.%s\n",
+		       __func__, RNA_struct_identifier(ptr->type), propname);
+		return;
+	}
+
+	view_transform_ptr = RNA_property_pointer_get(ptr, prop);
+	view_settings = view_transform_ptr.data;
+
+	col = uiLayoutColumn(layout, FALSE);
+
+	if (show_global_settings) {
+		wmWindow *win = CTX_wm_window(C);
+		bScreen *screen = CTX_wm_screen(C);
+
+		uiItemR(col, &view_transform_ptr, "use_global_settings", 0, NULL, ICON_NONE);
+
+		if (view_settings->flag & COLORMANAGE_VIEW_USE_GLOBAL) {
+			PointerRNA window_ptr;
+
+			RNA_pointer_create(&screen->id, &RNA_Window, win, &window_ptr);
+
+			prop = RNA_struct_find_property(&window_ptr, "view_settings");
+			view_transform_ptr = RNA_property_pointer_get(&window_ptr, prop);
+		}
+	}
+
+	uiItemR(col, &view_transform_ptr, "view_transform", 0, "View", ICON_NONE);
+
+	col = uiLayoutColumn(layout, FALSE);
+	uiItemR(col, &view_transform_ptr, "exposure", 0, NULL, ICON_NONE);
+	uiItemR(col, &view_transform_ptr, "gamma", 0, NULL, ICON_NONE);
+}

Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/clip_buttons.c

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list