Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5842

Get Full Path of PBR Textures

$
0
0

Hoping someone can help me with this. Trying to write a script to consolidate all the textures used by a Render Material into one folder. Often times I’m pulling from a library but need to consolidate for downstream applications. It’s been easy to implement with the standard Rhino materials, but we’ve been using the new PBR material in the WIP and would love to be able to pull roughness, metal etc.

I’ve gotten as far getting the textures used by the materials, but got lost getting the full file path using the texture class and FindReference method

Thanks

import Rhino.Render as rr
import scriptcontext as sc

for mat in sc.doc.RenderMaterials:
    mc = mat.GetTextureFromUsage(rr.RenderMaterial.StandardChildSlots.Diffuse)
    mm = mat.GetTextureFromUsage(rr.RenderMaterial.StandardChildSlots.PbrMetallic)
    mr = mat.GetTextureFromUsage(rr.RenderMaterial.StandardChildSlots.PbrRoughness)
    mn = mat.GetTextureFromUsage(rr.RenderMaterial.StandardChildSlots.Bump)
    if mc:
        print mc.Name
    if mm:
        print mm.Name
    if mr:
        print mr.Name
    if mn:
        print mn.Name

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 5842

Latest Images

Trending Articles



Latest Images