diff options
author | Hans Goudey <h.goudey@me.com> | 2020-05-13 22:21:30 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-05-13 22:21:30 +0300 |
commit | 5e96c438546932ca875aa35afb8c73f9a68d62a1 (patch) | |
tree | 03f7ed694262946243d8e487c815261bce9bd113 /source/blender | |
parent | 2b5e301ea4612c576a5934d1e1a79d5452f6792a (diff) |
Fix T76556: Apply parenting when joining parent into object
The current behavior isn't necessarily "incorrect," but it's unintuitive
and confusing. A simple fix is to apply parentinv before finishing the
operator.
However, there may still be issues when the object's parent has a parent.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D7723
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/mesh/meshtools.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 8dbd468d04f..917bbe61e3d 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -314,7 +314,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) int a, b, totcol, totmat = 0, totedge = 0, totvert = 0; int totloop = 0, totpoly = 0, vertofs, *matmap = NULL; int i, haskey = 0, edgeofs, loopofs, polyofs; - bool ok = false; + bool ok = false, join_parent = false; bDeformGroup *dg, *odg; CustomData vdata, edata, fdata, ldata, pdata; @@ -346,6 +346,10 @@ int join_mesh_exec(bContext *C, wmOperator *op) ok = true; } + if ((ob->parent != NULL) && (ob_iter == ob->parent)) { + join_parent = true; + } + /* check for shapekeys */ if (me->key) { haskey++; @@ -354,6 +358,13 @@ int join_mesh_exec(bContext *C, wmOperator *op) } CTX_DATA_END; + /* Apply parent transform if the active object's parent was joined to it. + * Note: This doesn't apply recursive parenting. */ + if (join_parent) { + ob->parent = NULL; + BKE_object_apply_mat4_ex(ob, ob->obmat, ob->parent, ob->parentinv, false); + } + /* that way the active object is always selected */ if (ok == false) { BKE_report(op->reports, RPT_WARNING, "Active object is not a selected mesh"); |