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

Synopsis

workspace [-active] [-baseWorkspace string] [-create string] [-directory string] [-expandName string] [-fileRule string string] [-fileRuleEntry string] [-fileRuleList] [-filter] [-fullName] [-list] [-listFullWorkspaces] [-listWorkspaces] [-newWorkspace] [-objectType string string] [-objectTypeEntry string] [-objectTypeList] [-openWorkspace] [-projectPath string] [-renderType string string] [-renderTypeEntry string] [-renderTypeList] [-rootDirectory string] [-saveWorkspace] [-shortName] [-update] [-updateAll] [-variable string string] [-variableEntry string] [-variableList] [string]

workspace is undoable, queryable, and NOT editable.

Create, open, or edit a workspace associated with a given workspace file. The string argument reprents the workspace. If no workspace is specified then the current workspace is assumed.

Return value

string
string[]

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

Related

chdir, pwd, translator

Flags

active, baseWorkspace, create, directory, expandName, fileRule, fileRuleEntry, fileRuleList, filter, fullName, list, listFullWorkspaces, listWorkspaces, newWorkspace, objectType, objectTypeEntry, objectTypeList, openWorkspace, projectPath, renderType, renderTypeEntry, renderTypeList, rootDirectory, saveWorkspace, shortName, update, updateAll, variable, variableEntry, variableList
Long name (short name) Argument types Properties
-newWorkspace(-n) create
This specifies that a new workspace is being created. If a workspace with this name already exists, the command will fail.
-openWorkspace(-o) createquery
Open the workspace. The workspace becomes the current workspace.
-active(-act) createquery
This flag is a synonym for -o/openWorkspace.
-saveWorkspace(-s) create
Save the workspace. Workspaces are normally saved when Maya exits but this flag will make sure that the data is flushed to disk.
-baseWorkspace(-bw) string query
A workspace may be based on another workspace. This means that all the settings in the base workspace apply to this workspace unless they are explicitly overridden.
-listWorkspaces(-lw) createquery
Returns a list of all the currently defined workspace names.
-listFullWorkspaces(-lfw) createquery
Returns a list of the full path names of all the currently defined workspaces.
-list(-l) createquery
This option will list the current workspace directory. If a path is specified for the "workspaceFile" then the contents of that directory will be listed. Otherwise, the contents of the directory set with the -dir flag will be listed.
-directory(-dir) string createquery
This option will set the current workspace directory to the path specified. When queried it will return the current workspace directory. This directory is used as an initial directory for the fileBrowser and is part of the search path used for locating files. It should not be confused with the current working directory as used by the pwd and chdir commands.
-create(-cr) string create
Create a new directory. If the directory name is not a full path name, it will be created as a subdirectory of the "current" directory set with the -dir flag.
-rootDirectory(-rd) string createquery
Returns the root directory of the workspace.
-objectType(-ot) string string createquery
This flag is obsolete. All default locations will be added to the fileRules going forward.
-objectTypeList(-otl) createquery
This flag is obsolete. This will now return the same results as fileRuleList going forward.
-objectTypeEntry(-ote) string createquery
This flag is obsolete. This will now return the same as fileRuleEntry.
-fileRule(-fr) string string createquery
Set the default location for a file. The first parameter is the fileRule (dxf, iges, etc) and the second is the location. When queried, it returns a list of strings. The elements of the list alternate between fileRule names and the corresponding location. There is typically one file rule for each available translator. Environment variables are supported. Maya will add the following defaults: scene, image, depth, iprImages, lights, renderScenes, sourceImages and textures.
-fileRuleList(-frl) createquery
Returns a list of the currently defined file rules.
-fileRuleEntry(-fre) string createquery
Return the location for the given fileRule.
-renderType(-rt) string string createquery
This flag is obsolete. All default render types will be added to fileRules going forward.
-renderTypeList(-rtl) createquery
This flag is obsolete, use fileRuleList going forward.
-renderTypeEntry(-rte) string createquery
This flag is obsolete, use fileRuleEntry going forward
-variable(-v) string string createquery
Set/query the value of a project variable. Project variables are used when expanding names. See the -en/expandName flag below.
-variableList(-vl) createquery
Return a list of all the available variables.
-variableEntry(-ve) string createquery
Return the value of the given variable name
-shortName(-sn) createquery
Query the short name of the workspace.
-fullName(-fn) createquery
Return the full name of the workspace.
-expandName(-en) string createquery
Query for the full path location of a the filename name. The name may be a project relative file name, or a full path name. If the name is an empty string, the return value will be the project directory. The return value is always a full path name.
-projectPath(-pp) string createquery
Convert filePath passed as argument to a filename that is relative to the project root directory (if possible) and return it. If the filePath is not under the project root directory, a full path name will be returned.
-update(-u) create
This flag reads all the workspace definitions from the project directory. It is used by Maya at startup time to find the avaiable workspaces.
-updateAll(-ua) create
This flag is a synonym for -u/update.
-filter(-f)
This flag is obsolete.

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 be used more than once in a command.

MEL examples

  // Set the current workspace to "alphabet".
  workspace -o alphabet;

  // Save the currently workspace settings (for "alphabet").
  workspace -s;

  // Create a new Workspace named "newWorkspace".
  workspace -n newWorkspace;

  // Find the current workspace area.
  workspace -q -dir;
// Result : /h/userName/maya/projects/default

// Note that the "current working directory" as defined by the
// 'pwd' and 'chdir' commands is unrelated to the directories
// used by the workspace command.
//
pwd;
// Result : /usr/tmp

chdir "/tmp";
pwd;
// Result : /tmp
workspace -q -dir;
// Result : /h/userName/maya/projects/default

workspace -dir "/h/userName/maya/projects/commercial";
pwd;
// Result : /tmp