/
getModules

getModules

Description

Returns an array of all modules currently in the scene

The getModules command is useful in script procedures for automatically identifying the modules in the scene. The flags provide options for narrowing results based upon selection status, or module type.

The results of the command are saved to a module array which may in turn be passed to a subsequent command or procedure.

Functional area

Data retrieval

Command syntax

Syntax

getModules [-type string] [-primary] [-selected] [-fullPath] [-nameOnly]

Arguments

None

Flags

NameFlag argumentsArgument typeExclusive toComments
type1stringReturn only modules of the named type.
primary0selectedReturn only the current primary selection.
selected0primaryReturn only modules that are currently selected.
fullPath0nameOnly
nameOnly0fullPath

Return value

string array

Examples

string $mds[] = `getModules -type BoneNode`;
int $i;
for( $i = 0; 
     $i < $mds.getCount(); 
     $i += 1 )
   { 
     print( $mds[$i] );
   }
   print ($mds.getCount());
 
// In this small procedure, a module array called "$mds" is declared
// and all scene modules of the type BoneNode are assigned to it.
// The for loop iterates through the elements of the array and
// prints each one to the interface. The last line prints the value
// of $mds.getCount, an integer describing the number of modules 
// that were found in this instance.

Additional information

Related commands