Blender V5.3
FX_shader_rim.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2018 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "DNA_screen_types.h"
10#include "DNA_shader_fx_types.h"
11
12#include "BLI_utildefines.hh"
13
14#include "BLT_translation.hh"
15
16#include "BKE_context.hh"
17#include "BKE_idtype.hh"
18#include "BKE_screen.hh"
19
21#include "UI_resources.hh"
22
23#include "RNA_access.hh"
24
25#include "FX_shader_types.hh"
26#include "FX_ui_common.hh"
27
28namespace blender {
29
30static void init_data(ShaderFxData *fx)
31{
32 RimShaderFxData *gpfx = reinterpret_cast<RimShaderFxData *>(fx);
33 ARRAY_SET_ITEMS(gpfx->offset, 50, -100);
34 ARRAY_SET_ITEMS(gpfx->rim_rgb, 1.0f, 1.0f, 0.5f);
35 ARRAY_SET_ITEMS(gpfx->mask_rgb, 0.0f, 0.0f, 0.0f);
37
38 ARRAY_SET_ITEMS(gpfx->blur, 0, 0);
39 gpfx->samples = 2;
40}
41
42static void copy_data(const ShaderFxData *md, ShaderFxData *target)
43{
45}
46
47static void panel_draw(const bContext * /*C*/, Panel *panel)
48{
49 ui::Layout &layout = *panel->layout;
50
52
53 layout.use_property_split_set(true);
54
55 layout.prop(ptr, "rim_color", UI_ITEM_NONE, std::nullopt, ICON_NONE);
56 layout.prop(ptr, "mask_color", UI_ITEM_NONE, std::nullopt, ICON_NONE);
57 layout.prop(ptr, "mode", UI_ITEM_NONE, IFACE_("Blend Mode"), ICON_NONE);
58 layout.prop(ptr, "offset", UI_ITEM_NONE, std::nullopt, ICON_NONE);
59
60 shaderfx_panel_end(layout, ptr);
61}
62
63static void blur_panel_draw(const bContext * /*C*/, Panel *panel)
64{
65 ui::Layout &layout = *panel->layout;
66
68
69 layout.use_property_split_set(true);
70
71 layout.prop(ptr, "blur", UI_ITEM_NONE, std::nullopt, ICON_NONE);
72 layout.prop(ptr, "samples", UI_ITEM_NONE, std::nullopt, ICON_NONE);
73}
74
75static void panel_register(ARegionType *region_type)
76{
78 shaderfx_subpanel_register(region_type, "blur", "Blur", nullptr, blur_panel_draw, panel_type);
79}
80
83{
84 RimShaderFxData *gpfx = reinterpret_cast<RimShaderFxData *>(fx);
85 fn.single(gpfx->rim_rgb);
86 fn.single(gpfx->mask_rgb);
87}
88
90 /*name*/ N_("Rim"),
91 /*struct_name*/ "RimShaderFxData",
92 /*struct_size*/ sizeof(RimShaderFxData),
94 /*flags*/ ShaderFxTypeFlag(0),
95
96 /*copy_data*/ copy_data,
97
98 /*init_data*/ init_data,
99 /*free_data*/ nullptr,
100 /*is_disabled*/ nullptr,
101 /*update_depsgraph*/ nullptr,
102 /*depends_on_time*/ nullptr,
103 /*foreach_ID_link*/ nullptr,
104 /*foreach_working_space_color*/ foreach_working_space_color,
105 /*panel_register*/ panel_register,
106};
107
108} // namespace blender
#define IFACE_(msgid)
#define UI_ITEM_NONE
#define ARRAY_SET_ITEMS(...)
BMesh Iterators.
static void copy_data(const ModifierData *md, ModifierData *target, const int flag)
PanelType * shaderfx_panel_register(ARegionType *region_type, ShaderFxType type, PanelDrawFn draw)
static void foreach_working_space_color(ModifierData *md, const IDTypeForeachColorFunctionCallback &fn)
static void init_data(ModifierData *md)
static void blur_panel_draw(const bContext *, Panel *panel)
PanelType * shaderfx_subpanel_register(ARegionType *region_type, const char *name, const char *label, PanelDrawFn draw_header, PanelDrawFn draw, PanelType *parent)
static void panel_register(ARegionType *region_type)
@ eShaderFxType_GpencilType
void shaderfx_panel_end(ui::Layout &layout, PointerRNA *ptr)
PointerRNA * shaderfx_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
static void panel_draw(const bContext *, Panel *panel)
ShaderFxTypeInfo shaderfx_Type_Rim
void BKE_shaderfx_copydata_generic(const ShaderFxData *fx_src, ShaderFxData *fx_dst)
Definition shader_fx.cc:161
ui::Layout * layout
void use_property_split_set(bool is_sep)
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)
#define N_(msgid)