PDA

View Full Version : doesFileExist "considerable slowdown..."


MikeOwen
02-19-2009, 11:37 PM
Hi All,
I'm using "doesFileExist thepath" to check that all the bitmaps exist in a scene are valid and available, but I get alot of slowdown (taking into account that it has to access the file servers) when I have more than about 10 bitmaps in a scene.
Is "doesFileExist thepath" the most efficient MAXScript command to use for this situation?
Can anyone suggest something better?
Thanks,
Mike

ZeBoxx2
02-20-2009, 01:47 AM
This is one..
((getFiles <filespec>).count > 0)
..not sure if that'd be faster, exactly.

Or you could go through ATSOps - that has a method to automatically get you the list of any missing files.

meditmaterials[1].diffusemap = bitmaptexture filename:"c:\\nonexist.png"
Bitmaptexture:Bitmap
ATSOps.GetFilesByFileSystemStatus #missing &foo
1
foo
#("c:\nonexist.png")


Finally, there's .NET - but try the above first..

Kameleon
02-20-2009, 10:30 AM
I took the opportunity and tried the doesFileExist agains it's dotnet equivalent and the result surprised me hehe.... Here's the script:

(
Dir=dotnetclass "System.IO.Directory"
TheFiles=Dir.GetFiles @"\\manager\3D STUFF\IAM\TEXTURES\3DSMAX ARCHMAT"
Fi=dotnetclass "System.IO.File"

print "doesFileExist"
local start=timestamp()
for i in TheFiles do doesFileExist i
local end=timestamp()
format "Processing took % seconds\n" ((end - start) / 1000.0)

print "System.IO.File.Exists"
local start=timestamp()
for i in TheFiles do Fi.Exists i
local end=timestamp()
format "Processing took % seconds\n" ((end - start) / 1000.0)
)

And the result:

"doesFileExist"
Processing took 0.188 seconds
"System.IO.File.Exists"
Processing took 0.234 seconds
OK

This directory has 438 files.... dunno how it will behave with more files, I guess you could try it! Cheers

CGTalk Moderation
02-20-2009, 10:30 AM
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.