Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2020-06-19 21:42:08 +0300
committerHans Goudey <h.goudey@me.com>2020-06-19 21:42:08 +0300
commitec963d9d7d179e3ba12f5bdf748818939c2f17d8 (patch)
tree099996a967053ba95d14eaeaa1df8d602ebbfd23 /source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
parentfb7d8e2f4b87307a749537f16e80800af09cf5ae (diff)
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
Diffstat (limited to 'source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
index b9fadea7fd0..4fa47a592ba 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
@@ -27,22 +27,33 @@
#include "BLI_math.h"
#include "BLI_utildefines.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_colortools.h"
+#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_lib_query.h"
#include "BKE_modifier.h"
+#include "BKE_screen.h"
#include "DEG_depsgraph.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"
static void initData(GpencilModifierData *md)
@@ -166,6 +177,46 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
+static void panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "normalize_thickness", 0, NULL, ICON_NONE);
+
+ if (RNA_boolean_get(&ptr, "normalize_thickness")) {
+ uiItemR(layout, &ptr, "thickness", 0, NULL, ICON_NONE);
+ }
+ else {
+ uiItemR(layout, &ptr, "thickness_factor", 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, true);
+}
+
+static void panelRegister(ARegionType *region_type)
+{
+ PanelType *panel_type = gpencil_modifier_panel_register(
+ region_type, eGpencilModifierType_Thick, panel_draw);
+ PanelType *mask_panel_type = gpencil_modifier_subpanel_register(
+ region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
+ gpencil_modifier_subpanel_register(region_type,
+ "curve",
+ "",
+ gpencil_modifier_curve_header_draw,
+ gpencil_modifier_curve_panel_draw,
+ mask_panel_type);
+}
+
GpencilModifierTypeInfo modifierType_Gpencil_Thick = {
/* name */ "Thickness",
/* structName */ "ThickGpencilModifierData",
@@ -188,4 +239,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Thick = {
/* foreachObjectLink */ NULL,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};