first of all, it is not true that the transition curves on key frames generate strange results.
They work pretty fine indeed!
Just put a simple box in a scene, assign a diffuse color at a certain frame, e.g. 300, then play with the transition keys and you will that the color transition follows the transition curve as expected
Said, this, I come back to the problem.
I want to do the simplest thing: setting the diffuse color of a prop.
Let's even make it simpler: I want to assign the color at time 0, i.e. the 1st frame.
So, let's go steps by steps...
Here there is a nice example: http://manual.reallusion.com/iclone/script/python/md_docs__way_to_control_prop.html
...but unfortunately that code is bugged!!
Just copy-paste it, run it and you should got the error: <class 'TypeError'>, File: C:\Program Files\Reallusion\iClone 7\Bin64\RLPy.py, Line: 8340
So, here we have another shoot: http://manual.reallusion.com/iClone/script/python/class_r_l_py_1_1_r_i_material_component.html#a05e80611f15b115595bc2dfd2ea12579
I can successfully load a texture, so I thought that it would be a piece of cake to use the same way to assign the diffuse color.
The code I pasted above is just a semplification of the the example in that page... but t does not work.
I get strange results...
Perhaps there is another way to set a color, but unfortunately this is what RL documented: one bugged example and another that ends into strange results
Any hints ?
PS: of course if you had learned Italian language instead of keep on playing tennis, right now there would be no language bareer
I have had a tinker with this and come up with the following script just run the script first press the get colour button and select a colour from the colordialog second press the place prop button the just scroll the timeline a little and you should see the colour you selected.
What I have found is sometimes the colour selected from the colordialog will not show correctly but I think this is to do with setting the red green and blue variables to int or simular.
anyway hope this helps.
here is the code
import PySide2, RLPy
from PySide2 import *
from PySide2 import QtWidgets
from PySide2.QtCore import Qt
from PySide2 import QtGui
from PySide2.shiboken2 import wrapInstance
import os, math
from winreg import *
#-- Make a global variable contain dialog --#
sample_dialog = None
Opens the color dialog
color = QtWidgets.QColorDialog.getColor()
#-- Get iClone 7 default template path --#
Registry = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
RawKey = OpenKey(Registry, r"SOFTWARE\Reallusion\iClone\7.0")
ic_template_path = os.path.abspath(QueryValueEx(RawKey, "Template Data" ))
#-- Load Box_001.iProp --#
RLPy.RFileIO.LoadFile(ic_template_path + "//iClone Template//Props//3D Blocks//Box_001.iProp")
#-- Get Prop --#
prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box_001")
#-- Get Material from Prop --#
material_component = prop.GetMaterialComponent()
mesh_list = prop.GetMeshNames()
mesh_name = mesh_list
material_list = material_component.GetMaterialNames(mesh_name)
material_name = material_list
alpha = color.alpha()
red = color.red()
green = color.green()
blue = color.blue()
# 208 48 197
diffuse_color = RLPy.RRgb().From(255, 127, 0)
R_Key = RLPy.RKey()
#-- Add diffuse key --#
material_component.AddDiffuseKey(R_Key, mesh_name, material_name, RLPy.RRgb().From(red, green, blue))
sample_dialog = RLPy.RUi.CreateRDialog()
#-- Create Pyside layout for RDialog --#
pyside_dialog = wrapInstance(int(sample_dialog.GetWindow()), QtWidgets.QDialog)
sample_layout = pyside_dialog.layout()
#-- Add PushButton --#
colourbutton = QtWidgets.QPushButton("Get Colour")
#-- Add PushButton --#
pushbutton = QtWidgets.QPushButton("Place Prop")