View Full Version : Averaging keyframes?
slebed 09-26-2006, 05:47 PM Is there a script out there that will take a range of keyframes on a selected channel, say y rotation, and average their values over a user defined number of frames? Is this something someone could quickly write, or is it a big deal. I'm looking for something like the 'Average' tool in Combustions math operations dialogue.
Thanks
|
|
_stev_
09-28-2006, 10:57 PM
I believe something like this would work. This is for Y rotation:
controllerKeys = $.rotation.controller[2].keys
keyValues = #()
avg = 0.0
for k in controllerKeys do (
append keyValues k.value
)
for v in keyValues do (
avg += v
)
avg = (avg / (keyValues.count as float))
Is this what you are looking for? Not sure how I'd apply this to a specific range.
_stev_
09-28-2006, 11:02 PM
fn sakAvgTest fMin fMax = (
controllerKeys = $.rotation.controller[2].keys
keyValues = #()
avg = 0.0
for k in controllerKeys do (
if (k.time > fMin AND k.time < fMax) then (
append keyValues k.value
)
)
for v in keyValues do (
avg += v
)
avg = (avg / (keyValues.count as float))
)
Okay, I think this works. It's averaging key frame values though
slebed
09-28-2006, 11:09 PM
Thats exactly what I needed! Thank you for taking to time to help me. I have motion capture data that was very noisy, and I needed a way of smoothing it out.
Stephen Lebed
Visual Effects Supervisor
Mechnology
CGTalk Moderation
09-28-2006, 11:09 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.