Blender  V3.3
FX_shader_flip.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 "DNA_gpencil_types.h"
11 #include "DNA_object_types.h"
12 #include "DNA_scene_types.h"
13 #include "DNA_screen_types.h"
14 
15 #include "BLI_utildefines.h"
16 
17 #include "BLT_translation.h"
18 
19 #include "BKE_context.h"
20 #include "BKE_screen.h"
21 
22 #include "UI_interface.h"
23 #include "UI_resources.h"
24 
25 #include "RNA_access.h"
26 
27 #include "FX_shader_types.h"
28 #include "FX_ui_common.h"
29 
30 static void initData(ShaderFxData *fx)
31 {
32  FlipShaderFxData *gpfx = (FlipShaderFxData *)fx;
33  gpfx->flag |= FX_FLIP_HORIZONTAL;
34 }
35 
36 static void copyData(const ShaderFxData *md, ShaderFxData *target)
37 {
39 }
40 
41 static void panel_draw(const bContext *UNUSED(C), Panel *panel)
42 {
43  uiLayout *row;
44  uiLayout *layout = panel->layout;
46 
48 
49  uiLayoutSetPropSep(layout, true);
50 
51  row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis"));
52  uiItemR(row, ptr, "use_flip_x", toggles_flag, NULL, ICON_NONE);
53  uiItemR(row, ptr, "use_flip_y", toggles_flag, NULL, ICON_NONE);
54 
55  shaderfx_panel_end(layout, ptr);
56 }
57 
58 static void panelRegister(ARegionType *region_type)
59 {
61 }
62 
64  /* name */ N_("Flip"),
65  /* structName */ "FlipShaderFxData",
66  /* structSize */ sizeof(FlipShaderFxData),
67  /* type */ eShaderFxType_GpencilType,
68  /* flags */ 0,
69 
70  /* copyData */ copyData,
71 
72  /* initData */ initData,
73  /* freeData */ NULL,
74  /* isDisabled */ NULL,
75  /* updateDepsgraph */ NULL,
76  /* dependsOnTime */ NULL,
77  /* foreachIDLink */ NULL,
78  /* panelRegister */ panelRegister,
79 };
@ eShaderFxType_GpencilType
Definition: BKE_shader_fx.h:35
void BKE_shaderfx_copydata_generic(const struct ShaderFxData *fx_src, struct ShaderFxData *fx_dst)
#define UNUSED(x)
#define IFACE_(msgid)
Object is a sort of wrapper for general info.
struct FlipShaderFxData FlipShaderFxData
@ FX_FLIP_HORIZONTAL
@ eShaderFxType_Flip
ShaderFxTypeInfo shaderfx_Type_Flip
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 * uiLayoutRowWithHeading(uiLayout *layout, bool align, const char *heading)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
@ UI_ITEM_R_TOGGLE
@ UI_ITEM_R_FORCE_BLANK_DECORATE
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
struct uiLayout * layout
#define N_(msgid)
PointerRNA * ptr
Definition: wm_files.c:3480