Forum: Poser Python Scripting


Subject: Scripted Shader Node Animation

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


structure posted Mon, 09 May 2022 at 7:55 AM Forum Coordinator

try 

import re
main = ("skinhead", "skinlimbs", "skintorso",
        "iris", "fingernails", "teeth", "gums", "tongue")

for material in materials:
    zone = material.Name()
    if any(m in zone.lower() for m in main):
        tree = material.ShaderTree()
        nodes = tree.Nodes()
        print("%s in main" % zone)
        for node in nodes:
            label = node.Name()
            print("\t"+label)
            result = re.search('[||0-90-9]', label)
            if result:
                print(result)

output:
4_Gums in main PoserSurface Color_Texture Anisotropic 4_Gums 4_Teeth in main PoserSurface Color_Texture Anisotropic 4_Teeth 4_Tongue in main PoserSurface Color_Texture Anisotropic 4_Tongue 2_SkinTorso in main PoserSurface Color_Texture ||12 <_sre.SRE_Match object at 0x000000000E3B9CC8> ColorRamp Diffuse Color_Math Math_Functions 2_SkinTorso 5_Iris in main PoserSurface Color_Texture 5_Iris

Also finds :

Color_Texture ||1_2
<_sre.SRE_Match object at 0x000000000EA233D8> : 2_SkinTorso : Color_Texture ||1_2
Color_Texture |1_2
<_sre.SRE_Match object at 0x000000000EA233D8> : 2_SkinTorso : Color_Texture |1_2
Color_Texture |1_2|
<_sre.SRE_Match object at 0x000000000EA233D8> : 2_SkinTorso : Color_Texture |1_2|

you can then  run the rest of your script on the matched node.

Locked Out