Hello,
Is there a way to batch convert files to corona proxies?
I would like to organize some plant libraries and it would be a big timesaver if it could be automated (instead of opening each file, export to proxy, save file, open next file etc.).
There's an older post on the forum, but after searching I didn't find a solution:
https://forum.corona-renderer.com/index.php?topic=25853.0Maybe it can be done with a script:
1. Opening each file from a source folder.
2. Select the geometry
3. Exporting the geometry as a Corona Proxy to a target folder.
4. Saving the modified scene in the target folder as a new .max file
5. Repeating this for all files in the source folder
Since I can't script, I asked ChatGPT, and got this:
-- Define folders
sourceFolder = "E:/folder_with_max_files/"
targetFolder = "E:/folder_a/"
-- Get all .max files in the source folder
maxFiles = getFiles (sourceFolder + "*.max")
for f in maxFiles do
(
try (
-- Open the .max file
loadMaxFile f useFileUnits:true quiet:true
-- Select all mesh geometry
select (for obj in geometry where superclassof obj == GeometryClass collect obj)
-- Build export path
fileName = getFilenameFile f
proxyPath = targetFolder + fileName + ".cproxy"
-- Export selection to Corona Proxy
coronaProxyExporter.exportToSingleFile = true
coronaProxyExporter.exportMultipleFiles = false
coronaProxyExporter.useObjectNames = false
coronaProxyExporter.exportSelected proxyPath
-- Optional: replace original geometry with proxy
-- Uncomment below if you want to auto-replace in scene
/*
delete selection
importFile proxyPath #noPrompt using:CoronaProxy
*/
-- Save the modified file to target folder
saveMaxFile (targetFolder + fileName + ".max")
-- Clean the scene
resetMaxFile #noPrompt
)
catch (
format "Failed to process file: %\n" f
)
)
messageBox "Batch export completed!"
Since no max files are saved and no proxies generated, there's obviously something wrong.
Is this possible with a script
Has anybody experience with something similar or a solution to this?
Thanks!