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

Get all materials in scene (Python)

$
0
0

@dick.lelyveld wrote:

Hi all,

I want to list all materials in the scene, so I can select a material from a list and assign it to a selected object.

I tried the following code, to no avail:

import import rhinoscriptsyntax as rs

def getSceneMaterials():
    rdk = rs.GetPlugInObject('Renderer Development Kit')

    #get list of all RDK data ids in the document
    rdkALL = rdk.FactoryList()

    #filtered materials ID list
    matIDList = rdk.ContentList('material')

    #get materials names
    matNames = []
    for i in range(len(matIDList)):
        matNames.append(rdk.ContentInstanceName(matIDList[i]))

    for i in range(len(matNames)):
        print(matNames[i])

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5821

Trending Articles