ジャンプ先: 概要. 戻り値. フラグ. MEL 例.
cmdFileOutput [-close uint] [-closeAll] [-open string] [-status uint]
cmdFileOutput は、取り消し可能、照会可能、および編集不可能です。
このコマンドは、通常はスクリプト エディタ(Script Editor)ウィンドウまたはコンソールに出力されるコマンドと結果をすべて受信したテキスト ファイルを開きます。このファイルは、正しいファイル記述子と -close、または -closeAll が明示的に指定されるまで、開いたままになります。したがって、不必要にファイルを開いたままにしないようにする必要があります。
Maya が起動してすぐログを開始にするために、起動する前に環境変数 MAYA_CMD_FILE_OUTPUT を指定することもできます。ファイル名に MAYA_CMD_FILE_OUTPUT を設定すると、ファイルが作成され、指定されたファイルに出力されます。Maya の起動後に記述子にアクセスする場合は、-query フラグと -open フラグを同時に使用します。
int | : 開いているときに、ステータスを照会またはファイルを閉じるのに使用する値(記述子)を返します。それ以外の場合は、ファイルのステータスを示すステータス コードを返します。 |
照会モードでは、戻り値のタイプは照会されたフラグに基づきます。
close, closeAll, open, status
フラグはコマンドの作成モードで表示できます
|
フラグはコマンドの編集モードで表示できます
|
フラグはコマンドの照会モードで表示できます
|
コマンド内でフラグを複数回使用できます。
|
cmdFileOutput -o "dbOutput.txt";
// Result: 1 //
print "This message is in the file\n";
// This message is in the file
cmdFileOutput -s 1;
// Result: 0 //
cmdFileOutput -s 2;
// Result: -3 //
cmdFileOutput -c 1;
// Result: 0 //
// Notice that the 'This message is in the file' string is in the file,
// as are all of the entered commands and the
// '// Result: ...' lines, etc.
// Turn on logging to a file on Maya startup so as to log all error
// messages which happen on startup.
//
// Set the environment variable MAYA_CMD_FILE_OUTPUT to "trace.txt"
// Start up Maya
// Messages should now be logged to the file "trace.txt" as well as the
// script editor window.
// Turn off logging to the filename specified by $MAYA_CMD_FILE_OUTPUT
// after Maya has completed startup.
//
string $traceFile = getenv( "MAYA_CMD_FILE_OUTPUT" );
int $descriptor = `cmdFileOutput -o $traceFile -q`;
if ( -1 != $descriptor ) {
cmdFileOutput -close $descriptor;
}
// Result: 0 //