Custom attributes in MAXScript can now be applied to any type of MAX object, including nodes and the scene rootnode. However, the rollouts associated with the custom attributes will only be displayed for materials, modifiers, and base objects.
A .custAttributes
property has been added to MAXWrapper in 3ds Max 5.1. It contains a virtual array of the custom attributes assigned to the object. Standard array methods and operations can be performed on this virtual array, with the exception of join
and sort
.
The class of the virtual array is MAXCustAttribArray
.
findItem <MAXCustAttribArray> < cust_attrib >
Find the given custom attribute in the supplied virtual array.
<MAXCustAttribArray> [< integer > | < cust_attrib_name >]
Get a custom attribute by index or name.
<MAXCustAttribArray> [< integer > | < cust_attrib_name >] = < cust_attrib >
Set a custom attribute by index or name.
append <MAXCustAttribArray> < cust_attrib >
Add a custom attribute to the end of the virtual array.
deleteItem <MAXCustAttribArray> (< cust_attrib > | < cust_attrib_name >)
Delete a custom attribute from the virtual array by providing the custom attribute or its name.
You can also map across the MAXCustAttribArray.
<MAXCustAttribArray>.owner
Returns the owner of this custom attribute array. Available in 3ds Max 2019.3 Update and higher.
isDeleted <MAXCustAttribArray>
Returns true if the virtual array is deleted. A MAXCustAttribArray is considered deleted if the owner is deleted.
<MAXCustAttribArray> == <MAXCustAttribArray>
<MAXCustAttribArray> != <MAXCustAttribArray>
Standard comparison operators. Note that these compare the attribute container, not whether they contain the same elements.
t = teapot()
--> $Teapot:Teapot001 @ [0.000000,0.000000,0.000000]
cac = t.custAttributes
--> #CustAttribs()
cac.owner
--> $Teapot:Teapot001 @ [0.000000,0.000000,0.000000]
delete t
isDeleted t
--> true
isDeleted cac
--> true