substance3d_baker_info_handlers module

Example of usage with Substance3dBakerInfoOutputHandler (output_handlers module):

# call a substance3d_baker_info with the kwarg output_handler=True to get an OutputHandler instead of Popen
# the OutputHandler will stop the interpreter during the batchtool process exactly like Popen.wait()
out = batchtools.substance3d_baker_info('foo.fbx', output_handler=True)
print(out)
# <pysbs.batchtools.output_handlers.Substance3dBakerInfoOutputHandler object at 0x7f8808fe1c50>
# to get the result use get_results, an OutputHandler's common method that extracts the meshes information from the raw output
results = out.get_results()
print(results)
# [<pysbs.batchtools.substance3d_baker_info_handlers.Substance3dBakerInfoMeshStruct object at 0x7f7757881c10>, <pysbs.batchtools.substance3d_baker_info_handlers.Substance3dBakerInfoMeshStruct object at 0x7f7757881e10>]
# Substance3dBakerInfoOutputHandler.get_results() return a list of Substance3dBakerInfoMeshStruct. Follow the doc to get more details of Substance3dBakerInfoMeshStruct
# as much as possible each member type is converted in a python type.
for mesh in results:
    # some examples of its different members
    print(mesh.path)
    print(mesh.vertices_number)
    for uv in mesh.uvs:
        print(uv.udim_tiles)
    for subpart in mesh.geom_subsets:
        print(subpart.color)
# it become easy to retrieve all the udims or uv tiles:
all_udims = set([udim for mesh in results for uv in mesh.uvs for udim in uv.udim_tiles])

# an other OutputHandler common method is dump() to write the output in a stream IO (file)
with open("dumped_file.ext", 'w') as f:
    out.dump(f)
class batchtools.substance3d_baker_info_handlers.Substance3dBakerInfoBboxStruct(minimal_point=(), maximal_point=(), center=(), size=())

Bases: object

Bbox handles bounding box info of a mesh, member of Substance3dBakerInfoMeshStruct.

Parameters:
  • minimal_point – the smallest point of the box

  • maximal_point – the highest point of the box

  • center – the center of the box

  • size – the size of the box

class batchtools.substance3d_baker_info_handlers.Substance3dBakerInfoGeomSubsetStruct(path='', material_ID='', color='', faces_number=0)

Bases: object

GeomSubset handles material info for each mesh’s geomsubset, member of Substance3dBakerInfoMeshStruct.

Parameters:
  • path – path to the object in the scene

  • material_ID – material name

  • color – color assignation

  • faces_number – faces number present in this geomsubset

class batchtools.substance3d_baker_info_handlers.Substance3dBakerInfoLocStruct(local_transformation, global_transformation)

Bases: object

Loc handles location info of a mesh, member of Substance3dBakerInfoMeshStruct. Warning, the values is not relevant with obj format.

Parameters:
  • local_transformation – local transformation matrix

  • global_transformation – global transformation matrix

class batchtools.substance3d_baker_info_handlers.Substance3dBakerInfoMeshStruct(path='', name='', enabled=True, vertices_number=0, faces_number=0, material_ID='', color='', uvs=None, geom_subsets=None, bounding_box=None, location=None)

Bases: object

Mesh is the higher structure of substance3d_baker info. It defines the mesh object in the scene. Substance3dBakerInfoOutputHandler.get_results returns a list of Substance3dBakerInfoMeshStruct instances. Each argument is accessible with attribute members.

Parameters:
  • path – path to the object in the scene

  • name – name of the mesh part

  • enabled – if the object is enabled

  • vertices_number – mesh’s vertices number

  • faces_number – faces number

  • material_ID – material name

  • color – color assignation

  • uvs – uv info handled by Substance3dBakerInfoUvStruct

  • geom_subsets – sub parts of a mesh, usually defined by a material assignation or a shader group

  • bounding_box – bounding box info handled by Substance3dBakerInfoBboxStruct.

  • location – location info handled by Substance3dBakerInfoLocStruct.

static convert_str_value(value)
property enabled
class batchtools.substance3d_baker_info_handlers.Substance3dBakerInfoUvStruct(is_in_unit_square='1', points_number=0, uv_tiles='', udim_tiles='')

Bases: object

Uv handles UV info for each mesh’s uv sets, member of Substance3dBakerInfoMeshStruct.

Parameters:
  • is_in_unit_square – if all the uvs is in the 0-1 space

  • points_number – points number

  • uv_tiles – uv tiles where points are present (could be several)

  • udim_tiles – udim tiles where points are present (could be several)

property udim_tiles
property uv_tiles