Go to: Synopsis. Return value. Related. MEL examples.

Synopsis

objExists string

objExists is undoable, queryable, and editable.

This command simply returns true or false depending on whether an object with the given name exists.

Return value

boolean

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

Related

addAttr, aliasAttr, attributeInfo, attributeQuery, deleteAttr, getClassification, nodeType, objectType, renameAttr

MEL examples

// Select an object if and only if it exists.
// Print a warning if it does not exist.
if( `objExists surface1` ) {
    select surface1;
} else {
    warning("No surface exists");
}