ジャンプ先: 概要. 戻り値. 関連項目. フラグ. 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
string[]

戻り値の型は照会モードでは照会フラグが基になります。

関連項目

chdir, pwd, translator

フラグ

active, baseWorkspace, create, directory, expandName, fileRule, fileRuleEntry, fileRuleList, filter, fullName, list, listFullWorkspaces, listWorkspaces, newWorkspace, objectType, objectTypeEntry, objectTypeList, openWorkspace, projectPath, removeFileRuleEntry, removeVariableEntry, renderType, renderTypeEntry, renderTypeList, rootDirectory, saveWorkspace, shortName, update, updateAll, variable, variableEntry, variableList
ロング ネーム(ショート ネーム) 引数型 プロパティ
-newWorkspace(-n) create
新しいワークスペースの作成を指定します。同じ名前のワークスペースがすでに存在する場合、 コマンドは失敗します。
-openWorkspace(-o) createquery
ワークスペースを開きます。開かれたワークスペースがカレントの ワークスペースになります。
-active(-act) createquery
このフラグは -o/openWorkspace フラグと同義です。
-saveWorkspace(-s) create
ワークスペースを保存します。通常、ワークスペースは Maya が終了するときに保存されますが、 このフラグを使用するとデータは確実にディスクに保存されます。
-baseWorkspace(-bw) string query
ワークスペースは別のワークスペースをベースにしている場合があります。したがって、はっきり優先の指定がない場合、ベースのワークスペースの全設定が このワークスペースに適用されます。
-listWorkspaces(-lw) createquery
現在設定されているワークスペースの名前の リストを返します。
-listFullWorkspaces(-lfw) createquery
現在設定されている、すべてのワークスペースの名前の フル パスのリストを返します。
-list(-l) createquery
このオプションは、カレント ワークスペース ディレクトリをリストします。「workspaceFile」用にパスが指定されている場合、 このディレクトリのコンテンツがリストされます。指定されていなければ、-dir フラグで設定された ディレクトリの内容がリストされます。
-directory(-dir) string createquery
このオプションは、カレントのワークスペース ディレクトリを 指定したパスに設定します。照会すると、カレントのワークスペース ディレクトリを返します。このディレクトリは、fileBrowser の 最初のディレクトリとして使用され、ファイルの位置を指定する 検索パスの一部となります。pwd および chdir コマンドが使用する カレント ワーキング ディレクトリと混同しないでください。 ファイル ブラウザを使用する場合、この値は最後に参照した場所に設定されます。
-create(-cr) string create
新しいディレクトリを作成します。ディレクトリの名前がフル パスでなかった場合、 このディレクトリは、-dir フラグで設定されたカレント ディレクトリの サブディレクトリとして作成されます。
-rootDirectory(-rd) query
ワークスペースのルート ディレクトリを返します。
-objectType(-ot) string string createquery
このフラグは現在サポートしていません。 今後、デフォルト位置はすべて fileRules に追加されます。
-objectTypeList(-otl) createquery
このフラグは現在サポートしていません。 今後、これは fileRuleList と同じ結果を返します。
-objectTypeEntry(-ote) string createquery
このフラグは現在サポートしていません。 これは、fileRuleEntry と同じ結果を返します。
-fileRule(-fr) string string createquery
ファイルのデフォルト位置を設定します。1 番目のパラメータは fileRule(シーン、イメージなど)で、2 番目は位置です。照会すると文字列のリストを返します。リストには、fileRule 名とその場所が交互に現れます。通常、使用可能なトランスレータ 1 つにつき、 1 つのファイル規則があります。 環境変数がサポートされています。ファイル規則用に複数のパスを設定する場合、Windows ではセミコロン(;)、MacOSX と Linux ではコロン(:)で区切ります。パスごとに冒頭と末尾にスペースを入れることが重要です。スペースはパス名の一部として扱われます(実際にスペースで始まったりスペースで終わるわけではありません)。
-fileRuleList(-frl) createquery
現在定義されている fileRule のリストを返します。
-fileRuleEntry(-fre) string createquery
指定した fileRule の位置を返します。
-removeFileRuleEntry(-rfr) string create
指定したワークスペースから指定したファイル規則を削除します。 ワークスペース名が指定されていない場合、カレント ワークスペースから指定したファイル規則が削除されます。
-renderType(-rt) string string createquery
このフラグは現在サポートしていません。 デフォルト レンダー タイプは今後すべて fileRules に追加されます。
-renderTypeList(-rtl) createquery
このフラグはサポートしていません。今後は fileRuleList を使用してください。
-renderTypeEntry(-rte) string createquery
このフラグはサポートしていません。今後は fileRuleEntry を使用してください。
-variable(-v) string string createquery
プロジェクト変数を設定または照会します。プロジェクト変数は、名前の展開時に使用されます。次の -en/expandName を参照してください。
-variableList(-vl) createquery
ワークスペースのすべての変数のリストを返します。
-variableEntry(-ve) string createquery
変数名を指定すると、その値が返されます。
-removeVariableEntry(-rve) string create
指定したワークスペースから指定した変数を削除します。 ワークスペース名が指定されていない場合、カレント ワークスペースから指定した変数が削除されます。
-shortName(-sn) createquery
ワークスペースのショート ネームを照会します。
-fullName(-fn) createquery
ワークスペースのフル ネームを返します。
-expandName(-en) string createquery
カレントのワークスペース定義を使用してファイル名のフル パスの場所を照会します。パスはプロジェクトの相対的なファイル名、フル パス名、または変数名になります。戻り値は必ずフル パス名となります。 パスが空の文字列の場合、戻り値はプロジェクトのルート ディレクトリになります。変数の拡張子をサポートしているため、ワークスペースで定義された変数と環境変数の両方が考慮されます。 拡張変数名には次の 3 つのフォーマットがサポートされています: %variableName%、$variableName、${variableName}。 まず、カレントのワークスペースで定義された変数が検索され、次に環境変数が検索されます。 チルダ(~)もサポートしています。変数の冒頭にチルダを入れると、Maya では、環境変数のみを考慮して展開し、展開結果にチルダを残します。Linux でのみ、チルダを使用して ~username、~、または ~/ のフォームでユーザのホーム ディレクトリを展開できます。~username と指定すると該当するユーザのホーム ディレクトリに置き換えられ、~ または ~/ と指定すると HOME 環境変数の値に置き換えられます。
-projectPath(-pp) string createquery
引数として渡された filePath を、(可能な場合は)プロジェクト ルート ディレクトリを基準にした ファイル名に変換して返します。ファイルパスがプロジェクトのルート ディレクトリの下にない場合、 フル パス名を返します。
-update(-u) create
このフラグはプロジェクト ディレクトリから、 すべてのワークスペース設定を読み込みます。Maya ではスタートアップ時に使用し、使用可能なワークスペースを検索します。
-updateAll(-ua) create
このフラグは -u/update と同義です。
-filter(-f)
このフラグは現在サポートしていません。

: コマンドの作成モードで使用可能なフラグ : コマンドの編集モードで使用可能なフラグ
: コマンドの照会モードで使用可能なフラグ : 1 つのコマンドで複数回使用可能なフラグ

MEL 例

// Set the current workspace to "alphabet"
workspace -openWorkspace alphabet;

/ Save the current workspace settings (for "alphabet").
workspace -saveWorkspace;

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

// The settings 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

// The following will only return the first expanded path.
workspace -expandName $multipath;
// Result : /h/userName/maya/projects/default

// 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