Blender  V3.3
FX_shader_blur.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2017 Blender Foundation. */
3 
8 #include <stdio.h>
9 
10 #include "BLI_math.h"
11 #include "BLI_utildefines.h"
12 
13 #include "BLT_translation.h"
14 
15 #include "BKE_context.h"
16 #include "BKE_screen.h"
17 
18 #include "DNA_screen_types.h"
19 
20 #include "UI_interface.h"
21 #include "UI_resources.h"
22 
23 #include "RNA_access.h"
24 
25 #include "FX_shader_types.h"
26 #include "FX_ui_common.h"
27 
28 static void initData(ShaderFxData *fx)
29 {
30  BlurShaderFxData *gpfx = (BlurShaderFxData *)fx;
31  copy_v2_fl(gpfx->radius, 50.0f);
32  gpfx->samples = 8;
33  gpfx->rotation = 0.0f;
34 }
35 
36 static void copyData(const ShaderFxData *md, ShaderFxData *target)
37 {
39 }
40 
41 static void panel_draw(const bContext *UNUSED(C), Panel *panel)
42 {
43  uiLayout *col;
44  uiLayout *layout = panel->layout;
45 
47 
48  uiLayoutSetPropSep(layout, true);
49 
50  uiItemR(layout, ptr, "samples", 0, NULL, ICON_NONE);
51 
52  uiItemR(layout, ptr, "use_dof_mode", 0, IFACE_("Use Depth of Field"), ICON_NONE);
53  col = uiLayoutColumn(layout, false);
54  uiLayoutSetActive(col, !RNA_boolean_get(ptr, "use_dof_mode"));
55  uiItemR(col, ptr, "size", 0, NULL, ICON_NONE);
56  uiItemR(col, ptr, "rotation", 0, NULL, ICON_NONE);
57 
58  shaderfx_panel_end(layout, ptr);
59 }
60 
61 static void panelRegister(ARegionType *region_type)
62 {
64 }
65 
67  /* name */ N_("Blur"),
68  /* structName */ "BlurShaderFxData",
69  /* structSize */ sizeof(BlurShaderFxData),
70  /* type */ eShaderFxType_GpencilType,
71  /* flags */ 0,
72 
73  /* copyData */ copyData,
74 
75  /* initData */ initData,
76  /* freeData */ NULL,
77  /* isDisabled */ NULL,
78  /* updateDepsgraph */ NULL,
79  /* dependsOnTime */ NULL,
80  /* foreachIDLink */ NULL,
81  /* panelRegister */ panelRegister,
82 };
@ 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 UNUSED(x)
#define IFACE_(msgid)
struct BlurShaderFxData BlurShaderFxData
@ eShaderFxType_Blur
ShaderFxTypeInfo shaderfx_Type_Blur
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panelRegister(ARegionType *region_type)
static void copyData(const ShaderFxData *md, ShaderFxData *target)
static void initData(ShaderFxData *fx)
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 uiLayoutSetActive(uiLayout *layout, bool active)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
uint col
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
struct uiLayout * layout
#define N_(msgid)
PointerRNA * ptr
Definition: wm_files.c:3480