selection to scene name and output file

Hi,

I'm looking for a way to select a couple of objects in my scene and then use this selection to define the name of the scene to be saved. If possible i would use the same selection (name) to define the Render output file name.

so if in my scene i have Box_001 Cone_001 and Sphere_001

i would like to select Box_001 and Sphere_001

then save the scene C:/scene/Box001Sphere001.max

then eventually output the render to C:/RenderOutputs/Box001Sphere001.jpg

any kind of input or help would be much appreciate

thanks

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

(
	local nameToUse = ""
	for o in selection do nameToUse += o.name
	--
	saveNodes selection (getDir #scene + "\\" + nameToUse + ".max") quiet:true 
	--	
	rendOutputFilename = (getDir #renderoutput  + "\\" + nameToUse + ".jpg")
)
4strings4ever's picture

that works great thanks .. but one more thing

That's exactly what i was looking for

but just one more thing, how can i define the selection of both items (as in select them both by sccript without me selecting them) say box001 and shere001 so that it always picks up these names for the selection. Iknow it's a very basic question but i'm fairly knew to scripting

your help is much appreciated

thanks

miauu's picture

.

It is not a good practicse, but since you want it:

(
	local obj01 = $Box001
	local obj02 = $Sphere001
	local name01 = obj01.name
	local name02 = obj02.name
	--
	local nameToUse = name01 + name02 
	--
	saveNodes #(obj01, obj02) (getDir #scene + "\\" + nameToUse + ".max") quiet:true 
	--	
	rendOutputFilename = (getDir #renderoutput  + "\\" + nameToUse + ".jpg")
)
4strings4ever's picture

thanks for your help

That helps me very much

thanks for your help !!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.