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:
Diffstat (limited to 'source/blender/gpencil_modifiers/intern')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c458
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.h66
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c45
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c152
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c94
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c48
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c87
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c60
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c46
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c76
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c78
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c41
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c86
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c54
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c53
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c40
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciltexture.c62
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c52
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c97
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c62
20 files changed, 1754 insertions, 3 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c b/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c
new file mode 100644
index 00000000000..c15bef1f748
--- /dev/null
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c
@@ -0,0 +1,458 @@
+/* This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup modifiers
+ */
+
+#include <string.h>
+
+#include "BLI_listbase.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BKE_context.h"
+#include "BKE_gpencil_modifier.h"
+#include "BKE_material.h"
+#include "BKE_object.h"
+#include "BKE_screen.h"
+
+#include "DNA_object_force_types.h"
+#include "DNA_object_types.h"
+#include "DNA_particle_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+
+#include "ED_object.h"
+
+#include "BLT_translation.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "RNA_access.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "MOD_gpencil_ui_common.h" /* Self include */
+
+static Object *get_gpencilmodifier_object(const bContext *C)
+{
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
+ if (sbuts != NULL && (sbuts->pinid != NULL) && GS(sbuts->pinid->name) == ID_OB) {
+ return (Object *)sbuts->pinid;
+ }
+ else {
+ return CTX_data_active_object(C);
+ }
+}
+
+/**
+ * Poll function so these modifier panels only show for grease pencil objects.
+ */
+static bool gpencil_modifier_ui_poll(const bContext *C, PanelType *UNUSED(pt))
+{
+ Object *ob = get_gpencilmodifier_object(C);
+
+ return (ob != NULL) && (ob->type == OB_GPENCIL);
+}
+
+/* -------------------------------------------------------------------- */
+/** \name Panel Drag and Drop, Expansion Saving
+ * \{ */
+
+/**
+ * Move a modifier to the index it's moved to after a drag and drop.
+ */
+static void gpencil_modifier_reorder(bContext *C, Panel *panel, int new_index)
+{
+ Object *ob = get_gpencilmodifier_object(C);
+
+ GpencilModifierData *md = BLI_findlink(&ob->greasepencil_modifiers, panel->runtime.list_index);
+ PointerRNA props_ptr;
+ wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_gpencil_modifier_move_to_index", false);
+ WM_operator_properties_create_ptr(&props_ptr, ot);
+ RNA_string_set(&props_ptr, "modifier", md->name);
+ RNA_int_set(&props_ptr, "index", new_index);
+ WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr);
+ WM_operator_properties_free(&props_ptr);
+}
+
+static short get_gpencil_modifier_expand_flag(const bContext *C, Panel *panel)
+{
+ Object *ob = get_gpencilmodifier_object(C);
+ GpencilModifierData *md = BLI_findlink(&ob->greasepencil_modifiers, panel->runtime.list_index);
+ return md->ui_expand_flag;
+ return 0;
+}
+
+static void set_gpencil_modifier_expand_flag(const bContext *C, Panel *panel, short expand_flag)
+{
+ Object *ob = get_gpencilmodifier_object(C);
+ GpencilModifierData *md = BLI_findlink(&ob->greasepencil_modifiers, panel->runtime.list_index);
+ md->ui_expand_flag = expand_flag;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Modifier Panel Layouts
+ * \{ */
+
+void gpencil_modifier_masking_panel_draw(const bContext *C,
+ Panel *panel,
+ bool use_material,
+ bool use_vertex)
+{
+ uiLayout *row, *col, *sub;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ PointerRNA ob_ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
+
+ PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data");
+ bool has_layer = RNA_string_length(&ptr, "layer") != 0;
+
+ uiLayoutSetPropSep(layout, true);
+
+ col = uiLayoutColumn(layout, true);
+ row = uiLayoutRow(col, true);
+ uiItemPointerR(row, &ptr, "layer", &obj_data_ptr, "layers", NULL, ICON_GREASEPENCIL);
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetActive(sub, has_layer);
+ uiLayoutSetPropDecorate(sub, false);
+ uiItemR(sub, &ptr, "invert_layers", 0, "", ICON_ARROW_LEFTRIGHT);
+
+ row = uiLayoutRow(col, true);
+ uiItemR(row, &ptr, "layer_pass", 0, NULL, ICON_NONE);
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetActive(sub, RNA_int_get(&ptr, "layer_pass") != 0);
+ uiLayoutSetPropDecorate(sub, false);
+ uiItemR(sub, &ptr, "invert_layer_pass", 0, "", ICON_ARROW_LEFTRIGHT);
+
+ if (use_material) {
+ PointerRNA material_ptr = RNA_pointer_get(&ptr, "material");
+ bool has_material = !RNA_pointer_is_null(&material_ptr);
+
+ /* Because the Gpencil modifier material property used to be a string in an earlier version of
+ * Blender, we need to check if the material is valid and display it differently if so. */
+ bool valid = false;
+ {
+ if (!has_material) {
+ valid = true;
+ }
+ else {
+ Material *current_material = material_ptr.data;
+ Object *ob = ob_ptr.data;
+ for (int i = 0; i <= ob->totcol; i++) {
+ Material *mat = BKE_object_material_get(ob, i);
+ if (mat == current_material) {
+ valid = true;
+ break;
+ }
+ }
+ }
+ }
+
+ col = uiLayoutColumn(layout, true);
+ row = uiLayoutRow(col, true);
+ uiLayoutSetRedAlert(row, !valid);
+ uiItemPointerR(row,
+ &ptr,
+ "material",
+ &obj_data_ptr,
+ "materials",
+ NULL,
+ valid ? ICON_SHADING_TEXTURE : ICON_ERROR);
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetActive(sub, has_material);
+ uiLayoutSetPropDecorate(sub, false);
+ uiItemR(sub, &ptr, "invert_materials", 0, "", ICON_ARROW_LEFTRIGHT);
+
+ row = uiLayoutRow(col, true);
+ uiItemR(row, &ptr, "pass_index", 0, NULL, ICON_NONE);
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetActive(sub, RNA_int_get(&ptr, "pass_index") != 0);
+ uiLayoutSetPropDecorate(sub, false);
+ uiItemR(sub, &ptr, "invert_material_pass", 0, "", ICON_ARROW_LEFTRIGHT);
+ }
+
+ if (use_vertex) {
+ bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
+
+ row = uiLayoutRow(layout, true);
+ uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetActive(sub, has_vertex_group);
+ uiLayoutSetPropDecorate(sub, false);
+ uiItemR(sub, &ptr, "invert_vertex", 0, "", ICON_ARROW_LEFTRIGHT);
+ }
+}
+
+void gpencil_modifier_curve_header_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiItemR(layout, &ptr, "use_custom_curve", 0, NULL, ICON_NONE);
+}
+
+void gpencil_modifier_curve_panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiTemplateCurveMapping(layout, &ptr, "curve", 0, false, false, false, false);
+}
+
+/**
+ * Draw modifier error message.
+ */
+void gpencil_modifier_panel_end(uiLayout *layout, PointerRNA *ptr)
+{
+ GpencilModifierData *md = ptr->data;
+ if (md->error) {
+ uiLayout *row = uiLayoutRow(layout, false);
+ uiItemL(row, IFACE_(md->error), ICON_ERROR);
+ }
+}
+
+/**
+ * Gets RNA pointers for the active object and the panel's modifier data.
+ */
+#define ERROR_LIBDATA_MESSAGE TIP_("External library data")
+void gpencil_modifier_panel_get_property_pointers(const bContext *C,
+ Panel *panel,
+ PointerRNA *r_ob_ptr,
+ PointerRNA *r_md_ptr)
+{
+ Object *ob = get_gpencilmodifier_object(C);
+ GpencilModifierData *md = BLI_findlink(&ob->greasepencil_modifiers, panel->runtime.list_index);
+
+ RNA_pointer_create(&ob->id, &RNA_GpencilModifier, md, r_md_ptr);
+
+ if (r_ob_ptr != NULL) {
+ RNA_pointer_create(&ob->id, &RNA_Object, ob, r_ob_ptr);
+ }
+
+ uiBlock *block = uiLayoutGetBlock(panel->layout);
+ UI_block_lock_clear(block);
+ UI_block_lock_set(block, ob && ID_IS_LINKED(ob), ERROR_LIBDATA_MESSAGE);
+
+ uiLayoutSetContextPointer(panel->layout, "modifier", r_md_ptr);
+}
+
+static void gpencil_modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v)
+{
+ PointerRNA op_ptr;
+ uiLayout *row;
+ GpencilModifierData *md = (GpencilModifierData *)md_v;
+ const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
+
+ PointerRNA ptr;
+ Object *ob = get_gpencilmodifier_object(C);
+ RNA_pointer_create(&ob->id, &RNA_GpencilModifier, md, &ptr);
+ uiLayoutSetContextPointer(layout, "modifier", &ptr);
+ uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
+
+ uiLayoutSetUnitsX(layout, 4.0f);
+
+ /* Apply. */
+ if (!(mti->flags & eGpencilModifierTypeFlag_NoApply)) {
+ uiItemO(layout,
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
+ ICON_CHECKMARK,
+ "OBJECT_OT_gpencil_modifier_apply");
+ }
+
+ /* Duplicate. */
+ uiItemO(layout,
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"),
+ ICON_DUPLICATE,
+ "OBJECT_OT_gpencil_modifier_copy");
+
+ uiItemS(layout);
+
+ /* Move to first. */
+ row = uiLayoutColumn(layout, false);
+ uiItemFullO(row,
+ "OBJECT_OT_gpencil_modifier_move_to_index",
+ IFACE_("Move to First"),
+ ICON_TRIA_UP,
+ NULL,
+ WM_OP_INVOKE_DEFAULT,
+ 0,
+ &op_ptr);
+ RNA_int_set(&op_ptr, "index", 0);
+ if (!md->prev) {
+ uiLayoutSetEnabled(row, false);
+ }
+
+ /* Move to last. */
+ row = uiLayoutColumn(layout, false);
+ uiItemFullO(row,
+ "OBJECT_OT_gpencil_modifier_move_to_index",
+ IFACE_("Move to Last"),
+ ICON_TRIA_DOWN,
+ NULL,
+ WM_OP_INVOKE_DEFAULT,
+ 0,
+ &op_ptr);
+ RNA_int_set(&op_ptr, "index", BLI_listbase_count(&ob->greasepencil_modifiers) - 1);
+ if (!md->next) {
+ uiLayoutSetEnabled(row, false);
+ }
+}
+
+static void gpencil_modifier_panel_header(const bContext *C, Panel *panel)
+{
+ uiLayout *row, *sub;
+ uiLayout *layout = panel->layout;
+
+ Object *ob = get_gpencilmodifier_object(C);
+ GpencilModifierData *md = BLI_findlink(&ob->greasepencil_modifiers, panel->runtime.list_index);
+ PointerRNA ptr;
+ RNA_pointer_create(&ob->id, &RNA_GpencilModifier, md, &ptr);
+ uiLayoutSetContextPointer(panel->layout, "modifier", &ptr);
+
+ const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
+ bool narrow_panel = (panel->sizex < UI_UNIT_X * 9 && panel->sizex != 0);
+
+ /* Modifier Icon. */
+ row = uiLayoutRow(layout, false);
+ if (mti->isDisabled && mti->isDisabled(md, 0)) {
+ uiLayoutSetRedAlert(row, true);
+ }
+ uiItemL(row, "", RNA_struct_ui_icon(ptr.type));
+
+ /* Modifier name. */
+ row = uiLayoutRow(layout, true);
+ if (!narrow_panel) {
+ uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
+ }
+ else {
+ uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
+ }
+
+ /* Display mode buttons. */
+ if (mti->flags & eGpencilModifierTypeFlag_SupportsEditmode) {
+ sub = uiLayoutRow(row, true);
+ uiItemR(sub, &ptr, "show_in_editmode", 0, "", ICON_NONE);
+ }
+ uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
+ uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
+
+ /* Extra operators. */
+ // row = uiLayoutRow(layout, true);
+ uiItemMenuF(row, "", ICON_DOWNARROW_HLT, gpencil_modifier_ops_extra_draw, md);
+
+ /* Remove button. */
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetEmboss(sub, UI_EMBOSS_NONE);
+ uiItemO(sub, "", ICON_X, "OBJECT_OT_gpencil_modifier_remove");
+
+ /* Extra padding. */
+ uiItemS(layout);
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Modifier Registration Helpers
+ * \{ */
+
+/**
+ * Create a panel in the context's region
+ */
+PanelType *gpencil_modifier_panel_register(ARegionType *region_type,
+ GpencilModifierType type,
+ PanelDrawFn draw)
+{
+
+ /* Get the name for the modifier's panel. */
+ char panel_idname[BKE_ST_MAXNAME];
+ BKE_gpencil_modifierType_panel_id(type, panel_idname);
+
+ PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
+
+ strcpy(panel_type->idname, panel_idname);
+ strcpy(panel_type->label, "");
+ strcpy(panel_type->context, "modifier");
+ strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+
+ panel_type->draw_header = gpencil_modifier_panel_header;
+ panel_type->draw = draw;
+ panel_type->poll = gpencil_modifier_ui_poll;
+
+ /* Give the panel the special flag that says it was built here and corresponds to a
+ * modifier rather than a #PanelType. */
+ panel_type->flag = PNL_LAYOUT_HEADER_EXPAND | PNL_DRAW_BOX | PNL_INSTANCED;
+ panel_type->reorder = gpencil_modifier_reorder;
+ panel_type->get_list_data_expand_flag = get_gpencil_modifier_expand_flag;
+ panel_type->set_list_data_expand_flag = set_gpencil_modifier_expand_flag;
+
+ BLI_addtail(&region_type->paneltypes, panel_type);
+
+ return panel_type;
+}
+
+/**
+ * Add a child panel to the parent.
+ *
+ * \note To create the panel type's idname, it appends the \a name argument to the \a parent's
+ * idname.
+ */
+PanelType *gpencil_modifier_subpanel_register(ARegionType *region_type,
+ const char *name,
+ const char *label,
+ PanelDrawFn draw_header,
+ PanelDrawFn draw,
+ PanelType *parent)
+{
+ /* Create the subpanel's ID name. */
+ char panel_idname[BKE_ST_MAXNAME];
+ strcpy(panel_idname, parent->idname);
+ strcat(panel_idname, "_");
+ strcat(panel_idname, name);
+
+ PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
+
+ strcpy(panel_type->idname, panel_idname);
+ strcpy(panel_type->label, label);
+ strcpy(panel_type->context, "modifier");
+ strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+
+ panel_type->draw_header = draw_header;
+ panel_type->draw = draw;
+ panel_type->poll = gpencil_modifier_ui_poll;
+ panel_type->flag = (PNL_DEFAULT_CLOSED | PNL_DRAW_BOX);
+
+ BLI_assert(parent != NULL);
+ strcpy(panel_type->parent_id, parent->idname);
+ panel_type->parent = parent;
+ BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
+ BLI_addtail(&region_type->paneltypes, panel_type);
+
+ return panel_type;
+}
+
+/** \} */
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.h b/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.h
new file mode 100644
index 00000000000..9c6edb51d63
--- /dev/null
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.h
@@ -0,0 +1,66 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup modifiers
+ */
+
+#ifndef __MOD_UI_COMMON__GPENCIL_H__
+#define __MOD_UI_COMMON__GPENCIL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "MOD_gpencil_modifiertypes.h"
+
+struct ARegionType;
+struct bContext;
+struct PanelType;
+struct uiLayout;
+typedef void (*PanelDrawFn)(const bContext *, Panel *);
+
+void gpencil_modifier_masking_panel_draw(const bContext *C,
+ Panel *panel,
+ bool use_material,
+ bool use_vertex);
+
+void gpencil_modifier_curve_header_draw(const bContext *C, Panel *panel);
+void gpencil_modifier_curve_panel_draw(const bContext *C, Panel *panel);
+
+void gpencil_modifier_panel_end(struct uiLayout *layout, PointerRNA *ptr);
+
+void gpencil_modifier_panel_get_property_pointers(const bContext *C,
+ struct Panel *panel,
+ struct PointerRNA *r_ob_ptr,
+ struct PointerRNA *r_ptr);
+
+PanelType *gpencil_modifier_panel_register(struct ARegionType *region_type,
+ GpencilModifierType type,
+ PanelDrawFn draw);
+
+struct PanelType *gpencil_modifier_subpanel_register(struct ARegionType *region_type,
+ const char *name,
+ const char *label,
+ PanelDrawFn draw_header,
+ PanelDrawFn draw,
+ struct PanelType *parent);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MOD_UI_COMMON__GPENCIL_H__ */
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
index 776e5521179..60c3877b89a 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
@@ -28,6 +28,8 @@
#include "BLI_math.h"
+#include "BLT_translation.h"
+
#include "DNA_armature_types.h"
#include "DNA_gpencil_modifier_types.h"
#include "DNA_gpencil_types.h"
@@ -35,8 +37,10 @@
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
#include "BKE_armature.h"
+#include "BKE_context.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_geom.h"
#include "BKE_gpencil_modifier.h"
@@ -44,10 +48,17 @@
#include "BKE_main.h"
#include "BKE_modifier.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"
@@ -181,6 +192,39 @@ static void foreachObjectLink(GpencilModifierData *md,
walk(userData, ob, &mmd->object, IDWALK_CB_NOP);
}
+static void panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *sub, *row, *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ PointerRNA ob_ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
+
+ bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
+ row = uiLayoutRow(layout, true);
+ uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetActive(sub, has_vertex_group);
+ uiLayoutSetPropDecorate(sub, false);
+ uiItemR(sub, &ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
+
+ col = uiLayoutColumnWithHeading(layout, true, IFACE_("Bind to"));
+ uiItemR(col, &ptr, "use_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE);
+ uiItemR(col, &ptr, "use_bone_envelopes", 0, IFACE_("Bone Envelopes"), ICON_NONE);
+
+ gpencil_modifier_panel_end(layout, &ptr);
+}
+
+static void panelRegister(ARegionType *region_type)
+{
+ gpencil_modifier_panel_register(region_type, eGpencilModifierType_Armature, panel_draw);
+}
+
GpencilModifierTypeInfo modifierType_Gpencil_Armature = {
/* name */ "Armature",
/* structName */ "ArmatureGpencilModifierData",
@@ -202,4 +246,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Armature = {
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
index da4c1f71f44..d92721f887f 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -35,12 +35,16 @@
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLT_translation.h"
+
#include "DNA_gpencil_modifier_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
#include "BKE_collection.h"
+#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_geom.h"
@@ -51,12 +55,19 @@
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_scene.h"
+#include "BKE_screen.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "RNA_access.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "DEG_depsgraph_query.h"
#include "MOD_gpencil_modifiertypes.h"
+#include "MOD_gpencil_ui_common.h"
#include "MOD_gpencil_util.h"
typedef struct tmpStrokes {
@@ -78,6 +89,9 @@ static void initData(GpencilModifierData *md)
gpmd->flag |= GP_ARRAY_USE_RELATIVE;
gpmd->seed = 1;
gpmd->material = NULL;
+
+ /* Open the first subpanel too, because it's activated by default. */
+ md->ui_expand_flag = (1 << 0) | (1 << 1);
}
static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
@@ -330,6 +344,143 @@ 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 *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "count", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "replace_material", 0, IFACE_("Material Override"), ICON_NONE);
+
+ gpencil_modifier_panel_end(layout, &ptr);
+}
+
+static void relative_offset_header_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiItemR(layout, &ptr, "use_relative_offset", 0, IFACE_("Relative Offset"), ICON_NONE);
+}
+
+static void relative_offset_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);
+
+ uiLayout *col = uiLayoutColumn(layout, false);
+
+ uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_relative_offset"));
+ uiItemR(col, &ptr, "relative_offset", 0, IFACE_("Factor"), ICON_NONE);
+}
+
+static void constant_offset_header_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiItemR(layout, &ptr, "use_constant_offset", 0, IFACE_("Constant Offset"), ICON_NONE);
+}
+
+static void constant_offset_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);
+
+ uiLayout *col = uiLayoutColumn(layout, false);
+
+ uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_constant_offset"));
+ uiItemR(col, &ptr, "constant_offset", 0, IFACE_("Distance"), ICON_NONE);
+}
+
+/**
+ * Object offset in a subpanel for consistency with the other offset types.
+ */
+static void object_offset_header_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiItemR(layout, &ptr, "use_object_offset", 0, NULL, ICON_NONE);
+}
+
+static void object_offset_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);
+
+ uiLayout *col = uiLayoutColumn(layout, false);
+
+ uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_object_offset"));
+ uiItemR(col, &ptr, "offset_object", 0, NULL, ICON_NONE);
+}
+
+static void random_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, "random_offset", 0, IFACE_("Offset"), ICON_NONE);
+ uiItemR(layout, &ptr, "random_rotation", 0, IFACE_("Rotation"), ICON_NONE);
+ uiItemR(layout, &ptr, "random_scale", 0, IFACE_("Scale"), ICON_NONE);
+ uiItemR(layout, &ptr, "seed", 0, NULL, ICON_NONE);
+}
+
+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_Array, panel_draw);
+ gpencil_modifier_subpanel_register(region_type,
+ "relative_offset",
+ "",
+ relative_offset_header_draw,
+ relative_offset_draw,
+ panel_type);
+ gpencil_modifier_subpanel_register(region_type,
+ "constant_offset",
+ "",
+ constant_offset_header_draw,
+ constant_offset_draw,
+ panel_type);
+ gpencil_modifier_subpanel_register(
+ region_type, "object_offset", "", object_offset_header_draw, object_offset_draw, panel_type);
+ gpencil_modifier_subpanel_register(
+ region_type, "randomize", "Randomize", NULL, random_panel_draw, panel_type);
+ gpencil_modifier_subpanel_register(
+ region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
+}
+
GpencilModifierTypeInfo modifierType_Gpencil_Array = {
/* name */ "Array",
/* structName */ "ArrayGpencilModifierData",
@@ -352,4 +503,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Array = {
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
index 71a051629d8..54ed2ffafe1 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
@@ -30,20 +30,31 @@
#include "BLI_blenlib.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_gpencil.h"
#include "BKE_gpencil_geom.h"
#include "BKE_gpencil_modifier.h"
+#include "BKE_screen.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "RNA_access.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "MOD_gpencil_modifiertypes.h"
+#include "MOD_gpencil_ui_common.h"
#include "MOD_gpencil_util.h"
static void initData(GpencilModifierData *md)
@@ -537,6 +548,88 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
}
}
+static void panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *row, *sub;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ PointerRNA ob_ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
+
+ int mode = RNA_enum_get(&ptr, "mode");
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE);
+ if (mode == GP_BUILD_MODE_CONCURRENT) {
+ uiItemR(layout, &ptr, "concurrent_time_alignment", 0, NULL, ICON_NONE);
+ }
+
+ uiItemS(layout);
+
+ uiItemR(layout, &ptr, "transition", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "start_delay", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "length", 0, IFACE_("Frames"), ICON_NONE);
+
+ uiItemS(layout);
+
+ row = uiLayoutRowWithHeading(layout, true, IFACE_("Use Factor"));
+ uiItemR(row, &ptr, "use_percentage", 0, "", ICON_NONE);
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_percentage"));
+ uiItemR(sub, &ptr, "percentage_factor", 0, "", ICON_NONE);
+
+ /* Check for incompatible time modifier. */
+ Object *ob = ob_ptr.data;
+ GpencilModifierData *md = ptr.data;
+ if (BKE_gpencil_modifiers_findby_type(ob, eGpencilModifierType_Time) != NULL) {
+ BKE_gpencil_modifier_set_error(md, "Build and Time Offset modifiers are incompatible");
+ }
+
+ gpencil_modifier_panel_end(layout, &ptr);
+}
+
+static void frame_range_header_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiItemR(layout, &ptr, "use_restrict_frame_range", 0, IFACE_("Custom Range"), ICON_NONE);
+}
+
+static void frame_range_panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiLayoutSetPropSep(layout, true);
+
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, &ptr, "frame_start", 0, IFACE_("Start"), ICON_NONE);
+ uiItemR(col, &ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
+}
+
+static void mask_panel_draw(const bContext *C, Panel *panel)
+{
+ gpencil_modifier_masking_panel_draw(C, panel, false, false);
+}
+
+static void panelRegister(ARegionType *region_type)
+{
+ PanelType *panel_type = gpencil_modifier_panel_register(
+ region_type, eGpencilModifierType_Build, panel_draw);
+ gpencil_modifier_subpanel_register(
+ region_type, "frame_range", "", frame_range_header_draw, frame_range_panel_draw, panel_type);
+ gpencil_modifier_subpanel_register(
+ region_type, "_mask", "Influence", NULL, mask_panel_draw, panel_type);
+}
+
/* ******************************************** */
GpencilModifierTypeInfo modifierType_Gpencil_Build = {
@@ -561,4 +654,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Build = {
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
index 14125d5c8d4..03137a5cf23 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
@@ -29,22 +29,33 @@
#include "BLI_math_color.h"
#include "BLI_math_vector.h"
+#include "BLT_translation.h"
+
#include "DNA_gpencil_modifier_types.h"
#include "DNA_gpencil_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_gpencil.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "BKE_material.h"
+#include "BKE_screen.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
#include "BKE_modifier.h"
+#include "RNA_access.h"
#include "DEG_depsgraph.h"
#include "MOD_gpencil_modifiertypes.h"
+#include "MOD_gpencil_ui_common.h"
#include "MOD_gpencil_util.h"
static void initData(GpencilModifierData *md)
@@ -186,6 +197,42 @@ 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, "modify_color", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "hue", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "value", UI_ITEM_R_SLIDER, 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_Color, 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_Color = {
/* name */ "Hue/Saturation",
/* structName */ "ColorGpencilModifierData",
@@ -208,4 +255,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Color = {
/* foreachObjectLink */ NULL,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
index d39c94e06d5..a0987aafcd2 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
@@ -28,15 +28,19 @@
#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_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
#include "BKE_action.h"
#include "BKE_colortools.h"
+#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_gpencil_geom.h"
#include "BKE_gpencil_modifier.h"
@@ -45,10 +49,17 @@
#include "BKE_main.h"
#include "BKE_modifier.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"
@@ -345,6 +356,81 @@ 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 *sub, *row, *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ PointerRNA ob_ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
+
+ PointerRNA hook_object_ptr = RNA_pointer_get(&ptr, "object");
+ bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
+
+ uiLayoutSetPropSep(layout, true);
+
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, &ptr, "object", 0, NULL, ICON_NONE);
+ if (!RNA_pointer_is_null(&hook_object_ptr) &&
+ RNA_enum_get(&hook_object_ptr, "type") == OB_ARMATURE) {
+ PointerRNA hook_object_data_ptr = RNA_pointer_get(&hook_object_ptr, "data");
+ uiItemPointerR(
+ col, &ptr, "subtarget", &hook_object_data_ptr, "bones", IFACE_("Bone"), ICON_NONE);
+ }
+
+ row = uiLayoutRow(layout, true);
+ uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetActive(sub, has_vertex_group);
+ uiLayoutSetPropSep(sub, false);
+ uiItemR(sub, &ptr, "invert_vertex", 0, "", ICON_ARROW_LEFTRIGHT);
+
+ uiItemR(layout, &ptr, "strength", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+
+ gpencil_modifier_panel_end(layout, &ptr);
+}
+
+static void falloff_panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *row;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ bool use_falloff = RNA_enum_get(&ptr, "falloff_type") != eWarp_Falloff_None;
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "falloff_type", 0, IFACE_("Type"), ICON_NONE);
+
+ row = uiLayoutRow(layout, false);
+ uiLayoutSetActive(row, use_falloff);
+ uiItemR(row, &ptr, "falloff_radius", 0, NULL, ICON_NONE);
+
+ uiItemR(layout, &ptr, "use_falloff_uniform", 0, NULL, ICON_NONE);
+
+ if (RNA_enum_get(&ptr, "falloff_type") == eWarp_Falloff_Curve) {
+ uiTemplateCurveMapping(layout, &ptr, "falloff_curve", 0, false, false, false, false);
+ }
+}
+
+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_Hook, panel_draw);
+ gpencil_modifier_subpanel_register(
+ region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type);
+ gpencil_modifier_subpanel_register(
+ region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
+}
+
GpencilModifierTypeInfo modifierType_Gpencil_Hook = {
/* name */ "Hook",
/* structName */ "HookGpencilModifierData",
@@ -367,4 +453,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Hook = {
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
index 92b35f390f8..0f5fc4d5cf6 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
@@ -26,12 +26,16 @@
#include "BLI_listbase.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_context.h"
#include "BKE_deform.h"
#include "BKE_gpencil_geom.h"
#include "BKE_gpencil_modifier.h"
@@ -41,10 +45,17 @@
#include "BKE_main.h"
#include "BKE_modifier.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"
@@ -208,6 +219,54 @@ 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 *sub, *row, *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ PointerRNA ob_ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
+
+ PointerRNA hook_object_ptr = RNA_pointer_get(&ptr, "object");
+ bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
+
+ uiLayoutSetPropSep(layout, true);
+
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, &ptr, "object", 0, NULL, ICON_NONE);
+ if (!RNA_pointer_is_null(&hook_object_ptr) &&
+ RNA_enum_get(&hook_object_ptr, "type") == OB_ARMATURE) {
+ PointerRNA hook_object_data_ptr = RNA_pointer_get(&hook_object_ptr, "data");
+ uiItemPointerR(
+ col, &ptr, "subtarget", &hook_object_data_ptr, "bones", IFACE_("Bone"), ICON_NONE);
+ }
+
+ row = uiLayoutRow(layout, true);
+ uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetActive(sub, has_vertex_group);
+ uiLayoutSetPropSep(sub, false);
+ uiItemR(sub, &ptr, "invert_vertex", 0, "", ICON_ARROW_LEFTRIGHT);
+
+ uiItemR(layout, &ptr, "strength", UI_ITEM_R_SLIDER, 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_Lattice, panel_draw);
+ gpencil_modifier_subpanel_register(
+ region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
+}
+
GpencilModifierTypeInfo modifierType_Gpencil_Lattice = {
/* name */ "Lattice",
/* structName */ "LatticeGpencilModifierData",
@@ -230,4 +289,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Lattice = {
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
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,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
index 22e46626a13..619c37015e4 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
@@ -29,6 +29,7 @@
#include "DNA_gpencil_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
#include "BLI_alloca.h"
#include "BLI_blenlib.h"
@@ -37,6 +38,8 @@
#include "BLI_rand.h"
#include "BLI_utildefines.h"
+#include "BLT_translation.h"
+
#include "BKE_collection.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -51,6 +54,7 @@
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_scene.h"
+#include "BKE_screen.h"
#include "bmesh.h"
#include "bmesh_tools.h"
@@ -59,7 +63,13 @@
#include "DEG_depsgraph_build.h"
#include "DEG_depsgraph_query.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)
@@ -305,8 +315,71 @@ 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 *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "duplicates", 0, NULL, ICON_NONE);
+
+ col = uiLayoutColumn(layout, false);
+ uiLayoutSetActive(layout, RNA_int_get(&ptr, "duplicates") > 0);
+ uiItemR(col, &ptr, "distance", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "offset", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+
+ gpencil_modifier_panel_end(layout, &ptr);
+}
+
+static void fade_header_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiItemR(layout, &ptr, "use_fade", 0, NULL, ICON_NONE);
+}
+
+static void fade_panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_fade"));
+
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, &ptr, "fading_center", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "fading_thickness", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "fading_opacity", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+}
+
+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_Multiply, panel_draw);
+ gpencil_modifier_subpanel_register(
+ region_type, "fade", "", fade_header_draw, fade_panel_draw, panel_type);
+ gpencil_modifier_subpanel_register(
+ region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
+}
+
GpencilModifierTypeInfo modifierType_Gpencil_Multiply = {
- /* name */ "Multiple Strokes",
+ /* name */ "MultipleStrokes",
/* structName */ "MultiplyGpencilModifierData",
/* structSize */ sizeof(MultiplyGpencilModifierData),
/* type */ eGpencilModifierTypeType_Gpencil,
@@ -327,4 +400,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Multiply = {
/* foreachObjectLink */ NULL,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
index 73328d7dd31..812bb5628e1 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
@@ -31,6 +31,8 @@
#include "BLI_math_vector.h"
#include "BLI_rand.h"
+#include "BLT_translation.h"
+
#include "MEM_guardedalloc.h"
#include "DNA_gpencil_modifier_types.h"
@@ -38,8 +40,10 @@
#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_geom.h"
@@ -47,11 +51,18 @@
#include "BKE_lib_query.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
+#include "BKE_screen.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.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)
@@ -269,6 +280,72 @@ 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 *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiLayoutSetPropSep(layout, true);
+
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, &ptr, "factor", 0, IFACE_("Position"), ICON_NONE);
+ uiItemR(col, &ptr, "factor_strength", 0, IFACE_("Strength"), ICON_NONE);
+ uiItemR(col, &ptr, "factor_thickness", 0, IFACE_("Thickness"), ICON_NONE);
+ uiItemR(col, &ptr, "factor_uvs", 0, IFACE_("UV"), ICON_NONE);
+ uiItemR(col, &ptr, "noise_scale", 0, NULL, ICON_NONE);
+
+ gpencil_modifier_panel_end(layout, &ptr);
+}
+
+static void random_header_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiItemR(layout, &ptr, "random", 0, IFACE_("Randomize"), ICON_NONE);
+}
+
+static void random_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);
+
+ uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "random"));
+
+ uiItemR(layout, &ptr, "step", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "seed", 0, NULL, ICON_NONE);
+}
+
+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_Noise, panel_draw);
+ gpencil_modifier_subpanel_register(
+ region_type, "randomize", "", random_header_draw, random_panel_draw, panel_type);
+ 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_Noise = {
/* name */ "Noise",
/* structName */ "NoiseGpencilModifierData",
@@ -291,4 +368,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Noise = {
/* foreachObjectLink */ NULL,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
index 686f589ffe9..9cc3712e8f4 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
@@ -28,22 +28,33 @@
#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_colortools.h"
+#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_gpencil_geom.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)
@@ -136,6 +147,35 @@ 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, "location", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "rotation", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "scale", 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_Offset, panel_draw);
+ gpencil_modifier_subpanel_register(
+ region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
+}
+
GpencilModifierTypeInfo modifierType_Gpencil_Offset = {
/* name */ "Offset",
/* structName */ "OffsetGpencilModifierData",
@@ -158,4 +198,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Offset = {
/* foreachObjectLink */ NULL,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
index 92b2621d211..34142709c18 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
@@ -28,13 +28,17 @@
#include "BLI_blenlib.h"
#include "BLI_math_vector.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"
@@ -42,10 +46,17 @@
#include "BKE_main.h"
#include "BKE_material.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)
@@ -180,6 +191,7 @@ static void bakeModifier(Main *UNUSED(bmain),
}
}
}
+
static void freeData(GpencilModifierData *md)
{
OpacityGpencilModifierData *gpmd = (OpacityGpencilModifierData *)md;
@@ -196,6 +208,79 @@ 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);
+
+ int modify_color = RNA_enum_get(&ptr, "modify_color");
+
+ uiItemR(layout, &ptr, "modify_color", 0, NULL, ICON_NONE);
+
+ if (modify_color == GP_MODIFY_COLOR_HARDNESS) {
+ uiItemR(layout, &ptr, "hardness", 0, NULL, ICON_NONE);
+ }
+ else {
+ uiItemR(layout, &ptr, "normalize_opacity", 0, NULL, ICON_NONE);
+ const char *text = (RNA_boolean_get(&ptr, "normalize_opacity")) ? IFACE_("Strength") :
+ IFACE_("Opacity Factor");
+ uiItemR(layout, &ptr, "hardness", 0, text, ICON_NONE);
+ }
+
+ gpencil_modifier_panel_end(layout, &ptr);
+}
+
+static void mask_panel_draw(const bContext *C, Panel *panel)
+{
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ int modify_color = RNA_enum_get(&ptr, "modify_color");
+ bool show_vertex = (modify_color != GP_MODIFY_COLOR_HARDNESS);
+
+ gpencil_modifier_masking_panel_draw(C, panel, true, show_vertex);
+}
+
+static void curve_header_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ int modify_color = RNA_enum_get(&ptr, "modify_color");
+ uiLayoutSetActive(layout, modify_color != GP_MODIFY_COLOR_HARDNESS);
+
+ gpencil_modifier_curve_header_draw(C, panel);
+}
+
+static void curve_panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ int modify_color = RNA_enum_get(&ptr, "modify_color");
+ uiLayoutSetActive(layout, modify_color != GP_MODIFY_COLOR_HARDNESS);
+
+ gpencil_modifier_curve_panel_draw(C, panel);
+}
+
+static void panelRegister(ARegionType *region_type)
+{
+ PanelType *panel_type = gpencil_modifier_panel_register(
+ region_type, eGpencilModifierType_Opacity, 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", "", curve_header_draw, curve_panel_draw, mask_panel_type);
+}
+
GpencilModifierTypeInfo modifierType_Gpencil_Opacity = {
/* name */ "Opacity",
/* structName */ "OpacityGpencilModifierData",
@@ -218,4 +303,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Opacity = {
/* foreachObjectLink */ NULL,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
index 2cda108682e..8d4556421eb 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
@@ -26,20 +26,31 @@
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
+#include "BLT_translation.h"
+
#include "DNA_gpencil_modifier_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
#include "DNA_vec_types.h"
+#include "BKE_context.h"
#include "BKE_gpencil_geom.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)
@@ -131,6 +142,48 @@ 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);
+
+ int mode = RNA_enum_get(&ptr, "mode");
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE);
+
+ if (mode == GP_SIMPLIFY_FIXED) {
+ uiItemR(layout, &ptr, "step", 0, NULL, ICON_NONE);
+ }
+ else if (mode == GP_SIMPLIFY_ADAPTIVE) {
+ uiItemR(layout, &ptr, "factor", 0, NULL, ICON_NONE);
+ }
+ else if (mode == GP_SIMPLIFY_SAMPLE) {
+ uiItemR(layout, &ptr, "length", 0, NULL, ICON_NONE);
+ }
+ else if (mode == GP_SIMPLIFY_MERGE) {
+ uiItemR(layout, &ptr, "distance", 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_Simplify, panel_draw);
+ gpencil_modifier_subpanel_register(
+ region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
+}
+
GpencilModifierTypeInfo modifierType_Gpencil_Simplify = {
/* name */ "Simplify",
/* structName */ "SimplifyGpencilModifierData",
@@ -153,4 +206,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Simplify = {
/* foreachObjectLink */ NULL,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
index e2e13b736e4..175a6d81b1b 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
@@ -26,21 +26,32 @@
#include "BLI_listbase.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_screen_types.h"
#include "BKE_colortools.h"
+#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_gpencil_geom.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)
@@ -174,6 +185,47 @@ 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 *row;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ row = uiLayoutRow(layout, true);
+ uiItemR(row, &ptr, "use_edit_position", UI_ITEM_R_TOGGLE, IFACE_("Position"), ICON_NONE);
+ uiItemR(row, &ptr, "use_edit_strength", UI_ITEM_R_TOGGLE, IFACE_("Stength"), ICON_NONE);
+ uiItemR(row, &ptr, "use_edit_thickness", UI_ITEM_R_TOGGLE, IFACE_("Thickness"), ICON_NONE);
+ uiItemR(row, &ptr, "use_edit_uv", UI_ITEM_R_TOGGLE, IFACE_("UV"), ICON_NONE);
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "factor", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "step", 0, IFACE_("Repeat"), 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_Smooth, 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_Smooth = {
/* name */ "Smooth",
/* structName */ "SmoothGpencilModifierData",
@@ -196,4 +248,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Smooth = {
/* foreachObjectLink */ NULL,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
index 072159136ce..2797235c002 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
@@ -28,20 +28,31 @@
#include "BLI_listbase.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_context.h"
#include "BKE_gpencil_geom.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)
@@ -112,6 +123,34 @@ 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, "subdivision_type", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "level", 0, IFACE_("Subdivisions"), 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_Subdiv, panel_draw);
+ gpencil_modifier_subpanel_register(
+ region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
+}
+
GpencilModifierTypeInfo modifierType_Gpencil_Subdiv = {
/* name */ "Subdivide",
/* structName */ "SubdivGpencilModifierData",
@@ -134,4 +173,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Subdiv = {
/* foreachObjectLink */ NULL,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltexture.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltexture.c
index a5adf12b617..2d16b6ead5c 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltexture.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltexture.c
@@ -27,23 +27,34 @@
#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_geom.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)
@@ -147,8 +158,56 @@ 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 *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ int mode = RNA_enum_get(&ptr, "mode");
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE);
+
+ if (ELEM(mode, STROKE, STROKE_AND_FILL)) {
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, &ptr, "fit_method", 0, IFACE_("Stroke Fit Method"), ICON_NONE);
+ uiItemR(col, &ptr, "uv_offset", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "uv_scale", 0, IFACE_("Scale"), ICON_NONE);
+ }
+
+ if (mode == STROKE_AND_FILL) {
+ uiItemS(layout);
+ }
+
+ if (ELEM(mode, FILL, STROKE_AND_FILL)) {
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, &ptr, "fill_rotation", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "fill_offset", 0, IFACE_("Offset"), ICON_NONE);
+ uiItemR(col, &ptr, "fill_scale", 0, IFACE_("Scale"), 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_Texture, panel_draw);
+ gpencil_modifier_subpanel_register(
+ region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
+}
+
GpencilModifierTypeInfo modifierType_Gpencil_Texture = {
- /* name */ "Texture Mapping",
+ /* name */ "TextureMapping",
/* structName */ "TextureGpencilModifierData",
/* structSize */ sizeof(TextureGpencilModifierData),
/* type */ eGpencilModifierTypeType_Gpencil,
@@ -169,4 +228,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Texture = {
/* foreachObjectLink */ NULL,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
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,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
index 85400b56cad..49396f56d26 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
@@ -26,20 +26,31 @@
#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_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)
@@ -165,8 +176,91 @@ static int remapTime(struct GpencilModifierData *md,
return cfra + offset;
}
+static void panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *row, *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ int mode = RNA_enum_get(&ptr, "mode");
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE);
+
+ col = uiLayoutColumn(layout, false);
+
+ const char *text = (mode == GP_TIME_MODE_FIX) ? IFACE_("Frame") : IFACE_("Frame Offset");
+ uiItemR(col, &ptr, "offset", 0, text, ICON_NONE);
+
+ row = uiLayoutRow(col, false);
+ uiLayoutSetActive(row, mode != GP_TIME_MODE_FIX);
+ uiItemR(row, &ptr, "frame_scale", 0, IFACE_("Scale"), ICON_NONE);
+
+ row = uiLayoutRow(layout, false);
+ uiLayoutSetActive(row, mode != GP_TIME_MODE_FIX);
+ uiItemR(row, &ptr, "use_keep_loop", 0, NULL, ICON_NONE);
+
+ gpencil_modifier_panel_end(layout, &ptr);
+}
+
+static void custom_range_header_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ int mode = RNA_enum_get(&ptr, "mode");
+
+ uiLayoutSetActive(layout, mode != GP_TIME_MODE_FIX);
+
+ uiItemR(layout, &ptr, "use_custom_frame_range", 0, NULL, ICON_NONE);
+}
+
+static void custom_range_panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ int mode = RNA_enum_get(&ptr, "mode");
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiLayoutSetActive(
+ layout, (mode != GP_TIME_MODE_FIX) && (RNA_boolean_get(&ptr, "use_custom_frame_range")));
+
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, &ptr, "frame_start", 0, IFACE_("Frame Start"), ICON_NONE);
+ uiItemR(col, &ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
+}
+
+static void mask_panel_draw(const bContext *C, Panel *panel)
+{
+ gpencil_modifier_masking_panel_draw(C, panel, false, false);
+}
+
+static void panelRegister(ARegionType *region_type)
+{
+ PanelType *panel_type = gpencil_modifier_panel_register(
+ region_type, eGpencilModifierType_Time, panel_draw);
+ gpencil_modifier_subpanel_register(region_type,
+ "custom_range",
+ "",
+ custom_range_header_draw,
+ custom_range_panel_draw,
+ panel_type);
+ gpencil_modifier_subpanel_register(
+ region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
+}
+
GpencilModifierTypeInfo modifierType_Gpencil_Time = {
- /* name */ "Time Offset",
+ /* name */ "TimeOffset",
/* structName */ "TimeGpencilModifierData",
/* structSize */ sizeof(TimeGpencilModifierData),
/* type */ eGpencilModifierTypeType_Gpencil,
@@ -187,4 +281,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Time = {
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
index c35728bc8b3..da7d33839f1 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
@@ -28,16 +28,20 @@
#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_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
#include "BKE_action.h"
#include "BKE_colorband.h"
#include "BKE_colortools.h"
+#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
@@ -47,10 +51,17 @@
#include "BKE_material.h"
#include "BKE_modifier.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"
@@ -330,6 +341,56 @@ 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 *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ int tint_type = RNA_enum_get(&ptr, "tint_type");
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "vertex_mode", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "factor", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "tint_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+
+ if (tint_type == GP_TINT_UNIFORM) {
+ uiItemR(layout, &ptr, "color", 0, NULL, ICON_NONE);
+ }
+ else {
+ col = uiLayoutColumn(layout, false);
+ uiLayoutSetPropSep(col, false);
+ uiTemplateColorRamp(col, &ptr, "colors", true);
+ uiItemS(layout);
+ uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "radius", 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_Tint, 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_Tint = {
/* name */ "Tint",
/* structName */ "TintGpencilModifierData",
@@ -352,4 +413,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Tint = {
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};