Blender V5.3
libocio_view.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 "libocio_view.hh"
6
7namespace blender::ocio {
8
10{
11 /* This is current based on heuristics using the view transform name, as OpenColorIO has no
12 * standard way to specify this. Recognizes "- SDR" and "- HDR XXXX nits" as used by the
13 * Blender and ACES configs. */
14 const StringRefNull n = name_;
15 if (n.endswith(" - SDR")) {
16 return 100;
17 }
18 const int64_t nits_pos = n.find(" nits");
19 if (nits_pos == StringRef::not_found) {
20 return 0;
21 }
22 const int64_t num_end = nits_pos;
23 int64_t num_start = num_end;
24 while (num_start > 0 && n[num_start - 1] >= '0' && n[num_start - 1] <= '9') {
25 num_start--;
26 }
27 int value = 0;
28 for (int64_t i = num_start; i < num_end; i++) {
29 value = value * 10 + (n[i] - '0');
30 }
31 return value > 0 ? value : 0;
32}
33
34} // namespace blender::ocio
static constexpr int64_t not_found
constexpr int64_t find(char c, int64_t pos=0) const
constexpr bool endswith(StringRef suffix) const
int max_nits() const override
__int64 int64_t
Definition BKE_text.h:90