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:
authorCampbell Barton <campbell@blender.org>2022-05-05 13:36:15 +0300
committerCampbell Barton <campbell@blender.org>2022-05-05 13:36:15 +0300
commit78fc5ea1c398f70d22cda72be33c105146c0d542 (patch)
tree84482209d4a5bf317a6dae196ade6e0c67df9d57 /source/blender/editors/object/object_add.cc
parent598917f49b3564c1ca1b28907547332d69a85328 (diff)
Workaround T81065: Merge UV's when applying modifiers
Support merging UV's that share the same vertex and are very close when applying modifiers. This is needed to prevent UV's becoming "detached" which can happen when applying the subdivision surface modifier. This regression was caused by [0] which removed selection threshold for nearby coordinates. While restoring the UV selection threshold could be done - some selection operations that walk around connected UV fans wouldn't behave in a deterministic way (such as select shortest path). There are also other cases where UV's may be compared without a threshold such as tangent calculation and exporters which have their own logic to handling UV's. Also resolves T86896, T89903. [0]: b88dd3b8e7b9c02ae08d4679bb427963c5d21250 Reviewed By: sergey Ref D14841
Diffstat (limited to 'source/blender/editors/object/object_add.cc')
-rw-r--r--source/blender/editors/object/object_add.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc
index 5b857d2dba1..db8860efdd8 100644
--- a/source/blender/editors/object/object_add.cc
+++ b/source/blender/editors/object/object_add.cc
@@ -2894,6 +2894,7 @@ static int object_convert_exec(bContext *C, wmOperator *op)
Object *ob1, *obact = CTX_data_active_object(C);
const short target = RNA_enum_get(op->ptr, "target");
bool keep_original = RNA_boolean_get(op->ptr, "keep_original");
+ const bool do_merge_customdata = RNA_boolean_get(op->ptr, "merge_customdata");
const float angle = RNA_float_get(op->ptr, "angle");
const int thickness = RNA_int_get(op->ptr, "thickness");
@@ -3122,6 +3123,10 @@ static int object_convert_exec(bContext *C, wmOperator *op)
Mesh *new_mesh = (Mesh *)newob->data;
BKE_mesh_nomain_to_mesh(me_eval, new_mesh, newob, &CD_MASK_MESH, true);
+ if (do_merge_customdata) {
+ BKE_mesh_merge_customdata_for_apply_modifier(new_mesh);
+ }
+
/* Anonymous attributes shouldn't be available on the applied geometry. */
MeshComponent component;
component.replace(new_mesh, GeometryOwnershipType::Editable);
@@ -3441,7 +3446,11 @@ static void object_convert_ui(bContext *UNUSED(C), wmOperator *op)
uiItemR(layout, op->ptr, "target", 0, nullptr, ICON_NONE);
uiItemR(layout, op->ptr, "keep_original", 0, nullptr, ICON_NONE);
- if (RNA_enum_get(op->ptr, "target") == OB_GPENCIL) {
+ const int target = RNA_enum_get(op->ptr, "target");
+ if (target == OB_MESH) {
+ uiItemR(layout, op->ptr, "merge_customdata", 0, nullptr, ICON_NONE);
+ }
+ else if (target == OB_GPENCIL) {
uiItemR(layout, op->ptr, "thickness", 0, nullptr, ICON_NONE);
uiItemR(layout, op->ptr, "angle", 0, nullptr, ICON_NONE);
uiItemR(layout, op->ptr, "offset", 0, nullptr, ICON_NONE);
@@ -3477,6 +3486,13 @@ void OBJECT_OT_convert(wmOperatorType *ot)
"Keep Original",
"Keep original objects instead of replacing them");
+ RNA_def_boolean(
+ ot->srna,
+ "merge_customdata",
+ true,
+ "Merge UV's",
+ "Merge UV coordinates that share a vertex to account for imprecision in some modifiers");
+
prop = RNA_def_float_rotation(ot->srna,
"angle",
0,