Forum: Poser Python Scripting


Subject: Updating/refreshing the document window

Ajax opened this issue on Apr 19, 2008 · 15 posts


bagginsbill posted Sat, 19 April 2008 at 1:01 PM

I believe I have found the solution - svdl give this a try.

Basically, I found that loading a material collection is the only way to update all the zones. So doing a quick save and load to a temporary file should take care of it. I did not bother deleting the file. You can add that step if you like.

However, the material room editor gets a little confused if that is all you do. I had to add a couple more steps.

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

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()


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)