User Guide Cancel

sbsbaker_info_handlers | Substance 3D Automation ToolKit

sbsbaker_info_handlers

Example of usage with SbsBakerInfoOutputHandler (output_handlers module):

# call a sbsbaker_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.sbsbaker_info('foo.fbx', output_handler=True)
print(out)
# <pysbs.batchtools.output_handlers.SbsBakerInfoOutputHandler object at 0x7f8808fe1c50>
# to get the result use get_results, an OutputHandler's common method
results = out.get_results()
print(results)
# [<pysbs.batchtools.sbsbaker_info_handlers.SbsBakerInfoEntityStruct object at 0x7f7757881c10>, <pysbs.batchtools.sbsbaker_info_handlers.SbsBakerInfoEntityStruct object at 0x7f7757881e10>]
# SbsBakerInfoOutputHandler.get_results() return a list of SbsBakerInfoEntityStruct. Follow the doc to get more details of SbsBakerInfoEntityStruct
# as mush as possible each member type is converted in a python type.
for entity in results:
# some examples of its different members
print(entity.label)
for mesh in entity.meshes:
print(mesh.vertices_number)
for uv in mesh.uvs:
print(uv.udim_tiles)
for subpart in mesh.submeshes:
print(subpart.color)
# it become easy to retrieve all the udims or uv tiles:
all_udims = set([udim for entity in out for mesh in entity.meshes 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)
# call a sbsbaker_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.sbsbaker_info('foo.fbx', output_handler=True) print(out) # <pysbs.batchtools.output_handlers.SbsBakerInfoOutputHandler object at 0x7f8808fe1c50> # to get the result use get_results, an OutputHandler's common method results = out.get_results() print(results) # [<pysbs.batchtools.sbsbaker_info_handlers.SbsBakerInfoEntityStruct object at 0x7f7757881c10>, <pysbs.batchtools.sbsbaker_info_handlers.SbsBakerInfoEntityStruct object at 0x7f7757881e10>] # SbsBakerInfoOutputHandler.get_results() return a list of SbsBakerInfoEntityStruct. Follow the doc to get more details of SbsBakerInfoEntityStruct # as mush as possible each member type is converted in a python type. for entity in results: # some examples of its different members print(entity.label) for mesh in entity.meshes: print(mesh.vertices_number) for uv in mesh.uvs: print(uv.udim_tiles) for subpart in mesh.submeshes: print(subpart.color) # it become easy to retrieve all the udims or uv tiles: all_udims = set([udim for entity in out for mesh in entity.meshes 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)
# call a sbsbaker_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.sbsbaker_info('foo.fbx', output_handler=True) 
print(out) 
# <pysbs.batchtools.output_handlers.SbsBakerInfoOutputHandler object at 0x7f8808fe1c50> 
# to get the result use get_results, an OutputHandler's common method 
results = out.get_results() 
print(results) 
# [<pysbs.batchtools.sbsbaker_info_handlers.SbsBakerInfoEntityStruct object at 0x7f7757881c10>, <pysbs.batchtools.sbsbaker_info_handlers.SbsBakerInfoEntityStruct object at 0x7f7757881e10>] 
# SbsBakerInfoOutputHandler.get_results() return a list of SbsBakerInfoEntityStruct. Follow the doc to get more details of SbsBakerInfoEntityStruct 
# as mush as possible each member type is converted in a python type. 
for entity in results: 
    # some examples of its different members 
    print(entity.label) 
    for mesh in entity.meshes: 
        print(mesh.vertices_number) 
        for uv in mesh.uvs: 
            print(uv.udim_tiles) 
        for subpart in mesh.submeshes: 
            print(subpart.color) 
# it become easy to retrieve all the udims or uv tiles: 
all_udims = set([udim for entity in out for mesh in entity.meshes 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.sbsbaker_info_handlers.SbsBakerInfoBboxStruct(minimal_point=(), maximal_point=(), center=(), size=())
class batchtools.sbsbaker_info_handlers.SbsBakerInfoBboxStruct(minimal_point=(), maximal_point=(), center=(), size=())
class batchtools.sbsbaker_info_handlers.SbsBakerInfoBboxStruct(minimal_point=(), maximal_point=(), center=(), size=())

Bases: object

Bbox handles bounding box info of an object, member of SbsBakerInfoEntityStruct.

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.sbsbaker_info_handlers.SbsBakerInfoEntityStruct(label='', enabled=True, bounding_box=None, location=None, meshes=None)
class batchtools.sbsbaker_info_handlers.SbsBakerInfoEntityStruct(label='', enabled=True, bounding_box=None, location=None, meshes=None)
class batchtools.sbsbaker_info_handlers.SbsBakerInfoEntityStruct(label='', enabled=True, bounding_box=None, location=None, meshes=None)

Bases: object

Entity is the higher structure of sbsbaker info. It defined an object in the scene. SbsBakeInfoOutputHandler info return a list of SbsBakerInfoEntityStruct instance. Each arguments is accessible with attribute members.

Parameters:
enabled
enabled
enabled
class batchtools.sbsbaker_info_handlers.SbsBakerInfoLocStruct(local_transformation, global_transformation)
class batchtools.sbsbaker_info_handlers.SbsBakerInfoLocStruct(local_transformation, global_transformation)
class batchtools.sbsbaker_info_handlers.SbsBakerInfoLocStruct(local_transformation, global_transformation)

Bases: object

Loc handles location info of an object, member of SbsBakerInfoEntityStruct. Warning, the values is not relevant with obj format.

Parameters:
  • local_transformation – local transformation matrix
  • global_transformation – global transformation matrix
class batchtools.sbsbaker_info_handlers.SbsBakerInfoMeshStruct(label='', vertices_number=0, uvs=None, submeshes=None)
class batchtools.sbsbaker_info_handlers.SbsBakerInfoMeshStruct(label='', vertices_number=0, uvs=None, submeshes=None)
class batchtools.sbsbaker_info_handlers.SbsBakerInfoMeshStruct(label='', vertices_number=0, uvs=None, submeshes=None)

Bases: object

Mesh handles mesh info part of an object, member of SbsBakerInfoEntityStruct.

Parameters:
  • label – the name of the mesh part
  • vertices_number – mesh’s vertices number
  • uv_info – uv info handled by SbsBakerInfoUvStruct
  • sub_meshes – sub part of a mesh, usually defined by a material assignation or a shader group
class batchtools.sbsbaker_info_handlers.SbsBakerInfoSubmeshStruct(label='', color='', triangles_number=0)
class batchtools.sbsbaker_info_handlers.SbsBakerInfoSubmeshStruct(label='', color='', triangles_number=0)
class batchtools.sbsbaker_info_handlers.SbsBakerInfoSubmeshStruct(label='', color='', triangles_number=0)

Bases: object

Submesh handles submesh’s material info for each mesh’s submesh, member of SbsBakerInfoMeshStruct.

Parameters:
  • label – material name
  • color – color assignation
  • triangles_number – triangles number present in this submesh
class batchtools.sbsbaker_info_handlers.SbsBakerInfoUvStruct(is_in_unit_square='1', points_number=0, uv_tiles='', udim_tiles='')
class batchtools.sbsbaker_info_handlers.SbsBakerInfoUvStruct(is_in_unit_square='1', points_number=0, uv_tiles='', udim_tiles='')
class batchtools.sbsbaker_info_handlers.SbsBakerInfoUvStruct(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 SbsBakerInfoMeshStruct.

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)
udim_tiles
udim_tiles
udim_tiles
uv_tiles
uv_tiles
uv_tiles

Get help faster and easier

New user?