Notifications
Clear all

[Closed] Possible to optimize that script ?

Hi all,

Just for fun, i try to make something.
But my script spend to much time to create the animation.

I have this in my scene, it’s like a game to make shape with your hands, i don’t remember the name of it.

So i render the Zdepth pass of an animation in 80*60 pixels (there is 80 stick * 60) so it’s simple to have the move of each on.

I just want to know if someone know if it’s possible to optimize the scipt ?

global unnamedRollout
rollout unnamedRollout "Untitled" width:233 height:53
(
	progressBar pb1 "ProgressBar" pos:[13,8] width:207 height:31
)

createDialog unnamedRollout

disableSceneRedraw()

arMeshs = $mesh_sticky* --array of all the meshs

aRbitmapToOpen = getFiles "E:\\_TEMP\\StickyBox3d\\render_zdepth_sequence\\*.tga" -- array of the image sequence

animate on
	
for t = 0 to 8 do
(
	unnamedRollout.pb1.value = 100.*t/8 
	at time t
	
	-- move sticks to original position
	
	if t != 0 do
	(
		my_image = openBitMap aRbitmapToOpen[(t+8)-1] -- open previous image
		for j = 0 to 59 do
		(
			aRcolors = getPixels my_image [0,j] 80
			for i = 0 to 79 do
			(
				meshToMove = arMeshs[(j*80)+(i+1)]
				valueOfMove = aRcolors[i+1].r * 1
				move meshToMove [0,valueOfMove,0]
			)
		)
	)
	
	my_image = openBitMap aRbitmapToOpen[t+8] -- open current image
	
	
	-- move sticks to the value of the zdepth pixel
	
	for j = 0 to 59 do
	(
		aRcolors = getPixels my_image [0,j] 80
		for i = 0 to 79 do
		(
			meshToMove = arMeshs[(j*80)+(i+1)]
			valueOfMove = aRcolors[i+1].r * 1
			move meshToMove [0,-valueOfMove,0]
		)
	)
)
enableSceneRedraw()

Thank you

Rob.

2 Replies

Thank you, i’m gonna check this out

Rob.