3ds Max Scene File Properties

The File Properties can be accessed in MAXScript using the methods described in this topic. The File Properties are organized into three sets. These sets correspond to the three pages in the Main Menu > File > File Properties dialog:

#summary

This set contains the Title, Subject, Author, Keywords, Comments fields from the Summary page.

#contents

This set contains the Manager, Company, Category and an array of all headers from the Contents page like General, Mesh Totals etc. Note that the Contents page contents are only update when the file is saved. You can perform a max hold to perform a scene hold, which causes the file to be saved and the Contents page contents to be updated.

#custom

This set contains all the fields from the Custom page.

 

The following methods are used to access the above sets. <set_name> can be any of the values from above.

fileProperties.getNumProperties <set_name>

Returns the number of properties in the given set.

For example:

numProps=fileProperties.getNumProperties #summary

 

fileProperties.getPropertyName <set_name> <index>

Returns as a string the property name of the given index. The index is 1-based.

For example:

nameProp=fileProperties.getPropertyName #summary 1

 

fileProperties.getPropertyValue <set_name> <index>

Returns the property value of given index. The value type can be one of the following four types of values currently supported by 3ds Max in the File Properties dialog. The values in bracket are the MAXScript equivalent value type.

Property Value Types:

Text [String]

Date [String] - contains the date eg:"03/23/99"

Number [Integer or Float based on actual value]

Yes or No [Boolean]

Headers [Array of strings]

Headers are items like General, Mesh Totals, etc. that appear in contents page.

For example,

an array of headers from contents page obtained using:

fileproperties.getPropertyValue #contents 1

will return

#("General", "Mesh Totals",…)

 

fileProperties.getItems <header_string>

Returns an array of strings containing all the items under the given header.

For example,

fileProperties.getItems "Mesh Totals"

might return

#("Vertices: 488", "Faces: 968")

 

fileProperties.findProperty <set_name> <prop_name_string>

Given the set name and property name string, will return the index of the property if found, 0 if not found.

For example:

fileProperties.findProperty #custom "BoolVal"

 

fileProperties.addProperty <set_name> <prop_name_string> \
<prop_value> [#date]

Adds a new property with the property name and property value to the specified set. The property values can be any of the types previously described except an Array as you cannot add anything to contents page.

If string containing a date is passed then the optional #date argument has to be passed for it to be added as a date value.

For example,

fileProperties.addProperty #custom "DateVal" "03/23/99" #date

will add a date property named DateVal to the custom page.

 

fileProperties.deleteProperty <set_name> <prop_name_string>

Delete the property indicated by <prop_name_string> in the specified set.

Following is an example of printing all the File Properties in an hierarchial fashion for the current scene.

Example:

-- Add some properties

fileProperties.addProperty #summary "Title" "Title val"

fileProperties.addProperty #custom "IntVal" 30

fileProperties.addProperty #custom "FloatVal" 30.034

fileProperties.addProperty #custom "BoolVal" true

fileProperties.addProperty #custom "DateVal" "03/23/99" #date

--

-- Perform a scene hold to update the Contents set.

max hold

--

-- Get all properties

pages = #(#summary, #contents, #custom)

for pg in pages do

(

format "--- % ---\n" (pg as string)

for i=1 to (fileProperties.getNumProperties pg) do

(

local pname = (fileProperties.getPropertyName pg i)

local pval = (fileProperties.getPropertyValue pg i)

format "\t% : " pname

if (pname == "Headers") then

(

format "\n"

for hdr in pval do

(

format "\t\t%\n" hdr

local docs = fileProperties.getItems hdr

if docs != undefined then

for d in docs do format "\t\t\t%\n" d

)

)

else format " %\n" pval

)

)