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

Synopsis

contextInfo( [context name] , [c=boolean], [escapeContext=boolean], [exists=boolean], [image1=boolean], [image2=boolean], [image3=boolean], [title=boolean])

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

contextInfo is undoable, queryable, and editable.

This command allows you to get information on named contexts.

Return value

string

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

Flags

c, escapeContext, exists, image1, image2, image3, title
Long name (short name) Argument types Properties
c(c) boolean create
Return the class type of the named context.
title(t) boolean create
Return the title string of the named context.
escapeContext(esc) boolean create
Return the command string that will allow you to exit the current tool.
exists(ex) boolean create
Return true if the context exists, false if it does not exists (or is internal and therefore untouchable)
image1(i1) boolean create
Returns the name of an xpm associated with the named context.
image2(i2) boolean create
Returns the name of an xpm associated with the named context.
image3(i3) boolean create
Returns the name of an xpm associated with the named context.

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 particle tool context, then switch to it
cmds.dynParticleCtx('dynParticleCtx1')
cmds.setToolTo('dynParticleCtx1')

# Get the class type of the current context
ctx = cmds.currentCtx()
cmds.contextInfo(ctx, c=True)
# Result: dynParticle #

# Get the title of the current context
cmds.contextInfo(ctx, t=True)
# Result: Particle Tool #