ScriptSpot

Forum topic · Scripts Wanted

selection to scene name and output file

By 4strings4ever · 2014-04-14

Description

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 (4)

.

miauu · 2014-04-14


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

that works great thanks .. but one more thing

4strings4ever · 2014-04-15

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 · 2014-04-15

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")
)

thanks for your help

4strings4ever · 2014-04-15

That helps me very much

thanks for your help !!