Forum: Poser 12


Subject: Two Python scripts to speed up things in the Material Room

Y-Phil opened this issue on Aug 25, 2021 ยท 4 posts


Y-Phil posted Wed, 25 August 2021 at 2:44 PM

The first script turns off all previews of all layers of all materials of all actors:

for actor in poser.Scene().Actors():
    mats = actor.Materials()
    if not mats:
        continue
    
    for mat in mats:
        for layer in mat.Layers():
            tree = layer.ShaderTree()
            for node in tree.Nodes():
                node.SetPreviewCollapsed(0)
            tree.UpdatePreview()

It's small, but it has such an effect in the Material room: switching to another material is instantaneous now. And of course, here its friend: a script to turn on the preview of only a subset, and only in the current material:


searched_types = [
    'image_map', 
    'ccl_ImageTexture',
    'poser',
    'CyclesSurface',
    'PhysicalSurface'
]

mat = poser.Scene().CurrentMaterial()
if mat:
    tree = mat.ShaderTree()
    for node in [n for n in tree.Nodes() if n.Type() in searched_types]:
        node.SetPreviewCollapsed(1)
    tree.UpdatePreview()

๐’ซ๐’ฝ๐“Ž๐“


(ใฃโ—”โ—กโ—”)ใฃ

๐Ÿ‘ฟ Win11 on i9-13900K@5GHz, 64GB, RoG Strix B760F Gamng, Asus Tuf Gaming RTX 4070 OC Edition, 1 TB SSD, 6+4+8TB HD
๐Ÿ‘ฟ Mac Mini M2, Sequoia 15.2, 16GB, 500GB SSD
๐Ÿ‘ฟ Nas 10TB
๐Ÿ‘ฟ Poser 13 and soon 14 โค๏ธ