Blender V4.3
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
9#include <cstdio>
10
11#include "BLI_math_vector.h"
12#include "BLI_utildefines.h"
13
14#include "BLT_translation.hh"
15
16#include "BKE_context.hh"
17#include "BKE_screen.hh"
18
19#include "DNA_screen_types.h"
20
21#include "UI_interface.hh"
22#include "UI_resources.hh"
23
24#include "RNA_access.hh"
25
26#include "FX_shader_types.h"
27#include "FX_ui_common.h"
28
29static void init_data(ShaderFxData *fx)
30{
32 copy_v2_fl(gpfx->radius, 50.0f);
33 gpfx->samples = 8;
34 gpfx->rotation = 0.0f;
35}
36
37static void copy_data(const ShaderFxData *md, ShaderFxData *target)
38{
40}
41
42static void panel_draw(const bContext * /*C*/, Panel *panel)
43{
45 uiLayout *layout = panel->layout;
46
48
49 uiLayoutSetPropSep(layout, true);
50
51 uiItemR(layout, ptr, "samples", UI_ITEM_NONE, nullptr, ICON_NONE);
52
53 uiItemR(layout, ptr, "use_dof_mode", UI_ITEM_NONE, IFACE_("Use Depth of Field"), ICON_NONE);
54 col = uiLayoutColumn(layout, false);
55 uiLayoutSetActive(col, !RNA_boolean_get(ptr, "use_dof_mode"));
56 uiItemR(col, ptr, "size", UI_ITEM_NONE, nullptr, ICON_NONE);
57 uiItemR(col, ptr, "rotation", UI_ITEM_NONE, nullptr, ICON_NONE);
58
59 shaderfx_panel_end(layout, ptr);
60}
61
62static void panel_register(ARegionType *region_type)
63{
65}
66
68 /*name*/ N_("Blur"),
69 /*struct_name*/ "BlurShaderFxData",
70 /*struct_size*/ sizeof(BlurShaderFxData),
72 /*flags*/ ShaderFxTypeFlag(0),
73
74 /*copy_data*/ copy_data,
75
76 /*init_data*/ init_data,
77 /*free_data*/ nullptr,
78 /*is_disabled*/ nullptr,
79 /*update_depsgraph*/ nullptr,
80 /*depends_on_time*/ nullptr,
81 /*foreach_ID_link*/ nullptr,
82 /*panel_register*/ panel_register,
83};
@ 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)
struct BlurShaderFxData BlurShaderFxData
@ eShaderFxType_Blur
static void panel_register(ARegionType *region_type)
static void init_data(ShaderFxData *fx)
static void panel_draw(const bContext *, Panel *panel)
ShaderFxTypeInfo shaderfx_Type_Blur
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)
void uiLayoutSetActive(uiLayout *layout, bool active)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
#define UI_ITEM_NONE
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
uint col
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
struct uiLayout * layout
#define N_(msgid)
PointerRNA * ptr
Definition wm_files.cc:4126