Autodesk / sitoa

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

Improve auto UI generation #9

Open JenusL opened 6 years ago

JenusL commented 6 years ago

Auto UI generation is made for all native Arnold shaders by the help of a metadata file called arnold_shaders.mtd. Some features would be good do add to that auto generation:

Tabs Auto UI generation currently lacks the function to create Tabs. This would come in handy if we want to implement ID AOVs #10

Disabling The arnold_shaders.mtd has a lot of disable expressions like soft.disable_when STRING "{ material != custom }" but there's currently no support for it in the auto generation code. This should also be implemented.

caron commented 6 years ago

I started to work on this and I am wondering if we agree this is the right place to put it...

soft.order STRING "AddTab My_Tab BeginGroup My_Group param1 param2 EndGroup"

Should look like this...

_________
| My Tab |
__________________________
|   ---My Group---------
|  | param1             |
|  | param2             |
|   --------------------
__________________________

Thoughts?

JenusL commented 6 years ago

I think it looks nice and clean. Just one question… Is the AddTab required for the default first tab or only for extra tabs? I would prefer if it was only for extra tabs.

caron commented 6 years ago

So if you do this...

[node mynode]
soft.order STRING "param1 param2 AddTab My_Tab param3 param4"

You will get a first tab named 'mynode' with param1 and param2 on it. Then a second tab named 'My Tab' with param3 and param4 on it. This is just Softimage PPG's default behavior I believe. Nothing in the SItoA code is deciding this.

caron commented 6 years ago

So I wanted to brainstorm about implementing this parameter disabling PPGLogic in mtd files. So I think we have to use the PutLogic method of the PPGLayout class...

PPGLayout::PutLogic

@sjannuz you defined some logic in the metadata file already for this. It exists on the parameter/attr... what was your initial design? Using PutLogic with a scripting language? Or some other dynamic way in C++? Right now since the PPGLogic exists on the entire PPGLayout and not on individual parameters I would need to collect all the soft.disable_when metadatas when params are defined and then build the script logic somewhere before or during the Layout function where it gets "put".

sjannuz commented 6 years ago

Hi Steven. The metadata file contains more than what SItoA handles, simply because it was common to the other plugins (HtoA was the first fetching the logic from the mtd). Then I did not have the time to include it in SItoA, nor any exact plan about how to handle it in the code.

JenusL commented 6 years ago

@caron Could you create a PR with the just the tab-stuff and we save the disabling for later?

caron commented 6 years ago

I can once I return from vacationing next week.

caron commented 6 years ago

@sjannuz Thanks for the feedback. I want to be sure .mtd file made for SItoA works with other plugins and vice-versa. Is there any .mtd files from other plugins I can use to test?

JenusL commented 6 years ago

I think the .mtd files are pretty different across the different plugins but I guess you could try. The maya one can be found here: https://trac.solidangle.com/mtoa/browser/mtoa/plugins/mtoa/mtoa.mtd That's the one I take min/max softmin/softmax from when I've added new shaders to SItoA.

caron commented 6 years ago

Thanks, @JenusL but I don't see any disable_when examples. But looking closer now the soft. prefix will make it specific to SItoA and I won't need to worry about supporting another one.

JenusL commented 6 years ago

Yeah the soft. prefix will make it safe so use that.

JenusL commented 6 years ago

I just want to say, for traceability sake, that I extended the auto UI generation by adding support for soft.node_type in #26

caron commented 6 years ago

I will make sure to work on top of #26 when supporting 'disabling metadata'.