Blender  V3.3
FX_shader_glow.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2018 Blender Foundation. */
3 
8 #include <stdio.h>
9 
10 #include "DNA_gpencil_types.h"
11 #include "DNA_object_types.h"
12 #include "DNA_scene_types.h"
13 #include "DNA_screen_types.h"
14 
15 #include "BLI_math.h"
16 #include "BLI_utildefines.h"
17 
18 #include "BLT_translation.h"
19 
20 #include "BKE_context.h"
21 #include "BKE_modifier.h"
22 #include "BKE_screen.h"
23 #include "BKE_shader_fx.h"
24 
25 #include "UI_interface.h"
26 #include "UI_resources.h"
27 
28 #include "RNA_access.h"
29 
30 #include "FX_shader_types.h"
31 #include "FX_ui_common.h"
32 
33 static void initData(ShaderFxData *md)
34 {
35  GlowShaderFxData *gpfx = (GlowShaderFxData *)md;
36  ARRAY_SET_ITEMS(gpfx->glow_color, 0.75f, 1.0f, 1.0f, 1.0f);
37  ARRAY_SET_ITEMS(gpfx->select_color, 0.0f, 0.0f, 0.0f);
38  copy_v2_fl(gpfx->blur, 50.0f);
39  gpfx->threshold = 0.1f;
40  gpfx->samples = 8;
41 }
42 
43 static void copyData(const ShaderFxData *md, ShaderFxData *target)
44 {
46 }
47 
48 static void panel_draw(const bContext *UNUSED(C), Panel *panel)
49 {
50  uiLayout *layout = panel->layout;
51 
53 
54  int mode = RNA_enum_get(ptr, "mode");
55 
56  uiLayoutSetPropSep(layout, true);
57 
58  uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
59 
60  uiItemR(layout, ptr, "threshold", 0, NULL, ICON_NONE);
61  if (mode == eShaderFxGlowMode_Color) {
62  uiItemR(layout, ptr, "select_color", 0, NULL, ICON_NONE);
63  }
64 
65  uiItemR(layout, ptr, "glow_color", 0, NULL, ICON_NONE);
66 
67  uiItemS(layout);
68 
69  uiItemR(layout, ptr, "blend_mode", 0, NULL, ICON_NONE);
70  uiItemR(layout, ptr, "opacity", 0, NULL, ICON_NONE);
71  uiItemR(layout, ptr, "size", 0, NULL, ICON_NONE);
72  uiItemR(layout, ptr, "rotation", 0, NULL, ICON_NONE);
73  uiItemR(layout, ptr, "samples", 0, NULL, ICON_NONE);
74  uiItemR(layout, ptr, "use_glow_under", 0, NULL, ICON_NONE);
75 
76  shaderfx_panel_end(layout, ptr);
77 }
78 
79 static void panelRegister(ARegionType *region_type)
80 {
82 }
83 
85  /* name */ N_("Glow"),
86  /* structName */ "GlowShaderFxData",
87  /* structSize */ sizeof(GlowShaderFxData),
88  /* type */ eShaderFxType_GpencilType,
89  /* flags */ 0,
90 
91  /* copyData */ copyData,
92 
93  /* initData */ initData,
94  /* freeData */ NULL,
95  /* isDisabled */ NULL,
96  /* updateDepsgraph */ NULL,
97  /* dependsOnTime */ NULL,
98  /* foreachIDLink */ NULL,
99  /* panelRegister */ panelRegister,
100 };
@ eShaderFxType_GpencilType
Definition: BKE_shader_fx.h:35
void BKE_shaderfx_copydata_generic(const struct ShaderFxData *fx_src, struct ShaderFxData *fx_dst)
MINLINE void copy_v2_fl(float r[2], float f)
#define ARRAY_SET_ITEMS(...)
#define UNUSED(x)
Object is a sort of wrapper for general info.
struct GlowShaderFxData GlowShaderFxData
@ eShaderFxGlowMode_Color
@ eShaderFxType_Glow
static void initData(ShaderFxData *md)
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panelRegister(ARegionType *region_type)
static void copyData(const ShaderFxData *md, ShaderFxData *target)
ShaderFxTypeInfo shaderfx_Type_Glow
PanelType * shaderfx_panel_register(ARegionType *region_type, ShaderFxType type, PanelDrawFn draw)
Definition: FX_ui_common.c:223
void shaderfx_panel_end(uiLayout *layout, PointerRNA *ptr)
Definition: FX_ui_common.c:84
PointerRNA * shaderfx_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
Definition: FX_ui_common.c:93
#define C
Definition: RandGen.cpp:25
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemS(uiLayout *layout)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
struct uiLayout * layout
#define N_(msgid)
PointerRNA * ptr
Definition: wm_files.c:3480