pymel.core.animation.defineVirtualDevice

defineVirtualDevice(*args, **kwargs)

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. In query mode, return type is based on queried flag.

Flags:
Long name (short name) Argument Types Properties
axis (ax) int ../../../_images/create.gif
 

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) unicode ../../../_images/create.gif
 

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) bool ../../../_images/create.gif
 
The -clear option will end a device definition and throw away any defined channels.
create (cr) bool ../../../_images/create.gif
 
Start defining a virtual device. If a device is currently being defined, the -create flag will produce an error.
device (d) unicode ../../../_images/create.gif
 

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) unicode ../../../_images/create.gif
 
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) bool ../../../_images/create.gif
 
Undefines the device specified with the -device flag.
usage (use) unicode ../../../_images/create.gif
 

The -usage option is required for every -channel flag. It describes what usage type the defined channel is. The usage types are: unknownscalarposrotposRotquaterni onposQuaternionrotXYZrotYZXrotZXYrotXZYrotYXZrotZYXposRotXYZposRotYZXposRotZXYposRotXZYposRotXZYposRotZYXposXposYposZrotXrotYrotZFlag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.defineVirtualDevice

Example:

import pymel.core as pm

import maya.cmds as cmds

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

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

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

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

Previous topic

pymel.core.animation.defineDataServer

Next topic

pymel.core.animation.deformer

Core

Core Modules

Other Modules

This Page