当前位置:网站首页>3DS MAX batch export file script MAXScript with interface

3DS MAX batch export file script MAXScript with interface

2022-08-10 13:19:00 FireFrame

In order to maintain distributed loading during a development process, the corresponding monolithic model resources are required. To be able to export all objects in 3DS MAX to independent files, I tried to write MAXScript by myself.

The above picture shows all the objects in the scene. I hope that the object name is the name of the export file, and it is exported to the specified folder.The exported script code is as follows:

rollout exportDlg "batch export" width:450 height:230(button 'btnExport' "Export" pos:[184,185] width:128 height:35 align:#leftbutton 'btnCancel' "Cancel" pos:[315,185] width:128 height:35 align:#leftlabel 'lbl1' "Batch export plugin" pos:[16,16] width:192 height:24 align:#lefton btnExport pressed do(dialog = DotNetObject"System.Windows.Forms.FolderBrowserDialog"dialog.Description = "Please select an export location"OpenFileResult = dialog.ShowDialog()if OpenFileResult.Equals OpenFileResult.OK then (print dialog.SelectedPathmax select all; -- select allSel = Selection as array;for i=1 to Sel.count do(select Sel[i];objName=Sel[i].name; -- get the selected name and export it separatelyexportPath=dialog.SelectedPath+"\\"+objName;-- Let's start exporting files, using: parameter can enter exporterPlugin.classes in MAXScriptListener to view all supported formatsexportfile exportPath #noPrompt selectedOnly:true using:OpenCOLLADAExporter))print "All export task completed!"))createDialog exportDlg 450 230

This script is a script with interface operation, the usage is as follows:

Copy the above script, save it with the extension "script.ms", then go back to 3DS MAX, select Scripting→Run Script... in the menu, open the corresponding .ms file just saved and run it.

After the script runs, the interface is shown below:

Click the export button to select the corresponding export path to start the export operation.

Note: The exported format is written in the .DAE format file of the OpenCOLLADAExporter exporter. If you need to export other formats, you can enter in the MAXScriptListener window:

exporterPlugin.classes

Press Enter on the keypad to run, and the corresponding supported format will be output, as shown below

Finally, select a format you want to export. For example, FBXEXP exports FBX files, and then replace the parameters after using: in the code.

Example:

exportfile exportPath #noPrompt selectedOnly:true using:FBXEXP

If the exporter after using does not exist, it seems that it can be exported successfully. The export format is the format you selected for export last time.

原网站

版权声明
本文为[FireFrame]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/222/202208101229127193.html