Go to: Synopsis. Return value. Flags. Python examples.

Synopsis

defineVirtualDevice([axis=int], [channel=string], [clear=boolean], [create=boolean], [device=string], [parent=string], [undefine=boolean], [usage=string])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

defineVirtualDevice is undoable, queryable, and NOT editable.

This command defines a virtual device. Virtual devices act like real devices and are useful to manipulate/playback data when an command device is not connected to the computer.

Return value

None

In query mode, return type is based on queried flag.

Flags

axis, channel, clear, create, device, parent, undefine, usage
Long name (short name) Argument types Properties
axis(ax) int create
Specifies the axis number of the channel. All children have their axis number determined by their parent's axis number and the width of the parent channel. If this flag is not used, the order of the channel determines the axis number.
channel(c) string create
After a -create is started, channels may be added to the device definition. The channel string wil be the name of the channel being added to the device. The -channel flag must also be accompanied by the -usage flag and optionally by the -axis flag.
clear(cl) boolean create
The -clear option will end a device definition and throw away any defined channels.
create(cr) boolean create
Start defining a virtual device. If a device is currently being defined, the -create flag will produce an error.
device(d) string create
The -device flag ends the device definition. All of the channels between the -create flag and the -device flag are added to the specified device. If that device already exists, the command will fail and the device should be redefined with another device name. To see the currently defined devices, use the listInputDevices command. The -device flag is also used with -undefine to undefine a virtual device.
parent(p) string create
Specified the parent channel of the channel being defined. If the channel does not exist, or is an incompatible type, the command will fail.
undefine(u) boolean create
Undefines the device specified with the -device flag.
usage(use) string create
The -usage option is required for every -channel flag. It describes what usage type the defined channel is. The usage types are:
unknownscalar
posrot posRotquaternionposQuaternion
rotXYZrotYZXrotZXY rotXZYrotYXZrotZYX
posRotXYZposRotYZXposRotZXY posRotXZYposRotXZYposRotZYX
posXposYposZrotX rotYrotZ

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

#    Create a virtual clock and read in some data.
cmds.defineVirtualDevice( create=True )
cmds.defineVirtualDevice( channel='seconds', usage='rotZ', axis=2 )
cmds.defineVirtualDevice( channel='minutes', usage='rotZ', axis=1 )
cmds.defineVirtualDevice( channel='hours', usage='rotZ', axis=0 )
cmds.defineVirtualDevice( device='virtualClock' )
cmds.readTake( device='virtualClock', take='clock.mov' )

#    Undefine the virtualClock
cmds.defineVirtualDevice( device='virtualClock', undefine=True )

#    Create a body device.
cmds.defineVirtualDevice( create=True )
cmds.defineVirtualDevice( channel='pelvis', usage='posRot' )
cmds.defineVirtualDevice( channel='back', usage='posRot' )
cmds.defineVirtualDevice( channel='head', usage='posRot' )
cmds.defineVirtualDevice( device='body' )

#    Explicitly order the axis of the device. The created device is
#    the same as the above body device.
cmds.defineVirtualDevice( create=True )
cmds.defineVirtualDevice( channel='head', usage='posRot', axis=12 )
cmds.defineVirtualDevice( channel='back', usage='posRot', axis=6 )
cmds.defineVirtualDevice( channel='pelvis', usage='posRot', axis=0 )
cmds.defineVirtualDevice( device='body' )