textureAnimation

snippets/textureAnimation.py
 1# © 2024 Autodesk, Inc. All rights reserved.
 2
 3texSwitch = findNode("TimedTextureSwitch")
 4textureDir = "C:/DummyTextures/"
 5textureName = "alwaysRebuild"
 6textureExt = "jpg"
 7currentChoice = 1
 8
 9def replaceImage():
10    global currentChoice
11    activeChoice = texSwitch.fields().getInt32("choice")
12    if activeChoice != currentChoice:
13        currentName = "%s%s%05d.%s" % (textureDir, textureName, activeChoice, textureExt)
14        setMaterialImage(findMaterial("lightMat"), "incandescenceMap", currentName)
15        currentChoice = activeChoice
16
17timer = vrTimer()
18timer.connect(replaceImage)
19timer.setActive(true)