Merge branch 'blender-v5.0-release'
This commit is contained in:
@@ -620,17 +620,19 @@ wmOperatorStatus join_objects_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
MutableSpan<int> dst_face_offsets = dst_mesh->face_offsets_for_write();
|
||||
for (const int i : objects_to_join.index_range()) {
|
||||
const Object &src_object = *objects_to_join[i];
|
||||
const IndexRange dst_range = face_ranges[i];
|
||||
const Mesh &src_mesh = *static_cast<const Mesh *>(src_object.data);
|
||||
const Span<int> src_face_offsets = src_mesh.face_offsets();
|
||||
for (const int face : dst_range.index_range()) {
|
||||
dst_face_offsets[dst_range[face]] = src_face_offsets[face] + corner_ranges[i].start();
|
||||
if (dst_mesh->faces_num > 0) {
|
||||
MutableSpan<int> dst_face_offsets = dst_mesh->face_offsets_for_write();
|
||||
for (const int i : objects_to_join.index_range()) {
|
||||
const Object &src_object = *objects_to_join[i];
|
||||
const IndexRange dst_range = face_ranges[i];
|
||||
const Mesh &src_mesh = *static_cast<const Mesh *>(src_object.data);
|
||||
const Span<int> src_face_offsets = src_mesh.face_offsets();
|
||||
for (const int face : dst_range.index_range()) {
|
||||
dst_face_offsets[dst_range[face]] = src_face_offsets[face] + corner_ranges[i].start();
|
||||
}
|
||||
}
|
||||
dst_face_offsets.last() = dst_mesh->corners_num;
|
||||
}
|
||||
dst_face_offsets.last() = dst_mesh->corners_num;
|
||||
|
||||
join_face_sets(objects_to_join, face_ranges, *dst_mesh);
|
||||
|
||||
|
||||
@@ -213,6 +213,24 @@ class TestMeshJoin(unittest.TestCase):
|
||||
self.assertEqual(len(cube_2.data.vertices), 16)
|
||||
self.assertEqual(len(cube_2.data.shape_keys.key_blocks), 4)
|
||||
|
||||
def test_no_faces(self):
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.object.delete()
|
||||
|
||||
bpy.ops.mesh.primitive_cube_add()
|
||||
bpy.ops.mesh.primitive_cube_add()
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
|
||||
bpy.ops.mesh.select_all(action='SELECT')
|
||||
bpy.ops.mesh.delete(type='ONLY_FACE')
|
||||
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
|
||||
|
||||
bpy.ops.object.join()
|
||||
|
||||
joined = bpy.context.object
|
||||
self.assertEqual(len(joined.data.vertices), 16)
|
||||
self.assertEqual(len(joined.data.polygons), 0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
||||
Reference in New Issue
Block a user