Profile Picture

Scripted Bone Rotations Not Showing Up As Motion Or Motion Layer Key Frames

Posted By Lord Ashes 5 Years Ago
You don't have permission to rate!

Scripted Bone Rotations Not Showing Up As Motion Or Motion Layer Key...

Author
Message
Lord Ashes
Lord Ashes
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (22.4K reputation)Distinguished Member (22.4K reputation)Distinguished Member (22.4K reputation)Distinguished Member (22.4K reputation)Distinguished Member (22.4K reputation)Distinguished Member (22.4K reputation)Distinguished Member (22.4K reputation)Distinguished Member (22.4K reputation)Distinguished Member (22.4K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 1.3K, Visits: 1.6K
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

Threaded View

Threaded View
Forum Post Scripted Bone Rotations Not Showing Up As Motion Or Motion Layer Key... By Lord Ashes ( 5 Years Ago )
Forum Post I am not sure to call it a bug or not, but the keyframes would appear... By 4u2ges ( 5 Years Ago )
Forum Post [quote][b]Lord Ashes (10/3/2020)[/b][hr]As my introduction to Python... By videodv ( 5 Years Ago )
Forum Post [quote] Try putting this bit of code after the final loop and before... By Lord Ashes ( 5 Years Ago )
Forum Post [quote][b]Lord Ashes (10/3/2020)[/b][hr][quote] Try putting this bit... By videodv ( 5 Years Ago )
Forum Post [quote] Hi Lord Ashes In order to see the keys on the timeline you... By Lord Ashes ( 5 Years Ago )
Forum Post I have tried both suggestions: 1. To put the stop code at the end.... By Lord Ashes ( 5 Years Ago )
Forum Post Hi Lord Ashes Here is the play example as I ran your original script... By videodv ( 5 Years Ago )
Forum Post [quote][b]videodv (10/4/2020)[/b][hr]Hi Lord Ashes Here is the play... By Lord Ashes ( 5 Years Ago )
Forum Post [quote][b]Lord Ashes (10/4/2020)[/b][hr][quote][b]videodv... By videodv ( 5 Years Ago )
Forum Post [quote] No just straight default settings, i used cc3 jade in the... By Lord Ashes ( 5 Years Ago )
Forum Post [quote]HI Try putting this bit of code after the final loop and... By 4u2ges ( 5 Years Ago )
Forum Post This whole thing with timeline update is still buggy. I know at least... By 4u2ges ( 5 Years Ago )
Forum Post It's Caleb a problem (maybe some other too). If you try it with Caleb... By 4u2ges ( 5 Years Ago )
Forum Post [quote][b]4u2ges (10/4/2020)[/b][hr]It's Caleb a problem (maybe some... By Lord Ashes ( 5 Years Ago )
Forum Post Yes, it is still a bug with CC3+ (default RL characters, converted... By 4u2ges ( 5 Years Ago )
Forum Post OK got it! :) Any character without Persona applied would not update... By 4u2ges ( 5 Years Ago )
Forum Post Hi every one, You can try to add this. # This API can trigger... By AllenLee (RL) ( 5 Years Ago )
Forum Post [quote][b]AllenLee (RL) (10/5/2020)[/b][hr]Hi every one, You can try... By videodv ( 5 Years Ago )
Forum Post Have not tried it myself yet but sounds like its a solution. Thanks... By Lord Ashes ( 5 Years Ago )
Forum Post The added code does indeed work. However, there is no explanation as... By Lord Ashes ( 5 Years Ago )
Forum Post @Ashes Re: "We often compare ourselves to the US..." Finding yourself... By SeanMac ( 5 Years Ago )
Forum Post [quote][b]SeanMac (10/6/2020)[/b][hr]@Ashes Finding yourself reading... By Lord Ashes ( 5 Years Ago )
Forum Post Thanks, man. A change is as good as a rest. Regards SeanMac By SeanMac ( 5 Years Ago )



Reading This Topic