Blender V4.5
FX_shader_glow.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
11#include "BLI_math_vector.h"
12#include "BLI_utildefines.h"
13
14#include "BLT_translation.hh"
15
16#include "BKE_context.hh"
17#include "BKE_modifier.hh"
18#include "BKE_screen.hh"
19#include "BKE_shader_fx.h"
20
21#include "UI_interface.hh"
22#include "UI_resources.hh"
23
24#include "RNA_access.hh"
25
26#include "FX_shader_types.h"
27#include "FX_ui_common.h"
28
29static void init_data(ShaderFxData *md)
30{
32 ARRAY_SET_ITEMS(gpfx->glow_color, 0.75f, 1.0f, 1.0f, 1.0f);
33 ARRAY_SET_ITEMS(gpfx->select_color, 0.0f, 0.0f, 0.0f);
34 copy_v2_fl(gpfx->blur, 50.0f);
35 gpfx->threshold = 0.1f;
36 gpfx->samples = 8;
37}
38
39static void copy_data(const ShaderFxData *md, ShaderFxData *target)
40{
42}
43
44static void panel_draw(const bContext * /*C*/, Panel *panel)
45{
46 uiLayout *layout = panel->layout;
47
49
50 int mode = RNA_enum_get(ptr, "mode");
51
52 uiLayoutSetPropSep(layout, true);
53
54 layout->prop(ptr, "mode", UI_ITEM_NONE, std::nullopt, ICON_NONE);
55
56 layout->prop(ptr, "threshold", UI_ITEM_NONE, std::nullopt, ICON_NONE);
57 if (mode == eShaderFxGlowMode_Color) {
58 layout->prop(ptr, "select_color", UI_ITEM_NONE, std::nullopt, ICON_NONE);
59 }
60
61 layout->prop(ptr, "glow_color", UI_ITEM_NONE, std::nullopt, ICON_NONE);
62
63 layout->separator();
64
65 layout->prop(ptr, "blend_mode", UI_ITEM_NONE, std::nullopt, ICON_NONE);
66 layout->prop(ptr, "opacity", UI_ITEM_NONE, std::nullopt, ICON_NONE);
67 layout->prop(ptr, "size", UI_ITEM_NONE, std::nullopt, ICON_NONE);
68 layout->prop(ptr, "rotation", UI_ITEM_NONE, std::nullopt, ICON_NONE);
69 layout->prop(ptr, "samples", UI_ITEM_NONE, std::nullopt, ICON_NONE);
70 layout->prop(ptr, "use_glow_under", UI_ITEM_NONE, std::nullopt, ICON_NONE);
71
72 shaderfx_panel_end(layout, ptr);
73}
74
75static void panel_register(ARegionType *region_type)
76{
78}
79
81 /*name*/ N_("Glow"),
82 /*struct_name*/ "GlowShaderFxData",
83 /*struct_size*/ sizeof(GlowShaderFxData),
85 /*flags*/ ShaderFxTypeFlag(0),
86
87 /*copy_data*/ copy_data,
88
89 /*init_data*/ init_data,
90 /*free_data*/ nullptr,
91 /*is_disabled*/ nullptr,
92 /*update_depsgraph*/ nullptr,
93 /*depends_on_time*/ nullptr,
94 /*foreach_ID_link*/ nullptr,
95 /*panel_register*/ panel_register,
96};
@ eShaderFxType_GpencilType
void BKE_shaderfx_copydata_generic(const struct ShaderFxData *fx_src, struct ShaderFxData *fx_dst)
ShaderFxTypeFlag
MINLINE void copy_v2_fl(float r[2], float f)
#define ARRAY_SET_ITEMS(...)
@ eShaderFxGlowMode_Color
@ eShaderFxType_Glow
static void panel_register(ARegionType *region_type)
static void panel_draw(const bContext *, Panel *panel)
static void init_data(ShaderFxData *md)
static void copy_data(const ShaderFxData *md, ShaderFxData *target)
ShaderFxTypeInfo shaderfx_Type_Glow
PanelType * shaderfx_panel_register(ARegionType *region_type, ShaderFxType type, PanelDrawFn draw)
void shaderfx_panel_end(uiLayout *layout, PointerRNA *ptr)
PointerRNA * shaderfx_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
static void init_data(ModifierData *md)
static void panel_register(ARegionType *region_type)
static void panel_draw(const bContext *, Panel *panel)
static void copy_data(const ModifierData *md, ModifierData *target, const int flag)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
#define UI_ITEM_NONE
int RNA_enum_get(PointerRNA *ptr, const char *name)
struct uiLayout * layout
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
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)
#define N_(msgid)
PointerRNA * ptr
Definition wm_files.cc:4227