From ec963d9d7d179e3ba12f5bdf748818939c2f17d8 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 19 Jun 2020 14:42:08 -0400 Subject: UI: Grease Pencil Modifier Drag and Drop, Layout Changes This patch implements the list panel system D7490 for grease pencil modifiers. It also moves their drawing to a callback in GpencilModifierTypeInfo in line with the extensible architecture refactoring goal T75724. This also adds the "set_error" function for grease pencil modifiers, which hadn't been copied from mesh modifiers yet. The implementation is basically exactly the same as for the modifier patch (9b099c86123fc82). Thanks to Matias Mendiola (mendio) for providing mockups for many of the layout changes. Differential Revision: https://developer.blender.org/D7978 --- .../gpencil_modifiers/intern/MOD_gpencilmirror.c | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c') diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c index 10f0dd763b1..581eaa886d8 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c @@ -28,12 +28,16 @@ #include "BLI_listbase.h" #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_gpencil_modifier_types.h" #include "DNA_gpencil_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_gpencil.h" #include "BKE_gpencil_modifier.h" @@ -43,10 +47,17 @@ #include "BKE_modifier.h" #include "BKE_object.h" #include "BKE_scene.h" +#include "BKE_screen.h" #include "MEM_guardedalloc.h" +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "MOD_gpencil_modifiertypes.h" +#include "MOD_gpencil_ui_common.h" #include "MOD_gpencil_util.h" #include "DEG_depsgraph.h" @@ -254,6 +265,40 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk, foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE; + + PointerRNA ptr; + gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis")); + uiItemR(row, &ptr, "x_axis", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "y_axis", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "z_axis", toggles_flag, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE); + + gpencil_modifier_panel_end(layout, &ptr); +} + +static void mask_panel_draw(const bContext *C, Panel *panel) +{ + gpencil_modifier_masking_panel_draw(C, panel, true, false); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = gpencil_modifier_panel_register( + region_type, eGpencilModifierType_Mirror, panel_draw); + gpencil_modifier_subpanel_register( + region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type); +} + GpencilModifierTypeInfo modifierType_Gpencil_Mirror = { /* name */ "Mirror", /* structName */ "MirrorGpencilModifierData", @@ -276,4 +321,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Mirror = { /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ NULL, + /* panelRegister */ panelRegister, }; -- cgit v1.2.3