Script to automate breathing?


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

By gordryd - 5 Years Ago
Now that people have had some time to play around with Python, is it possible to create a script to make an avatar 'breathe'?  Basic functionality should include the ability to choose which character and adjust breathing rate/intensity;  add'l helpful feature would be frame range to apply.
By Kelleytoons - 5 Years Ago
Assuming you had a "breathe" morph (more below) the coding is pretty simple and straightforward (this should give you all you need to get started):

import RLPy
avatar_list = RLPy.RScene.GetSelectedObjects()
for object in selected_list: #for all selected
    if object == RLPy.EObjectType_Avatar: #if is avatar
    avatar = object #just for reading purposes
    morph_component = avatar.GetMorphComponent()
    morph_names = morph_component.GetMorphNames("your_mesh_name")
    result = morph_component.AddKey( "your_mesh_name", "your_morph_name", RLPy.RTime(67),  0.5, False, False )


The real problem is that morph -- can't program it automagically.  So you would need to somehow develop it and, further, apply it (AFAIK you can't add a morph programmatically.  I might be mistaken in this but it doesn't appear so from first glance, although I just woke up from a nap).  If so, then the avatar you wanted to run this on would both have to have such a morph already applied AND the name would need to be standardized for automagic applying it (or you could have the interface select it I guess -- I'm not really going to do any UI in Python just yet but I know there are a few here who have who could help you).
By The-any-Key - 5 Years Ago
I saw this post and added a time feature in my Morph linker plugin so you can apply morphs with time.