As my introduction to Python scripting, I created a Python script to change the rotation of an Avatar's heard. I have the script working and when I apply it to an Avatar and play, the rotation is there. That is good.
However, the issue is that when I look at my timeline for the Avatar I don't see any key frames on the Transform layer (didn't expect any there since this is a head animation) but I also don't get any key frames on the Motion, Motion | Gesture, Motion | Motion Layer or
Motion | Motion Layer | Head layer where I expected to find some keys to reflect the script added rotation.As far as I can see, currently there is no evidence on the time line that a rotation should be applied to the head but the playback clearly shows one.Is there something that I need to add to my script in order to update the key frames? Should my script be setting the bone rotation in a different way in order to produce key frames?The current code that I am using is:import RLPy
print("Get Avatar")
avatar = RLPy.RScene.GetSelectedObjects()[0]
print("Get Bones")
motion_bones = avatar.GetSkeletonComponent().GetMotionBones()
print("Get Head Bone")
bone = motion_bones[0]
for this_bone in motion_bones:
if this_bone.GetName() == "RL_Head":
bone = this_bone
break
print("Create clip")
clip = avatar.GetSkeletonComponent().AddClip(RLPy.RGlobal.GetTime())
clip.SetLength(RLPy.RTime(150*1000))
print("Grab bone")
control = clip.GetControl("Layer", bone).GetDataBlock().GetControl("Rotation/RotationY")
print("Rotating...")
rotation_y = -45
frame = 0
for loop in range(16):
print("Setting Rotation %d At Time Frame %d." %(rotation_y, frame))
control.SetValue(RLPy.RTime(frame/60*1000, RLPy.kMilliseconds), rotation_y / 180 * RLPy.RMath.CONST_PI)
rotation_y = rotation_y + 5
frame = frame + 10
print("Done")
"We often compare ourselves to the U.S. and often they come out the best, but they only have the right to bear arms while we have the right to bare breasts"
Bowser and Blue, Busting The Breast