Rhino 6 materials: texture mapping chanels linked by hand?

Here a short script that sets all diffuse textures in all materials to use mapping channel 1.

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino.Render as rr

for rm in sc.doc.RenderMaterials:
    rt = rm.GetTextureFromUsage(rr.RenderMaterial.StandardChildSlots.Diffuse)

    rt.BeginChange(rr.RenderContent.ChangeContexts.Program)
    rt.SetProjectionMode(rr.TextureProjectionMode.MappingChannel, rr.RenderContent.ChangeContexts.Program)
    rt.SetMappingChannel(1, rr.RenderContent.ChangeContexts.Program)
    rt.EndChange()

Adapt to your own needs.

1 Like