Python Transition Curve


https://forum.reallusion.com/Topic400017.aspx
Print Topic | Close Window

By videodv - 5 Years Ago
Anyone know how to set/change the Transition Curve from Linear to Step for example from Python.
I can see it in the Class list but no idea how to set it?

def RLPy.RKey.SetTransitionType (   self,



eTransitionType 

)



Is it a number a string?

Regards
Chris.
By The-any-Key - 5 Years Ago
Set to one of these I think:

RLPy.ETransitionType_Linear
RLPy.ETransitionType_Step
RLPy.ETransitionType_Ease_Out
RLPy.ETransitionType_Ease_In
RLPy.ETransitionType_Ease_Out_In
RLPy.ETransitionType_Ease_In_Out
RLPy.ETransitionType_Ease_In_Sine
RLPy.ETransitionType_Ease_Out_Sine
RLPy.ETransitionType_Ease_In_Out_Sine
RLPy.ETransitionType_Ease_In_Quad
RLPy.ETransitionType_Ease_Out_Quad
RLPy.ETransitionType_Ease_In_Out_Quad
RLPy.ETransitionType_Ease_In_Cubic
RLPy.ETransitionType_Ease_Out_Cubic
RLPy.ETransitionType_Ease_In_Out_Cubic
RLPy.ETransitionType_Ease_In_Quart
RLPy.ETransitionType_Ease_Out_Quart
RLPy.ETransitionType_Ease_In_Out_Quart
RLPy.ETransitionType_Ease_In_Quint
RLPy.ETransitionType_Ease_Out_Quint
RLPy.ETransitionType_Ease_In_Out_Quint
RLPy.ETransitionType_Ease_In_Expo
RLPy.ETransitionType_Ease_Out_Expo
RLPy.ETransitionType_Ease_In_Out_Expo
RLPy.ETransitionType_Ease_In_Circ
RLPy.ETransitionType_Ease_Out_Circ
RLPy.ETransitionType_Ease_In_Out_Circ
RLPy.ETransitionType_Ease_In_Back
RLPy.ETransitionType_Ease_Out_Back
RLPy.ETransitionType_Ease_In_Out_Back
RLPy.ETransitionType_Ease_In_Elastic
RLPy.ETransitionType_Ease_Out_Elastic
RLPy.ETransitionType_Ease_In_Out_Elastic
RLPy.ETransitionType_Ease_In_Bounce
RLPy.ETransitionType_Ease_Out_Bounce
RLPy.ETransitionType_Ease_In_Out_Bounce

YourKey.SetTransitionType(RLPy.ETransitionType_Step)
By videodv - 5 Years Ago
Thanks The-any-Key
will check those out shortly.

Chris.
By videodv - 5 Years Ago
I am trying to change the step of a matieral from Linier to Step but having no luck yet, this is a cut down piece of code I am using.

import RLPy

#-- Get Prop --#
prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Ball_000")

#-- Get Material from Prop --#
material_component = prop.GetMaterialComponent()
mesh_list = prop.GetMeshNames()
mesh_name = mesh_list[0]

material_list = material_component.GetMaterialNames(mesh_name)
material_colour = material_list[0]

#-- Add diffuse key --#
material_component.AddDiffuseKey(RLPy.RTime(0), mesh_name, material_colour, RLPy.RRgb.RED) # Turn on Red
material_component.AddDiffuseKey(RLPy.RTime(1000), mesh_name, material_colour, RLPy.RRgb.BLUE) # Turn on Blue

# How to change the material keys from Linier to step ????
# This is not working????
#material_component.SetTransitionType(RLPy.RTime(0), RLPy.ETransitionType_Step, 1.0)

RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000))

This will change a default ball "Ball_000" from red to blue and as you can see it it changes over the one second run (linier) this is what I am trying to change so it will change suddenly "Step".

By the way this is from a "Traffic Light" setup I am working on so really need this change to make it work.

Regards
Chris.
By dogged2003 - 5 Years Ago
Try

material_component.SetTransitionType(RLPy.RTime(1000), RLPy.ETransitionType_Step, 1.0)
By The-any-Key - 5 Years Ago
You need to get the key object you want to change.
Ex:

# Grab transform control from prop
transform = prop.GetControl("Transform")
# Create empty key
key = RLPy.RTransformKey()
# Fill empty key with data at time 0 from prop
transform.GetTransformKey(RLPy.RTime(0), key)
# Set transition for key to step
key.SetTransitionType(RLPy.ETransitionType_Step)

I am however unsure if the key object is referencing back to the original key data. Or if you need to add the key to the prop. But we hope it use referencing.
By videodv - 5 Years Ago
Thanks dogged2003 but that will not work
By videodv - 5 Years Ago
The-any-Key (1/5/2019)
You need to get the key object you want to change.
Ex:

# Grab transform control from prop
transform = prop.GetControl("Transform")
# Create empty key
key = RLPy.RTransformKey()
# Fill empty key with data at time 0 from prop
transform.GetTransformKey(RLPy.RTime(0), key)
# Set transition for key to step
key.SetTransitionType(RLPy.ETransitionType_Step)

I am however unsure if the key object is referencing back to the original key data. Or if you need to add the key to the prop. But we hope it use referencing.


Thanks The-any-Key

That will run without error but it will not change the material settings?
I will look more closley at the documention tonight and try to see why I cannot seem to access the Material Settings to change (unless these are not avaliable yet)

I have of course tried many different ways to try and get this to work but so far without success, keep getting an "Atribute Error"

Many Thanks
Chris.
By Kelleytoons - 5 Years Ago
Chris,

There's a confirmed bug (confirmed by the devs) in GetMeshNames so that GetMaterialNames will not work properly (fails).  If that's your problem don't worry about it -- should be fixed soon.
By RobertoColombo - 5 Years Ago
The-any-Key (1/4/2019)
Set to one of these I think:

RLPy.ETransitionType_Linear
RLPy.ETransitionType_Step
YourKey.SetTransitionType(RLPy.ETransitionType_Step)
etc. etc.


Hi,
pls, where did you find these definitions in the doc ?
I might have missed, but I could not find any of the values in the API doc.

Thanks

  Roberto

By The-any-Key - 5 Years Ago
RobertoColombo (1/5/2019)
The-any-Key (1/4/2019)
Set to one of these I think:

RLPy.ETransitionType_Linear
RLPy.ETransitionType_Step
YourKey.SetTransitionType(RLPy.ETransitionType_Step)
etc. etc.


Hi,
pls, where did you find these definitions in the doc ?
I might have missed, but I could not find any of the values in the API doc.

Thanks

  Roberto



No docs. I check the source code of the wrapper in iClone 7>Bin64>RLPy.py
By The-any-Key - 5 Years Ago
videodv (1/5/2019)
The-any-Key (1/5/2019)
You need to get the key object you want to change.
Ex:

# Grab transform control from prop
transform = prop.GetControl("Transform")
# Create empty key
key = RLPy.RTransformKey()
# Fill empty key with data at time 0 from prop
transform.GetTransformKey(RLPy.RTime(0), key)
# Set transition for key to step
key.SetTransitionType(RLPy.ETransitionType_Step)

I am however unsure if the key object is referencing back to the original key data. Or if you need to add the key to the prop. But we hope it use referencing.


Thanks The-any-Key

That will run without error but it will not change the material settings?
I will look more closley at the documention tonight and try to see why I cannot seem to access the Material Settings to change (unless these are not avaliable yet)

I have of course tried many different ways to try and get this to work but so far without success, keep getting an "Atribute Error"

Many Thanks
Chris.

Tips is to request a sample how to do it in https://forum.reallusion.com/399188/Basic-Samples-Request-thread
By RobertoColombo - 5 Years Ago
Thanks!
By videodv - 5 Years Ago
Thanks for the tip done.
Chris.
By The-any-Key - 5 Years Ago
Just continued with the samples and found this:

# Grab transform control from prop
transform = prop.GetControl("Transform")
# Set key transition in frame 0 for prop
transform.SetKeyTransition(RLPy.RTime(0), RLPy.ETransitionType_Step, 1.0)


This is however for the transform keys, not the material keys. So the material keys might not have been added to the API in the way so you can change the transition type.
By videodv - 5 Years Ago
The-any-Key (1/6/2019)
Just continued with the samples and found this:

# Grab transform control from prop
transform = prop.GetControl("Transform")
# Set key transition in frame 0 for prop
transform.SetKeyTransition(RLPy.RTime(0), RLPy.ETransitionType_Step, 1.0)


This is however for the transform keys, not the material keys. So the material keys might not have been added to the API in the way so you can change the transition type.


That was the first one I tried but it did not work, will assume as others have said the material settings are still in experimental mode so not avaliable at the moment will wait and see after the next update.

Will place on feedback tracker so RL ia aware of this issue.

Regards
Chris.

By videodv - 5 Years Ago
Have placed on feedback tracker so hopfully not long to wait to get this functionallity.
Chris.
By AllenLee (RL) - 5 Years Ago
videodv (1/4/2019)
I am trying to change the step of a matieral from Linier to Step but having no luck yet, this is a cut down piece of code I am using.

import RLPy

#-- Get Prop --#
prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Ball_000")

#-- Get Material from Prop --#
material_component = prop.GetMaterialComponent()
mesh_list = prop.GetMeshNames()
mesh_name = mesh_list[0]

material_list = material_component.GetMaterialNames(mesh_name)
material_colour = material_list[0]

#-- Add diffuse key --#
material_component.AddDiffuseKey(RLPy.RTime(0), mesh_name, material_colour, RLPy.RRgb.RED) # Turn on Red
material_component.AddDiffuseKey(RLPy.RTime(1000), mesh_name, material_colour, RLPy.RRgb.BLUE) # Turn on Blue

# How to change the material keys from Linier to step ????
# This is not working????
#material_component.SetTransitionType(RLPy.RTime(0), RLPy.ETransitionType_Step, 1.0)

RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000))

This will change a default ball "Ball_000" from red to blue and as you can see it it changes over the one second run (linier) this is what I am trying to change so it will change suddenly "Step".

By the way this is from a "Traffic Light" setup I am working on so really need this change to make it work.

Regards
Chris.


Sorry, we don't have material "SetTransitionType" API yet.
By videodv - 5 Years Ago
AllenLee (RL) (1/7/2019)
videodv (1/4/2019)
I am trying to change the step of a matieral from Linier to Step but having no luck yet, this is a cut down piece of code I am using.

import RLPy

#-- Get Prop --#
prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Ball_000")

#-- Get Material from Prop --#
material_component = prop.GetMaterialComponent()
mesh_list = prop.GetMeshNames()
mesh_name = mesh_list[0]

material_list = material_component.GetMaterialNames(mesh_name)
material_colour = material_list[0]

#-- Add diffuse key --#
material_component.AddDiffuseKey(RLPy.RTime(0), mesh_name, material_colour, RLPy.RRgb.RED) # Turn on Red
material_component.AddDiffuseKey(RLPy.RTime(1000), mesh_name, material_colour, RLPy.RRgb.BLUE) # Turn on Blue

# How to change the material keys from Linier to step ????
# This is not working????
#material_component.SetTransitionType(RLPy.RTime(0), RLPy.ETransitionType_Step, 1.0)

RLPy.RGlobal.Play(RLPy.RTime(0), RLPy.RTime(1000))

This will change a default ball "Ball_000" from red to blue and as you can see it it changes over the one second run (linier) this is what I am trying to change so it will change suddenly "Step".

By the way this is from a "Traffic Light" setup I am working on so really need this change to make it work.

Regards
Chris.


Sorry, we don't have material "SetTransitionType" API yet.


Thanks for the conformation hopefully, we will not have to wait to long to get this functionallity.

Regards
Chris.