Difference between revisions of "Snippet:Scene Savers"

From The Foundry MODO SDK wiki
Jump to: navigation, search
Line 20: Line 20:
     return savers
     return savers
|lang=Python Examples, Python API, Scene Savers, list servers,
|lang=Python Examples, API Examples, Savers,

Latest revision as of 10:40, 26 November 2015


Function that returns a list of the Scene/Geometry savers registered in the system.

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


def get_savers():
    host_svc = lx.service.Host()
    savers = []
    for x in range(host_svc.NumServers('saver')):
        factory = host_svc.ServerByIndex('saver', x)
        out_class = factory.InfoTag(lx.symbol.sSAV_OUTCLASS)
        if  (out_class == 'scene') or (out_class == 'scene2'):
            name = factory.Name()
            uname = factory.UserName()
                dostype = factory.InfoTag(lx.symbol.sSAV_DOSTYPE)
                dostype = ''
            savers.append((name, uname, dostype,))
    return savers