インタフェース > コア インタフェース > NetRender |
このコア インタフェースは、MAXScript にネットワーク レンダリングを公開します。
メソッド
<Interface>NetRender.GetManager()
MAXScript からネットワーク レンダリングにアクセスするには、マネージャ インスタンスを作成する必要があります。
構文は次のようになります。
NetRender.GetManager()
Interface: NetManager
NetRender.GetManager メソッドから返される NetManager Mixin インタフェースでは、MAXScript からネットワークレンダリングにアクセスできます。
プロパティ
次のプロパティは、情報を取得する場合、またはマネージャの特定のプロパティを設定する場合に使用できます。
<netManager>.connected
マネージャに接続した場合、 true を返します。読み込み専用です。
<netManager>.netStatus
マネージャの状態を返します。 netstatus を使用して、マネージャに関するさまざまな情報を収集することができます。詳細は、netstatus のトピックを参照してください。読み込み専用です。
<netManager>.wantControl
QueueControl を取得しているときに、他のコンピュータが QueryControl を呼び出す場合、この関数は、コントロールを維持するか、または放棄するかを指定します。他のコンピュータが QueryControl を呼び出すと、WantControl に設定された値が返されます。
<netManager>.haveControl
現在 QueueControl を持っている場合は True です。読み込み専用です。
<netManager>.numJobs
キュー内のジョブの数を返します。読み込み専用です。
<netManager>.numServers
サーバの数を返します。読み込み専用です。
<netManager>.numGroups
グループの数を返します。読み込み専用です。
メソッド
マネージャの問い合わせまたは制御を行うには、次のメソッドを使用できます。
<netManager>.setCallback <#progress | #message | #update | #managerdown | #queuecontrol | #querycontrol> <somefunction>
ネットワーク レンダリング中に発生する特定のイベント タイプに関して、マネージャと交信するために使用されます。イベント タイプごとに、定義する単一の関数を呼び出すことができます。6 つのコールバック タイプは、それぞれが 1 つのイベント タイプです。これらのイベントのうち任意のイベントについてコールバックをインストールするか、またはいずれのイベントについてもコールバックをインストールしないようにすることができます。
イベント タイプによって異なる引数の数をとるように関数を定義する必要があります。
2 つの引数が必要です。引数は以下の場合に呼び出されます。
#progress myprogess
ジョブまたはサーバに関する情報を呼び出す場合など、ダウンロード中またはアップロード中に呼び出されます。
この場合、2 つの整数パラメータ Total と Current で定義された関数が必要です。Total は転送するデータの合計、Current は現時点での転送済みデータの量です。
例: |
fn myprogress total current = -- NOTE: two integer parameters format "Progress: completed % out of %\n" current total m.setcallback #progress myprogress -- sets the #progress callback to use myprogress() |
#message mymessage
マネージャからユーザへのテキスト メッセージがある場合に呼び出されます。この場合、メッセージのテキストである 1 つの文字列パラメータで定義された関数が必要です。
例: |
fn myNetMessage msg = -- NOTE: one string parameter format "Message: %\n" msg m.setcallback #message mymessage -- sets the #message callback to use mymessage() |
#update myupdate
ジョブの開始や完了など、変化があった場合に呼び出されます。GetUpdate を呼び出す場合やその他のリフレッシュを行う場合に通知します。パラメータなしで定義された関数が必要です。
例: |
fn myUpdate = job.GetUpdate() --example of what you might do m.setcallback #update myupdate -- sets the #update callback to use myupdate() |
#managerdown mymanagerdown
マネージャがシャットダウンされた場合に呼び出されます。パラメータなしで定義された関数が必要です。
例: |
fn myManagerDown = format "Manager is dead\n" m.setcallback mymanagerdown --sets the #managerdown callback to use mymanagerdown() |
#queuecontrol myqueuecontrol
キュー コントロールが変化した場合に呼び出されます。パラメータなしで定義された関数が必要です。
例: |
fn myQueueControl = format "Queue control has changed\n" m.setcallback #QueueControl myQueueControl --install the "QueueControl" callback |
#querycontrol myquerycontrol
所有しているキュー コントロールが別のコンピュータでも必要となった場合に、QueueManager またはスクリプト関数<netManager>.QueryControl()によって呼び出されます。コントロールを保持したい場合は、値 <netManager>.WantControl を true に、それ以外の場合は false に設定します。関数は 1 つの引数(コントロールを要求するマシンの名前)をとる必要があります。詳細は、関数 <netManager>.QueueControl() を参照してください。
例: |
fn myQueryControl clientName = ( --NOTE: one string parameter format "The computer % wants queue control" clientName m.wantControl = true -- use this to keep queue control m.wantControl = false -- use this to release queue control ) m.setcallback #QueryControl myQueryControl -- install the "QueryControl" callback |
<netManager>.GetCallback <#progress | #message | #update | #managerdown | #queuecontrol | #querycontrol>
特定のコールバックに使用される関数の名前を返します。コールバックが割り当てられていない場合は、空の配列を返します。次のいずれかの引数が必要です。
#progress: ジョブまたはサーバに関する情報を呼び出す場合など、ダウンロード中またはアップロード中に呼び出されます。
#message: マネージャからユーザへのテキスト メッセージがある場合に呼び出されます。
#update: ジョブの開始や完了など、変化があった場合に呼び出されます。GetUpdate を呼び出す場合やその他のリフレッシュを行う場合に通知します。
#managerdown: マネージャがシャットダウンされた場合に呼び出されます。
#queuecontrol: キュー コントロールが変化した場合に呼び出されます。
#querycontrol: 所有しているキュー コントロールが別のコンピュータでも必要となった場合に呼び出されます。
<netManager>.connect #manual <manager name>|<manager IP address> [port:<integer>] platform:<enum>
または
<netManager>.connect #automatic <subnet mask> [port:<integer>] platform:<enum>
platform enums: { #32|#64|#default }
platform 既定値: #default
マネージャとの接続を確立して、ジョブ ステートおよびサーバ ステートへのアクセス、ジョブ設定の編集などを可能にします。
platform のオプション: 引数は 32 ビットまたは 64 ビット プラットフォームで使用できます。既定値は 3ds Max が実行するコマンドをコピーするプラットフォームに基づきます。
マネージャ名またはマネージャの IP アドレスを文字列で指定してマネージャに手動で接続するか、またはサブネット マスクおよびオプションのポート番号を指定して自動的にマネージャに接続することができます。
例: |
m.connect #manual "manager" -- connects to manager of name "manager" |
または |
m.connect #manual "192.168.0.1" -- connects to manager of IP 192.168.0.1 |
または |
m.connect #automatic "255.255.255.0" port:1234 -- automatically connects to manager on subnet 255.255.255.0 at port 1234 |
どちらの場合も、マネージャが既定値以外のポート番号を使用している場合は、オプションのポート番号を指定することができます。接続に成功した場合、true が返されます。 |
<netManager>.Disconnect()
<netManager>.connect で確立された接続を切断します。
<netManager>.Kill()
マネージャをシャット ダウンします。これを実行するには、キュー コントロールが必要です。
<netManager>.QueryControl <#wait | #dontwait>
#wait または #dontWait が必要です。関数は次のように機能します。
キュー コントロールを取得しているユーザがいない場合、 #dontWait は true を返し、 #wait は true を返します。
キュー コントロールを取得しているユーザがいる場合、 #dontwait は false を返し、 #wait は現在のキュー コントローラを要求するプロンプトを表示します。
最後の場合、キュー コントローラは QueryControl コールバックを取得して、コントロールが必要かどうかを指定する必要があります。そのユーザがコントロールを保持したいと示している場合、関数は false を返します。コントロールを放棄した場合(または 10 秒間のタイムアウトが過ぎた場合)は、 true を返します。QueueManager は、必要なコントロールの指定を求めるプロンプトを表示します。MAXScript では、コールバックを取得して wantControl 値を使用する必要があります。
<netManager>.GetControl()
キューのコントロールを取得します。コントロールを取得した場合、 true を返します。コントロールの取得後は、キュー コントロールが放棄されるまで、ジョブの発信、編集、再順序付け、およびサーバの削除を行うことができます。
<netManager>.Lock <true | false>
キュー コントロールが取得されないように他のユーザをロックアウトします。他のユーザが QueryControl を呼び出した場合、自動的に false を返します。たとえば、 getcontrol() を使用して MAXScript からキューのコントロールを取得したときに、他のユーザが QueueManager を読み込み専用で呼び出して、キュー コントロールを要求できる場合があります。ロックを true に設定すると、マネージャから切断するまで、またはロックを false にリセットするまで、他のユーザがコントロールを取得できなくなります。QueueManager は常に QueryControl を呼び出して、キューを取得できるかどうかを確認します。
<netManager>.SetUpdates <true | false>
この関数の使い方は、ブール値が渡され、既にキュー コントロールを取得している必要があるという点で Lock() 関数に似ています。更新を false に設定すると、キューに対する変更を拒否するようにマネージャがフリーズします。これはコールバックには影響しません。ジョブ キューは更新されないため、受信する Update コールバックは少なくなります。この関数は、大量の変更を発信する場合、かつすべての変更を一度に有効にしたい場合に使用します。この場合、 setUpdates() を true の値で呼び出して実行します。
<netManager>.checkoutputvisibility <path>
1 つの引数(文字列として定義されるパス名、つまり「c:\\temp」)を指定します。パスが存在するかどうかを確認し、パスが存在しない場合は、「指定されたパスが見つかりません(0x3)」というメッセージを返します。
さまざまな関数とプロパティを使用して、ジョブにアクセスすることができます。 GetJobs() 関数を使用すると、キュー内のすべてのジョブの配列を取得できます。ジョブをさまざまな方法でフィルタ処理し、フィルタに基づいて配列を返すことができます。
警告: |
---|
GetJobs() または GetServers() を何度も呼び出さないでください。これらは非常に負担のかかるメソッドです。 |
<netManager>.getjobs [filter:#suspended | #complete | #waiting | #started | #error | #name | #handle | #index] [key:<name> | <handle> | <index>]
最後の 3 つのフィルタ タイプには、対応するキー引数が必要です。フィルタなしで使用した場合は、キュー内のすべてのジョブの配列が返されます。キューにジョブがない場合は、空の配列が返されます。
filter :#suspended: 中断されているすべてのジョブの配列を返します。中止されているジョブがない場合は、空の配列 #() を返します。
filter :#complete: 完了したすべてのジョブの配列を返します。完了したジョブがない場合は、空の配列 #() を返します。
filter :#waiting: レンダリングの待機中またはレンダリング中のジョブの配列を返します。待機中のジョブがない場合は、空の配列 #() を返します。
filter :#started: 実際に開始された、レンダリング中のジョブの配列を返します。
filter :#complete: 完了したすべてのジョブの配列を返します。完了したジョブがない場合は、空の配列 #() を返します。
filter :#error: エラーが発生したすべてのジョブの配列を返します。エラーが発生したジョブがない場合は、空の配列 #() を返します。
filter :#name: 名前をキー引数として渡し、指定された名前を持つすべてのジョブの配列を返します。その名前を持つジョブがない場合は、空の配列 #() を返します。
filter :#handle: ハンドルをキー引数として渡し、そのハンドルを持つジョブを 1 つの要素を含む配列として返します。そのハンドルを持つジョブがない場合は、空の配列 #() を返します。
filter :#index: 整数をキー引数として渡し、キュー内のそのインデックスのジョブを 1 つの要素を含む配列として返します。そのインデックスにジョブが存在しない場合は、空の配列 #() を返します。
例 |
manager.GetControl() --get queue control manager.SetUpdates false --the queue is now frozen jobs = manager.GetJobs() manager.SetUpdates true --the queue is unfrozen |
<netManager>.SetJobOrder <array>
キュー内のジョブの順序を変更します。配列には、 .getjobs() からの配列に含まれるジョブと同じジョブが含まれている必要がありますが、ジョブの順序は変更することができます。また、キュー コントロールも取得する必要があります。ジョブの順序を設定する前に、 .getcontrol() 関数を使用してコントロールを取得してください。
<netManager>.NewJobfile:<filename>
新しいジョブ インスタンスを作成します。有効な max ファイル名(ハード ドライブまたはネットワーク上に存在する max ファイル)が必要です。ファイルが存在する場合はジョブ定義を返し、ファイルが見つからない場合は undefined を返します。
例 |
job.newJob file:"file.max" --submitting a file job.newJob() --submitting the current scene |
<job>.GetUpdate()
選択されたジョブに関する情報を更新します。この操作はネットワークの相互作用を伴うため、負担がかかることに注意してください。
<job>.SendUpdate()
キュー内のジョブを新しいジョブ設定で更新します。キュー コントロールが必要です。キュー コントロールを取得するには、 <netManager>.getcontrol() を使用します。この操作はネットワークの相互作用を伴うため、負担がかかることに注意してください。
<job>.Submit() Servers:<array>
レンダリングする新しいジョブをキューに送信します。キュー コントロールが必要です。キュー コントロールを取得するには、 <netManager>.getcontrol() を使用します。サーバが指定されていない場合、すべてのサーバがジョブに割り当てられます。
<job>.Suspend()
選択されたジョブを中断します。キュー コントロールが必要です。キュー コントロールを取得するには、 <netManager>.getcontrol() を使用します。
<job>.Resume()
中断されたジョブを中断された場所から続行します。キュー コントロールが必要です。キュー コントロールが必要です。キュー コントロールを取得するには、 <netManager>.getcontrol() を使用します。
<job>.Restart()
ジョブを最初から再開します。キュー コントロールが必要です。キュー コントロールを取得するには、 <netManager>.getcontrol() を使用します。
<job>.Delete()
ジョブをキューから削除します。キュー コントロールが必要です。キュー コントロールを取得するには、 <netManager>.getcontrol() を使用します。
<job>.AssignServer <server>
選択されたサーバをジョブに割り当てます。キュー コントロールが必要です。キュー コントロールを取得するには、 <netManager>.getcontrol() を使用します。
<job>.SuspendServer <server>
サーバを選択されたジョブから削除します。キュー コントロールが必要です。キュー コントロールを取得するには、 <netManager>.getcontrol() を使用します。
<job>.GetServerInfo <integer>
ジョブに割り当てられた特定のサーバに関する情報を取得します。1 から始まるサーバ番号が必要です。
<job>.nonconcurrentDriver
(.MOV ファイルのように)フレームごとに出力をレンダリングできない場合、 true を返します。読み込み専用です。
<job>.uninterruptibleDriver
レンダリングが割り込みまたは中断された後に再開できない場合、 true を返します。
たとえば、.AVI ファイルの半分をレンダリングして、後で残りをレンダリングすることはできません。割り込みなしですべてをレンダリングする必要があります。読み込み専用です。
<job>.GetCameras()
シーン内のカメラの配列を返します。カメラがシーン内にない場合は、空の配列 #() が返されます。
<job>.GetLog() start:x numLines:y
ジョブのログをテキストで返します。'start' および 'numLines' パラメータはオプションです。パラメータを渡さない場合、ログ全体が返されます。start のみを渡す場合、指定した行から始まるすべての行が返されます。numLines のみを渡す場合、start は 0 とみなされます。
<job>.GetServerStatusText <server>
ジョブに割り当てられたサーバの中で選択されたサーバからのメッセージを返します。サーバからのメッセージがない場合は、空の文字列が返されます。読み込み専用です。
<job>.numServers
ジョブに割り当てられたサーバの数を返します。読み込み専用です。
<job>.state
ジョブの状態を返します。状態は、 #complete、#suspended、#busy 、または #waiting のいずれかです。読み込み専用です。
<job>.serverPID
この関数は、内部使用に限定した下位レベルの情報を提供します。
<job>.handle
ジョブのハンドルを返します。読み込み専用です。
次の値の多くは読み込み/書き込みが可能ですが、これらの値に対する変更は、 <job>.SendUpdate() を呼び出すまでマネージャに登録されません。
<job>.name
ジョブの名前を返します。ジョブ名は変更可能です。
<job>.filesize
ジョブのファイル サイズを返します。
<job>.filesizeExtracted
ジョブの抽出ファイル サイズを返します。読み込み専用です。
<job>.timeSubmitted
ジョブが送信された時間を文字列で返します。
<job>.timeStarted
ジョブが開始された時間を文字列で返します。ジョブが開始されていない場合は、undefined を返します。読み込み専用です。
<job>.timeFinished
ジョブが完了した時間を文字列で返します。ジョブが完了していない場合は、undefined を返します。読み込み専用です。
<job>.notifications
通知がオンの場合、true を返します。変更可能です。
<job>.notifyFailure
エラーが通知された場合、true を返します。変更可能です。
<job>.notifyProgress
進行状況が通知された場合、true を返します。変更可能です。
<job>.notifyCompletion
進行状況の通知がオン場合、true を返します。変更可能です。
<job>.notifyFrameInterval
通知の間隔を返します。変更可能です。
<job>.fromFrame
レンダリングの開始フレームを返します。変更可能です。
<job>.toFrame
レンダリングの終了フレームを返します。変更可能です。
<job>.nthFrame
レンダリングのフレーム間隔を返します。変更可能です。
<job>.outputWidth
レンダリングされたフレームの幅を返します。変更可能です。
<job>.outputHeight
レンダリングされたフレームの高さを返します。変更可能です。
<job>.numFramesComplete
ジョブに関して完了したフレームの数。読み込み専用です。
<job>.priority
ジョブの優先順位を返します。
<job>.videoPost
ビデオ ポストのシーケンスが存在する場合、 true を返します。読み込み専用です。
<job>.includeMaps
[マップを含む](include maps)をオンにしてジョブが送信された場合、 true を返します。変更可能です。
<job>.skipRenderedFrames
ジョブが送信されたときに[レンダリングされたフレームをスキップ](skip rendered frames)がオンに設定されていた場合、 true を返します。変更可能です。
<job>.useAllServers
ジョブが送信されたときに[すべてのサーバを使用](use all servers)がオンに設定されていた場合、 true を返します。変更可能です。
<job>.suspended
ジョブが中断されている場合、 true を返します。読み込み専用です。ジョブを中断するには、 <job>.suspend() を使用します。
<job>.finished
ジョブが終了している場合、 true を返します。読み込み専用です。
<job>.ignoreShare
[共有を無視](ignore share)をオンにしてジョブが送信された場合、 true を返します。変更可能です。
<job>.skipOutputTest
[出力テストをスキップ](skip output test)をオンにしてジョブが送信された場合、 true を返します。変更可能です。
<job>.nonSeqFrames
連続しないフレームをレンダリングするジョブが送信された場合、 true を返します。変更可能です。
<job>.combustionJob
ジョブが max ジョブの場合、 false を返します。読み込み専用です。
<job>.uncompressedFile
ジョブ ファイルが圧縮されている場合、 false を返します。読み込み専用です。
<job>.gammaCorrection
[ガンマ補正](gamma correction)をオンにしてジョブが送信された場合、 true を返します。変更可能です。
<job>.gammaValueIn
入ってくるガンマ値の浮動小数点値を返します。変更可能です。
<job>.gammaValueOut
出て行くガンマ値の浮動小数点値を返します。変更可能です。
<job>.renderPixelAspect
レンダリング ピクセル アスペクト比の浮動小数点値を返します。変更可能です。
<job>.renderCamera
レンダリング中のカメラ ビューの名前を文字列で返します。レンダリング中のビューがカメラ ビューではない場合(パース、フロント、ユーザなどの場合)、空の文字列が返されます。変更可能です。変更するシーン内の有効なカメラのリストを取得するには、 <job>.getcameras() 関数を使用します。
<job>.renderElements
レンダリング要素がアクティブな状態でジョブが送信された場合、 true を返します。レンダリングする要素が存在しない場合でも true が返されることに注意してください。変更可能です。
<job>.numSceneObjects
シーン内のオブジェクトの数を整数で返します。読み込み専用です。
<job>.numSceneFaces
シーン内の面の数を整数で返します。読み込み専用です。
<job>.numSceneLights
シーン内のライトの数を整数で返します。読み込み専用です。
<job>.sceneStartTime
フレーム内のシーンの開始時間を返します。そのため、[分 : 秒 : ティック](MM:SS:Ticks)を使用するようにシーンが設定されている場合でも、フレーム内の値が返されます。
<job>.sceneEndTime
フレーム内のシーンの終了時間を返します。
<job>.videoColorCheck
[ビデオ カラーをチェック](videocolorcheck)をオンにしてジョブが送信された場合、 true を返します。変更可能です。
<job>.force2Sided
[両面レンダリング](force 2 sided)をオンにしてジョブが送信された場合、 true を返します。変更可能です。
<job>.renderHiddenObjects
[非表示オブジェクトをレンダリング](render hidden objects)をオンにしてジョブが送信された場合、 true を返します。変更可能です。
<job>.renderAtmosphericEffects
[環境効果をレンダリング](render atmospheric effects)をオンにしてジョブが送信された場合、 true を返します。変更可能です。
<job>.superBlack
[スーパー ブラック](superblack)をオンにしてジョブが送信された場合、 true を返します。変更可能です。
<job>.serialNumbering
[N 番目の連続番号](nth serial numbering)がオンの場合、 true を返します。このプロパティは[基本設定](preferences)ダイアログ ボックス\[レンダリング](rendering)タブからアクセスできます。
<job>.ditherPaletted
[ディザ 256](Dither Paletted)を有効にしてジョブが送信された場合、 true を返します。変更可能です。
<job>.ditherTrueColor
[ディザ フルカラー](Dither True Color)を有効にしてジョブが送信された場合、 true を返します。変更可能です。
<job>.renderFields
[フィールドをレンダリング](Render Fields)を有効にしてジョブが送信された場合、 true を返します。変更可能です。
<job>.renderDisplacements
ディスプレイスメントを有効にしてジョブが送信された場合、 true を返します。変更可能です。
<job>.renderEffects
レンダリング効果を有効にしてジョブが送信された場合、 true を返します。変更可能です。
<job>.fieldOrder
ジョブの送信時に設定されていたフィールドの順序に応じて、 #odd または #even を返します。変更可能です。
<job>.numRenderElements
シーン内のレンダリング要素の数を返します。読み込み専用です。
<job>.userName
ジョブを送信したユーザの名前を文字列で返します。MAXScript から <job>.submit() を使用してジョブが送信され、別のコンピュータの他のユーザによって max ファイルが最後に保存された場合、ユーザ名はそのユーザの名前になります。読み込み専用です。
<job>.computerName
ジョブを送信したコンピュータの名前を文字列で返します。MAXScript から <job>.submit() を使用してジョブが送信され、別のコンピュータの他のユーザによって max ファイルが最後に保存された場合、コンピュータ名は max ファイルが最後に保存されたコンピュータの名前になります。読み込み専用です。
<job>.managerShare
すべてのジョブがマネージャに保存されている場合に、共有フォルダを文字列で返します。
<job>.frames
レンダリングするフレームの文字列(つまり、「 1,3,5-12 」)を返します。変更可能です。
<job>.frameOutputName
出力ファイルの名前およびパスを返します。変更可能です。
<job>.frameOutputGamma
レンダリングされたフレームの出力ガンマを返します。
<job>.frameOutputDevice
レンダリング時にデバイスが指定されている場合、デバイス名を返します。
<job>.numFrames
<job>.GetRenderElement <index>
n 番目の要素に関する情報をデータ構造体で返します。<element> 構造体は、次のように定義されます。インデックス番号に要素がない場合は undefined が返されます。たとえば、 el = jobs[1].getrenderelement 1 の場合、キュー内の 1 つ目のジョブの 1 つ目の要素が取得されます。これにより、要素が使用可能かどうか、フィルタが使用可能かどうか、環境効果が適用されているかどうか、シャドウが適用されているかどうか、および要素名と要素の出力ファイル名を知ることができます。要素に有効なプロパティは次のとおりです。
<element>.enabled
要素が使用可能な場合、 true を返します。その状態を設定することもできます。
<element>.filterEnabled
フィルタが使用可能な場合、 true を返します。その状態を設定することもできます。
<element>.atmosphereApplied
環境効果が適用されている場合、 true を返します。読み込み専用です。
<element>.shadowsApplied
シャドウが適用されている場合、 true を返します。読み込み専用です。
<element>.name
要素名を返します。要素名は変更可能です。
<element>.output
要素の出力ファイル名を返します。出力名とパスを変更できます。ただし、ファイル タイプを変更すると、実際のファイル タイプではなくイメージの拡張子が変更されます。たとえば、返された現在の出力が「 \\ej4sf\frames\foo_diffuse.tga 」の場合、拡張子を .bmp に変更すると、単純に .tga 拡張子の代わりに .bmp 拡張子が付いた tga ファイルになります。
<job>.SetRenderElement <index> <element>
選択されたレンダリング要素を、要素に割り当てられた新しい値に設定します。変更内容をジョブで有効にするには、 <job>.sendupdate() を実行して、キュー内のジョブ自体を更新する必要があります。
<job>.GetFrameInfo <integer>
n 番目のフレームに関する情報をデータ構造体で返します。インデックスの基数は 1 です。<frame> 構造体は次のように定義されます。
例 |
fr = getframeinfo 4 -- Returns info about the 4th frame. Read-only. |
<frame>.state
フレームの状態を返します。状態は、 #waiting 、 #assigned 、または #complete のいずれかです。
<frame>.index
実際のフレーム番号を返します。読み込み専用です。
<frame>.serverhandle
サーバ ハンドルを返します。フレームがまだレンダリングされていない場合は、undefined が返されます。読み込み専用です。
<frame>.servername
フレームに割り当てられたサーバの名前を返します。フレームがまだ割り当てられていない場合は undefined を返します。読み込み専用です。
<frame>.elapsedtime
フレームをレンダリングするのに必要な時間を返します。フレームがまだ割り当てられていない場合は undefined を返します。読み込み専用です。
さまざまな関数とプロパティを使用して、レンダリング サーバにアクセスすることができます。 getservers() 関数を使用すると、マネージャで管理されているすべてのサーバの配列を取得できます。サーバをさまざまな方法でフィルタ処理し、フィルタに基づいて配列を返すことができます。
警告: |
---|
GetJobs() または GetServers() を何度も呼び出さないでください。これらは、非常に負担のかかるメソッドです。 |
<netManager>.GetServers [filter:#idle | #busy | #absent | #suspended | #error | #group | #job | #handle | #index] [key:<string> | <integer> | <job> ]
GetServers () をフィルタなしで使用した場合は、マネージャで管理されているすべてのサーバの配列が返されます。サーバが存在しない場合は、空の配列が返されます。
filter:#idle: アイドル状態になっているすべてのサーバの配列を返します。
filter:#busy: ジョブのレンダリングでビジー状態になっているすべてのサーバの配列を返します。
filter:#absent: 不在状態(つまり、その時点でマネージャに接続していても停止しているか、サーバのサービスまたはサーバ アプリケーションが実行されていない状態)になっているすべてのサーバの配列を返します。
filter:#suspended: 中断されているすべてのサーバの配列を返します。
filter:#error: エラーが発生したすべてのサーバの配列を返します。
filter:#group: グループ内のサーバの配列を返します。キー オプションを使用する必要があります。キーには、文字列のグループ名または(基数 1 の)整数のグループ番号を使用できます。グループが定義されていない場合は、空の配列が返されます。
filter:#job: 指定されたジョブに割り当てられたサーバの配列を返します。キー オプションを使用する必要があります。キーはジョブ定義である必要があります。
filter:#handle: 指定されたハンドルを持つサーバを(1 つの項目を含む配列で)返します。キー オプションを使用する必要があります。キーはサーバ ハンドルである必要があります。
filter:#index: サーバ リストの指定されたインデックスのサーバを(1 つの項目を含む配列で)返します。キー オプションを使用する必要があります。キーは整数(インデックス)である必要があります。
例 |
server = m.getservers() |
<server>.GetUpdate()
サーバの状態の最新情報を取得します。正常に終了した場合、OK を返します。
<server>.SendUpdate()
サーバを新しい設定で更新します。キュー コントロールが必要です。
<server>.Delete()
サーバをマネージャから削除します。キュー コントロールが必要です。
<server>.ResetPerformance()
パフォーマンス メトリックを 0.0 にリセットします。キュー コントロールを取得し、 <server>.sendupdate() を実行してサーバを更新する必要があります。
<server>.netStatus
Netstatus
<server>.handle
サーバのハンドルを返します。読み込み専用です。
<server>.state
サーバの状態を返します。状態は、#idle、#absent、#busy のいずれかです。
<server>.name
サーバの名前を返します。読み込み専用です。
<server>.totalFrames
サーバによってレンダリングされたフレームの総数を返します。読み込み専用です。
<server>.totalTime
サーバの合計稼働時間を返します。戻り値は時間単位です。
<server>.performance
サーバのパフォーマンス インデックスを返します。読み込み専用です。
<server>.AttendedPriority
ユーザがログ インする際のサーバの優先順位を整数で返します。
0: 優先順位上位
1: 優先順位下位
2: アイドル状態
変更可能です。
<server>.UnattendedPriority
システムをログ アウトする際のサーバの優先順位レベルを整数で返します。
0: 優先順位上位
1: 優先順位下位
2: アイドル状態
これは、 serversvc を実行中で、ユーザがシステムにログインしていない場合にのみ有効です。 serversvc を実行中で、ユーザがシステムにログインしている場合は、 attendedpriority の値が有効になります。変更可能です。
<server>.schedule
7 つの bitarray の配列を返します。各 bitarray は曜日、各ビットは時間、ビット配列内の各ビットはサーバがその時間に利用可能なことを意味します。 #{1, 3..5, 15..24} のビット配列は、サーバが深夜の 12 時から午前 1 時まで、午前 3 時から 5 時まで、午後 3 時から深夜の 12 時まで利用可能なことを意味します。
<server>.jobHandle
サーバで処理されているジョブのハンドルを返します。そのサーバで処理されているジョブがない場合は、0 が返されます。
<server>.jobFrameIndex
サーバで処理されているジョブのフレーム インデックスを返します。
<server>.jobFrameTimeStarted
レンダリングされるフレームが開始された時間を返します。
<netManager>.SizeofGroup <index>
n 番目のグループのサーバの数を返します。
<netManager>.GetGroupName<index>
n 番目のグループの名前を返します。
<netManager>.CreateGroup <array> <string>
サーバの名前付きグループを作成します。2 つの引数を指定します。サーバの配列とグループ名を定義する文字列です。
<netManager>.DeleteGroup <string>
名前付きグループを削除します。文字列を引数としてとります。
マネージャとサーバの両方に netstatus プロパティがあります。すべてのプロパティは、読み込み専用です。
system = m.netstatus
<system>.SpaceOnDisk <index>
指定されたディスクの容量を MB 単位で返します。インデックスの基数は 1 です。ディスク 1 および 2 は、それぞれ a: および b: ドライブです。
このプロパティは現在、特定のディスク( .workdisk を使って指定する作業ディスク)に対してだけ、正しい結果を返します。実際には、作業ディスク以外のディスクも渡す必要があります。
NetStatus オブジェクトでは、UNIX および Linux との互換性を維持するために、常に 1 つのディスク(作業ディスク)のみをレポートします。このため、 NetStatus.SpaceOnDisk() 値は実際には正しくありませんが、作業ディスクの空き容量は判別できます。ほとんどの場合、この情報を取得するために使用します。
<system>.numDroppedPackets
ドロップされたパケットの数を返します。
<system>.numBad
無効なパケットの数を返します。
<system>.numTCPRequests
TCP 要求の数を返します。
<system>.numUDPRequests
UDP パケットの数を返します。
<system>.bootTime
システムが開始された時間を返します。
<system>.memorySize
システムのメモリの量を返します。
<system>.numProcessors
システム内のプロセッサの数を返します。
<system>.username
コンピュータにログ インするユーザのログイン名、またはサービスで使用されるログイン名を返します。
<system>.computerName
コンピュータの名前を返します。
<system>.workdisk
max がセットアップされているディスクを返します。
現在は正しく機能していません。常に同じ値を返します。
<system>.Disks
ディスクの存在を bitarray で返します(1=A、2=B、3=C など)。
現在は機能していません。
NetStatus オブジェクトでは、UNIX および Linux との互換性を維持するために、常に 1 つのディスク(作業ディスク)のみをレポートします。このため、 NetStatus.Disks() 値は実際には正しくありませんが、作業ディスクの空き容量は判別できます(ほとんどの場合、この情報を取得するために使用します)。
<system>.mac
システムのネットワーク カードの MAC アドレスを返します。コンピュータがネットワーク サーバの場合、これはサーバのハンドルになります。
Backburner 技術が導入されたため、以下のプロパティは 3ds Max 5 以降ではサポートされていません。
<system>.platformID
3ds Max 4では、整数を返します。値 1 は Windows 95、2 は Windows NT を示します。
<system>.majorVersion
3ds Max 4では、整数を返します。platformID が Windows NT を示す場合、ここで 5 以上の値は Windows 2000 を示します。
<system>.minorVersion
3ds Max 4では、整数を返します。Windows 98 は、0 (Windows 95)より大きなマイナー ビルドで示されます。
<system>.buildNumber
3ds Max 4 ではビルド番号を返します。これは Windows NT および 2000 にのみ適用されます。Windows 95、98、または ME ではサポートされていません。
<system>.CSDVersion
3ds Max 4 では、OS のサービス パック番号を文字列で返します。
<system>.tempDir
3ds Max 4 では、システムの一時ディレクトリを返します。
例: |
-- ESTABLISHING A CONNECTION -- m = netrender.getmanager() --get a NetManager instance --start this session m.connect #manual "nimbus" -- OR m.connect #manual "nimbus" port:1234 --specifying a port number |
-- QUEUE CONTROL -- --Get QueueControl using GetControl(); --there is no way to release control, but if wantControl==false --then control will be relinquished to the next client --that requests it if ( m.QueryControl #wait ) do --only take control if you have permission m.getcontrol() --takes queue control m.wantControl=true --if another client does QueryControl(), they will get a return value of false m.Lock true --this completely prevents others from getting queue control m.Lock false --others can now get control |
-- SUBMITTING JOBS -- job = m.newjob file:"c:\\share\\test.max" job.suspended = true --jobs can be submitted as suspended job.state --should be unsubmitted job.includeMaps = true --turn on "Include Maps" srv_list = m.getservers() --get the server list to assign to the job job.submit servers:srv_list --specify which servers to use for the job -- job.submit() --this uses all servers for the job |
-- GETTING JOBS & SERVER OBJECTS -- m.SetUpdates false --lock the queue, to make sure nothing changes while you download info j = m.getjobs filter:#suspended --an array of NetJob objects; filters are optinal s = m.getservers filter:#idle --an array of NetServer objects; filters are optinal --see below for other filters... there are many m.SetUpdates true --be sure to unlock the queue! |
-- WORKING WITH GROUPS -- m.creategroup s "myGroup" --takes an array of NetServers and a name num_groups = m.numGroups --total number of groups size_group1 = m.SizeofGroup 1 --number of servers in the first group g = m.getservers filter:#group key:1 --an array of the servers for group 1 g = m.getservers filter:#group key:"myGroup" --an array of the servers for group "myGroup" g_name = m.GetGroupName 1 --the name of the first group m.deletegroup g_name --delete a group |
-- WORKING WITH JOBS -- job = j[1] --pull a job out of the list jHandle = job.handle --the job's ID p = job.priority --job's priority if job.nonSeqFrames == True then frames = job.frames --one of those "1,3,5-12" frame lists else frames = (job.fromFrame as string) + "-" + (job.toFrame as string) --now frames is "0-100" if 0 and 100 are the start/end frames cameraArray = job.GetCameras() --an array of the camera names l = job.GetLog --the entire log, as text l = job.GetLog start:4 numLines:2 --gets the 4th and 5th entries of the log statText = job.GetServerStatusText s[1] --text about a server, regarding this job num_workers = job.numServers --number of servers on this job job.frameOutputName = "d:\\blah.bmp" --change the output name isDevice = job.frameOutputDevice --true if the output is to a device, false otherwise share = job.managerShare --the manager share for this job job.filesize --size of the MAZ file for the job job.filesizeextracted --extracted size of the MAZ file for the job |
-- WORKING WITH SERVERS -- srv = s[1] --pull a server out of the list sHandle = srv.Handle --the server's ID sName = srv.name --the server's machine name speed = srv.performance --server's performance index srv.ResetPerformance() --reset the index timeUsed = srv.totalTime --total time spent rendering sjHandle = srv.jobHandle --the handle of the server's current job, 0 if none sjFrameIndex = srv.jobFrameIndex --the index of the frame the server is rendering |
--PRACTICAL EXAMPLE; get info about the frame being rendered sjHandle = srv.jobHandle sjIndex = srv.jobFrameIndex sJobs = m.getJobs filter:job key:sjHandle --should be an array with one entry frameInfo = (sJobs[1].getFrameInfo sjIndex) --get info about the current frame frameTime = frameInfo.elapsedTime |
-- UPDATES FROM MANAGER -- --Jobs and Servers support GetUpdate and SendUpdate functions, -- for synchronizing with the manager job.status --should be busy job.Suspend() job.status --still says busy (status value is stale) job.GetUpdate() --download the latest news job.status --now says suspended s[1].GetUpdate() --servers also have Get/SendUpdate |
-- CALLBACKS -- -- These are used to listen for messages from the manager, -- They are functions you can define, that will get called when -- the manager has something to say -- There are 6 possible callbacks -- NOTE: you can name these functions anything you want, but they must have correct paramters --NETPROGRESS CALLBACK; Called anytime a download/upload is underway, -- including anytime you fetch information about jobs or servers fn myNetProgress total current = --NOTE: two integer parameters format "Progress: completed % out of %\n" current total --NETMESSAGE CALLBACK; Called when the manager has a text message for the user fn myNetMessage msg = --NOTE: one string parameter format "Message: %\n" msg --UPDATE CALLBACK; Called when something has changed, like a job started or finished -- Let's you know when you need to make GetUpdate calls, or other refreshing fn myUpdate = job.GetUpdate() --example of what you might do --MANAGERDOWN CALLBACK; Called when the manager dies fn myManagerDown = format "Manager is dead\n" --QUEUECONTROL CALLBACK; Called whenever queue control changes fn myQueueControl = format "Queue control has changed\n" --QUERYCONTROL CALLBACK; Called when you have Queue Control, and another computer wants it fn myQueryControl clientName = ( --NOTE: one string parameter format "The computer % wants queue control" clientName m.wantControl = true -- use this to keep queue control m.wantControl = false -- use this to release queue control ) --INSTALLING THE CALLBACKS; after you define the functions, you must give them to the -- manager as follows --NOTE: only one callback of each type is allowed (e.g., you can't have two "Update" callbacks) m.setcallback #Progress myNetProgress --install the "Progress" callback m.setcallback #Message myNetMessage --install the "Message" callback m.setcallback #Update myUpdate --install the "Update" callback m.setcallback #ManagerDown myManagerDown --install the "ManagerDown" callback m.setcallback #QueueControl myQueueControl --install the "QueueControl" callback m.setcallback #QueryControl myQueryControl --install the "QueryControl" callback |
-- NETSTATUS OBJECTS -- --Read-only information about a computer on the network stat = s[1].netStatus --get network info about server 1 stat.boottime --make a query stat.Disks -- d = stat.workDisk --which is the disk for net-rendering work? stat.SpaceOnDisk d --megabytes of free space on the workdisk stat.memorySize --computer's memory in bytes (note: 1 meg = 1048576 bytes) s[1].GetUpdate() --this refreshes the netStatus object stat = m.netStatus --manager also has a NetStatus --NOTE: Manager has no GetUpdate(), you must fetch the NetStatus again to see any changes --To print out the operating system on the machine... --Win95 has a platformID of 1; WinNT has a platformID of 2 --Win2K is indicated by a majorBuild of 5 or more for WinNT --Win98 is indicated by a minorBuild greater than 0 for Win95. -- Also, build number and the CSDVersion string are not supported by Win95/98 format "Windows %.%, Build %, %\n" \ stat.majorVersion stat.minorVersion stat.buildNumber stat.CSDVersion |
-- JOBFRAME OBJECTS -- num_frames = job.numFrames() frame = job.getFrameInfo 1 --get info about the 1st frame elapsed_time = frame.ElapsedTime --amount of time frame has been rendering num_rendElems = job.numRenderElements() --number of render elements for render if num_rendElems>0 do( rendElem = job.GetRenderElement 1 --pass the index of the element rendElem.enabled = false --turn off the rend element job.SetRenderElement 1 rendElem --update the job with the new changes job.SendUpdate() --upload the changes ) |
-- JOBSERVER OBJECTS -- --Read-only information about a server, in relation to a particular job j_num_servers = j[1].numServers --how many servers does the job have? js = j[1].GetServerInfo 1 --info about the job's first server sh = js.serverHandle --what's the server's handle? sn = js.serverName --what's the server's name? isWorker = js.active --whether this server participates in this job js_state = js.state --is the server busy with the job? has an error? etc --Print out some stats format "rendering frame %, completed %, total time % hours\n" \ js.currentFrame js.numFramesComplete js.elapsedTime --ways to get more info about this server... jSrv = m.GetServers filter:#handle key:sh --get the actual server object statText = j[1].GetServerStatusText jSrv[1] --text info from the server about this job |
-- RENDERELEMENT OBJECTS -- --Information about particular render elements for a job n = j[1].numRenderElements --how many render elements for this job? re = j[1].GetRenderElement 1 --get the first one re.enabled = false --disable it re.filterEnabled = false --disable filtering re.name = "newName" --change its name useShadows = re.shadowsApplied --are shadows applied? (read-only) useShadows = re.atmosphereApplied --are atmospherics applied (read-only) re.output = "C:\\share\\rendElem1.bmp" --change its output path & name j[1].SetRenderElement 1 re --update the job with the new changes j[1].SendUpdate --upload the changes |
-- WEEKLY SCHEDULES -- -- a servers' weekly schedule is an array of seven BitArrays; -- Each bitArray is a day, each bit is an hour sched = s[1].schedule sched[1][11] = false --sunday 11am, the server will not work sched[1][12] = false -- same for sunday noon s[1].attendedPriority = 60 --set the priorities for the server's schedule s[1].unattendedPriority = 10 s[1].schedule = sched --set the new schedule s[1].schedule --printout to prove the change worked s[1].SendUpdate() --upload the changes to this server --NOTE: a Schedule is just a BitArray and has no GetUpdate, --you must fetch it again from the server to see any changes |
-- MISCELANEOUS FUNCTIONS -- jobList = #( j[3], j[1], j[2] ) --make an array of some jobs m.SetJobOrder jobList --rearrange the jobs; e.g. j[3] is now the first in the queue mName = (m.netStatus).computerName --the machine name of the manager |
-- JOB & SERVER FILTERS -- jobServers = m.getservers filter:#Job key:j[1] groupServers = m.getservers filter:#group key:"Clouds" |
-- ENDING THE SEESION -- m.wantControl=true --other clients can now get QueueControl m.disconnect() --end this session -- m.kill() --brings down the manager, (would need queue control) |