ScriptSpot

Forum topic · Scripts Wanted

Batch save scene by model's name.

By AlexYu · 2013-08-06

Description

Hi,
I've a master scene (studio) and a lot of models in different files (.max). I need merge these files by one in a master scene and save the master scene by name of this merged model. Is it possible to automatize this task? )

Comments (5)

Batch save scene by model's name.

AlexYu · 2013-08-06

hi,
thank you! I already tried this great script and rendered the scene via batch render and scene states but it is a long story to setup the scene.
I downloaded MFrender script http://www.scriptspot.com/3ds-max/scripts/mfrender this is much faster way to render a lot of files but now i'm looking for how to automatize creating the files to render.

Batch save scene by model's name.

AlexYu · 2013-08-06

thanks scriptspot.com i've get some workflow for my task.

1. merge files in a master scene by the great script "Batch loader" http://www.scriptspot.com/3ds-max/scripts/batch-loader
(it can merge files in personal layers}.

2. By using this script I could render one by one and script gives the names by the model's name. Perfect! thanks to Christoph Bьlter

--Select all objects you want to render separately and execute the script.
--written by Christoph Bьlter

(

local outputPath = "C:\Users\YourName\Desktop" --change this to where your renderings should be placed
local fileExt = ".png" --change this to any image file type

renderSceneDialog.close() --close render scene dialog to make changes have an effect

for s in selection do s.isHidden = true --hide all selected objects

for s in selection do --loop through selection
(
s.isHidden = false --unhide object
rendSaveFile = true --make sure image is saved to disk
rendOutputFileName = outputPath + "\\" + s.name + fileExt --create filename
max quick render --render using the settings from the render scene dialog
s.isHidden = true --hide object again
)--end for
)

Anybody know how to save the scene right after the render finish the first object with the name of current model?
I don't know the Maxscript, i found this in maxscript listener

actionMan.executeAction 0 "40007" -- File: Save File As

But how to give the name by the object in a scene automatically?
something like "s.name" ?

barigazy · 2013-08-06

You can use #postrender callback and next line which will works only if you select any object before you press "Render" button

(
if selection.count != 0 do
(
saveMaxFile (@"c:\Users\Branko\Desktop\"+selection[1].name)
)
)

AlexYu · 2013-08-06

thank you very much!!!