Adds a set of attributes to an object or a collection. You can only add one custom attribute set of a particular attributes definition to an object, but you can have as many different attribute sets from different definitions as needed.
When adding custom attributes to an object using the custAttributes.add() function, you can now supply an optional #unique keyword as the third argument. If you do this, each object being added to will have custom attributes added that have their own private copy of the definition and do *not* share the original definition. Any later redefinitions of the original attributes definition will not update these custom attributes. To update the individual object's attributes, you would get the unique definition from the object using custAttributes.getDef , and redefine it in one of the two ways described.
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.
The custAttributes.add() function can be applied to an object collection to add sets of attributes to a group of objects in one go.
EXAMPLE |
Adds a separate set of these custom attributes to all objects whose names begin "weapon" in the scene. |
As with Scripted plug-ins, an attributes definition can have any number of sets of parameter and rollout clauses, to allow you to organize added attributes into multiple rollouts as needed.
Scripted custom attributes added to an object or modifier can be accessedviaMAXScript. They turn up directlyas properties on the objectsthey are added to. If the names of any of the custom attributes are the same as existing properties on the host object, the custom attributes are effectively hidden when accessed directly. As an alternative, you can access each added block of custom attributesby their attributes definition nameand then access individual attributes as properties within that block.
Adding Custom Attributes Presets
Custom Attributes Presets can be added to an object using the pre-defined attributes definition CustomAttributesPresets, which is defined in the [3dsmax]\scripts\Startup\CustomAttributes.ms file. This corresponds to the "Add Presets Options" checkbox in the Parameter Editor in the 3ds Max UI.
EXAMPLE |
custAttributes.add $weapon* CustomAttributesPresets |
Adds Custom Attributes Presets to all objects whose name begins with "weapon" in the scene. |
custAttributes.add $weapon.modifiers[#Attribute_Holder] CustomAttributesPresets |
Adds Custom Attributes Presets to the Attribute Holder Modifier on the $weapon object. |