Notifications
Clear all

[Closed] Keyframe/cache vertex locations

Thanks Denis,
That definitely got it to work but it is very slow and sometimes unresponsive and crashes occur with very complex objects (ie 1k poly shoe treads or tires going through 100k-500k poly strip of dirt for tire tracks).While on the other hand my script was faster and more stable with things like that.
It also eats up the memory a lot and came close to 96% of my 8gb on vista x64, making it almost unusable, while my script used about 45%, I could’nt undestand why that happened though, I thought the FPU was responsible for that?.
Actually the difference between the two was about 38 minutes, my script finished in 3min for 60 frames while yours took almost 41 minutes and I was barely able to use the PC while it was running .
Using my script, there was the expense of some tweaking with my settings to get the right effect vs no tweaking with your script, your’s also handled well at any depth of intersection, while mine needed to be tweaked once again to prevent verticies from being dragged too far; but in this case I think speed is more important than anything else.
This was the result, both are so indentical it’s pointless posting the other one, since it just has sharper edges in the snow from the sides of the tire.

I have tried again and again and I still cannot get my process into your script because I’m afraid I just dont understand it. Is it even possible to do what I’m asking with my script?

I am very desperate to get this script working so I’m posting the code up to see if anyone else has any solutions for me.
This is very rough so ignore the simplicity and timers, they are only temporary. I will fix them once I go into slidertime and understand it better but right now my priority is getting the piece of code in there that tells max to buffer or save the current status of the mesh at the end of each frame.

macroScript TEST
category:"My Tools"


(
rollout window "Excavator" width:200 height:100
(

checkbutton chk1 "DIG!" pos:[20,5] width:50 height:44
timer tmr1 active:false interval:1
edittext edt1  pos:[80,5] width:30 height:20 text:((tmr1.ticks)as string) readonly:true
timer tmr2 active:false interval:100 --50 @ 20fps 200@30fps

local A=$Sphere01
local B=$Box01

	on  chk1 changed state do
		if state==true then
		(
			tmr1.active=true
			tmr2.active=true
		)
		else
		(
			tmr1.active=false
			tmr2.active=false

		)
		
	on tmr1 tick do
	animate on
	(
		slidertime=(tmr1.ticks)
		edt1.text=((tmr1.ticks)as string)
		select $Box01
		macros.run "Modifier Stack" "Convert_to_Mesh"
		modPanel.addModToSelection (Vol__Select ()) ui:on
		$Box01.modifiers[#Vol__Select].level = 1
		$Box01.modifiers[#Vol__Select].Volume = 3
		$Box01.modifiers[#Vol__Select].node = $Sphere01
		$Box01.modifiers[#Vol__Select].UseAffectRegion = on
		$Box01.modifiers[#Vol__Select].falloff = .15
		$Box01.modifiers[#Vol__Select].pinch = 0
		$Box01.modifiers[#Vol__Select].bubble =0

	)
	on tmr2 tick do
	(	
		modPanel.addModToSelection (Push ()) ui:on
		$Box01.modifiers[#Push].Push_Value = -2
	)

		

	

)
createDialog window width:200 height:100
)

From what I’ve been able to gather; I managed to progress the script to this:

macroScript TEST
 category:"My Tools"
 
 
 (
 rollout window "Excavator" width:200 height:100
 (
 
 checkbutton chk1 "DIG!" pos:[20,5] width:50 height:44
 timer tmr1 active:false interval:1
 edittext edt1  pos:[80,5] width:30 height:20 text:((tmr1.ticks)as string) readonly:true
 timer tmr2 active:false interval:10 --50 @ 20fps 200@30fps
 
 local A=$Sphere01
 local B=$Box01
 
 
 
 	on  chk1 changed state do
 		
 		if state==true then
 			animate on
 		(
 			animatevertex $Box01 #all
 			bake = for v=1 to B.numverts collect #(getVert B v, bezier_point3())
 			modified = #()
 			for v=1 to B.numverts do
 				vPos = bake[v][1]
 			
 
 			tmr1.active=true
 			tmr2.active=true
 			select $Box01
 			disablesceneredraw()
 
 
 		)
 		
 		else
 		animate off
 		(
 			tmr1.active=false
 			tmr2.active=false
 			clearselection()
 			enablesceneredraw()
 			convertTomesh B
 			modified[v] = (tmr1.ticks)
 			if modified[v] == undefined do vPos[v][2].value = bake[v][1]
 			for v=1 to B.numverts where modified[v] != undefined do (B.baseobject[#Master_Point_Controller][v].track = bake[v][2])
 			update B
 		)
 
 
 	on tmr1 tick do
 
 	(
 		slidertime=(tmr1.ticks)
 		edt1.text=((tmr1.ticks)as string)
 		--macros.run "Modifier Stack" "Convert_to_Mesh"
 		convertTomesh B
 		modPanel.addModToSelection (Vol__Select ()) ui:on
 		$Box01.modifiers[#Vol__Select].level = 1
 		$Box01.modifiers[#Vol__Select].Volume = 3
 		$Box01.modifiers[#Vol__Select].node = $Sphere01
 		$Box01.modifiers[#Vol__Select].UseAffectRegion = on
 		$Box01.modifiers[#Vol__Select].falloff = .1
 		$Box01.modifiers[#Vol__Select].pinch = 0
 		$Box01.modifiers[#Vol__Select].bubble =0
 	)
 	on tmr2 tick do
 	(	
 		modPanel.addModToSelection (Push ()) ui:on
 		$Box01.modifiers[#Push].Push_Value = -1
 
 			)
 
 )
 createDialog window width:200 height:100
 )
 

It seems like the buffer is not collecting since I keep getting “No ““put”” function for undefined” and “No ““get”” function for undefined” errors when chk1.enabled=false.

Is anyone able to point out what I’ve done wrong? If not, can anyone point me towards some maxscript books/dvd’s that I can buy that focus specifically on vertex animation/buffering/collecting etc. I have been racking my brain with this for days and am unable to get any further since I literally cannot find any material that focuses on this topic.

Page 2 / 2