Blender  V2.93
FX_shader_wave.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2018, Blender Foundation
17  * This is a new part of Blender
18  */
19 
24 #include <stdio.h>
25 
26 #include "DNA_gpencil_types.h"
27 #include "DNA_object_types.h"
28 #include "DNA_scene_types.h"
29 #include "DNA_screen_types.h"
30 
31 #include "BKE_context.h"
32 #include "BKE_screen.h"
33 
34 #include "BLI_utildefines.h"
35 
36 #include "UI_interface.h"
37 #include "UI_resources.h"
38 
39 #include "RNA_access.h"
40 
41 #include "FX_shader_types.h"
42 #include "FX_ui_common.h"
43 
44 static void initData(ShaderFxData *fx)
45 {
46  WaveShaderFxData *gpfx = (WaveShaderFxData *)fx;
47  gpfx->amplitude = 10.0f;
48  gpfx->period = 20.0f;
49  gpfx->phase = 0.0f;
50  gpfx->orientation = 1;
51 }
52 
53 static void copyData(const ShaderFxData *md, ShaderFxData *target)
54 {
56 }
57 
58 static void panel_draw(const bContext *UNUSED(C), Panel *panel)
59 {
60  uiLayout *layout = panel->layout;
61 
63 
64  uiLayoutSetPropSep(layout, true);
65 
66  uiItemR(layout, ptr, "orientation", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
67  uiItemR(layout, ptr, "amplitude", 0, NULL, ICON_NONE);
68  uiItemR(layout, ptr, "period", 0, NULL, ICON_NONE);
69  uiItemR(layout, ptr, "phase", 0, NULL, ICON_NONE);
70 
71  shaderfx_panel_end(layout, ptr);
72 }
73 
74 static void panelRegister(ARegionType *region_type)
75 {
77 }
78 
80  /* name */ "WaveDistortion",
81  /* structName */ "WaveShaderFxData",
82  /* structSize */ sizeof(WaveShaderFxData),
83  /* type */ eShaderFxType_GpencilType,
84  /* flags */ 0,
85 
86  /* copyData */ copyData,
87 
88  /* initData */ initData,
89  /* freeData */ NULL,
90  /* isDisabled */ NULL,
91  /* updateDepsgraph */ NULL,
92  /* dependsOnTime */ NULL,
93  /* foreachIDLink */ NULL,
94  /* panelRegister */ panelRegister,
95 };
@ eShaderFxType_GpencilType
Definition: BKE_shader_fx.h:49
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:242
void shaderfx_panel_end(uiLayout *layout, PointerRNA *ptr)
Definition: FX_ui_common.c:99
PointerRNA * shaderfx_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
Definition: FX_ui_common.c:111
#define C
Definition: RandGen.cpp:39
@ UI_ITEM_R_EXPAND
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
struct uiLayout * layout
PointerRNA * ptr
Definition: wm_files.c:3157