PDA

View Full Version : Possible to optimize that script ?


Ziboo
12-13-2008, 07:55 PM
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.

http://img233.imageshack.us/img233/5023/renderscenesm6.th.jpg (http://img233.imageshack.us/my.php?image=renderscenesm6.jpg)

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.

Bobo
12-13-2008, 10:55 PM
http://forums.cgsociety.org/showthread.php?f=98&t=693696&

Ziboo
12-14-2008, 02:11 PM
Thank you, i'm gonna check this out

Rob.

CGTalk Moderation
12-14-2008, 02:11 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.