State Sets: Not saving/serializing added or changed parameters.

 
 
 
Posted by:duke
Data created:5 June 2014

I've made a .NET assembly to help with manipulating state sets (from maxscript), including forcibly settings various parameters. This appears to work, but the changes are lost on reload.

I'm checking if a StateSet has that State (so, for example, a Rendering state), and adding if not, then checking if it has a Parameter for that RenderProperty, and if not, creating it. It returns the Parameter. In maxscript, i'm then directly setting the Parameter.Value.

Am I doing it the wrong way? Should I be setting the value a different way?

 

How are you adding the states to State Sets? The reason I ask is there is an "autoGenerated" parameter in StateSet.AddChild which must be set to false.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

I added them directly to the .Children collection which was probably a bad idea. I'll try using .AddChild when I get back to work next week. FYI, I'm trying to implement "explicit" state sets.

Yes, that would definitely not work :)

Great to hear about explicit State Sets! It is certainly a feature many people miss.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Used AddChild and autoGenerated false - saved and reloaded and it worked. Thanks Marsel!