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/editors/object/object_add.c')
-rw-r--r--source/blender/editors/object/object_add.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 916c26e7667..63bc7c4071c 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -2929,20 +2929,45 @@ static int join_exec(bContext *C, wmOperator *op)
}
}
+ int ret = OPERATOR_CANCELLED;
if (ob->type == OB_MESH) {
- return join_mesh_exec(C, op);
+ ret = join_mesh_exec(C, op);
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
- return join_curve_exec(C, op);
+ ret = join_curve_exec(C, op);
}
else if (ob->type == OB_ARMATURE) {
- return join_armature_exec(C, op);
+ ret = join_armature_exec(C, op);
}
else if (ob->type == OB_GPENCIL) {
- return ED_gpencil_join_objects_exec(C, op);
- }
-
- return OPERATOR_CANCELLED;
+ ret = ED_gpencil_join_objects_exec(C, op);
+ }
+
+ if (ret & OPERATOR_FINISHED) {
+ /* Even though internally failure to invert is accounted for with a fallback,
+ * show a warning since the result may not be what the user expects. See T80077.
+ *
+ * Failure to invert the matrix is typically caused by zero scaled axes
+ * (which can be caused by constraints, even if the input scale isn't zero).
+ *
+ * Internally the join functions use #invert_m4_m4_safe_ortho which creates
+ * an inevitable matrix from one that has one or more degenerate axes.
+ *
+ * In most cases we don't worry about special handling for non-inevitable matrices however for
+ * joining objects there may be flat 2D objects where it's not obvious the scale is zero.
+ * In this case, using #invert_m4_m4_safe_ortho works as well as we can expect,
+ * joining the contents, flattening on the axis that's zero scaled.
+ * If the zero scale is removed, the data on this axis remains un-scaled
+ * (something that wouldn't work for #invert_m4_m4_safe). */
+ float imat_test[4][4];
+ if (!invert_m4_m4(imat_test, ob->obmat)) {
+ BKE_report(op->reports,
+ RPT_WARNING,
+ "Active object final transform has one or more zero scaled axes");
+ }
+ }
+
+ return ret;
}
void OBJECT_OT_join(wmOperatorType *ot)