Can not change weights on multiple texture channels (Python_API_073_for_iClone_741)
Here is a code to show the issue I'm having. To test it, you want to put some image named "image.jpg" to the same folder as the script, it will be used as texture.
import os, time, math, random, RLPy, PySide2, copy from winreg import * from PySide2 import * from PySide2.QtWidgets import * from PySide2.QtQuickWidgets import QQuickWidget from PySide2.QtQuick import QQuickView from PySide2.QtCore import QUrl from PySide2.QtCore import QObject from PySide2.shiboken2 import wrapInstance
def findObj(name, type = RLPy.EObjectType_Prop): obj = RLPy.RScene.FindObject(type, name) if obj == None: print("object '{}' is not found on the scene".format(name)) return obj
def loadObj(path): global ic_template_path full_path = ic_template_path + path status = RLPy.RFileIO.LoadFile(full_path) if status != RLPy.RStatus.Success: print("object '{}' is not found".format(full_path)) return 0 return 1
def getControl(obj, name): control = obj.GetControl(name) if control == None: print("control '{}' for object '{}' is not found".format(name, obj)) return control
def setTexture(mat_comp, mesh_name, mat_name, channel, file): global cwd full_path = cwd + file result = mat_comp.LoadImageToTexture(mesh_name, mat_name, channel, full_path) if result != RLPy.RStatus.Success: print("LoadTexture '{}' failed".format(full_path))
button_start.mousePressEvent = create button_test.mousePressEvent = test button_test2.mousePressEvent = test2
rl_dialog.Show()
First, you press "CREATE" to make a textured cube with Diffuse, Blend and Glow channels. The problem is with the function test (assigned to button "TEST").
For some reason, only the last channel will change its weight, in this case Blend. If you shuffle the order, whichever is the last one will change weight and others won't.
On the other hand, if you only have one call to AddTextureWeightKey as in the function test2 (assigned to button "TEST2"), it will always work. So, if you press CREATE and then TEST, Diffuse channel will not change weight, if you then press TEST2 - it will.