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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-09-15 14:05:07 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-09-15 14:05:07 +0400
commita73dd3476e7d180d3320afc04d218ce22f2f3bfc (patch)
treea540f5657bc9e8692eb0d3417de71393bad6bece /source/blender/makesrna
parentb93da9b01e163158a830872d29f8bd874f63d54d (diff)
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces only with OpenColorIO-based pipeline. This introduces two configurable color spaces: - Input color space for images and movie clips. This space is used to convert images/movies from color space in which file is saved to Blender's linear space (for float images, byte images are not internally converted, only input space is stored for such images and used later). This setting could be found in image/clip data block settings. - Display color space which defines space in which particular display is working. This settings could be found in scene's Color Management panel. When render result is being displayed on the screen, apart from converting image to display space, some additional conversions could happen. This conversions are: - View, which defines tone curve applying before display transformation. These are different ways to view the image on the same display device. For example it could be used to emulate film view on sRGB display. - Exposure affects on image exposure before tone map is applied. - Gamma is post-display gamma correction, could be used to match particular display gamma. - RGB curves are user-defined curves which are applying before display transformation, could be used for different purposes. All this settings by default are only applying on render result and does not affect on other images. If some particular image needs to be affected by this transformation, "View as Render" setting of image data block should be set to truth. Movie clips are always affected by all display transformations. This commit also introduces configurable color space in which sequencer is working. This setting could be found in scene's Color Management panel and it should be used if such stuff as grading needs to be done in color space different from sRGB (i.e. when Film view on sRGB display is use, using VD16 space as sequencer's internal space would make grading working in space which is close to the space using for display). Some technical notes: - Image buffer's float buffer is now always in linear space, even if it was created from 16bit byte images. - Space of byte buffer is stored in image buffer's rect_colorspace property. - Profile of image buffer was removed since it's not longer meaningful. - OpenGL and GLSL is supposed to always work in sRGB space. It is possible to support other spaces, but it's quite large project which isn't so much important. - Legacy Color Management option disabled is emulated by using None display. It could have some regressions, but there's no clear way to avoid them. - If OpenColorIO is disabled on build time, it should make blender behaving in the same way as previous release with color management enabled. More details could be found at this page (more details would be added soon): http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management -- Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO integration and to Brecht van Lommel for some further development and code/ usecase review!
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/RNA_access.h3
-rw-r--r--source/blender/makesrna/intern/rna_color.c242
-rw-r--r--source/blender/makesrna/intern/rna_image.c10
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c20
-rw-r--r--source/blender/makesrna/intern/rna_movieclip.c6
-rw-r--r--source/blender/makesrna/intern/rna_scene.c60
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c5
-rw-r--r--source/blender/makesrna/intern/rna_sequencer_api.c3
-rw-r--r--source/blender/makesrna/intern/rna_space.c21
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c12
10 files changed, 317 insertions, 65 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index a32272e2a7f..8e387dd4eba 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -104,6 +104,9 @@ extern StructRNA RNA_CollectionProperty;
extern StructRNA RNA_CollisionModifier;
extern StructRNA RNA_CollisionSensor;
extern StructRNA RNA_CollisionSettings;
+extern StructRNA RNA_ColorManagedColorspaceSettings;
+extern StructRNA RNA_ColorManagedDisplaySettings;
+extern StructRNA RNA_ColorManagedViewSettings;
extern StructRNA RNA_ColorRamp;
extern StructRNA RNA_ColorRampElement;
extern StructRNA RNA_ColorSequence;
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index 0bd42c2f5a0..0edcad59577 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -34,25 +34,31 @@
#include "DNA_color_types.h"
#include "DNA_texture_types.h"
+#include "WM_api.h"
+#include "WM_types.h"
+
#ifdef RNA_RUNTIME
#include "RNA_access.h"
+#include "DNA_image_types.h"
#include "DNA_material_types.h"
+#include "DNA_movieclip_types.h"
#include "DNA_node_types.h"
#include "MEM_guardedalloc.h"
#include "BKE_colortools.h"
#include "BKE_depsgraph.h"
+#include "BKE_image.h"
+#include "BKE_movieclip.h"
#include "BKE_node.h"
#include "BKE_texture.h"
-#include "WM_api.h"
-#include "WM_types.h"
-
#include "ED_node.h"
+#include "IMB_colormanagement.h"
+
static int rna_CurveMapping_curves_length(PointerRNA *ptr)
{
CurveMapping *cumap = (CurveMapping *)ptr->data;
@@ -337,6 +343,154 @@ static void rna_Scopes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointer
s->ok = 0;
}
+static int rna_ColorManagedDisplaySettings_display_device_get(struct PointerRNA *ptr)
+{
+ ColorManagedDisplaySettings *display = (ColorManagedDisplaySettings *) ptr->data;
+
+ return IMB_colormanagement_display_get_named_index(display->display_device);
+}
+
+static void rna_ColorManagedDisplaySettings_display_device_set(struct PointerRNA *ptr, int value)
+{
+ ColorManagedDisplaySettings *display = (ColorManagedDisplaySettings *) ptr->data;
+ const char *name = IMB_colormanagement_display_get_indexed_name(value);
+
+ if (name) {
+ BLI_strncpy(display->display_device, name, sizeof(display->display_device));
+ }
+}
+
+static EnumPropertyItem *rna_ColorManagedDisplaySettings_display_device_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+{
+ EnumPropertyItem *items = NULL;
+ int totitem = 0;
+
+ IMB_colormanagement_display_items_add(&items, &totitem);
+ RNA_enum_item_end(&items, &totitem);
+
+ *free = TRUE;
+
+ return items;
+}
+
+static void rna_ColorManagedDisplaySettings_display_device_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ ID *id = ptr->id.data;
+
+ if (GS(id->name) == ID_SCE) {
+ Scene *scene = (Scene *) id;
+
+ IMB_colormanagement_validate_settings(&scene->display_settings, &scene->view_settings);
+
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+ }
+}
+
+static int rna_ColorManagedViewSettings_view_transform_get(PointerRNA *ptr)
+{
+ ColorManagedViewSettings *view = (ColorManagedViewSettings *) ptr->data;
+
+ return IMB_colormanagement_view_get_named_index(view->view_transform);
+}
+
+static void rna_ColorManagedViewSettings_view_transform_set(PointerRNA *ptr, int value)
+{
+ ColorManagedViewSettings *view = (ColorManagedViewSettings *) ptr->data;
+
+ const char *name = IMB_colormanagement_view_get_indexed_name(value);
+
+ if (name) {
+ BLI_strncpy(view->view_transform, name, sizeof(view->view_transform));
+ }
+}
+
+static EnumPropertyItem* rna_ColorManagedViewSettings_view_transform_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+{
+ Scene *scene = CTX_data_scene(C);
+ EnumPropertyItem *items = NULL;
+ ColorManagedDisplaySettings *display_settings = &scene->display_settings;
+ int totitem = 0;
+
+ IMB_colormanagement_view_items_add(&items, &totitem, display_settings->display_device);
+ RNA_enum_item_end(&items, &totitem);
+
+ *free = TRUE;
+ return items;
+}
+
+static void rna_ColorManagedViewSettings_use_curves_set(PointerRNA *ptr, int value)
+{
+ ColorManagedViewSettings *view_settings = (ColorManagedViewSettings *) ptr->data;
+
+ if (value) {
+ view_settings->flag |= COLORMANAGE_VIEW_USE_CURVES;
+
+ if (view_settings->curve_mapping == NULL) {
+ view_settings->curve_mapping = curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
+ }
+ }
+ else {
+ view_settings->flag &= ~COLORMANAGE_VIEW_USE_CURVES;
+ }
+}
+
+static int rna_ColorManagedColorspaceSettings_colorspace_get(struct PointerRNA *ptr)
+{
+ ColorManagedColorspaceSettings *colorspace = (ColorManagedColorspaceSettings *) ptr->data;
+
+ return IMB_colormanagement_colorspace_get_named_index(colorspace->name);
+}
+
+static void rna_ColorManagedColorspaceSettings_colorspace_set(struct PointerRNA *ptr, int value)
+{
+ ColorManagedColorspaceSettings *colorspace = (ColorManagedColorspaceSettings *) ptr->data;
+ const char *name = IMB_colormanagement_colorspace_get_indexed_name(value);
+
+ if (name) {
+ BLI_strncpy(colorspace->name, name, sizeof(colorspace->name));
+ }
+}
+
+static EnumPropertyItem *rna_ColorManagedColorspaceSettings_colorspace_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+{
+ EnumPropertyItem *items = NULL;
+ int totitem = 0;
+
+ IMB_colormanagement_colorspace_items_add(&items, &totitem);
+ RNA_enum_item_end(&items, &totitem);
+
+ *free = TRUE;
+
+ return items;
+}
+
+static void rna_ColorManagedColorspaceSettings_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ ID *id = ptr->id.data;
+
+ if (GS(id->name) == ID_IM) {
+ Image *ima = (Image *) id;
+
+ BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
+ WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id);
+ }
+ else if (GS(id->name) == ID_MC) {
+ MovieClip *clip = (MovieClip *) id;
+
+ BKE_movieclip_reload(clip);
+ WM_main_add_notifier(NC_MOVIECLIP | ND_DISPLAY, &clip->id);
+ }
+}
+
+static void rna_ColorManagement_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ ID *id = ptr->id.data;
+
+ if (GS(id->name) == ID_SCE) {
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+ }
+}
+
/* this function only exists because #curvemap_evaluateF uses a 'const' qualifier */
float rna_CurveMap_evaluateF(struct CurveMap *cuma, float value)
{
@@ -682,6 +836,87 @@ static void rna_def_scopes(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Vectorscope Opacity", "Opacity of the points");
}
+static void rna_def_colormanage(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem display_device_items[] = {
+ {0, "DEFAULT", 0, "Default", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem view_transform_items[] = {
+ {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", "Do not perform any color transform on load, treat colors as in scene linear space already"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ /* ** Display Settings ** */
+ srna = RNA_def_struct(brna, "ColorManagedDisplaySettings", NULL);
+ RNA_def_struct_ui_text(srna, "ColorManagedDisplaySettings", "Color management specific to display device");
+
+ prop= RNA_def_property(srna, "display_device", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, display_device_items);
+ RNA_def_property_enum_funcs(prop, "rna_ColorManagedDisplaySettings_display_device_get",
+ "rna_ColorManagedDisplaySettings_display_device_set",
+ "rna_ColorManagedDisplaySettings_display_device_itemf");
+ RNA_def_property_ui_text(prop, "Display Device", "Display device name");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedDisplaySettings_display_device_update");
+
+ /* ** View Settings ** */
+ srna = RNA_def_struct(brna, "ColorManagedViewSettings", NULL);
+ RNA_def_struct_ui_text(srna, "ColorManagedViewSettings", "Color management settings used for displaying images on the display");
+
+ prop= RNA_def_property(srna, "view_transform", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, view_transform_items);
+ RNA_def_property_enum_funcs(prop, "rna_ColorManagedViewSettings_view_transform_get",
+ "rna_ColorManagedViewSettings_view_transform_set",
+ "rna_ColorManagedViewSettings_view_transform_itemf");
+ RNA_def_property_ui_text(prop, "View Transform", "View used ");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
+
+ prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "exposure");
+ RNA_def_property_range(prop, -10.0f, 10.0f);
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_ui_text(prop, "Exposure", "Exposure (stops) applied before display transform");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
+
+ prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "gamma");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.0f, 5.0f);
+ RNA_def_property_ui_text(prop, "Gamma", "Amount of gamma modification applied after display transform");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
+
+ prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curve_mapping");
+ RNA_def_property_ui_text(prop, "Curve", "Color curve mapping applied before display transform");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
+
+ prop = RNA_def_property(srna, "use_curve_mapping", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", COLORMANAGE_VIEW_USE_CURVES);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_ColorManagedViewSettings_use_curves_set");
+ RNA_def_property_ui_text(prop, "Use Curves", "Use RGB curved for pre-display transformation");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
+
+ /* ** Colorspace ** */
+ srna = RNA_def_struct(brna, "ColorManagedColorspaceSettings", NULL);
+ RNA_def_struct_ui_text(srna, "ColorManagedColorspaceSettings", "Input color space settings");
+
+ prop= RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, color_space_items);
+ RNA_def_property_enum_funcs(prop, "rna_ColorManagedColorspaceSettings_colorspace_get",
+ "rna_ColorManagedColorspaceSettings_colorspace_set",
+ "rna_ColorManagedColorspaceSettings_colorspace_itemf");
+ RNA_def_property_ui_text(prop, "Color Space", "Input color space name");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");
+}
void RNA_def_color(BlenderRNA *brna)
{
@@ -692,6 +927,7 @@ void RNA_def_color(BlenderRNA *brna)
rna_def_color_ramp(brna);
rna_def_histogram(brna);
rna_def_scopes(brna);
+ rna_def_colormanage(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 62a06888613..495d60df49c 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -513,6 +513,11 @@ static void rna_def_image(BlenderRNA *brna)
"to avoid fringing for images with light backgrounds");
RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_free_update");
+ prop = RNA_def_property(srna, "view_as_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_VIEW_AS_RENDER);
+ RNA_def_property_ui_text(prop, "View as Render", "Apply render part of display transformation when displaying this image on the screen");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
+
prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -652,6 +657,11 @@ static void rna_def_image(BlenderRNA *brna)
RNA_def_property_dynamic_array_funcs(prop, "rna_Image_pixels_get_length");
RNA_def_property_float_funcs(prop, "rna_Image_pixels_get", "rna_Image_pixels_set", NULL);
+ prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedColorspaceSettings");
+ RNA_def_property_ui_text(prop, "Colorspace Settings", "Input color space settings");
+
RNA_api_image(srna);
}
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index fa3f8d69c47..c66c0085763 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -50,6 +50,7 @@
#include "BKE_global.h" /* grr: G.main->name */
#include "IMB_imbuf.h"
+#include "IMB_colormanagement.h"
#include "BIF_gl.h"
#include "GPU_draw.h"
@@ -80,16 +81,17 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
BKE_reportf(reports, RPT_ERROR, "Couldn't acquire buffer from image");
}
else {
- /* temp swap out the color */
- const unsigned char imb_planes_back = ibuf->planes;
- const float dither_back = ibuf->dither;
- ibuf->planes = scene->r.im_format.planes;
- ibuf->dither = scene->r.dither_intensity;
- if (!BKE_imbuf_write(ibuf, path, &scene->r.im_format)) {
+ ImBuf *write_ibuf = IMB_dupImBuf(ibuf);
+
+ IMB_display_buffer_to_imbuf_rect(write_ibuf, &scene->view_settings, &scene->display_settings);
+
+ write_ibuf->planes = scene->r.im_format.planes;
+ write_ibuf->dither = scene->r.dither_intensity;
+
+ if (!BKE_imbuf_write(write_ibuf, path, &scene->r.im_format)) {
BKE_reportf(reports, RPT_ERROR, "Couldn't write image: %s", path);
}
- ibuf->planes = imb_planes_back;
- ibuf->dither = dither_back;
+ IMB_freeImBuf(write_ibuf);
}
BKE_image_release_ibuf(image, lock);
@@ -118,6 +120,8 @@ static void rna_Image_save(Image *image, ReportList *reports)
if (image->source == IMA_SRC_GENERATED)
image->source = IMA_SRC_FILE;
+ IMB_colormanagment_colorspace_from_ibuf_ftype(&image->colorspace_settings, ibuf);
+
ibuf->userflags &= ~IB_BITMAPDIRTY;
}
else {
diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c
index 8b2b741b83e..8d1105fd620 100644
--- a/source/blender/makesrna/intern/rna_movieclip.c
+++ b/source/blender/makesrna/intern/rna_movieclip.c
@@ -299,6 +299,12 @@ static void rna_def_movieclip(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Frame Offset", "Offset of footage first frame relative to it's file name "
"(affects only how footage is loading, does not change data associated with a clip)");
RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
+
+ /* color management */
+ prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedColorspaceSettings");
+ RNA_def_property_ui_text(prop, "Colorspace Settings", "Input color space settings");
}
void RNA_def_movieclip(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index f34c23a463e..0227d9c1554 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1093,34 +1093,6 @@ static void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi
DAG_id_tag_update(&scene->id, 0);
}
-static void rna_RenderSettings_color_management_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
-{
- /* reset image nodes */
- Scene *scene = (Scene *)ptr->id.data;
- bNodeTree *ntree = scene->nodetree;
- bNode *node;
-
- if (ntree && scene->use_nodes) {
- /* images are freed here, stop render and preview threads, until
- * Image is threadsafe. when we are changing this property from a
- * python script in the render thread, don't stop own thread */
- if (BLI_thread_is_main())
- WM_jobs_stop_all(bmain->wm.first);
-
- for (node = ntree->nodes.first; node; node = node->next) {
- if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_IMAGE)) {
- ED_node_changed_update(&scene->id, node);
- WM_main_add_notifier(NC_NODE | NA_EDITED, node);
-
- if (node->type == CMP_NODE_IMAGE)
- BKE_image_signal((Image *)node->id, NULL, IMA_SIGNAL_FREE);
- }
- }
- }
-
- rna_Scene_glsl_update(bmain, scene, ptr);
-}
-
static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value)
{
Scene *scene = (Scene *)ptr->id.data;
@@ -2958,6 +2930,17 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "G", "Log conversion gamma");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* color management */
+ prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
+ RNA_def_property_ui_text(prop, "View Settings", "Color management settings applied on image before saving");
+
+ prop = RNA_def_property(srna, "display_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "display_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedDisplaySettings");
+ RNA_def_property_ui_text(prop, "Display Settings", "Settings of device saved image would be displayed on");
}
static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
@@ -3698,11 +3681,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
"editor pipeline, if sequencer strips exist");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- prop = RNA_def_property(srna, "use_color_management", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "color_mgt_flag", R_COLOR_MANAGEMENT);
- RNA_def_property_ui_text(prop, "Color Management", "Use linear workflow - gamma corrected imaging pipeline");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_RenderSettings_color_management_update");
-
prop = RNA_def_property(srna, "use_color_unpremultiply", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "color_mgt_flag", R_COLOR_MANAGEMENT_PREDIVIDE);
RNA_def_property_ui_text(prop, "Color Unpremultiply",
@@ -4574,6 +4552,22 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Active Movie Clip", "Active movie clip used for constraints and viewport drawing");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ /* color management */
+ prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
+ RNA_def_property_ui_text(prop, "View Settings", "Color management settings applied on image before saving");
+
+ prop = RNA_def_property(srna, "display_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "display_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedDisplaySettings");
+ RNA_def_property_ui_text(prop, "Display Settings", "Settings of device saved image would be displayed on");
+
+ prop = RNA_def_property(srna, "sequencer_colorspace_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "sequencer_colorspace_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedColorspaceSettings");
+ RNA_def_property_ui_text(prop, "Sequencer Colorspace Settings", "Settings of color space sequencer is working in");
+
/* Nestled Data */
rna_def_tool_settings(brna);
rna_def_unified_paint_settings(brna);
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index e3e467a9abb..b27148e964d 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -1433,6 +1433,11 @@ static void rna_def_sequence(BlenderRNA *brna)
RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_channel_set", NULL); /* overlap test */
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "use_linear_modifiers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_LINEAR_MODIFIERS);
+ RNA_def_property_ui_text(prop, "Use Linear Modifiers", "Calculate modifiers in linear space instead of sequencer's space");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
/* blending */
prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c
index 549868e5ed0..ab1dfbf22b0 100644
--- a/source/blender/makesrna/intern/rna_sequencer_api.c
+++ b/source/blender/makesrna/intern/rna_sequencer_api.c
@@ -188,7 +188,8 @@ static Sequence *rna_Sequences_new_movie(ID *id, Editing *ed, ReportList *report
Scene *scene = (Scene *)id;
Sequence *seq;
- struct anim *an = openanim(file, IB_rect, 0);
+ /* OCIO_TODO: support configurable color spaces for strips */
+ struct anim *an = openanim(file, IB_rect, 0, NULL);
if (an == NULL) {
BKE_report(reports, RPT_ERROR, "Sequences.new_movie: unable to open movie file");
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index a00e8bfea2d..246f9fef98a 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -658,20 +658,6 @@ static void rna_SpaceImageEditor_cursor_location_set(PointerRNA *ptr, const floa
}
}
-static void rna_SpaceImageEditor_curves_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
-{
- SpaceImage *sima = (SpaceImage *)ptr->data;
- ImBuf *ibuf;
- void *lock;
-
- ibuf = ED_space_image_acquire_buffer(sima, &lock);
- if (ibuf->rect_float)
- curvemapping_do_ibuf(sima->cumap, ibuf);
- ED_space_image_release_buffer(sima, lock);
-
- WM_main_add_notifier(NC_IMAGE, sima->image);
-}
-
static void rna_SpaceImageEditor_scopes_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
SpaceImage *sima = (SpaceImage *)ptr->data;
@@ -680,7 +666,7 @@ static void rna_SpaceImageEditor_scopes_update(Main *UNUSED(bmain), Scene *scene
ibuf = ED_space_image_acquire_buffer(sima, &lock);
if (ibuf) {
- scopes_update(&sima->scopes, ibuf, scene->r.color_mgt_flag & R_COLOR_MANAGEMENT);
+ scopes_update(&sima->scopes, ibuf, &scene->view_settings, &scene->display_settings);
WM_main_add_notifier(NC_IMAGE, sima->image);
}
ED_space_image_release_buffer(sima, lock);
@@ -1980,11 +1966,6 @@ static void rna_def_space_image(BlenderRNA *brna)
"Parameters defining which layer, pass and frame of the image is displayed");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
- prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "cumap");
- RNA_def_property_ui_text(prop, "Curve", "Color curve mapping to use for displaying the image");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_curves_update");
-
prop = RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "scopes");
RNA_def_property_struct_type(prop, "Scopes");
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index cf43bd74d72..ea38b60b25f 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -415,6 +415,7 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_function_ui_description(func, "User interface for setting image format options");
parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
+ RNA_def_boolean(func, "color_management", 0, "", "Show color management settings");
func = RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip");
RNA_def_function_ui_description(func, "Item(s). User interface for selecting movie clips and their source paths");
@@ -497,6 +498,17 @@ void RNA_api_ui_layout(StructRNA *srna)
func = RNA_def_function(srna, "introspect", "uiLayoutIntrospect");
parm = RNA_def_string(func, "string", "", 1024 * 1024, "Descr", "DESCR");
RNA_def_function_return(func, parm);
+
+ /* color management templates */
+ func = RNA_def_function(srna, "template_colorspace_settings", "uiTemplateColorspaceSettings");
+ RNA_def_function_ui_description(func, "Item. A widget to control input color space settings.");
+ api_ui_item_rna_common(func);
+
+ func = RNA_def_function(srna, "template_colormanaged_view_settings", "uiTemplateColormanagedViewSettings");
+ RNA_def_function_ui_description(func, "Item. A widget to control color managed view settings settings.");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ /* RNA_def_boolean(func, "show_global_settings", 0, "", "Show widgets to control global color management settings"); */
}
#endif