複数の .MAX ファイルをバッチ処理する方法はありますか。

MAXScript に関する質問と回答 > シーン ノードの操作 > 複数の .MAX ファイルをバッチ処理する方法はありますか。

質問:

次の作業を簡単に行う方法があるでしょうか。たとえば、100 の MAX シーン ファイルがあり、それぞれのファイルのオブジェクトをスケールまたは移動する必要があるとします。各ファイルを開き、そのオブジェクトを修正してから、ファイルを保存し直すように、3ds Max に指示するコマンドはありますか。

回答:

パスを選択し、指定したディレクトリの MAX ファイルをすべて収集し、各ファイルを開いてから、保存し直すという作業に必要な基本コードがあります。ロードと保存の間のスペースに、ユーザ独自のコードを挿入することができます。

スクリプト:

thePath = getSavePath()--get a path dialog to specify the path
if thePath != undefined do--if the user did not cancel
(
  theFiles = getFiles (thePath+"\\*.max") --collect all max files in the dir.
  for f intheFiles do-- go through all of them
  (
    loadMaxFile f--load the next file
 
-----------------------------------------------------------
-- MAKE SOME SCRIPTED CHANGES TO THE SCENE HERE...
-----------------------------------------------------------
 
    saveMaxFile f --save the file back to disk
  )--end f loop
  resetMaxFile #noPrompt --at the end, you can reset
)--end if

関連事項