Blender  V3.3
FX_shader_wave.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 "BKE_context.h"
16 #include "BKE_screen.h"
17 
18 #include "BLI_utildefines.h"
19 
20 #include "BLT_translation.h"
21 
22 #include "UI_interface.h"
23 #include "UI_resources.h"
24 
25 #include "RNA_access.h"
26 
27 #include "FX_shader_types.h"
28 #include "FX_ui_common.h"
29 
30 static void initData(ShaderFxData *fx)
31 {
32  WaveShaderFxData *gpfx = (WaveShaderFxData *)fx;
33  gpfx->amplitude = 10.0f;
34  gpfx->period = 20.0f;
35  gpfx->phase = 0.0f;
36  gpfx->orientation = 1;
37 }
38 
39 static void copyData(const ShaderFxData *md, ShaderFxData *target)
40 {
42 }
43 
44 static void panel_draw(const bContext *UNUSED(C), Panel *panel)
45 {
46  uiLayout *layout = panel->layout;
47 
49 
50  uiLayoutSetPropSep(layout, true);
51 
52  uiItemR(layout, ptr, "orientation", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
53  uiItemR(layout, ptr, "amplitude", 0, NULL, ICON_NONE);
54  uiItemR(layout, ptr, "period", 0, NULL, ICON_NONE);
55  uiItemR(layout, ptr, "phase", 0, NULL, ICON_NONE);
56 
57  shaderfx_panel_end(layout, ptr);
58 }
59 
60 static void panelRegister(ARegionType *region_type)
61 {
63 }
64 
66  /* name */ N_("WaveDistortion"),
67  /* structName */ "WaveShaderFxData",
68  /* structSize */ sizeof(WaveShaderFxData),
69  /* type */ eShaderFxType_GpencilType,
70  /* flags */ 0,
71 
72  /* copyData */ copyData,
73 
74  /* initData */ initData,
75  /* freeData */ NULL,
76  /* isDisabled */ NULL,
77  /* updateDepsgraph */ NULL,
78  /* dependsOnTime */ NULL,
79  /* foreachIDLink */ NULL,
80  /* panelRegister */ panelRegister,
81 };
@ eShaderFxType_GpencilType
Definition: BKE_shader_fx.h:35
void BKE_shaderfx_copydata_generic(const struct ShaderFxData *fx_src, struct ShaderFxData *fx_dst)
#define UNUSED(x)
Object is a sort of wrapper for general info.
struct WaveShaderFxData WaveShaderFxData
@ eShaderFxType_Wave
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)
ShaderFxTypeInfo shaderfx_Type_Wave
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)
@ UI_ITEM_R_EXPAND
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
struct uiLayout * layout
#define N_(msgid)
PointerRNA * ptr
Definition: wm_files.c:3480