Blender  V3.3
FX_shader_pixel.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2017 Blender Foundation. */
3 
8 #include <stdio.h>
9 
10 #include "BLI_utildefines.h"
11 
12 #include "BLT_translation.h"
13 
14 #include "BKE_context.h"
15 #include "BKE_screen.h"
16 
17 #include "DNA_screen_types.h"
18 
19 #include "UI_interface.h"
20 #include "UI_resources.h"
21 
22 #include "RNA_access.h"
23 
24 #include "FX_shader_types.h"
25 #include "FX_ui_common.h"
26 
27 static void initData(ShaderFxData *fx)
28 {
30  ARRAY_SET_ITEMS(gpfx->size, 5, 5);
31  ARRAY_SET_ITEMS(gpfx->rgba, 0.0f, 0.0f, 0.0f, 0.9f);
32 }
33 
34 static void copyData(const ShaderFxData *md, ShaderFxData *target)
35 {
37 }
38 
39 static void panel_draw(const bContext *UNUSED(C), Panel *panel)
40 {
41  uiLayout *col;
42  uiLayout *layout = panel->layout;
43 
45 
46  uiLayoutSetPropSep(layout, true);
47 
48  /* Add the X, Y labels manually because size is a #PROP_PIXEL. */
49  col = uiLayoutColumn(layout, true);
50  PropertyRNA *prop = RNA_struct_find_property(ptr, "size");
51  uiItemFullR(col, ptr, prop, 0, 0, 0, IFACE_("Size X"), ICON_NONE);
52  uiItemFullR(col, ptr, prop, 1, 0, 0, IFACE_("Y"), ICON_NONE);
53 
54  uiItemR(layout, ptr, "use_antialiasing", 0, NULL, ICON_NONE);
55 
56  shaderfx_panel_end(layout, ptr);
57 }
58 
59 static void panelRegister(ARegionType *region_type)
60 {
62 }
63 
65  /* name */ N_("Pixelate"),
66  /* structName */ "PixelShaderFxData",
67  /* structSize */ sizeof(PixelShaderFxData),
68  /* type */ eShaderFxType_GpencilType,
69  /* flags */ 0,
70 
71  /* copyData */ copyData,
72 
73  /* initData */ initData,
74  /* freeData */ NULL,
75  /* isDisabled */ NULL,
76  /* updateDepsgraph */ NULL,
77  /* dependsOnTime */ NULL,
78  /* foreachIDLink */ NULL,
79  /* panelRegister */ panelRegister,
80 };
@ eShaderFxType_GpencilType
Definition: BKE_shader_fx.h:35
void BKE_shaderfx_copydata_generic(const struct ShaderFxData *fx_src, struct ShaderFxData *fx_dst)
#define ARRAY_SET_ITEMS(...)
#define UNUSED(x)
#define IFACE_(msgid)
@ eShaderFxType_Pixel
struct PixelShaderFxData PixelShaderFxData
ShaderFxTypeInfo shaderfx_Type_Pixel
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panelRegister(ARegionType *region_type)
static void copyData(const ShaderFxData *md, ShaderFxData *target)
static void initData(ShaderFxData *fx)
PanelType * shaderfx_panel_register(ARegionType *region_type, ShaderFxType type, PanelDrawFn draw)
Definition: FX_ui_common.c:223
void shaderfx_panel_end(uiLayout *layout, PointerRNA *ptr)
Definition: FX_ui_common.c:84
PointerRNA * shaderfx_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
Definition: FX_ui_common.c:93
#define C
Definition: RandGen.cpp:25
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiItemFullR(uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, const char *name, int icon)
uint col
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
struct uiLayout * layout
#define N_(msgid)
PointerRNA * ptr
Definition: wm_files.c:3480