Vertex Keyframe Trasfer

Friends need help with this script.

This script creates boxes at each vertex of the object pick and trasnfiere keyframes of each vertex to each box set. (eye, the script is not mine, I copy a page of examples)

I need help to make some changes, please:

1-select only the vertices I want to use and save it in an array.
2-create a copy of a selected object in each vertex that is in the array and transfer your keyframes.

rollout A1 "Animated Vertex"
( 
 button B3 "Pick Object"
	on B3 pressed do
(	 
 local boxSize = 1 
 local frameStepping = 2 
 ------------------------------------------------------- 
 local obj = selection[1] 
 if isValidNode obj do 
 ( 
  local tMesh = obj.mesh 
  local boxes = for i=1 to tMesh.numVerts collect box width:boxSize height:boxSize length:boxSize 
  with animate true for t=animationRange.start.frame to animationRange.end.frame by frameStepping do at time t for i=1 to tMesh.numVerts do boxes[i].pos=((getVert obj.mesh i)*obj.transform)  
 )
 )  
)

Comments

Comment viewing options

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

alternative baking options

Hey Nice Script,
But is it possible to modify the script, so it bakes the vertex animation from the original mesh to transform keys? without assigning any meshes to the vertex(Plain and simple bake all the vertex animations to transforms key frames on the original mesh?)

Best Regards
Daniel

barigazy's picture

...

I thiks for that is better to use skin wrap modifier

barigazy

skaale's picture

update on vertex animation to transform keys

HI again,
Thanks for your reply, is because I want to export a FBX file to keyshot render(http://keyshot.com/) and there is no support for modifiers and skin and bones right now only position,rotation and scale keys so I have been experimented with vertex animation and i works fine but I want to translate it back to transforms keys so I can export meshes with baked modifiers etc.. maybe I could make a video to explain my experiment and I found this nice script but it copy the vertex animation to an array of instances And I just want the transforms keys to the original mesh.

workflow right now:

1) mesh with edit poly.
2) apply vol selection modifier
3) ex. FFD modifiers
4) the a use http://www.scriptspot.com/3ds-max/scripts/volume-select-vertex-baker
5) ?

Best
Daniel

barigazy's picture

...

Try this one:
Example
Create sphere, assigne FFD modifier and animate control points.
Next use this code which will create copy of original mesh with baked verts animation.

fn bakeVertsAnim obj = if isvalidnode obj and canConvertTo obj Editable_mesh do
(
	slidertime = animationRange.start
	targObj = snapShot obj
	local gv = meshop.getVert, sv = meshop.setVert
	animateVertex targObj #all
 
	for a in animationRange.start to animationRange.end do
	(
		at time a animate on with redraw off
		(
			arr = for v in 1 to obj.verts.count collect gv obj v
			sv targObj #{1..targObj.numverts} arr
		)
	)
	select targObj
)
bakeVertsAnim $Sphere001

barigazy

skaale's picture

error in max with the code

Big thanks Barigazy,

Get this error in the array Unable to convert: undefined to type: Point3
I have a screen shot

https://dl.dropboxusercontent.com/u/6776363/test.jpg

thanks for helping me out Keyshort has become a very powerful path raytrace rendering engine
best
Daniel

barigazy's picture

...

I fix some lines. Try now and tell me how it works for you

fn bakeVertsAnim obj = if isvalidnode obj and canConvertTo obj Editable_mesh do
(
	slidertime = animationRange.start
	if getCommandPanelTaskMode() != #create do setCommandPanelTaskMode #create
	targObj = snapShot obj
	addModifier obj (Turn_to_Mesh ())
	local gv = meshop.getVert, sv = meshop.setVert
	animateVertex targObj #all
	with undo off with redraw off
	(
		for a in animationRange.start to animationRange.end do
		(
			with animate on at time a 
			(
				arr = for v in 1 to obj.numverts collect gv obj v
				sv targObj #{1..targObj.numverts} arr
			)
		)
		deletemodifier obj 1
	)
	select targObj
)
bakeVertsAnim $Sphere001

barigazy

skaale's picture

Hey, It made a copy with

Hey,

It made a copy with vertex animation, but it did not translated into transform keys

https://dl.dropboxusercontent.com/u/6776363/test2.jpg

best
Daniel

barigazy's picture

...

maybe this :)

fn bakeVertsAnim obj = if isvalidnode obj and canConvertTo obj Editable_mesh do
(
	slidertime = animationRange.start
	if getCommandPanelTaskMode() != #create do setCommandPanelTaskMode #create
	targObj = snapShot obj
	addModifier obj (Turn_to_Mesh ())
	local gv = meshop.getVert, sv = meshop.setVert
	animateVertex targObj #all
	with undo off with redraw off
	(
		for a in animationRange.start to animationRange.end do
		(
			with animate on at time a 
			(
				targObj.transform = obj.transform
				arr = for v in 1 to obj.numverts collect gv obj v
				sv targObj #{1..targObj.numverts} arr
			)
		)
		deletemodifier obj 1
	)
	select targObj
)
bakeVertsAnim $Sphere001

barigazy

skaale's picture

:-)

hey,
Thanks again!, but It was a crazy idea. I can see now it is not possible to convert vertex animation to animated transform keys because it only works with XYZ position. But Thanks again Barigazy:-)

https://dl.dropboxusercontent.com/u/6776363/3.jpg

Best
Daniel
Email : [email protected]

skaale's picture

So fare

I can do it with your older script, but it assigning a new mesh to every vertex point

https://dl.dropboxusercontent.com/u/6776363/test5.jpg

Best
Daniel

Comment viewing options

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