Blender  V2.93
FX_shader_pixel.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2017, Blender Foundation
17  * This is a new part of Blender
18  */
19 
24 #include <stdio.h>
25 
26 #include "BLI_utildefines.h"
27 
28 #include "BLT_translation.h"
29 
30 #include "BKE_context.h"
31 #include "BKE_screen.h"
32 
33 #include "DNA_screen_types.h"
34 
35 #include "UI_interface.h"
36 #include "UI_resources.h"
37 
38 #include "RNA_access.h"
39 
40 #include "FX_shader_types.h"
41 #include "FX_ui_common.h"
42 
43 static void initData(ShaderFxData *fx)
44 {
46  ARRAY_SET_ITEMS(gpfx->size, 5, 5);
47  ARRAY_SET_ITEMS(gpfx->rgba, 0.0f, 0.0f, 0.0f, 0.9f);
48 }
49 
50 static void copyData(const ShaderFxData *md, ShaderFxData *target)
51 {
53 }
54 
55 static void panel_draw(const bContext *UNUSED(C), Panel *panel)
56 {
57  uiLayout *col;
58  uiLayout *layout = panel->layout;
59 
61 
62  uiLayoutSetPropSep(layout, true);
63 
64  /* Add the X, Y labels manually because size is a #PROP_PIXEL. */
65  col = uiLayoutColumn(layout, true);
66  PropertyRNA *prop = RNA_struct_find_property(ptr, "size");
67  uiItemFullR(col, ptr, prop, 0, 0, 0, IFACE_("Size X"), ICON_NONE);
68  uiItemFullR(col, ptr, prop, 1, 0, 0, IFACE_("Y"), ICON_NONE);
69 
70  uiItemR(layout, ptr, "use_antialiasing", 0, NULL, ICON_NONE);
71 
72  shaderfx_panel_end(layout, ptr);
73 }
74 
75 static void panelRegister(ARegionType *region_type)
76 {
78 }
79 
81  /* name */ "Pixelate",
82  /* structName */ "PixelShaderFxData",
83  /* structSize */ sizeof(PixelShaderFxData),
84  /* type */ eShaderFxType_GpencilType,
85  /* flags */ 0,
86 
87  /* copyData */ copyData,
88 
89  /* initData */ initData,
90  /* freeData */ NULL,
91  /* isDisabled */ NULL,
92  /* updateDepsgraph */ NULL,
93  /* dependsOnTime */ NULL,
94  /* foreachIDLink */ NULL,
95  /* panelRegister */ panelRegister,
96 };
@ eShaderFxType_GpencilType
Definition: BKE_shader_fx.h:49
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:242
void shaderfx_panel_end(uiLayout *layout, PointerRNA *ptr)
Definition: FX_ui_common.c:99
PointerRNA * shaderfx_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
Definition: FX_ui_common.c:111
#define C
Definition: RandGen.cpp:39
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:866
struct uiLayout * layout
PointerRNA * ptr
Definition: wm_files.c:3157