The following method is used to collect a list of the bitmap files used in a scene. For the properties and methods associated with bitmap values, including reading and writing bitmap files, see Bitmap Values.
enumerateFiles [ <maxwrapper_obj> ] <function> [ <arg> ] \
[ #inactive ] [ #videoPost ] [ #render ] [ #missing ] \
[ #firstSubOnly ]
Lets you run through all the bitmap files currently used in the scene or in an individual object. You can filter this so it just gives you those for video post or the renderer or the ones that are inactive or missing.
The enumerator works by calling a function you give it once for each of the file names it finds corresponding to the filters switches and other arguments you set.
The only required argument is the <function> argument. The details are:
An optional 3ds Max object, such as a node or a material. Supplying this argument causes the enumerator to only consider files associated with this object. See the #localOnly switch for more info.
The function to be called for each file found. It should be a function of one or two arguments, the first one is the string file name supplied by the enumerator. See example below.
If specified is passed to the <function> as its second argument by the enumerator. This is useful if you have a general purpose enumerator function that can be conditioned by the argument you pass in on a particular enumeration, or if you want to pass in an array that the found names should be appended to.
Include the inactive files.
Include the files used in video post.
Include the files used during rendering.
Include files that are missing in the file system
If you don't specify any of the above filter flags, all the files are enumerated.
Use in conjunction with the <maxwrapper_obj> argument. If specified, limits the enumeration to those files used directly in the object, if not then any referenced objects are scanned.
Don't enumerate into custom attributes
Don't include viewport rendering only required files
Check only first file in an .ifl
function get_names name a = append a name
files = #()
enumerateFiles get_names files #missing
The following script will print out a sorted list of all the bitmap files used in the current scene file:
fn addmap mapfile =
local mapfileN=mapfile as name
local index=finditem mapfiles mapfileN
if index == 0 do append mapfiles mapfileN
for mapfile in mapfiles do print (mapfile as string)
By replacing line 8 with
enumeratefiles addmap #missing
only the missing bitmap files will be printed.
External File Methods
File Name Parsing
Standard Open and Save File Dialogs