Custom Attributes Management Functions

The following management functions are available through the custAttributes struct:

 

custAttributes.count <obj> [BaseObject:<bool>]

Returns a count of the number of separate scripted custom attribute sets have been added via the .add() function.

BaseObject:<bool>

If the optional keyword argument baseObject is set to true (the default), in case the object specified is a node, the base object will be operated on instead. If false, the node itself will be operated on.

custAttributes.get <obj> (<index> | <attrib_def>) [BaseObject:<bool>]

Returns the custom attribute set, specified as an index or by its defining attribute definition.

BaseObject:<bool>

If the optional keyword argument baseObject is set to true (the default), in case the object specified is a node, the base object will be operated on. If false, the node itself will be operated on. (In versions prior 3ds Max 5.1, the base object was always used.)

Note:

The custom attribute set values returned by the custAttributes are effectively holder values for the object's custom parameters in that attribute set. You can get at these parameter values as simple properties on the attribute set value.

Example:

gp = custAttributes.get $ gameParams

gp.hitPoints = 50

This is equivalent to accessing the custom attribute parameters directly on the object:

$.gameParams.hitPoints = 50

 

custAttributes.delete <obj_or_collection> (<index> | <attrib_def>) [baseObject:<bool>]

Deletes the specified custom attribute set from the object or from all the objects in the given collection. The set to be deleted is defined by index number or by its defining attributes definition.

BaseObject:<bool>

If the optional keyword argument baseObject is set to true (the default), in case the object specified is a node, the base object will be operated on. If false, the node itself will be operated on. (In versions prior 3ds Max 5.1, the base object was always used.)

 

custAttributes.makeUnique <obj> (<index> | <attrib_def>) [baseObject:<bool>]

If some objects with custom attribute sets share a specific attributes definition, you can make selected objects have unique copies of the definition.

BaseObject:<bool>

If the optional keyword argument baseObject is set to true (the default), in case the object specified is a node, the base object will be operated on. If false, the node itself will be operated on. ( In versions prior 3ds Max 5.1, the base object was always used.)

Example:

custAttributes.add $box* def1

You can make box01 unique with:

custAttributes.makeUnique $box01 def1

or all of them unique with:

custAttributes.makeUnique $box* def1

 

custAttributes.getDef (<obj> <index>) | <custAttrib> [baseObject:<bool>]

Returns the attribute definition for a given custom attribute set in an object or from a custom attribute set accessed with the .get() method.

BaseObject:<bool>

If the optional keyword argument baseObject is set to true (the default), in case the object specified is a node, the base object will be operated on. If false, the node itself will be operated on. ( In versions prior 3ds Max 5.1, the base object was always used. )

 

custAttributes.getDefs <obj> [baseObject:<bool>]

Returns an array of definitions in attribute set order.

BaseObject:<bool>

If the optional keyword argument baseObject is set to true (the default), in case the object specified is a node, the base object will be operated on. If false, the node itself will be operated on. (In versions prior 3ds Max 5.1, the base object was always used. )

Next Topic:

Custom Attributes Definition Values

See also

Scripted Custom Attributes

Adding Custom Attributes

Global and Private Custom Attributes Definitions

Access to Custom Attributes Virtual Array

Custom Attributes in Materials and Texture Maps