diff options
author | Hans Goudey <h.goudey@me.com> | 2020-06-19 22:07:13 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-06-19 22:07:13 +0300 |
commit | bb4cef71eeaf36aa61187d47b8a8ae06ba55f7c0 (patch) | |
tree | 35700820beee851c984c9162d40952387cca5e39 /source/blender/shader_fx/intern/FX_shader_pixel.c | |
parent | 702e00f91088031f83cfed1528d5ed22069a9d35 (diff) |
UI: ShaderFx Drag and Drop, Layout Updates
This patch implements the list panel system D7490 for grease pencil
shader effects. It also moves their drawing to a callback in
ShaderFxTypeInfo in line with the extensible architecture refactoring
goal T75724.
The implementation is basically exactly the same as for the modifier
patch (9b099c86123fc82).
Thanks to Matias Mendiola (@mendio) for helping to develop the layout
changes.
Differential Revision: https://developer.blender.org/D7985
Diffstat (limited to 'source/blender/shader_fx/intern/FX_shader_pixel.c')
-rw-r--r-- | source/blender/shader_fx/intern/FX_shader_pixel.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/shader_fx/intern/FX_shader_pixel.c b/source/blender/shader_fx/intern/FX_shader_pixel.c index 04bf9ae5b6d..b22dae1064d 100644 --- a/source/blender/shader_fx/intern/FX_shader_pixel.c +++ b/source/blender/shader_fx/intern/FX_shader_pixel.c @@ -25,7 +25,20 @@ #include "BLI_utildefines.h" +#include "BLT_translation.h" + +#include "BKE_context.h" +#include "BKE_screen.h" + +#include "DNA_screen_types.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "FX_shader_types.h" +#include "FX_ui_common.h" static void initData(ShaderFxData *fx) { @@ -39,6 +52,30 @@ static void copyData(const ShaderFxData *md, ShaderFxData *target) BKE_shaderfx_copydata_generic(md, target); } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + /* Add the X, Y labels manually because size is a #PROP_PIXEL. */ + col = uiLayoutColumn(layout, true); + PropertyRNA *prop = RNA_struct_find_property(&ptr, "size"); + uiItemFullR(col, &ptr, prop, 0, 0, 0, IFACE_("Size X"), ICON_NONE); + uiItemFullR(col, &ptr, prop, 1, 0, 0, IFACE_("Y"), ICON_NONE); + + shaderfx_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + shaderfx_panel_register(region_type, eShaderFxType_Pixel, panel_draw); +} + ShaderFxTypeInfo shaderfx_Type_Pixel = { /* name */ "Pixelate", /* structName */ "PixelShaderFxData", @@ -55,4 +92,5 @@ ShaderFxTypeInfo shaderfx_Type_Pixel = { /* dependsOnTime */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* panelRegister */ panelRegister, }; |