Blender V5.0
FX_shader_pixel.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_utildefines.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 ARRAY_SET_ITEMS(gpfx->size, 5, 5);
30 ARRAY_SET_ITEMS(gpfx->rgba, 0.0f, 0.0f, 0.0f, 0.9f);
31}
32
33static void copy_data(const ShaderFxData *md, ShaderFxData *target)
34{
36}
37
38static void panel_draw(const bContext * /*C*/, Panel *panel)
39{
41 uiLayout *layout = panel->layout;
42
44
45 layout->use_property_split_set(true);
46
47 /* Add the X, Y labels manually because size is a #PROP_PIXEL. */
48 col = &layout->column(true);
50 col->prop(ptr, prop, 0, 0, UI_ITEM_NONE, IFACE_("Size X"), ICON_NONE);
51 col->prop(ptr, prop, 1, 0, UI_ITEM_NONE, IFACE_("Y"), ICON_NONE);
52
53 layout->prop(ptr, "use_antialiasing", UI_ITEM_NONE, std::nullopt, ICON_NONE);
54
55 shaderfx_panel_end(layout, ptr);
56}
57
58static void panel_register(ARegionType *region_type)
59{
61}
62
64 /*name*/ N_("Pixelate"),
65 /*struct_name*/ "PixelShaderFxData",
66 /*struct_size*/ sizeof(PixelShaderFxData),
68 /*flags*/ ShaderFxTypeFlag(0),
69
70 /*copy_data*/ copy_data,
71
72 /*init_data*/ init_data,
73 /*free_data*/ nullptr,
74 /*is_disabled*/ nullptr,
75 /*update_depsgraph*/ nullptr,
76 /*depends_on_time*/ nullptr,
77 /*foreach_ID_link*/ nullptr,
78 /*foreach_working_space_color*/ nullptr,
79 /*panel_register*/ panel_register,
80};
@ eShaderFxType_GpencilType
void BKE_shaderfx_copydata_generic(const struct ShaderFxData *fx_src, struct ShaderFxData *fx_dst)
ShaderFxTypeFlag
#define ARRAY_SET_ITEMS(...)
#define IFACE_(msgid)
@ eShaderFxType_Pixel
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_Pixel
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
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
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