Blender V4.3
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
9#include <cstdio>
10
12#include "DNA_object_types.h"
13#include "DNA_scene_types.h"
14#include "DNA_screen_types.h"
15
16#include "BLI_math_vector.h"
17#include "BLI_utildefines.h"
18
19#include "BLT_translation.hh"
20
21#include "BKE_context.hh"
22#include "BKE_modifier.hh"
23#include "BKE_screen.hh"
24#include "BKE_shader_fx.h"
25
26#include "UI_interface.hh"
27#include "UI_resources.hh"
28
29#include "RNA_access.hh"
30
31#include "FX_shader_types.h"
32#include "FX_ui_common.h"
33
34static void init_data(ShaderFxData *md)
35{
37 ARRAY_SET_ITEMS(gpfx->glow_color, 0.75f, 1.0f, 1.0f, 1.0f);
38 ARRAY_SET_ITEMS(gpfx->select_color, 0.0f, 0.0f, 0.0f);
39 copy_v2_fl(gpfx->blur, 50.0f);
40 gpfx->threshold = 0.1f;
41 gpfx->samples = 8;
42}
43
44static void copy_data(const ShaderFxData *md, ShaderFxData *target)
45{
47}
48
49static void panel_draw(const bContext * /*C*/, Panel *panel)
50{
51 uiLayout *layout = panel->layout;
52
54
55 int mode = RNA_enum_get(ptr, "mode");
56
57 uiLayoutSetPropSep(layout, true);
58
59 uiItemR(layout, ptr, "mode", UI_ITEM_NONE, nullptr, ICON_NONE);
60
61 uiItemR(layout, ptr, "threshold", UI_ITEM_NONE, nullptr, ICON_NONE);
62 if (mode == eShaderFxGlowMode_Color) {
63 uiItemR(layout, ptr, "select_color", UI_ITEM_NONE, nullptr, ICON_NONE);
64 }
65
66 uiItemR(layout, ptr, "glow_color", UI_ITEM_NONE, nullptr, ICON_NONE);
67
68 uiItemS(layout);
69
70 uiItemR(layout, ptr, "blend_mode", UI_ITEM_NONE, nullptr, ICON_NONE);
71 uiItemR(layout, ptr, "opacity", UI_ITEM_NONE, nullptr, ICON_NONE);
72 uiItemR(layout, ptr, "size", UI_ITEM_NONE, nullptr, ICON_NONE);
73 uiItemR(layout, ptr, "rotation", UI_ITEM_NONE, nullptr, ICON_NONE);
74 uiItemR(layout, ptr, "samples", UI_ITEM_NONE, nullptr, ICON_NONE);
75 uiItemR(layout, ptr, "use_glow_under", UI_ITEM_NONE, nullptr, ICON_NONE);
76
77 shaderfx_panel_end(layout, ptr);
78}
79
80static void panel_register(ARegionType *region_type)
81{
83}
84
86 /*name*/ N_("Glow"),
87 /*struct_name*/ "GlowShaderFxData",
88 /*struct_size*/ sizeof(GlowShaderFxData),
90 /*flags*/ ShaderFxTypeFlag(0),
91
92 /*copy_data*/ copy_data,
93
94 /*init_data*/ init_data,
95 /*free_data*/ nullptr,
96 /*is_disabled*/ nullptr,
97 /*update_depsgraph*/ nullptr,
98 /*depends_on_time*/ nullptr,
99 /*foreach_ID_link*/ nullptr,
100 /*panel_register*/ panel_register,
101};
@ 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(...)
Object is a sort of wrapper for general info.
struct GlowShaderFxData GlowShaderFxData
@ 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)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemS(uiLayout *layout)
#define UI_ITEM_NONE
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
int RNA_enum_get(PointerRNA *ptr, const char *name)
struct uiLayout * layout
#define N_(msgid)
PointerRNA * ptr
Definition wm_files.cc:4126