Blender V4.3
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
9#include <cstdio>
10
11#include "BLI_utildefines.h"
12
13#include "BLT_translation.hh"
14
15#include "BKE_context.hh"
16#include "BKE_screen.hh"
17
18#include "DNA_screen_types.h"
19
20#include "UI_interface.hh"
21#include "UI_resources.hh"
22
23#include "RNA_access.hh"
24
25#include "FX_shader_types.h"
26#include "FX_ui_common.h"
27
28static void init_data(ShaderFxData *fx)
29{
31 ARRAY_SET_ITEMS(gpfx->size, 5, 5);
32 ARRAY_SET_ITEMS(gpfx->rgba, 0.0f, 0.0f, 0.0f, 0.9f);
33}
34
35static void copy_data(const ShaderFxData *md, ShaderFxData *target)
36{
38}
39
40static void panel_draw(const bContext * /*C*/, Panel *panel)
41{
43 uiLayout *layout = panel->layout;
44
46
47 uiLayoutSetPropSep(layout, true);
48
49 /* Add the X, Y labels manually because size is a #PROP_PIXEL. */
50 col = uiLayoutColumn(layout, true);
52 uiItemFullR(col, ptr, prop, 0, 0, UI_ITEM_NONE, IFACE_("Size X"), ICON_NONE);
53 uiItemFullR(col, ptr, prop, 1, 0, UI_ITEM_NONE, IFACE_("Y"), ICON_NONE);
54
55 uiItemR(layout, ptr, "use_antialiasing", UI_ITEM_NONE, nullptr, ICON_NONE);
56
57 shaderfx_panel_end(layout, ptr);
58}
59
60static void panel_register(ARegionType *region_type)
61{
63}
64
66 /*name*/ N_("Pixelate"),
67 /*struct_name*/ "PixelShaderFxData",
68 /*struct_size*/ sizeof(PixelShaderFxData),
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 /*panel_register*/ panel_register,
81};
@ 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
struct PixelShaderFxData PixelShaderFxData
static void panel_register(ARegionType *region_type)
ShaderFxTypeInfo shaderfx_Type_Pixel
static void init_data(ShaderFxData *fx)
static void panel_draw(const bContext *, Panel *panel)
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 uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, const char *name, int icon, const char *placeholder=nullptr)
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
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
struct uiLayout * layout
#define N_(msgid)
PointerRNA * ptr
Definition wm_files.cc:4126