Forum: Poser Python Scripting


Subject: Scripted Shader Node Animation

Iuvenis_Scriptor opened this issue on May 08, 2022 ยท 19 posts


adp001 posted Mon, 09 May 2022 at 7:46 AM

This works for me (P11):


import poser

scene = poser.Scene()
character = scene.CurrentFigure()
actor = character.Actor("Body")
materials = actor.Materials()

main = ["SkinHead", "SkinLimbs", "SkinTorso", "Iris", "Fingernails", "Teeth", "Gums", "Tongue"]
for (material, zone) in [(mat, mat.Name()) for mat in actor.Materials() if mat.Name() in main]:
    nodes = material.ShaderTree().Nodes()

    for node in [n for n in nodes if "||" in n.Name()]:
        label, p, numberstring = node.Name().partition("||")
        if p and numberstring:
            numberlist = [int(n) for n in numberstring.strip().split("_")]
            for number in numberlist:
                node.Input(number).SetAnimated(1)
            scene.DrawAll()

            for number in numberlist:
                parameter = node.Input(number).Parameters()[0]
                identifier = zone + "_" + label + "_" + input.Name()
                parameter.SetInternalName(identifier)
                parameter.SetName(identifier)
                print(identifier)