Blender V4.5
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"
16
18
20{
21 PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str());
22
23 if (!prop) {
24 printf("%s: property not found: %s.%s\n",
25 __func__,
27 propname.c_str());
28 return;
29 }
30
31 PointerRNA colorspace_settings_ptr = RNA_property_pointer_get(ptr, prop);
32
33 layout->prop(&colorspace_settings_ptr, "name", UI_ITEM_NONE, IFACE_("Color Space"), ICON_NONE);
34}
35
37 bContext * /*C*/,
39 const StringRefNull propname)
40{
41 PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str());
42
43 if (!prop) {
44 printf("%s: property not found: %s.%s\n",
45 __func__,
47 propname.c_str());
48 return;
49 }
50
51 PointerRNA view_transform_ptr = RNA_property_pointer_get(ptr, prop);
52 ColorManagedViewSettings *view_settings = static_cast<ColorManagedViewSettings *>(
53 view_transform_ptr.data);
54
55 uiLayout *col = &layout->column(false);
56 col->prop(&view_transform_ptr, "view_transform", UI_ITEM_NONE, IFACE_("View"), ICON_NONE);
57 col->prop(&view_transform_ptr, "look", UI_ITEM_NONE, IFACE_("Look"), ICON_NONE);
58
59 col = &layout->column(false);
60 col->prop(&view_transform_ptr, "exposure", UI_ITEM_NONE, std::nullopt, ICON_NONE);
61 col->prop(&view_transform_ptr, "gamma", UI_ITEM_NONE, std::nullopt, ICON_NONE);
62
63 col = &layout->column(false);
64 col->prop(&view_transform_ptr, "use_curve_mapping", UI_ITEM_NONE, std::nullopt, ICON_NONE);
65 if (view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) {
67 col, &view_transform_ptr, "curve_mapping", 'c', true, false, false, false);
68 }
69
70 col = &layout->column(false);
71 col->prop(&view_transform_ptr, "use_white_balance", UI_ITEM_NONE, std::nullopt, ICON_NONE);
72 if (view_settings->flag & COLORMANAGE_VIEW_USE_WHITE_BALANCE) {
73 col->prop(
74 &view_transform_ptr, "white_balance_temperature", UI_ITEM_NONE, std::nullopt, ICON_NONE);
75 col->prop(&view_transform_ptr, "white_balance_tint", UI_ITEM_NONE, std::nullopt, ICON_NONE);
76 }
77}
#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)
#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:4226