I wrote a little script a few years back. It was working in SI 2011.5, and
should work in later as well.

Just select some keys in animation editor and run the script a few times :)
(if you want to resample the curve as well. just uncomment the
"oCurve.Resample.." line)

Play with the last line with math.random function - the values there or
read about random library on some python manual :) It may be very light
change or very large - it depends on what the original values are.

Remember to save Your work before running the script, just for backup.

###PYTHON SCRIPT
###BEGIN HERE
import math
import random
xsi = Application

oCurves = xsi.FCurveSelection

for oCurve in oCurves:
oKeys = oCurve.SelectedKeys
cntKeys = oKeys.Count

if cntKeys > 0:
tmp = 0
for oKey in oKeys:
 if oKey.Selected == 1:
if tmp == 0:
fKey = oCurve.GetKeyFrame(oKey.index)
 tmp = tmp + 1
lKey = oCurve.GetKeyFrame(oKey.index)
firstKey = math.floor(fKey)
 lastKey = math.ceil(lKey)
# oCurve.Resample(firstKey, lastKey, 2.0) #uncomment this line to apply
resampling between first and last key selected.
 KeysCollection = oCurve.GetKeysBetween(firstKey, lastKey)
for oKeyz in KeysCollection:
keyNow = oKeyz.index
 # move key by random number
oKeyz.Value += (random.random() - 0.5 ) * 0.3 #change this values or use a
different random - it will depend on what the original values are

###END HERE




On Fri, Feb 14, 2014 at 2:48 PM, Rob Wuijster <r...@casema.nl> wrote:

>  Hi all,
>
> I ran into this before, but never really found a quick and dirty solution.
>
> What I'm after is to select a bunch of equal keyframes in the Animation
> Editor, and randomize them in time.
> e.g. 20 objects going from left to right, frame 1 to 100. Now randomize
> start and end keys on the f-curves within 25 frames or so.
>
> I did some digging and found an old script set for f-curve manipulation
> from Juan Brockhaus, but those don't work anymore in SI2013SP1.
>
> One would expect to have the r(x,y) or l(x,y) commands work in the Frame
> box in the AE by now, but strangely enough no....
> So if anyone has a simple solution, or a simple script that would be great.
>
> --
>
> cheers,
>
> Rob
>
> \/-------------\/----------------\/
>
>

Reply via email to