MAXScript and State Sets

Hi.

I need some help in working with MAXScript State Sets.
I have read page http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/index.html?url=fil.... But I could not find the answers to two questions.

1. How to find out the name of the State Set which the script is executed?
2. How to programmatically create a State Set the template?

I need to write a generic script that will change the names of files in the external render, depending on the names of State Set, which give a command to render.

For example this:

vr = renderers.current
sName = stateSet.Name
FullPathRAW = "D:/_"+ sName + ".exr"
FullPathCNL = "D:/_"+ sName + ".tif"
vr.output_rawFileName = FullPathRAW
vr.output_splitfilename = FullPathCNL
/* render outputwidth:640 outputheight:480 outputfile:("D:/test.png") vfb:on */

Comments

Comment viewing options

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

On the first question I found

On the first question I found a solution:

vr = renderers.current
 
stateSetsDotNetObject = dotNetObject "Autodesk.Max.StateSets.Plugin"
stateSets = stateSetsDotNetObject.Instance
masterState = stateSets.EntityManager.RootEntity.MasterStateSet
sName = masterState.CurrentState[1].Name as String
 
FullPathRAW = "D:/"+ sName + ".exr"
FullPathCNL = "D:/"+ sName + "_channel.tif"
vr.output_rawFileName = FullPathRAW
vr.output_splitfilename = FullPathCNL

The question remains 2.

barigazy's picture
Lantsov's picture

Yes, I've read. But I could

Yes, I've read.
But I could not find there the answers to these questions.
By the way, the version that I have described, is only at the top level.
For Sub-State must change the index of the array.

barigazy's picture

...

What about this

stateCount = masterState.Children.count
--create template for the first item ei. stateset
masterState.Children.item[0].CreateTemplate() 

bga

Lantsov's picture

I do not speak English. Maybe

I do not speak English.
Maybe I did not put the question correctly. I do not want to create a template. How to do it I found.
I want to create a State Set using an already created template.

barigazy's picture

...

Max2012 and Max2013 have different state scene managment system.
Also you can read this thread

http://www.scriptspot.com/forums/3ds-max/general-scripting/apply-a-state...

bga

Lantsov's picture

Thanks for the link. I will

Thanks for the link. I will read.
But I am looking for information on State Sets, and not on the Scene State.

Comment viewing options

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