Profile Picture

Quick code example: How to change the speed of an EXPRESSION CLIP of a character in iClone 8 Python...

Posted By mrtobycook 2 Years Ago
You don't have permission to rate!

Quick code example: How to change the speed of an EXPRESSION CLIP of a...

Author
Message
mrtobycook
mrtobycook
Posted 2 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)

Group: Forum Members
Last Active: 9 Months Ago
Posts: 425, Visits: 2.7K
Hi all,
If you have an avatar in your scene (a character), and it has an EXPRESSION CLIP on it (NOT a motion clip - which is the bone animation, but an EXPRESSION CLIP that has morph target animation aka blendshape animation), how do you change the speed of it?
It's quite straightforward, but there's no examples specifically on the wiki at the moment, and I keep forgetting how to do it after a while and then come back and wish there was. :-)
So...

import RLPy
import os

rl_plugin_info = {"ap": "iClone", "ap_version": "8.0"}

def get_yourcurrentlyselected_obj():
    global ic_selected_obj
    if RLPy.RScene.GetSelectedObjects():
        ic_selected_objs = RLPy.RScene.GetSelectedObjects()
        ic_selected_obj = ic_selected_objs[0]
    else:
        ic_selected_obj = None

get_yourcurrentlyselected_obj()

cur_face_component = ic_selected_obj.GetFaceComponent()

clip_index = 0
cur_clip = cur_face_component.GetClip(clip_index)

if (cur_clip != None):
    print("Ok now changing the speed of the clip...")
    cur_clip.SetSpeed(0.5)
    RLPy.RGlobal.ObjectModified(ic_selected_obj, RLPy.EObjectModifiedType_Attribute)


So basically you use FACE COMPONENT - which allows you to 'GetClip' with it.
In the example above, the clip is at index 0. You may have to loop through and try to find which index it's on - it may not always be at zero.

Toby



- - - - - - - - - - - - - - - - - - - - - - - - - - - - 
https://forum.reallusion.com/uploads/images/d11fc97b-7387-4f19-bb1e-0785.png
virtualfilmer.com | youtube




Reading This Topic