[Closed] moveKeys from Bobo
Hi all …
I made a script following Bobo’s CG academy ( Max Script Fundamentals 2 ) to move the keys of an objects. it’s working great ( as any thing usually Bobo’s doing ).
theOffset = 0
for o in selection do moveKeys o.(any controller) = ( theOffset += (the number of frames))
but the problem is i don’t know how to control from which object the animation started and the direction and i searched in the help but no luck,
i found keyShifter script wish dose the thing but i did not know how because it’s is encrypted.
can any one help pleas.
thanks in advance
read carefully MXS help -> Controller Key Functions (moveKeys, selectKeys[b])…
[/b]If you need a help with your script please post a sample. The code (sample) that you posted:
theOffset = 0
for o in selection do moveKeys o.(any controller) = ( theOffset += (the number of frames))
can’t work and couldn’t be given to you as a sample…
Sorry denis …
this is my cod:
theOffset = 0
for o in selection do moveKeys o.pos.z = ( theOffset +=5)
hope i can get some help
cheers
but my problem is in the selection array and how to define which object to art the animation from like what happening in the link i put earlier.
cheers
In the DVD example, the shifting happened in the order of object creation which is what MAXScript usually does when using object paths like $Box* or any of the built-in collections like objects, geometry etc.
In the case of selections though, MAXScript actually knows the order of selection, so if you hold Ctrl and start clicking objects one by one to add them to the selection, then convert the selection to an array, the array will reflect the order in which the objects were collected.
A possible approach to this would be to sort the objects by some factor like name, position or anything else (typically using indexed qsort). It is up to you to decide what the logic of sorting your objects should be. Do you have any specific ideas?
why do you not want to read MXS help?
the
for o in selection do moveKeys o.pos.z = ( theOffset +=5)
doesn’t make any sense!
according to the help[b] moveKeys[/b] functions needs two parameters - controller and time shift.
so the syntax is:[b][i] moveKeys theController timeShift [/i][/b]
[b]o.pos[/b] is point3 value of the node's position controller that represents node's position.
[b]o.pos.z[/b] is float value that represents node's position Z component.
you need node's position controller (or Z_position subcontroller) to move its keys.
the code that makes any sense is:
for obj in selection do moveKeys obj.pos.controller.Z_position.controller (theOffset += 5)
it makes sense if object's transform controller is PRS (position_rotation_scale) controller and Position Sub Controller is Position XYZ controller.
what do you know about controllers and sub controllers? what do you know about controller's time range, controller's keys, and key time property?
eh..
well... here is a max script snippet that creates 5 boxes, applies PRS controllers as transform controllers to their transforms, applies Position_XYZ controller as sub controller of PRS, create extra key for Z position at time 10, and moves Z_Position controller's keys on 5 frames far for every created box. As the final result you will see that every box starts moving with 5+ frames delay:
(
-- Pre-make
delete objects -- to clear the scene
stopAnimation()
slidertime = 0f
-- Make Boxes and setup controllers
boxes = for k=1 to 5 collect
(
b = box name:("theBox_" + k as string) pos:[0,0,0] wirecolor:(color (50*k) 0 0)
b.transform.controller = prs()
b.pos.controller = Position_XYZ()
with animate on at time 10 b.pos.z += 2*b.height
b
)
-- move Keys
select boxes
theOffset = 0f
for obj in selection do moveKeys obj.pos.controller.Z_Position.controller (theOffset += 5f)
-- Set scene's animation range and Play animation
animationrange = interval 0 35
playAnimation()
)
READ the MXS Help!
denis …
thank you for your help …
but take it easy man i forgot to writ controller … that’s it no need for the attetute … if it’s bothering you too much to answer pleas dont … 2nd you didn’t read what is the problem I’m facing I HAVE NO PROBLEM MOVING THE KEYS …
cheers
dear Bobo …
this script is doing waht i have in minde KeyShifter i attached some photos for waht i’m trying to do …
Thanks in advance …