From c186cfe419baa6f715544353b0861c374150b87b Mon Sep 17 00:00:00 2001 From: Antonioya Date: Tue, 25 Jun 2019 13:59:59 +0200 Subject: GPencil: Add Lattice modifier when use Ctrl+P to Lattice Deform When parent a Grease Pencil object to Lattice, automatically a Lattice modifier is added. --- source/blender/editors/object/object_relations.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/blender/editors/object/object_relations.c') diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 42b27d1d255..e6637265fbc 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -898,6 +898,17 @@ bool ED_object_parent_set(ReportList *reports, invert_m4_m4(ob->parentinv, workob.obmat); } + else if ((ob->type == OB_GPENCIL) && (par->type == OB_LATTICE)) { + /* Add Lattice modifier */ + if (partype == PAR_LATTICE) { + ED_gpencil_add_lattice_modifier(C, reports, ob, par); + } + /* get corrected inverse */ + ob->partype = PAROBJECT; + BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob); + + invert_m4_m4(ob->parentinv, workob.obmat); + } else { /* calculate inverse parent matrix */ BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob); -- cgit v1.2.3