Blender V5.3
interface_template_color_management.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BLI_string_ref.hh"
10
11#include "BLT_translation.hh"
12
13#include "DNA_color_types.h"
14
15#include "RNA_access.hh"
16
17#include "UI_interface.hh"
19
20namespace blender::ui {
21
23{
24 PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str());
25
26 if (!prop) {
27 printf("%s: property not found: %s.%s\n",
28 __func__,
30 propname.c_str());
31 return;
32 }
33
34 PointerRNA colorspace_settings_ptr = RNA_property_pointer_get(ptr, prop);
35
36 layout->prop_with_menu(&colorspace_settings_ptr,
37 "name",
39 IFACE_("Color Space"),
40 ICON_NONE,
41 "UI_MT_color_space_select");
42}
43
45 bContext * /*C*/,
46 PointerRNA *ptr,
47 const StringRefNull propname)
48{
49 PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str());
50
51 if (!prop) {
52 printf("%s: property not found: %s.%s\n",
53 __func__,
55 propname.c_str());
56 return;
57 }
58
59 PointerRNA view_transform_ptr = RNA_property_pointer_get(ptr, prop);
60 ColorManagedViewSettings *view_settings = static_cast<ColorManagedViewSettings *>(
61 view_transform_ptr.data);
62
63 Layout *col = &layout->column(false);
64 col->prop(&view_transform_ptr, "view_transform", UI_ITEM_NONE, IFACE_("View"), ICON_NONE);
65 col->prop(&view_transform_ptr, "look", UI_ITEM_NONE, IFACE_("Look"), ICON_NONE);
66
67 col = &layout->column(false);
68 col->prop(&view_transform_ptr, "exposure", UI_ITEM_NONE, std::nullopt, ICON_NONE);
69 col->prop(&view_transform_ptr, "gamma", UI_ITEM_NONE, std::nullopt, ICON_NONE);
70
71 col = &layout->column(false);
72 col->prop(&view_transform_ptr, "use_curve_mapping", UI_ITEM_NONE, std::nullopt, ICON_NONE);
73 if (view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) {
75 col, &view_transform_ptr, "curve_mapping", 'c', true, false, false, false, false);
76 }
77
78 col = &layout->column(false);
79 col->prop(&view_transform_ptr, "use_white_balance", UI_ITEM_NONE, std::nullopt, ICON_NONE);
80 if (view_settings->flag & COLORMANAGE_VIEW_USE_WHITE_BALANCE) {
81 col->prop(
82 &view_transform_ptr, "white_balance_temperature", UI_ITEM_NONE, std::nullopt, ICON_NONE);
83 col->prop(&view_transform_ptr, "white_balance_tint", UI_ITEM_NONE, std::nullopt, ICON_NONE);
84 }
85}
86
87} // namespace blender::ui
#define IFACE_(msgid)
#define UI_ITEM_NONE
constexpr const char * c_str() const
void template_colorspace_settings(Layout *layout, PointerRNA *ptr, StringRefNull propname)
void template_colormanaged_view_settings(Layout *layout, bContext *C, PointerRNA *ptr, StringRefNull propname)
void template_curve_mapping(Layout *layout, PointerRNA *ptr, StringRefNull propname, int type, bool levels, bool brush, bool neg_slope, bool tone, bool presets)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
@ COLORMANAGE_VIEW_USE_WHITE_BALANCE
@ COLORMANAGE_VIEW_USE_CURVES
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
const char * RNA_struct_identifier(const StructRNA *type)
StructRNA * type
Definition RNA_types.hh:63
void prop_with_menu(PointerRNA *ptr, blender::StringRefNull propname, eUI_Item_Flag flag, std::optional< blender::StringRefNull > name, int icon, const char *menu_type)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
Layout & column(bool align)