Blender V5.0
FX_shader_wave.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
8
9#include "DNA_screen_types.h"
10
11#include "BKE_context.hh"
12#include "BKE_screen.hh"
13
14#include "BLT_translation.hh"
15
17#include "UI_resources.hh"
18
19#include "RNA_access.hh"
20
21#include "FX_shader_types.h"
22#include "FX_ui_common.h"
23
24static void init_data(ShaderFxData *fx)
25{
27 gpfx->amplitude = 10.0f;
28 gpfx->period = 20.0f;
29 gpfx->phase = 0.0f;
30 gpfx->orientation = 1;
31}
32
33static void copy_data(const ShaderFxData *md, ShaderFxData *target)
34{
36}
37
38static void panel_draw(const bContext * /*C*/, Panel *panel)
39{
40 uiLayout *layout = panel->layout;
41
43
44 layout->use_property_split_set(true);
45
46 layout->prop(ptr, "orientation", UI_ITEM_R_EXPAND, std::nullopt, ICON_NONE);
47 layout->prop(ptr, "amplitude", UI_ITEM_NONE, std::nullopt, ICON_NONE);
48 layout->prop(ptr, "period", UI_ITEM_NONE, std::nullopt, ICON_NONE);
49 layout->prop(ptr, "phase", UI_ITEM_NONE, std::nullopt, ICON_NONE);
50
51 shaderfx_panel_end(layout, ptr);
52}
53
54static void panel_register(ARegionType *region_type)
55{
57}
58
60 /*name*/ N_("WaveDistortion"),
61 /*struct_name*/ "WaveShaderFxData",
62 /*struct_size*/ sizeof(WaveShaderFxData),
64 /*flags*/ ShaderFxTypeFlag(0),
65
66 /*copy_data*/ copy_data,
67
68 /*init_data*/ init_data,
69 /*free_data*/ nullptr,
70 /*is_disabled*/ nullptr,
71 /*update_depsgraph*/ nullptr,
72 /*depends_on_time*/ nullptr,
73 /*foreach_ID_link*/ nullptr,
74 /*foreach_working_space_color*/ nullptr,
75 /*panel_register*/ panel_register,
76};
@ eShaderFxType_GpencilType
void BKE_shaderfx_copydata_generic(const struct ShaderFxData *fx_src, struct ShaderFxData *fx_dst)
ShaderFxTypeFlag
@ eShaderFxType_Wave
ShaderFxTypeInfo shaderfx_Type_Wave
static void panel_register(ARegionType *region_type)
static void init_data(ShaderFxData *fx)
static void panel_draw(const bContext *, Panel *panel)
static void copy_data(const ShaderFxData *md, ShaderFxData *target)
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)
static void init_data(ModifierData *md)
static void panel_register(ARegionType *region_type)
static void panel_draw(const bContext *, Panel *panel)
static void copy_data(const ModifierData *md, ModifierData *target, const int flag)
@ UI_ITEM_R_EXPAND
#define UI_ITEM_NONE
struct uiLayout * layout
void use_property_split_set(bool value)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)
#define N_(msgid)
PointerRNA * ptr
Definition wm_files.cc:4238