Page MenuHome

Cycles/UI: Implement dropdown menu that shows the available attributes in the Attribute node
Needs ReviewPublic

Authored by Lukas Stockner (lukasstockner97) on May 4 2018, 5:06 PM.

Details

Summary

Currently, users have to type in the correct attribute into the string field, but as far as I'm aware there's not even an official list of supported attributes.
Also, D2057 would make this usability issue even worse.

The menu that's also used for e.g. UV maps in the UV node is the obvious option, but currently it only supports showing the elements of a collection.
However, since the available elements have to be queried from the render engine depending on the selected objects etc., I didn't find a way of implementing it that way.

So, the compromise I ended up with was extending uiItemPointerR so that it also can show the elements of an enum. Then, Cycles can define an enum with a items callback
that queries the available attributes based on the current context.

One downside of this is that the Cycles property name has to be hardcoded into the node drawing code, which makes it pretty much impossible for other rendering engines
to add their own properties without changing the Blender code. I'd be grateful for suggestions on how to avoid this problem.

Diff Detail

Repository
rB Blender
Branch
attribute_dropdown (branched from master)
Build Status
Buildable 1483
Build 1483: arc lint + arc unit