Blender V5.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
8
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.hh"
24#include "FX_ui_common.hh"
25
26namespace blender {
27
28static void init_data(ShaderFxData *fx)
29{
30 BlurShaderFxData *gpfx = reinterpret_cast<BlurShaderFxData *>(fx);
31 copy_v2_fl(gpfx->radius, 50.0f);
32 gpfx->samples = 8;
33 gpfx->rotation = 0.0f;
34}
35
36static void copy_data(const ShaderFxData *md, ShaderFxData *target)
37{
39}
40
41static void panel_draw(const bContext * /*C*/, Panel *panel)
42{
43 ui::Layout &layout = *panel->layout;
44
46
47 layout.use_property_split_set(true);
48
49 layout.prop(ptr, "samples", UI_ITEM_NONE, std::nullopt, ICON_NONE);
50
51 layout.prop(ptr, "use_dof_mode", UI_ITEM_NONE, IFACE_("Use Depth of Field"), ICON_NONE);
52 ui::Layout &col = layout.column(false);
53 col.active_set(!RNA_boolean_get(ptr, "use_dof_mode"));
54 col.prop(ptr, "size", UI_ITEM_NONE, std::nullopt, ICON_NONE);
55 col.prop(ptr, "rotation", UI_ITEM_NONE, std::nullopt, ICON_NONE);
56
57 shaderfx_panel_end(layout, ptr);
58}
59
60static void panel_register(ARegionType *region_type)
61{
63}
64
66 /*name*/ N_("Blur"),
67 /*struct_name*/ "BlurShaderFxData",
68 /*struct_size*/ sizeof(BlurShaderFxData),
70 /*flags*/ ShaderFxTypeFlag(0),
71
72 /*copy_data*/ copy_data,
73
74 /*init_data*/ init_data,
75 /*free_data*/ nullptr,
76 /*is_disabled*/ nullptr,
77 /*update_depsgraph*/ nullptr,
78 /*depends_on_time*/ nullptr,
79 /*foreach_ID_link*/ nullptr,
80 /*foreach_working_space_color*/ nullptr,
81 /*panel_register*/ panel_register,
82};
83
84} // namespace blender
#define IFACE_(msgid)
#define UI_ITEM_NONE
BMesh Iterators.
static void copy_data(const ModifierData *md, ModifierData *target, const int flag)
MINLINE void copy_v2_fl(float r[2], float f)
PanelType * shaderfx_panel_register(ARegionType *region_type, ShaderFxType type, PanelDrawFn draw)
static void init_data(ModifierData *md)
ShaderFxTypeInfo shaderfx_Type_Blur
static void panel_register(ARegionType *region_type)
@ eShaderFxType_GpencilType
void shaderfx_panel_end(ui::Layout &layout, PointerRNA *ptr)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
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)
void active_set(bool active)
Layout & column(bool align)
#define N_(msgid)