Find nodes and materials¶
find.py¶
1# © 2024 Autodesk, Inc. All rights reserved.
2
3# demo script to show how to search nodes and materials
4print("Executing find script!")
5
6newScene()
7loadGeometry("$VRED_EXAMPLES/geo/teddy.osb")
8updateScene()
9
10# find all nodes via regular expression.
11nodes = findNodes("Eye_*", true)
12
13# search material
14brown = findMaterial("fur_brown")
15
16# set the material of all found nodes to be brown
17for geo in nodes:
18 geo.setMaterial(brown)
19
20
21# search material
22white = findMaterial("fur_white")
23
24# find nodes via a list of names. If you don't like to type all the names
25# just select the nodes in the scenegraph press ctrl-c and ctrl-v in the editor.
26nodes = findNodes(["Tail", "Nose"])
27
28# set the material of all found nodes to be white
29for geo in nodes:
30 geo.setMaterial(white)