IC Python API:RLPy RIVisemeComponent
- Main article: Modules.
Inheritance
This class inherits public member functions from:
Detailed Description
RIVisemeComponent.
avatar_list = RLPy.RScene.GetAvatars()
avatar = avatar_list[0]
viseme_animator = avatar.GetVisemeComponent()
#set the RVisemeSmoothOption
viseme_smooth_option = RLPy.RVisemeSmoothOption()
full_enable = True
full_value = 0.3
jaw_enable = True
jaw_value = 0.4
lips_enble = False
lips_value = 0.5
tongue_enble = True
tongue_value = 0.6
self.viseme_smooth_option.SetStrengthEnable(full_enable, jaw_enable, lips_enble, tongue_enble) #bFullEnable, bJawEnable, bLipsEnable, bTongueEnable
self.viseme_smooth_option.SetStrengthValue(full_value, jaw_value, lips_value, tongue_value) #fFull, fJaw, fLips, fTongue
# load vocal
audio_object = RLPy.RAudio.CreateAudioObject()
audio_object.Load("C:\\sample.wav")
clip_name = "VisemeClip"
clip_start_time = RLPy.RTime(0)
viseme_animator.LoadVocal(audio_object, clip_start_time, clip_name)
viseme_animator.AddVisemeOptionClip(viseme_smooth_option, clip_start_time, clip_name)
# add viseme clip
clip_name = "VisemeClip"
time_begin = RLPy.RTime(0)
clip_length = RLPy.RTime(1000)
viseme_animator.AddVisemesClip(time_begin, clip_name, clip_length);
# add viseme key to viseme clip
expressiveness = 50
viseme_animator.AddVisemeKey(RLPy.RTime(100) , RLPy.EVisemeID_AH, expressiveness);
# remove viseme key
viseme_animator.AddVisemeKey(RLPy.RTime(0) , RLPy.EVisemeID_AH, 50);
viseme_animator.RemoveVisemesKey(RLPy.RTime(0));
# remove viseme clip
viseme_animator.AddVisemesClip(RLPy.RTime(2000), "Clip1", RLPy.RTime(1000));
viseme_animator.RemoveVisemesClip(RLPy.RTime(2000));
# get all viseme bones
viseme_bones = viseme_animator.GetVisemeBones();
print(len(viseme_bones))
print(viseme_bones[0].GetName())
# get all viseme weights
viseme_weights = viseme_animator.GetVisemeMorphWeights();
print(len(viseme_weights))
print(viseme_weights[0])
# get all viseme keys
keys = viseme_animator.GetVisemeKeys();
print(len(keys))
print(keys[0].GetValue())
print(keys[1].GetValue())
#get viseme key info
viseme_id = 0 #RLPy.EVisemeID_NONE
viseme_weight = 0
result = viseme_animator.GetVisemeKey(RLPy.RTime(0), viseme_id, viseme_weight);
print(result[0]) #Success or failure
print(result[1]) #viseme id
print(result[2]) #viseme weight
Member Functions
AddVisemeKey
RLPy.RIVisemeComponent.AddVisemeKey ( self, kTime, eVisemeID, fWeight )
Add a viseme key. ( Experimental Class )
Parameters
kTime [IN] The time at which to add the key - RLPy.RTime
eVisemeID [IN] Type of the viseme ID - RLPy.EVisemeID
- RLPy.EVisemeID_NONE
- RLPy.EVisemeID_EE
- RLPy.EVisemeID_ER
- RLPy.EVisemeID_IH
- RLPy.EVisemeID_AH
- RLPy.EVisemeID_OH
- RLPy.EVisemeID_W_OO
- RLPy.EVisemeID_S_Z
- RLPy.EVisemeID_CH_J
- RLPy.EVisemeID_F_V
- RLPy.EVisemeID_TH
- RLPy.EVisemeID_T_L_D_N
- RLPy.EVisemeID_B_M_P
- RLPy.EVisemeID_K_G_H_NG
- RLPy.EVisemeID_AE
- RLPy.EVisemeID_R
fWeight [IN] Settings of Expressiveness, the range is from 0.0 to 100.0 - float
Returns
AddVisemeOptionClip
RLPy.RIVisemeComponent.AddVisemeOptionClip ( self, kSmoothOption, kStartTime, strClipName )
You can separately adjust the viseme animation strength/smooth for the tongue, lips, and jaw from this function.
Parameters
kSmoothOption [IN] Settings of Smooth/Strength - RLPy.RVisemeSmoothOption
kStartTime [IN] Specifies the start time of the clip - RLPy.RTime
strClipName [IN] The name of the clip - string
Returns
AddVisemesClip
RLPy.RIVisemeComponent.AddVisemesClip ( self, kTime, nClipName, kClipLength )
Add a viseme clip. ( Experimental Class )
Parameters
kTime [IN] Setting of clip's begin time - RLPy.RTime
nClipName [IN] Name of the Clip - string
kClipLength [IN] Time of clip length, the value must be greater than 0 - RLPy.RTime
Returns
GetVisemeBones
RLPy.RIVisemeComponent.GetVisemeBones ( self )
Get all viseme bones. ( Experimental Class )
Returns
GetVisemeKey
RLPy.RIVisemeComponent.GetVisemeKey ( self, kTime, eVisemeID, fWeight )
Get viseme key information. ( Experimental Class )
Parameters
kTime [IN] Time of the key - RLPy.RTime
eVisemeID [IN] Type of the viseme ID - RLPy.EVisemeID
- RLPy.EVisemeID_NONE
- RLPy.EVisemeID_EE
- RLPy.EVisemeID_ER
- RLPy.EVisemeID_IH
- RLPy.EVisemeID_AH
- RLPy.EVisemeID_OH
- RLPy.EVisemeID_W_OO
- RLPy.EVisemeID_S_Z
- RLPy.EVisemeID_CH_J
- RLPy.EVisemeID_F_V
- RLPy.EVisemeID_TH
- RLPy.EVisemeID_T_L_D_N
- RLPy.EVisemeID_B_M_P
- RLPy.EVisemeID_K_G_H_NG
- RLPy.EVisemeID_AE
- RLPy.EVisemeID_R
fWeight [IN] Settings of Expressiveness - float
Returns
GetVisemeKeys
RLPy.RIVisemeComponent.GetVisemeKeys ( self )
Get Time of all viseme keys. ( Experimental Class )
Returns
GetVisemeMorphWeights
RLPy.RIVisemeComponent.GetVisemeMorphWeights ( self )
Get all morph weights of viseme. ( Experimental Class )
Returns
LoadVocal
RLPy.RIVisemeComponent.LoadVocal ( self, pAudio, kStartTime, strClipName )
Import voice source to generate facial/Lips expressions for avatars.
Parameters
pAudio [IN] Input audio source - RLPy.RIAudioObject
kStartTime [IN] Specifies the start time of the clip - RLPy.RTime
strClipName [IN] The name of the clip - string
Return Values
RLPy.RStatus.Success Success
RLPy.RStatus.Failure Fail
RemoveVisemesClip
RLPy.RIVisemeComponent.RemoveVisemesClip ( self, kTime )
Remove viseme clip. ( Experimental Class )
Parameters
kTime [IN] The time for finding viseme clip - RLPy.RTime
Returns
RemoveVisemesKey
RLPy.RIVisemeComponent.RemoveVisemesKey ( self, kTime )
Remove viseme key. ( Experimental Class )
Parameters
kTime [IN] The time for finding viseme key - RLPy.RTime