移動先: 概要 戻り値 フラグ. 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
: コマンドの作成モードで使用可能なフラグ
|
: コマンドの編集モードで使用可能なフラグ
|
: コマンドの照会モードで使用可能なフラグ
|
: 1 つのコマンドで複数回使用可能なフラグ
|
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 //