Blender V5.3
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.hh"
22#include "FX_ui_common.hh"
23
24namespace blender {
25
26static void init_data(ShaderFxData *fx)
27{
28 WaveShaderFxData *gpfx = reinterpret_cast<WaveShaderFxData *>(fx);
29 gpfx->amplitude = 10.0f;
30 gpfx->period = 20.0f;
31 gpfx->phase = 0.0f;
32 gpfx->orientation = 1;
33}
34
35static void copy_data(const ShaderFxData *md, ShaderFxData *target)
36{
38}
39
40static void panel_draw(const bContext * /*C*/, Panel *panel)
41{
42 ui::Layout &layout = *panel->layout;
43
45
46 layout.use_property_split_set(true);
47
48 layout.prop(ptr, "orientation", ui::ITEM_R_EXPAND, std::nullopt, ICON_NONE);
49 layout.prop(ptr, "amplitude", UI_ITEM_NONE, std::nullopt, ICON_NONE);
50 layout.prop(ptr, "period", UI_ITEM_NONE, std::nullopt, ICON_NONE);
51 layout.prop(ptr, "phase", UI_ITEM_NONE, std::nullopt, ICON_NONE);
52
53 shaderfx_panel_end(layout, ptr);
54}
55
56static void panel_register(ARegionType *region_type)
57{
59}
60
62 /*name*/ N_("WaveDistortion"),
63 /*struct_name*/ "WaveShaderFxData",
64 /*struct_size*/ sizeof(WaveShaderFxData),
66 /*flags*/ ShaderFxTypeFlag(0),
67
68 /*copy_data*/ copy_data,
69
70 /*init_data*/ init_data,
71 /*free_data*/ nullptr,
72 /*is_disabled*/ nullptr,
73 /*update_depsgraph*/ nullptr,
74 /*depends_on_time*/ nullptr,
75 /*foreach_ID_link*/ nullptr,
76 /*foreach_working_space_color*/ nullptr,
77 /*panel_register*/ panel_register,
78};
79
80} // namespace blender
#define UI_ITEM_NONE
BMesh Iterators.
static void copy_data(const ModifierData *md, ModifierData *target, const int flag)
PanelType * shaderfx_panel_register(ARegionType *region_type, ShaderFxType type, PanelDrawFn draw)
static void init_data(ModifierData *md)
static void panel_register(ARegionType *region_type)
@ eShaderFxType_GpencilType
void shaderfx_panel_end(ui::Layout &layout, PointerRNA *ptr)
ShaderFxTypeInfo shaderfx_Type_Wave
PointerRNA * shaderfx_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
static void panel_draw(const bContext *, Panel *panel)
void BKE_shaderfx_copydata_generic(const ShaderFxData *fx_src, ShaderFxData *fx_dst)
Definition shader_fx.cc:161
ui::Layout * layout
void use_property_split_set(bool is_sep)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
#define N_(msgid)