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/MOD_gpencillattice.c')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c67
1 files changed, 64 insertions, 3 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
index 5d5d673ca55..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"
@@ -105,7 +116,8 @@ static void deformStroke(GpencilModifierData *md,
if (weight < 0.0f) {
continue;
}
- calc_latt_deform((struct LatticeDeformData *)mmd->cache_data, &pt->x, mmd->strength * weight);
+ BKE_lattice_deform_data_eval_co(
+ (struct LatticeDeformData *)mmd->cache_data, &pt->x, mmd->strength * weight);
}
/* Calc geometry data. */
BKE_gpencil_stroke_geometry_update(gps);
@@ -147,7 +159,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData
/* free lingering data */
ldata = (struct LatticeDeformData *)mmd->cache_data;
if (ldata) {
- end_latt_deform(ldata);
+ BKE_lattice_deform_data_destroy(ldata);
mmd->cache_data = NULL;
}
@@ -162,7 +174,7 @@ static void freeData(GpencilModifierData *md)
struct LatticeDeformData *ldata = (struct LatticeDeformData *)mmd->cache_data;
/* free deform data */
if (ldata) {
- end_latt_deform(ldata);
+ BKE_lattice_deform_data_destroy(ldata);
}
}
@@ -207,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",
@@ -229,4 +289,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Lattice = {
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
+ /* panelRegister */ panelRegister,
};