Blender V5.0
FX_shader_blur.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2017 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BLI_math_vector.h"
10
11#include "BLT_translation.hh"
12
13#include "BKE_context.hh"
14#include "BKE_screen.hh"
15
16#include "DNA_screen_types.h"
17
19#include "UI_resources.hh"
20
21#include "RNA_access.hh"
22
23#include "FX_shader_types.h"
24#include "FX_ui_common.h"
25
26static void init_data(ShaderFxData *fx)
27{
29 copy_v2_fl(gpfx->radius, 50.0f);
30 gpfx->samples = 8;
31 gpfx->rotation = 0.0f;
32}
33
34static void copy_data(const ShaderFxData *md, ShaderFxData *target)
35{
37}
38
39static void panel_draw(const bContext * /*C*/, Panel *panel)
40{
42 uiLayout *layout = panel->layout;
43
45
46 layout->use_property_split_set(true);
47
48 layout->prop(ptr, "samples", UI_ITEM_NONE, std::nullopt, ICON_NONE);
49
50 layout->prop(ptr, "use_dof_mode", UI_ITEM_NONE, IFACE_("Use Depth of Field"), ICON_NONE);
51 col = &layout->column(false);
52 col->active_set(!RNA_boolean_get(ptr, "use_dof_mode"));
53 col->prop(ptr, "size", UI_ITEM_NONE, std::nullopt, ICON_NONE);
54 col->prop(ptr, "rotation", UI_ITEM_NONE, std::nullopt, ICON_NONE);
55
56 shaderfx_panel_end(layout, ptr);
57}
58
59static void panel_register(ARegionType *region_type)
60{
62}
63
65 /*name*/ N_("Blur"),
66 /*struct_name*/ "BlurShaderFxData",
67 /*struct_size*/ sizeof(BlurShaderFxData),
69 /*flags*/ ShaderFxTypeFlag(0),
70
71 /*copy_data*/ copy_data,
72
73 /*init_data*/ init_data,
74 /*free_data*/ nullptr,
75 /*is_disabled*/ nullptr,
76 /*update_depsgraph*/ nullptr,
77 /*depends_on_time*/ nullptr,
78 /*foreach_ID_link*/ nullptr,
79 /*foreach_working_space_color*/ nullptr,
80 /*panel_register*/ panel_register,
81};
@ eShaderFxType_GpencilType
void BKE_shaderfx_copydata_generic(const struct ShaderFxData *fx_src, struct ShaderFxData *fx_dst)
ShaderFxTypeFlag
MINLINE void copy_v2_fl(float r[2], float f)
#define IFACE_(msgid)
@ eShaderFxType_Blur
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)
ShaderFxTypeInfo shaderfx_Type_Blur
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)
#define UI_ITEM_NONE
uint col
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
struct uiLayout * layout
uiLayout & column(bool align)
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