ジャンプ先: 概要. 戻り値. 関連. フラグ. MEL 例.
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] [-removeFileRuleEntry string] [-removeVariableEntry string] [-renderType string string] [-renderTypeEntry string] [-renderTypeList] [-rootDirectory] [-saveWorkspace] [-shortName] [-update] [-updateAll] [-variable string string] [-variableEntry string] [-variableList]
[string]
workspace は、取り消し可能、照会可能、および編集不可能です。
指定したワークスペース ファイルに従って、ワークスペースを生成したり、開いたり、編集したりします。 この文字列引数はワークスペースを表します。ワークスペースが指定されていない場合、現在のワークスペースが指定されたものとみなされます。 ワークスペースは Maya プロジェクトの基本となる定義を提供します。各プロジェクトには workspace.mel という関連付けされたワークスペース ファイルがあり、プロジェクトのルート ディレクトリに保存されています。ワークスペース ファイルは、ファイル タイプをルート ディレクトリに対して相対的または絶対的な保存場所にマップする一連の規則を定義します。この規則は、実行時にファイル パスを解決する際に使用されます。 ワークスペース コマンドは、定義の基本ファイルへの読出し、変更、保存時には、ワークスペースの低レベルの定義で直接動作します。このコマンドを使用する必要はほとんどありません。通常は、プロジェクト定義の変更はユーザ インタフェースのプロジェクト ウィンドウを介して行うことをお勧めします。複数のアクションは、指定されたパスが存在するという前提に基づきます。| 要求されたアクションによります。 | |
| string | 「shortName」フラグを照会する場合は、プロジェクトのショート ネームです。 |
| string | 「fullName」 フラグを照会する場合は、プロジェクトのフル ネームです。 |
| string | 「openWorkspace」フラグを照会する場合は、現在のワークスペース名です(現在のワークスペースがある場合)。 |
| string | 「directory」フラグを照会する場合は、作業スペースのディレクトリです。 |
| string | 「renderTypeEntry」、「fileRuleEntry」、または「objectTypeEntry」フラグを照会する場合は、現在のワークスペースのファイル ルールです。 |
| string | 「variableEntry」フラグを照会する場合は、現在のワークスペースのファイル ルールです。 |
| string | 「expandName」フラグを照会する場合は、指定したファイル名または現在のルート ディレクトリ(名前が指定されていない場合)の解決済みのフル ネームです。 |
| string | 「projectPath」フラグを照会する場合は、現在のプロジェクト ワークスペースのパスです。 |
| string | 「baseWorkspace」フラグを照会する場合は、現在のベース ワークスペースの名前です。 |
| string | 「rootDirectory」フラグを照会する場合は、現在のワークスペースのルート ディレクトリです。 |
| string[] | 「fileRule」フラグを照会する場合は、ファイル ルールのリストです。 |
| string[] | 「variableList」フラグを照会する場合は、変数のリストです。 |
| string[] | 「listWorkspaces」フラグを照会すると、すべてのワークスペースのリストです。 |
| string[] | 「listFullWorkspaces」フラグを照会する場合は、すべてのワークスペースのフルネームのリストです。 |
| string[] | 「list」フラグを照会する場合は、指定されたディレクトリ内のすべてのワークスペースのパス名のリストです。ディレクトリが指定されていない場合は、現在のワークスペースのパス名のリストです。 |
| string[] | 現在のワークスペースのファイル ルールに対応する代替(ファイル ルール、ルールの位置)文字列のリストです。 |
| string[] | 現在のワークスペースの変数に対応する代替(変数、値)文字列のリストです。 |
照会モードでは、戻り値のタイプは照会されたフラグに基づきます。
| ロング ネーム(ショート ネーム) | 引数タイプ | プロパティ | ||
|---|---|---|---|---|
-active(-act)
|
|
|
||
|
||||
-baseWorkspace(-bw)
|
string
|
|
||
|
||||
-create(-cr)
|
string
|
|
||
|
||||
-directory(-dir)
|
string
|
|
||
|
||||
-expandName(-en)
|
string
|
|
||
|
||||
-fileRule(-fr)
|
string string
|
|
||
|
||||
-fileRuleEntry(-fre)
|
string
|
|
||
|
||||
-fileRuleList(-frl)
|
|
|
||
|
||||
-filter(-f)
|
|
|||
|
||||
-fullName(-fn)
|
|
|
||
|
||||
-list(-l)
|
|
|
||
|
||||
-listFullWorkspaces(-lfw)
|
|
|
||
|
||||
-listWorkspaces(-lw)
|
|
|
||
|
||||
-newWorkspace(-n)
|
|
|
||
|
||||
-objectType(-ot)
|
string string
|
|
||
|
||||
-objectTypeEntry(-ote)
|
string
|
|
||
|
||||
-objectTypeList(-otl)
|
|
|
||
|
||||
-openWorkspace(-o)
|
|
|
||
|
||||
-projectPath(-pp)
|
string
|
|
||
|
||||
-removeFileRuleEntry(-rfr)
|
string
|
|
||
|
||||
-removeVariableEntry(-rve)
|
string
|
|
||
|
||||
-renderType(-rt)
|
string string
|
|
||
|
||||
-renderTypeEntry(-rte)
|
string
|
|
||
|
||||
-renderTypeList(-rtl)
|
|
|
||
|
||||
-rootDirectory(-rd)
|
|
|
||
|
||||
-saveWorkspace(-s)
|
|
|
||
|
||||
-shortName(-sn)
|
|
|
||
|
||||
-update(-u)
|
|
|
||
|
||||
-updateAll(-ua)
|
|
|
||
|
||||
-variable(-v)
|
string string
|
|
||
|
||||
-variableEntry(-ve)
|
string
|
|
||
|
||||
-variableList(-vl)
|
|
|
||
|
||||
// Set the current workspace to "alphabet"
workspace -openWorkspace alphabet;
// Save the current workspace settings (for "alphabet").
workspace -saveWorkspace;
// Change current directory to project directory
workspace -directory "/h/userName/maya/projects/";
// Create a directory for a new workspace
workspace -create newWorkspace;
// Create a new workspace named "newWorkspace".
workspace -newWorkspace newWorkspace;
// The file rules and variables of "newWorkspace" are based on "default" workspace
workspace -baseWorkspace "default";
// Return the list of existing workspaces
workspace -listWorkspaces ;
// Result: default newWorkspace
// Add a scriptJob to run on workspaceChanged events
global proc workspaceChangedCallback()
{
print "My workspaceChangedCallback was called";
}
int $workspaceChangedID = `scriptJob -event workspaceChanged workspaceChangedCallback`;
// add a file rule to the current workspace
workspace -fileRule "newFileRuleName" "newFileRuleValue";
My workspaceChangedCallback was called //workspaceChangedCallback was called
// look up the value of the file rule entry
workspace -q -fileRuleEntry "newFileRuleName";
// Result: newFileRuleValue
// remove specified file rule entry
workspace -removeFileRuleEntry "newFileRuleName";
My workspaceChangedCallback was called //workspaceChangedCallback is called
// kill the scriptJob with the number
scriptJob -kill $workspaceChangedID;
// The following example shows how to expand environment and workspace variables
// expand a path value to be a full path relative to the project directory
// relative path example
workspace -expandName "relativePathName";
// Result: /h/userName/maya/projects/newWorkspace/relativePathName
// full path example
workspace -expandName "/h/userName/maya/projects/default/";
// Result: /h/userName/maya/projects/default/
// The following examples show various formats for expanding workspace and
// environment variables
// add a variable to the current workspace
workspace -variable "newVariableName" "newVariableValue";
workspace -expandName "%newVariableName%";
// Result: /h/userName/maya/projects/newWorkspace/newVariableValue
// add an environment variable
putenv "newEnvVariableName" "newEnvVariableValue";
workspace -expandName "%newEnvVariableName%";
// Result: /h/userName/maya/projects/newWorkspace/newEnvVariableValue
// The following example shows how conflicting names in both workspace
// and environment variables are resolved.
// Add an environment variable with the same as the workspace variable
putenv "newVariableName" "newEnvVariableValue"
// maya considers workspace variables first before matching environment variables
workspace -expandName "%newVariableName%";
// Result: /h/userName/maya/projects/newWorkspace/newVariableValue
// However when a tilde is used, maya will only consider the environment varible, not
// the workspace variable.
workspace -expandName "~%newVariableName%";
// Result: /h/userName/maya/projects/newWorkspace/~newEnvVariableValue
// The following example shows how to set multiple paths into a fileRule value
workspace -fileRule "newMultiPathFileRuleName" "/h/userName/maya/projects/default;newFileRuleValue";
string $multipath = `workspace -q -fileRuleEntry "newMultiPathFileRuleName"`;
// Result : /h/userName/maya/projects/default;newFileRuleValue
// Note that white space at the beginning and the end of each path is significant
// Add a file rule that uses multiple paths with the white space at the beginning and the end
// of each path
workspace -fileRule "newMultiPathFileRuleName" " /h/userName/maya/projects/default ; newFileRuleValue ";
// Querying and expanding the path value shows the white space is still included
string $multipath = `workspace -q -fileRuleEntry "newMultiPathFileRuleName"`;
// Result : /h/userName/maya/projects/default ; newFileRuleValue
// Find the current workspace area.
workspace -q -directory;
// 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 -directory;
// Result : /h/userName/maya/projects/default
workspace -directory "/h/userName/maya/projects/commercial";
pwd;
// Result : /tmp