Blender V5.0
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 "RNA_access.hh"
14
15#include "UI_interface.hh"
17
19
21{
22 PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str());
23
24 if (!prop) {
25 printf("%s: property not found: %s.%s\n",
26 __func__,
28 propname.c_str());
29 return;
30 }
31
32 PointerRNA colorspace_settings_ptr = RNA_property_pointer_get(ptr, prop);
33
34 layout->prop(&colorspace_settings_ptr, "name", UI_ITEM_NONE, IFACE_("Color Space"), ICON_NONE);
35}
36
38 bContext * /*C*/,
40 const StringRefNull propname)
41{
42 PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str());
43
44 if (!prop) {
45 printf("%s: property not found: %s.%s\n",
46 __func__,
48 propname.c_str());
49 return;
50 }
51
52 PointerRNA view_transform_ptr = RNA_property_pointer_get(ptr, prop);
53 ColorManagedViewSettings *view_settings = static_cast<ColorManagedViewSettings *>(
54 view_transform_ptr.data);
55
56 uiLayout *col = &layout->column(false);
57 col->prop(&view_transform_ptr, "view_transform", UI_ITEM_NONE, IFACE_("View"), ICON_NONE);
58 col->prop(&view_transform_ptr, "look", UI_ITEM_NONE, IFACE_("Look"), ICON_NONE);
59
60 col = &layout->column(false);
61 col->prop(&view_transform_ptr, "exposure", UI_ITEM_NONE, std::nullopt, ICON_NONE);
62 col->prop(&view_transform_ptr, "gamma", UI_ITEM_NONE, std::nullopt, ICON_NONE);
63
64 col = &layout->column(false);
65 col->prop(&view_transform_ptr, "use_curve_mapping", UI_ITEM_NONE, std::nullopt, ICON_NONE);
66 if (view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) {
68 col, &view_transform_ptr, "curve_mapping", 'c', true, false, false, false, false);
69 }
70
71 col = &layout->column(false);
72 col->prop(&view_transform_ptr, "use_white_balance", UI_ITEM_NONE, std::nullopt, ICON_NONE);
73 if (view_settings->flag & COLORMANAGE_VIEW_USE_WHITE_BALANCE) {
74 col->prop(
75 &view_transform_ptr, "white_balance_temperature", UI_ITEM_NONE, std::nullopt, ICON_NONE);
76 col->prop(&view_transform_ptr, "white_balance_tint", UI_ITEM_NONE, std::nullopt, ICON_NONE);
77 }
78}
#define IFACE_(msgid)
@ COLORMANAGE_VIEW_USE_WHITE_BALANCE
@ COLORMANAGE_VIEW_USE_CURVES
void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, blender::StringRefNull propname, int type, bool levels, bool brush, bool neg_slope, bool tone, bool presets)
#define UI_ITEM_NONE
constexpr const char * c_str() const
uint col
#define printf(...)
void uiTemplateColorspaceSettings(uiLayout *layout, PointerRNA *ptr, const StringRefNull propname)
void uiTemplateColormanagedViewSettings(uiLayout *layout, bContext *, PointerRNA *ptr, const StringRefNull propname)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
const char * RNA_struct_identifier(const StructRNA *type)
void * data
Definition RNA_types.hh:53
uiLayout & column(bool align)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)
PointerRNA * ptr
Definition wm_files.cc:4238