Create, edit or query a model editor. Note that some of the flags of this command may have different settings for normal mode and for interactive/playback mode. For example, a modelEditor can be set to use shaded mode normally, but to use wireframe during playback for greater speed. Some flags also support having defaults set so that new model editors will be created with those settings.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
activeComponentsXray (acx) | bool | ||
|
|||
activeOnly (ao) | bool | ||
|
|||
activeView (av) | bool | ||
|
|||
addObjects (aob) | unicode | ||
|
|||
addSelected (addSelected) | bool | ||
|
|||
allObjects (alo) | bool | ||
|
|||
backfaceCulling (bfc) | bool | ||
Turns on or off backface culling for the whole view. This setting overrides the culling settings of individual objects. All objects draw in the view will be backface culled. When backface culling is turned on, surfaces becomes invisible in areas where the normal is pointing away from the camera. |
|||
bufferMode (bm) | unicode | ||
|
|||
bumpResolution (brz) | int, int | ||
|
|||
camera (cam) | unicode | ||
|
|||
cameraName (cn) | unicode | ||
Set the name of the panel’s camera transform and shape. The shape name is computed by appending the string Shapeto the transform name. This flag may not be queried. |
|||
cameraSet (cst) | unicode | ||
cameraSetup (cs) | bool | ||
Based on the model editor name passed in will returns a string list containing camera setups. A camera setup can contain one or more cameras which are associated with each other. Camera setups are defined as pairs of consecutive strings in the list. Each pair is comprised of: a string which identifies an active camera, and a string which defines a script to set up a given active camera. As many pairs of strings can be returned as the number of active cameras. If nothing is returned then it is assumed that no set up is required to activate a given camera. |
|||
cameras (ca) | bool | ||
|
|||
colorMap (cm) | bool | ||
|
|||
colorResolution (crz) | int, int | ||
|
|||
control (ctl) | bool | ||
Query only. Returns the top level control for this editor. Usually used for getting a parent to attach popup menus. Caution: It is possible, at times, for an editor to exist without a control. This flag returns NONEif no control is present. |
|||
controlVertices (cv) | bool | ||
|
|||
cullingOverride (cov) | unicode | ||
Set whether to override the culling attributes on objects when using the hardware renderer. The options are: none: Use the culling object attributes per object.doubleSided: Force all objects to be double sided.singleSided: Force all objects to be single sided.The default value is none. |
|||
default (d) | bool | ||
Causes this command to modify the default value of this setting. Newly created model editors will inherit the values. This flag may be used with the -interactive to set default interactive settings. |
|||
defineTemplate (dt) | unicode | ||
Puts a command in a mode where any other flags and args are parsed and added to the command template specified in the argument. They will be used as default arguments in any subsequent invocations of the command when templateName is set as the current template. |
|||
deformers (df) | bool | ||
|
|||
dimensions (dim) | bool | ||
|
|||
displayAppearance (da) | unicode | ||
Sets the display appearance of the model panel. Possible values are wireframe, points, boundingBox, smoothShaded, flatShaded. This flag may be used with the -interactive and -default flags. Note that only wireframe, points, and boundingBoxare valid for the interactive mode. |
|||
displayLights (dl) | unicode | ||
|
|||
displayTextures (dtx) | bool | ||
|
|||
docTag (dtg) | unicode | ||
|
|||
dynamicConstraints (dc) | bool | ||
|
|||
dynamics (dy) | bool | ||
|
|||
editorChanged (ec) | callable | ||
An optional script callback which is called when the editors options have changed. This is useful in a situation where a scripted panel contains a modelEditor and wants to be notified when the contained editor changes its options. |
|||
exists (ex) | bool | ||
|
|||
filter (f) | unicode | ||
|
|||
fluids (fl) | bool | ||
|
|||
fogColor (fcl) | float, float, float, float | ||
|
|||
fogDensity (fdn) | float | ||
|
|||
fogEnd (fen) | float | ||
|
|||
fogMode (fmd) | unicode | ||
|
|||
fogSource (fsc) | unicode | ||
Set the type of fog algorithm to use. If the argument is fragment(default) then fog is computed per pixel. If the argument is coordinatethen if the geometry has specified vertex fog coordinates, and the OpenGL extension for vertex fog is supported by the graphics system, then fog is computed per vertex. |
|||
fogStart (fst) | float | ||
|
|||
fogging (fg) | bool | ||
|
|||
follicles (fo) | bool | ||
|
|||
forceMainConnection (fmc) | unicode | ||
Specifies the name of a selectionConnection object which the editor will use as its source of content. The editor will only display items contained in the selectionConnection object. This is a variant of the -mainListConnection flag in that it will force a change even when the connection is locked. This flag is used to reduce the overhead when using the -unlockMainConnection , -mainListConnection, -lockMainConnection flags in immediate succession. |
|||
grid (gr) | bool | ||
|
|||
hairSystems (hs) | bool | ||
|
|||
handles (ha) | bool | ||
|
|||
headsUpDisplay (hud) | bool | ||
Sets whether the model panel will draw any enabled heads up display elements in this window (if true). Currently this requires the HUD elements to be globally enabled. |
|||
highlightConnection (hlc) | unicode | ||
Specifies the name of a selectionConnection object which the editor will synchronize with its highlight list. Not all editors have a highlight list. For those that do, it is a secondary selection list. |
|||
hulls (hu) | bool | ||
|
|||
ignorePanZoom (ipz) | bool | ||
|
|||
ikHandles (ikh) | bool | ||
|
|||
interactive (i) | bool | ||
Causes this command to modify the interactive refresh settings of the view. In this way it is possible to change the behavior of the model editor during playback for improved performance. |
|||
interactiveBackFaceCull (ibc) | bool | ||
interactiveDisableShadows (dis) | bool | ||
jointXray (jx) | bool | ||
|
|||
joints (j) | bool | ||
|
|||
lights (lt) | bool | ||
|
|||
lineWidth (lw) | float | ||
|
|||
locators (lc) | bool | ||
|
|||
lockMainConnection (lck) | bool | ||
Locks the current list of objects within the mainConnection, so that only those objects are displayed within the editor. Further changes to the original mainConnection are ignored. |
|||
lowQualityLighting (lql) | bool | ||
|
|||
mainListConnection (mlc) | unicode | ||
Specifies the name of a selectionConnection object which the editor will use as its source of content. The editor will only display items contained in the selectionConnection object. |
|||
manipulators (m) | bool | ||
|
|||
maxConstantTransparency (mct) | float | ||
Sets the maximum constant transparency. Setting this value remaps constant transparency values from the range [0.0, 1.0] to the range [0.0, maxConstantTransparency]. All transparency values are shifted linearly to the new range, so a fully transparency object (transparency 1.0) would appear with a transparency of maxConstantTransparency in the viewport, allowing highly transparent objects to be made visible. This flag only affects constant (non-textured) transparent objects. |
|||
maximumNumHardwareLights (mhl) | bool | ||
modelPanel (mp) | unicode | ||
Allows the created model editor to be embedded in the named model panel. Intended for use with custom model editors created via the API (i.e. the flag would be used on the derived MPxModelEditorCommand), though the flag may also be used on the base modelEditor command to restore a default Maya model editor to the panel. Note that the model editor previously owned by the panel is deleted. |
|||
nCloths (ncl) | bool | ||
|
|||
nParticles (npa) | bool | ||
|
|||
nRigids (nr) | bool | ||
|
|||
noUndo (nud) | bool | ||
|
|||
nurbsCurves (nc) | bool | ||
|
|||
nurbsSurfaces (ns) | bool | ||
|
|||
occlusionCulling (ocl) | bool | ||
|
|||
panel (pnl) | unicode | ||
Specifies the panel that the editor belongs to. By default if an editor is created in the create callback of a scripted panel it will belong to that panel. If an editor doesn’t belong to a panel it will be deleted when the window that it is in is deleted. |
|||
parent (p) | unicode | ||
|
|||
pivots (pv) | bool | ||
|
|||
planes (pl) | bool | ||
|
|||
polymeshes (pm) | bool | ||
|
|||
removeSelected (rs) | bool | ||
|
|||
rendererList (rls) | bool | ||
Query for a list of the internal names for renderers are available for usage with the 3d modeling viewport. The default list contains at least base_OpenGL_Renderer, and hwRender_OpenGL_Renderer, if supported. See rendererName for more details on these renderers. Any plugin viewport renderers will also appear in this list. |
|||
rendererListUI (rlu) | bool | ||
Query for a list of the UI names renderers are available for usage with the 3d modeling viewport. The default list contains at the UI name forbase_OpenGL_Renderer, and possibly the UI name for hwRender_OpenGL_Rendererif it is support. Any plugin viewport renderer’s UI names will also appear in this list. This list and the list returned from rendererList have a 1:1 correpsondance. |
|||
rendererName (rnm) | unicode | ||
Set or get the renderer used for the 3d modeling viewport. The default options for setting are: base_OpenGL_Renderer: The default OpenGL based renderer. hwRender_OpenGL_Renderer: The high quality hardware renderer. The default is base_OpenGL_Renderer. The high quality renderer is only supported on certain hardware configurations. See the hardware qualification charts for more details. |
|||
selectionConnection (slc) | unicode | ||
Specifies the name of a selectionConnection object which the editor will synchronize with its own selection list. As the user selects things in this editor, they will be selected in the selectionConnection object. If the object undergoes changes, the editor updates to show the change. |
|||
selectionHiliteDisplay (sel) | bool | ||
|
|||
setSelected (ss) | bool | ||
|
|||
shadingModel (sml) | int | ||
shadows (sdw) | bool | ||
|
|||
smallObjectCulling (soc) | bool | ||
smallObjectThreshold (sot) | float | ||
smoothWireframe (swf) | bool | ||
|
|||
sortTransparent (st) | bool | ||
This flag turns on/off sorting of transparent objects during shaded mode refresh. Normally, objects are sorted according to their origin in camera space but when this flag is turned off they will be drawn according to their (depth-first traversal) order in the scene graph. This is a global flag that affects all model editors. |
|||
stateString (sts) | bool | ||
Query only flag. Returns the MEL command that will edit an editor to match the current editor state. The returned command string uses the string variable $editorName in place of a specific name. |
|||
stereoDrawMode (sdm) | bool | ||
strokes (str) | bool | ||
|
|||
subdivSurfaces (sds) | bool | ||
|
|||
textureAnisotropic (ta) | bool | ||
|
|||
textureCompression (tcp) | bool | ||
textureDisplay (td) | unicode | ||
Set the type of blending to use for textures. The blend is performed between the destination fragment and the texture fragment. The source is usually the material color. Argument options are: modulate: multiply the destination and texture fragment decal: overwrite the destination with the texture fragment |
|||
textureEnvironmentMap (tem) | bool | ||
textureHilight (th) | bool | ||
|
|||
textureMaxSize (tms) | int | ||
Set maximum texture size for hardware texturing. The integer value must be a power of 2. Recommended values are 128 or 256. If the value specified is larger than the OpenGL maximim textures size for the graphics hardware it will be clamped to the OpenGL size. If many large textures are used in a scene reducing this value improves performance. On Impact texture memory is pinned in RAM so using large textures can cause reliability and performance problems. Again reducing this value will help. Software rendering does not use this value. This flag is obsolete as of Maya 6.5. The maxTextureResolution/mtr argument on the displayPref command should be used instead. |
|||
textureMemoryUsed (tmu) | bool | ||
Returns the total number of bytes used by all texture maps. This is typicly width*height*channels for all texture objects in the scene If the texture is mip mapped all mip map levels are included in the total though not never more than two level will be in use at one time |
|||
textureSampling (ts) | int | ||
Set the type of sampling to be used for texture display. The argument can be either: 1 : means to perform point sample2 : means to perform bilinear interpolation (default) |
|||
textures (tx) | bool | ||
|
|||
transpInShadows (tis) | bool | ||
|
|||
transparencyAlgorithm (tal) | unicode | ||
Set the transparency algorithm. The options are: 1) frontAndBackCull: Two pass front and back culling technique.2) perPolygonSort: Draw transparent polygons in back-to-front order technique.transparency pptions 1) and 2) are supported by the hardware renderer. Options 1) is supported by the interactive modeling viewports. The default value is frontAndBackCull. |
|||
twoSidedLighting (tsl) | bool | ||
|
|||
unParent (up) | bool | ||
|
|||
unlockMainConnection (ulk) | bool | ||
|
|||
updateColorMode (ucm) | bool | ||
Using this flag tells the model panel to check which color mode it should be in, and to switch accordingly. This flag may be used to update a model panel after a camera image plane has been added or removed. |
|||
updateMainConnection (upd) | bool | ||
|
|||
useBaseRenderer (ubr) | bool | ||
|
|||
useColorIndex (uci) | bool | ||
Sets whether the model panel will attempt to use color index mode when possible. Color index mode can provide a performance increase for point, bounding box, and wireframe display modes. This may be used with the -default flag. |
|||
useDefaultMaterial (udm) | bool | ||
|
|||
useInteractiveMode (ui) | bool | ||
|
|||
useRGBImagePlane (ip) | bool | ||
|
|||
useReducedRenderer (urr) | bool | ||
useTemplate (ut) | unicode | ||
|
|||
userNode (un) | unicode | ||
|
|||
viewObjects (vo) | bool | ||
Returns the name (if any) of the objectSet which contains the list of objects visible in the view if viewSelected is true and the list of objects being displayed does notcome from the active list. |
|||
viewSelected (vs) | bool | ||
This flag turns on/off viewing of selected objects. When the flag is set to true, the currently active objects are captured and used as the list of objects to view. |
|||
viewType (vt) | bool | ||
Returns a string indicating the type of the model editor. For the default model editor, returns the empty string. For custom model editor types created via the API, returns the same string as is returned via the method MPx3dModelView::viewType(). Flag can have multiple arguments, passed either as a tuple or a list. |
|||
wireframeBackingStore (wbs) | bool | ||
Sets whether a backing store is used to optimization the drawing of active objects. This mode can provide a performance increase in wireframe mode for certain scenes. |
|||
wireframeOnShaded (wos) | bool | ||
|
|||
xray (xr) | bool | ||
|
Derived from mel command maya.cmds.modelEditor
Example:
import pymel.core as pm
# Create a window with a model editor and some buttons that
# change the editor's display of objects in the scene.
#
window = pm.window('window')
form = pm.formLayout()
editor = pm.modelEditor()
column = pm.columnLayout('true')
# Create some buttons that will alter the display appearance of
# objects in the model editor, eg. wireframe vs. shaded mode.
#
pm.button(label='Wireframe', command= "pm.modelEditor(editor, edit=True, displayAppearance='wireframe')")
# Result: ui.Button('window|formLayout59|true|button56') #
pm.button(label='Points', command= "pm.modelEditor(editor, edit=True, displayAppearance='points')")
# Result: ui.Button('window|formLayout59|true|button57') #
pm.button(label='Bounding Box', command= "pm.modelEditor(editor, edit=True, displayAppearance='boundingBox')")
# Result: ui.Button('window|formLayout59|true|button58') #
pm.button(label='Smooth Shaded', command= "pm.modelEditor(editor, edit=True, displayAppearance='smoothShaded')")
# Result: ui.Button('window|formLayout59|true|button59') #
pm.button(label='Flat Shaded', command= "pm.modelEditor(editor, edit=True, displayAppearance='flatShaded')")
# Result: ui.Button('window|formLayout59|true|button60') #
# Set up the window layout attachments.
#
pm.formLayout( form, edit=True, attachForm=[(column, 'top', 0), (column, 'left', 0), (editor, 'top', 0), (editor, 'bottom', 0), (editor, 'right', 0)], attachNone=[(column, 'bottom'), (column, 'right')], attachControl=(editor, 'left', 0, column))
# Result: ui.FormLayout('window|formLayout59') #
# Create a camera for the editor. This particular camera will
# have a close up perspective view of the centre of the ground plane.
#
camera= pm.camera(centerOfInterest=2.450351,
position = (1.535314, 1.135712, 1.535314),
rotation = (-27.612504, 45, 0),
worldUp = (-0.1290301, 0.3488592, -0.1290301))
# Attach the camera to the model editor.
#
pm.modelEditor( editor, edit=True, camera=camera[0] )
# Put an object in the scene.
#
pm.cone()
pm.showWindow( window )
# The following two examples assume a custom model editor command
# defined via the MPxModelEditorCommand API class, named 'myEditor'.
#
# Create a custom editor, and use it as the model editor of Maya's
# default modelPanel4 (the perspective view).
#
pm.myEditor( modelPanel='modelPanel4' )
# Restore the default model editor.
#
pm.modelEditor( modelPanel='modelPanel4' )