Blender V5.3
libocio_fallback_config.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include <sstream>
6
7#include "BLI_assert.hh"
8
9#include "error_handling.hh"
10#include "libocio_config.hh"
11
12namespace blender::ocio {
13
14/* Minimal configuration with linear Rec.709, sRGB and non-color data. It uses only built-in
15 * transforms, so that loading it depends on no file. */
16static const char *fallback_config_source = R"(
17ocio_profile_version: 2.3
18
19name: Blender Fallback
20description: Built-in configuration, used when no other configuration could be loaded
21strictparsing: true
22luma: [0.2126, 0.7152, 0.0722]
23
24roles:
25 scene_linear: Linear Rec.709
26 rendering: Linear Rec.709
27 default: Linear Rec.709
28 default_byte: sRGB
29 default_float: Linear Rec.709
30 default_sequencer: sRGB
31 color_picking: sRGB
32 texture_paint: Linear Rec.709
33 data: Non-Color
34 aces_interchange: ACES2065-1
35 cie_xyz_d65_interchange: Linear CIE-XYZ D65
36 color_timing: Linear Rec.709
37 compositing_log: Linear Rec.709
38
39displays:
40 sRGB:
41 - !<View> {name: Standard, view_transform: Standard, display_colorspace: sRGB}
42
43active_displays: [sRGB]
44active_views: [Standard]
45inactive_colorspaces: [ACES2065-1, Linear CIE-XYZ D65]
46
47display_colorspaces:
48 - !<ColorSpace>
49 name: Linear CIE-XYZ D65
50 aliases: [lin_ciexyzd65_scene]
51 isdata: false
52 encoding: display-linear
53
54 - !<ColorSpace>
55 name: sRGB
56 aliases: [srgb_rec709_display]
57 isdata: false
58 from_display_reference: !<GroupTransform>
59 children:
60 - !<MatrixTransform> {matrix: [3.2409699, -1.5373832, -0.4986108, 0, -0.9692436, 1.8759675, 0.0415551, 0, 0.0556301, -0.2039770, 1.0569715, 0, 0, 0, 0, 1]}
61 - !<ExponentWithLinearTransform> {gamma: 2.4, offset: 0.055, direction: inverse}
62
63default_view_transform: Standard
64
65view_transforms:
66 - !<ViewTransform>
67 name: Standard
68 from_scene_reference: !<MatrixTransform> {matrix: [3.2409699, -1.5373832, -0.4986108, 0, -0.9692436, 1.8759675, 0.0415551, 0, 0.0556301, -0.2039770, 1.0569715, 0, 0, 0, 0, 1], direction: inverse}
69
70colorspaces:
71 - !<ColorSpace>
72 name: Linear Rec.709
73 aliases: [lin_rec709_scene, Linear]
74 isdata: false
75
76 - !<ColorSpace>
77 name: ACES2065-1
78 aliases: [lin_ap0_scene]
79 isdata: false
80 to_scene_reference: !<GroupTransform>
81 children:
82 - !<BuiltinTransform> {style: UTILITY - ACES-AP0_to_CIE-XYZ-D65_BFD}
83 - !<MatrixTransform> {matrix: [3.2409699, -1.5373832, -0.4986108, 0, -0.9692436, 1.8759675, 0.0415551, 0, 0.0556301, -0.2039770, 1.0569715, 0, 0, 0, 0, 1]}
84
85 - !<ColorSpace>
86 name: Non-Color
87 isdata: true
88)";
89
90std::unique_ptr<Config> LibOCIOConfig::create_fallback()
91{
92 try {
93 std::istringstream stream(fallback_config_source);
94 return std::unique_ptr<LibOCIOConfig>(
95 new LibOCIOConfig(OCIO_NAMESPACE::Config::CreateFromStream(stream)));
96 }
97 catch (OCIO_NAMESPACE::Exception &exception) {
98 report_exception(exception);
99 }
100
102 return nullptr;
103}
104
105} // namespace blender::ocio
#define BLI_assert_unreachable()
static std::unique_ptr< Config > create_fallback()
static const char * fallback_config_source
void report_exception(const OCIO_NAMESPACE::Exception &exception)