Bitmap Files

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] \
 [#localOnly ] [#skipCustAttributes ] [#skipVPRender] [#firstSubOnly] \
 [#skipSubFiles] [#visitOnce] [#useEnumAccessor]      

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:

<maxwrapper_obj>

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.

<function> 

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.

<arg> 

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.

#inactive 

Include the inactive files.

#videoPost 

Include the files used in video post.

#render 

Include the files used during rendering.

#missing 

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.

#localOnly 

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.

#skipCustAttributes 

Don't enumerate into custom attributes

#skipVPRender 

Don't include viewport rendering only required files.

#firstSubOnly 

Stop checking after the first missing sub file is found when checking for missing files. This applies to objects that use sub files for their assets, for example the bitmap files specified in an .ifl file, or per-frame cache files used by the point cache modifier.

#skipSubFiles 

Skip asset sub files. This applies to objects that use sub files for their assets, for example the bitmap files specified in an .ifl file, or per-frame cache files used by point cache modifier.

#visitOnce 

Use in conjunction with the <maxwrapper_obj> argument. If specified, any references held by the object are scanned once. In large scenes, using this option can be an expensive operation.

#useEnumAccessor 

Use an alternative means of recording of assets that is used by the Asset Tracking dialog. This is primarily exposed for testing of the object EnumAuxFiles methods. The handling of sub files is different when using this option. The first sub file is always recorded, and only missing sub files after that first sub file are recorded.

FOR EXAMPLE:

   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:

EXAMPLE:

   (
   local mapfiles=#()
   fn addmap mapfile =
   (
   local mapfileN=mapfile as name
   local index=finditem mapfiles mapfileN
   if index == 0 do append mapfiles mapfileN
   )
   enumeratefiles addmap --line 9
   sort mapfiles
   for mapfile in mapfiles do print (mapfile as string)
   )

By replacing line 9 with

   enumeratefiles addmap #missing

only the missing bitmap files will be printed.