Forum: Poser Python Scripting


Subject: Updating/refreshing the document window

Ajax opened this issue on Apr 19, 2008 ยท 15 posts


nruddock posted Mon, 21 April 2008 at 3:12 AM

Quote - I'm going to just paste it here, but you'll have to add indentation because this stupid editor will remove it.

Click the "Source" button and add

 around the code sample :-

def saveAndRestoreMaterials(tempFolder):
    import os.path

    tempfile = os.path.join(tempFolder, 'temp.mc6')
    curmat = poser.Scene().WacroMaterials()[0]
    actor = poser.Scene().CurrentActor()
    for mat in actor.Materials():
        mat.SetSelected(1)
        actor.SaveMaterialCollection(tempfile)
        actor.LoadMaterialCollection(tempfile)
    poser.Scene().SelectMaterial(curmat)
    curmat.ShaderTree().UpdatePreview()