AutoKey - Animation Converter(Dev)

Hi, i'm trying to remake AutoKey script, it's currently able to copy from one object to another - exact same XYZ position key's.
But problem is that i have a rigged skeleton with animation and it has about 30+ bones and script can't work with more then 2 objects( 1 without anim and 2 with anim)
This is what i was able to do

on alignSource pressed do
	(	
		(
		sticks = #()
		append sticks $ 
		)
		for i = 1 to sticks.count do
 
		(global object1 = sticks[i]
		 objNames = for obj in selection collect obj.name
		objNames = makeUniqueArray objNames
		uniObjs = objNames as string
			AlignSource.text = uniObjs
 
 
 
 
 
		)
	)
	on alignDest pressed  do
		(	
		(
		vecs = #()
		append vecs $ 
		)
		for i = 1 to vecs.count do
 
		(global object2 = vecs[i]
		 objNames = for obj in selection collect obj.name
		objNames = makeUniqueArray objNames
		uniObjs = objNames as string
		alignDest.text = uniObjs
 
		)
	)
 
)

The result is same(working with 1 selecetion on each menu) only change is that http://i.shotnes.com/a/09/zw1rkbus.ko3_522e5062a76e4.png
object's that where seleceted are displaying in text box.

But if there is more then 2 objects selected i get this error.

If you can help with it please, i waisted a lot of time on this issue and ruined a project because of time it taked.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
DolVai's picture

Seems transform function

Seems transform function can't be used because it's transform with position of an object and after that it deletes anim keys, but i need just to rotate along the object(to be able properly transfer animation).

Anyway guys thx for help, but big thx goes to http://www.scriptspot.com/forums/3ds-max/general-scripting/aligning-boxe...

I just figured it out how to use that for my script and here is result.

Rotation Result - far from

AttachmentSize
desktop_2013_09_24_07_29_25_344.gif 2.08 MB
Budi G's picture

hi DolVai ... hmm... do you

hi DolVai ...

hmm...
do you need to keep the original position after baking keys ?

it's still using transform function... :

originalpos = object1.pos -- append original position
------------------------------------------ start process ...
 
-- baking keys process ... such a using my scipt in bottom
 
------------------------------------------ end process ...
object1.pos = originalpos -- back to original pos

anyway, if you found the best code as you need than this method... just use that ;)

goodluck

DolVai's picture

barigazy Any update on this

barigazy

Any update on this ?
Only problem is remains in this part
coordsys local object1.rotation = y - x

I can simply make counter for object1[i].rotation = object2[i].rotation, but because it's not in world local, the result is far from what it should be like.

Budi G's picture

hi ... try this

hi ...

try this one:

object1[i].rotation.controller.value = object2[i].rotation.controller.value

it's great for the rotation technique ;)

another ways..
you can put a rotation first then a pos if need it, such:

object1[i].rotation = object2[i].rotation
object1[i].position = object2[i].position
DolVai's picture

Thx but if you look in script

Hello, Thx for reply, but if you look in script controller functin allready is used,

if selRotation.checked do( 
							for object1 in arr1 do 
	(
		addNewKey object1.rotation.controller startFrame.value 
	)

Here is what i have

	if arr1.count == arr2.count do
				(
			in coordsys world x = arr1
			in coordsys world y = arr2
				for i = 1 to arr1.count do
				(
 
		x[i].rotation = y[i].rotation
 
				)
			)

Rotation Result - far from

but its far from what i should be

AttachmentSize
desktop_2013_09_22_07_54_35_992.gif 3.62 MB
Budi G's picture

just wondering, your goal is

just wondering, your goal is align dummy to bone. is it right ?
hmm.. the case is similiar with baking animation tools

I have some method, a snipet from my old script

(
position_checked = true -- such as checkbox
rotation_checked = true -- such as checkbox
scale_checked = false -- such as checkbox
 
object1 = $ -- ie: dummy as target
object2 = $bone002 -- ie: the bone have a motion as source
 
startfrm = 0
endfrm = 50
 
----------------------------------- align first
with animate on
(
	for T=startfrm to endfrm by 1 do
	(
	   at time T object1.transform = object2.transform
	)
)
------------------------------------------------------ user option
if position_checked == false then deleteKeys object1.pos.controller #allKeys
if rotation_checked == false then deleteKeys object1.rotation.controller #allKeys
if scale_checked == false then deleteKeys object1.scale.controller #allKeys
 
)

you can apply it into dummy to dummy, box to dummy or etc...
without making you dizzy thinking about PRS controller
:)

DolVai's picture

Thx will try.

Thx a lot i think it works just perfect

arr1[i].transform

Only issue is that - it deletes not all objects in selection.

barigazy's picture

...

Hey Budi
The main problem is that bones have X-axis for normal direction and other object have Z-axis for dir.
BTW shorter version of your code wil be

object1[i][3][2].track.value = object2[i][3][2].track.value

bga

Budi G's picture

yep, you're right ... I did

yep, you're right ...
I did not look into the whole case before :)

DolVai's picture

....

Here is result

Autokeyr For multy objects

But i still can't figure out how to make same thing for orientation, maybe someone will help me out again ?

---this is what in header - first button
 
global arr1 = for obj in selection collect obj
 
 
		for i = 1 to arr1.count do
 
		(global object1 = arr1[i]
 
 
--scnd button is same but is arr2
--------
-- The orientatin script itself
 
		set animate on
		startValue = ( startFrame.value )	
 
				prevRot = object2t.rotation
 
	-------------------------------------------------------------------
		while startFrame.value <= endFrame.value do
		(
 
 
			if selRotation.checked do
			(
			in coordsys world x = object1.rotation
			in coordsys world y = object2.rotation
			in coordsys local object1.rotation = y - x
			)
 
	-------------------------------------------------------------------

If i try to add arr count'er to object1[i].rotation = y -x i get error
-- Unknown property: "rotation" in SubAnim:Visibility

If i i add counter for arr1

like here

for i = 1 to arr1.count do arr1[i].rotation = y - x
the result give me for example Box001 orientation transferred to both box003 and box004, but should be Box1 to box3, box2 to box4, like for translation.

Autokeyr For multy objects orientation

How to make this working ?, it would be realy good tool for animation transfering , if it would has this option.

AttachmentSize
desktop_2013_09_16_20_18_56_261_cut.gif 3.42 MB
desktop_2013_09_16_20_23_50_364.gif 2.67 MB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.