Create texture and add it to a material¶
create-texture.py¶
1# © 2024 Autodesk, Inc. All rights reserved.
2
3# This example shows how to create a texture and add it to a material with API v2.
4print("Executing create-texture script!")
5
6# load a new scene
7examplesDir = vrFileIOService.getVREDExamplesDir()
8vrFileIOService.loadFile(examplesDir + "/geo/teddy.osb")
9
10# load the image that we will use as texture
11waterImage = vrImageService.loadImage(examplesDir + "/textures/Wasser1.png")
12
13# find the material we want to change and edit its diffuse texture
14furMaterial = vrMaterialService.findMaterials("fur_brown")[0]
15furTexture = furMaterial.getDiffuseTexture()
16furTexture.setImage(waterImage)
17furTexture.setUseTexture(True)