Difference between revisions of "Snippet:Image Savers"

From The Foundry MODO SDK wiki
Jump to: navigation, search
Line 25: Line 25:
     return savers
     return savers
|lang=Python Examples, Python API, Image Savers,
|lang=Python Examples, API Examples, Savers,

Latest revision as of 10:34, 26 November 2015


Function that returns a list of the images savers registered in the system.

Returns a list of the savers as tuples where each tuple consists of the image saver's internal name, it's username and the saver DOS type (extension). Also servers as an example of how to build a list of specific servers.


def get_imagesavers():
    """ Returns a list of available image savers. Each entry in the returned list
        is a tuple made up of the format's internal name, it's username and it's
        DOS type (extension).
    host_svc = lx.service.Host()
    savers = []
    for x in range(host_svc.NumServers('saver')):
        saver = host_svc.ServerByIndex('saver', x)
        out_class = saver.InfoTag(lx.symbol.sSAV_OUTCLASS)
        if  (out_class == 'image' or out_class == 'layeredimage'):
            name = saver.Name()
            uname = saver.UserName()
                dostype = saver.InfoTag(lx.symbol.sSAV_DOSTYPE)
                dostype = ''
            savers.append((name, uname, dostype,))
    return savers