|
Multitude ManagerIntroductionThe Multitude Manager is a new editor that helps you to deal with large numbers of objects within Maya.It is normally very difficult to specify changes to multiple objects at once, and TDs working on large scenes would commonly resort to writing small MEL scripts directly into Maya's Script Editor in order to achieve what they need. This tool aims to avoid the most common cases, but there will always be times when you can't beat a hand crafted script. The Multitude Manager has multiple tabs, each containing a different function as outlined below.
|
You can have the functions in the Multitude Manager deal with all nodes in your scene or restrict it to only affect nodes of a particular type (e.g. transform, joint, mySuperCoolCustomNode), or only nodes within your current selection.
Using the 'Selection' mode is a good way of whittling down to a more specific group of nodes. For example, if you had a scene with hundreds of lights you might first select all your spotlight nodes, then within that selection choose a percentage (30% of all spotLights) or select a sub-set based on their attribute values (e.g. if their intensity is greater than 2).
This simple function is a great way of "mixing up" a section of CG objects. For example, if you create 100 cubes they will all look identical, but you can select say 30% of them and assign a different shader. Then select 60% of them and rotate them to a different angle, rinse, repeat, until everything is nicely broken up.
Each time you run this function it will pick a different random selection. So, if you run it once and it makes a selection you don't like then simply undo and run it again for a new selection.
An easy way of selecting all nodes of a particular type (e.g. all locators in your scene) is to set the tool to affect only nodes of the type (e.g. "locator") and then select 100 percent of them.
When a selection is made a message will be printed in Maya's command feedback area telling you how many nodes were matched.
After making a selection, the Multitude Manager will be automatically set to operate in selection mode.
On the left side of a rule you type in the name of the attribute to query, and in the field on the right the value you wish to test against. Between the fields you choose from the dropdown menu the type of test: equals, includes, greater/less than, exists or wildcard match (uses same syntax as the gmatch MEL command), and also their negative predicates. You can add more rules than the default one, and each additional rule can then be a logical AND or OR rule. Although there is currently no way of grouping the logic operations (affecting their precedence) you can usually get what you want by running it a couple of times with different rules to narrow down the selection.
When you have set up your rules you can click the buttons under the rules to add any matching nodes to your current selection or to have them replace your current selection.
When a selection is made a message will be printed in Maya's command feedback area telling you how many nodes were matched.
After making a selection, the Multitude Manager will be automatically set to operate in selection mode.
There are three ways you can assign values using this panel:
To assign attributes via a MEL expression, select that mode, then type in your expression in the text field and it will be run through the MEL script engine by way of the 'eval' command. So, for example, to randomly assign a height to your selection of nodes, you could enter 'rand(0,10)' as the expression and press the 'Set Attributes' button. Note though that the expression must be a single MEL function, rather than a compound expression such as 'rand(0,1) / 4' (this is due to a limitation in Maya's 'eval' command).
The final way to assign attributes in this panel is to select the 'By Random List' mode, and enter a list of possible values into the list field. Each node being assigned to will then get a random pick from that list. This mode is great for assigning randomness to a bunch of objects, when the randomness must be from a set of potential values rather than ranging between two values.
If you need to assign to a vector (e.g. the translate attribute) using a MEL expression then you'll need to use the 'makeVector' command which is built into the Multitude Manager. This is to get around a problem with Maya's 'eval' command. For example to assign a random position to a bunch of objects you can do this (in 'By MEL Expression' mode):
translate = makeVector(rand(-100,100), rand(-100,100), rand(-100,100))
This function makes available some special variables which you can use to easily refer to the nodes from within your expression. The variable '$node' refers to the current node being operated on from your selection, '$parent' refers to its parent node in the hierarchy, and '$shape' refers to its shape node if it is not itself a shape node (in which case this will be an empty string). See notes below on dealing with transform/shape nodes.
So, the MEL you type in here will be run once per matching node (i.e. All, of type, or in selection) with '$node' replaced by the full path of the node that it is being applied to.
The possibilities for modifying your scene with this function are limited only by your own knowledge of MEL scripting. This function doesn't do anything particularly special, but is a handy and more accessible alternative to writing lots of little throwaway scripts when manipulating large numbers of objects in Maya.
The load/save presets functionality (see below) is particularly useful when working with this mode.
It is a common problem to be trying to set shape attributes on a transform, or vice versa. If you have a selection of shape nodes and you wish to set an attribute on their transform nodes you have two choices. Firstly, you can press the up arrow key within a Maya viewport or the Outliner, which will walk your selection one step up in the hierarchy (i.e. each selected node will now have its parent selected). The second option is to use the Run Expression function, which provides you with variables for easily accessing both the transform and shape nodes.
A hidden preset is used to save the current state of the Multitude Manager whenever you execute one of its operations, and this is automatically loaded the next time you open the window, so it should always look like it did when you last ran something.
float $oldValue = getAttr($node + ".translateY"); setAttr ($node + ".translateY") ($oldValue + 44.0);
| v1.0 (July 2003) |
- initial release
|
| v1.0 to v1.2.1 |
- added the affect nodes 'under hierarchy' modes - added 'is connected/keyframed' rule types - minor fixes |
| v1.3 (May 2005) |
- added the new functionality to set attributes randomly from a list of potential values - fixed a bug with comments at start or end of the 'Run Expression' user code - added 'Help' menu, with about box and link to the online docs - updated the online docs |
The latest version of the script can always be found here.
Last Updated: 18 May 2004