@@ -1346,7 +1346,7 @@ def extend(self, N: int):
1346
1346
return Meshes (verts = new_verts_list , faces = new_faces_list , textures = tex )
1347
1347
1348
1348
1349
- def join_meshes (meshes : List [Meshes ], include_textures : bool = True ):
1349
+ def join_meshes_as_batch (meshes : List [Meshes ], include_textures : bool = True ):
1350
1350
"""
1351
1351
Merge multiple Meshes objects, i.e. concatenate the meshes objects. They
1352
1352
must all be on the same device. If include_textures is true, they must all
@@ -1363,58 +1363,58 @@ def join_meshes(meshes: List[Meshes], include_textures: bool = True):
1363
1363
"""
1364
1364
if isinstance (meshes , Meshes ):
1365
1365
# Meshes objects can be iterated and produce single Meshes. We avoid
1366
- # letting join_meshes (mesh1, mesh2) silently do the wrong thing.
1367
- raise ValueError ("Wrong first argument to join_meshes ." )
1366
+ # letting join_meshes_as_batch (mesh1, mesh2) silently do the wrong thing.
1367
+ raise ValueError ("Wrong first argument to join_meshes_as_batch ." )
1368
1368
verts = [v for mesh in meshes for v in mesh .verts_list ()]
1369
1369
faces = [f for mesh in meshes for f in mesh .faces_list ()]
1370
1370
if len (meshes ) == 0 or not include_textures :
1371
1371
return Meshes (verts = verts , faces = faces )
1372
1372
1373
1373
if meshes [0 ].textures is None :
1374
1374
if any (mesh .textures is not None for mesh in meshes ):
1375
- raise ValueError ("Inconsistent textures in join_meshes ." )
1375
+ raise ValueError ("Inconsistent textures in join_meshes_as_batch ." )
1376
1376
return Meshes (verts = verts , faces = faces )
1377
1377
1378
1378
if any (mesh .textures is None for mesh in meshes ):
1379
- raise ValueError ("Inconsistent textures in join_meshes ." )
1379
+ raise ValueError ("Inconsistent textures in join_meshes_as_batch ." )
1380
1380
1381
1381
# Now we know there are multiple meshes and they have textures to merge.
1382
1382
first = meshes [0 ].textures
1383
1383
kwargs = {}
1384
1384
if first .maps_padded () is not None :
1385
1385
if any (mesh .textures .maps_padded () is None for mesh in meshes ):
1386
- raise ValueError ("Inconsistent maps_padded in join_meshes ." )
1386
+ raise ValueError ("Inconsistent maps_padded in join_meshes_as_batch ." )
1387
1387
maps = [m for mesh in meshes for m in mesh .textures .maps_padded ()]
1388
1388
kwargs ["maps" ] = maps
1389
1389
elif any (mesh .textures .maps_padded () is not None for mesh in meshes ):
1390
- raise ValueError ("Inconsistent maps_padded in join_meshes ." )
1390
+ raise ValueError ("Inconsistent maps_padded in join_meshes_as_batch ." )
1391
1391
1392
1392
if first .verts_uvs_padded () is not None :
1393
1393
if any (mesh .textures .verts_uvs_padded () is None for mesh in meshes ):
1394
- raise ValueError ("Inconsistent verts_uvs_padded in join_meshes ." )
1394
+ raise ValueError ("Inconsistent verts_uvs_padded in join_meshes_as_batch ." )
1395
1395
uvs = [uv for mesh in meshes for uv in mesh .textures .verts_uvs_list ()]
1396
1396
V = max (uv .shape [0 ] for uv in uvs )
1397
1397
kwargs ["verts_uvs" ] = struct_utils .list_to_padded (uvs , (V , 2 ), - 1 )
1398
1398
elif any (mesh .textures .verts_uvs_padded () is not None for mesh in meshes ):
1399
- raise ValueError ("Inconsistent verts_uvs_padded in join_meshes ." )
1399
+ raise ValueError ("Inconsistent verts_uvs_padded in join_meshes_as_batch ." )
1400
1400
1401
1401
if first .faces_uvs_padded () is not None :
1402
1402
if any (mesh .textures .faces_uvs_padded () is None for mesh in meshes ):
1403
- raise ValueError ("Inconsistent faces_uvs_padded in join_meshes ." )
1403
+ raise ValueError ("Inconsistent faces_uvs_padded in join_meshes_as_batch ." )
1404
1404
uvs = [uv for mesh in meshes for uv in mesh .textures .faces_uvs_list ()]
1405
1405
F = max (uv .shape [0 ] for uv in uvs )
1406
1406
kwargs ["faces_uvs" ] = struct_utils .list_to_padded (uvs , (F , 3 ), - 1 )
1407
1407
elif any (mesh .textures .faces_uvs_padded () is not None for mesh in meshes ):
1408
- raise ValueError ("Inconsistent faces_uvs_padded in join_meshes ." )
1408
+ raise ValueError ("Inconsistent faces_uvs_padded in join_meshes_as_batch ." )
1409
1409
1410
1410
if first .verts_rgb_padded () is not None :
1411
1411
if any (mesh .textures .verts_rgb_padded () is None for mesh in meshes ):
1412
- raise ValueError ("Inconsistent verts_rgb_padded in join_meshes ." )
1412
+ raise ValueError ("Inconsistent verts_rgb_padded in join_meshes_as_batch ." )
1413
1413
rgb = [i for mesh in meshes for i in mesh .textures .verts_rgb_list ()]
1414
1414
V = max (i .shape [0 ] for i in rgb )
1415
1415
kwargs ["verts_rgb" ] = struct_utils .list_to_padded (rgb , (V , 3 ))
1416
1416
elif any (mesh .textures .verts_rgb_padded () is not None for mesh in meshes ):
1417
- raise ValueError ("Inconsistent verts_rgb_padded in join_meshes ." )
1417
+ raise ValueError ("Inconsistent verts_rgb_padded in join_meshes_as_batch ." )
1418
1418
1419
1419
tex = Textures (** kwargs )
1420
1420
return Meshes (verts = verts , faces = faces , textures = tex )
0 commit comments