Autodesk / sitoa

Arnold plugin for Softimage
Apache License 2.0
33 stars 16 forks source link

Making Toon usable #26

Closed JenusL closed 5 years ago

JenusL commented 5 years ago

So this went a little further than expected... Instead of making a special case for the Toon shader I went with a more generic implementation. It's broken up in to two things, the ShaderDef building and the Parameter loading.

ShaderDef part Looking at camera_projection I noticed that it had a soft.node_type STRING "camera" line. I guessed it's to tell what type of objects to show in the pick browser but the soft.node_type has never been implemented in ShaderDef. So I went ahead and implemented that. It works like this: AI_TYPE_NODE will get pickers by default (just like before so this isn't new) AI_TYPE_STRING that has the soft.node_type attribute will get a Picker instead of a string field. I implemented all the filters in siShaderReferenceFilterType If array is added as a second word after the filter type, a ShaderArrayParamDef will be created instead of standard ShaderParamDef. The metadata for lights and rim_light of the toon shader looks like this.

[attr lights]
soft.label STRING "Lights"
soft.node_type STRING "light array"

[attr rim_light]
soft.label STRING "Light"
soft.node_type STRING "light"

And the Shader UI ends up like this: toon

Parameter Loading Parameter loading does two new things:

Other changes

This passes the testsuite and closes #24