|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
|
Hi,
I’ve got a simple script with several stacked for-loops. It reads out image data and drives objects properties with it.
I use a print command to put out the progress (which frame its working on). Unfortunately after working on serveralf frames Max gets in some kind of freeze state and no print output is visible anymore. Although it’s finishing the job and the output is visible afterwards.
I’ve attached the script, one note: the boxArray variable is defined elsewhere so it won’t work on your computer.
Can’t manage the attachment, so I post the script here:
videoFilename = meditMaterials[1].fileName
videoFile = openBitMap(videoFilename)
videoLength = videoFile.numframes
animationRange = interval 0 videoLength
--for timer in 0 to videoLength do
for timer in 0 to 50 do (
for y in 1 to 30 do
(
ausgabe = "timer = " + timer as string + "y = " + y as string
print ausgabe
videoFile.frame = timer
pixel = getPixels videoFile [0,y-1] 60
for x in 1 to 60 do
(
farbe = pixel[x]
wert = (pixel[x].r + pixel[x].g + pixel[x].b)/3
animate on
(
at time timer
(
in coordsys parent boxArray[x][y].pos.z = wert/5
boxArray[x][y].material.Diffuse = farbe
)
)
)
)
)
|
|
|
|
Please see this post for help with attachments.
Part of your problem is your choice of variable name - look up “timer” in the maxscript help.
Changed timer to myTimer throughout.
Changed “in” to “=” in the for loops. While “in” and “=” are synonymous, conventional usage is “=” for numeric loops, “in” for collections.
Changed the print to a format statement.
Note. Not tested, but should be about right.
( for myTimer = 0 to 50 do
(
for y = 1 to 30 do
(
format "Timer = %, y = %\n" myTimer y to:listener
videoFile.frame = myTimer
pixel = getPixels videoFile [0,y-1] 60
for x = 1 to 60 do
(
farbe = pixel[x]
wert = (pixel[x].r + pixel[x].g + pixel[x].b)/3
animate on
(
at time myTimer
(
in coordsys parent boxArray[x][y].pos.z = wert/5
boxArray[x][y].material.Diffuse = farbe
) --end at time...
) -- end animate
) -- end x loop
) -- end y loop
) -- end myTimer loop
)
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
Thanks Steve for your advice.
Unfortunately it does’t change my maxs behaviour. It still stops the format output after a certain amount of time. Even when I have a routine like this:
for myTimer = 0 to 100 do
(
for y = 1 to 60 do
(
format "Timer = %, y = %\n" myTimer y to:listener
)
)
It seems like Max avoids output when the calculation lasts for to long. Strange, isn’t it?
|
|
|
|
Very strange - because it works perfectly here (your last, small example).
Can you close Max, re-open it, put your (small) test script into a new script and execute it. I’ve seen odd things happen before when I spend too much time editing and running scripts - especially after a number of errors have occurred (normally my typos ;) ).
Which version of Max you using?
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
Thank you so much for helping Steve. I restarted Max (max 2010 64bit on Win7) but nothing has changed. But I’ve introduced a progress bar and this solves my problem. And while the progress bar is incresing the format values get printed as well. Weird, isn’t it?
|
|
|
|
Just a bit. It should just work as expected.
Could be that the introduction of a progress bar is causing the listener window to refresh itself as well. Pure guesswork, of course.
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
|
|