Fix #128839: "Apply Visual Geometry to Mesh" doesn't apply shape-keys
Technically a regression in [0] although it matches behavior prior to v3.3 going back to 2.7x. The fix for #101883 [1] added a check for the vertex number changing after the number was zeroed, causing the shape key to be cleared in most cases. While the handling of shape-keys in OBJECT_OT_convert wasn't well defined - clearing the shape-key means in the evaluated coordinates are always used so it is preferable. Now the operator ensures the old (un-evaluated) shape-key isn't used. [0]:0791f53029[1]:be32882e1c
This commit is contained in:
@@ -3279,6 +3279,22 @@ static int object_convert_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
Mesh *ob_data_mesh = (Mesh *)newob->data;
|
||||
|
||||
if (ob_data_mesh->key) {
|
||||
/* NOTE(@ideasman42): Clearing the shape-key is needed when the
|
||||
* number of vertices remains unchanged. Otherwise using this operator
|
||||
* to "Apply Visual Geometry" will evaluate using the existing shape-key
|
||||
* which doesn't have the "evaluated" coordinates from `new_mesh`.
|
||||
* See #128839 for details.
|
||||
*
|
||||
* While shape-keys could be supported, this is more of a feature to consider.
|
||||
* As there are already a `MESH_OT_blend_from_shape` operator,
|
||||
* it's not clear this is especially useful or needed. */
|
||||
if (!CustomData_has_layer(&new_mesh->vert_data, CD_SHAPEKEY)) {
|
||||
id_us_min(&ob_data_mesh->key->id);
|
||||
ob_data_mesh->key = nullptr;
|
||||
}
|
||||
}
|
||||
BKE_mesh_nomain_to_mesh(new_mesh, ob_data_mesh, newob);
|
||||
|
||||
BKE_object_free_modifiers(newob, 0); /* after derivedmesh calls! */
|
||||
|
||||
Reference in New Issue
Block a user