Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / print progress
  RSS 2.0 ATOM  

print progress
Rate this thread
 
37620
 
Permlink of this thread  
avatar
  • gaspedalo
  • Posted: 09 December 2009 11:11 PM
  • Total Posts: 15
  • Joined: 19 March 2008 05:50 PM

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 = " 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].pixel[x].pixel[x].b)/3
 
 animate on
 (
 
 at time timer 
 (
 in coordsys parent boxArray[x][y]
.pos.wert/5
 boxArray[x][y]
.material.Diffuse farbe
 )
 
 )
 
 )
 )
)


Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

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 1 to 30 do
      
(
      format 
"Timer = %, y = %\n" myTimer y to:listener
 
      videoFile
.frame myTimer
      pixel 
getPixels videoFile [0,y-1] 60

      
for 1 to 60 do
         
(
         farbe 
pixel[x]
         wert 
(pixel[x].pixel[x].pixel[x].b)/3
 
         animate on
            (
            at time myTimer 
               (
               in coordsys parent boxArray[x][y]
.pos.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.

Replies: 0
avatar
  • gaspedalo
  • Posted: 10 December 2009 12:52 AM

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 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?



Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

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.

Replies: 0
avatar
  • gaspedalo
  • Posted: 10 December 2009 01:15 AM

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?



Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

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.

Replies: 0