Blender V5.0
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_idtype.hh"
18#include "BKE_modifier.hh"
19#include "BKE_screen.hh"
20#include "BKE_shader_fx.h"
21
23#include "UI_resources.hh"
24
25#include "RNA_access.hh"
26
27#include "FX_shader_types.h"
28#include "FX_ui_common.h"
29
30static void init_data(ShaderFxData *md)
31{
33 ARRAY_SET_ITEMS(gpfx->glow_color, 0.75f, 1.0f, 1.0f, 1.0f);
34 ARRAY_SET_ITEMS(gpfx->select_color, 0.0f, 0.0f, 0.0f);
35 copy_v2_fl(gpfx->blur, 50.0f);
36 gpfx->threshold = 0.1f;
37 gpfx->samples = 8;
38}
39
40static void copy_data(const ShaderFxData *md, ShaderFxData *target)
41{
43}
44
45static void panel_draw(const bContext * /*C*/, Panel *panel)
46{
47 uiLayout *layout = panel->layout;
48
50
51 int mode = RNA_enum_get(ptr, "mode");
52
53 layout->use_property_split_set(true);
54
55 layout->prop(ptr, "mode", UI_ITEM_NONE, std::nullopt, ICON_NONE);
56
57 layout->prop(ptr, "threshold", UI_ITEM_NONE, std::nullopt, ICON_NONE);
58 if (mode == eShaderFxGlowMode_Color) {
59 layout->prop(ptr, "select_color", UI_ITEM_NONE, std::nullopt, ICON_NONE);
60 }
61
62 layout->prop(ptr, "glow_color", UI_ITEM_NONE, std::nullopt, ICON_NONE);
63
64 layout->separator();
65
66 layout->prop(ptr, "blend_mode", UI_ITEM_NONE, std::nullopt, ICON_NONE);
67 layout->prop(ptr, "opacity", UI_ITEM_NONE, std::nullopt, ICON_NONE);
68 layout->prop(ptr, "size", UI_ITEM_NONE, std::nullopt, ICON_NONE);
69 layout->prop(ptr, "rotation", UI_ITEM_NONE, std::nullopt, ICON_NONE);
70 layout->prop(ptr, "samples", UI_ITEM_NONE, std::nullopt, ICON_NONE);
71 layout->prop(ptr, "use_glow_under", UI_ITEM_NONE, std::nullopt, ICON_NONE);
72
73 shaderfx_panel_end(layout, ptr);
74}
75
76static void panel_register(ARegionType *region_type)
77{
79}
80
88
90 /*name*/ N_("Glow"),
91 /*struct_name*/ "GlowShaderFxData",
92 /*struct_size*/ sizeof(GlowShaderFxData),
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};
@ 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 foreach_working_space_color(ShaderFxData *fx, const IDTypeForeachColorFunctionCallback &fn)
static void panel_register(ARegionType *region_type)
static void foreach_working_space_color(ShaderFxData *fx, const IDTypeForeachColorFunctionCallback &fn)
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)
#define UI_ITEM_NONE
int RNA_enum_get(PointerRNA *ptr, const char *name)
const blender::FunctionRef< void(float rgb[3])> single
struct uiLayout * layout
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
void use_property_split_set(bool value)
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:4238