I’m updating my Modifier List addon to support Geometry Nodes in Blender 3.0 but there are two things I don’t know how to do or if they are even possible.
Is it possible to know when to display the Input Attribute Toggle?
Is it possible to show this nice attribute search? (I would guess not?)
Currently, I’m just using prop_search but it doesn’t show built-in attributes and attribute domains.
Thanks for the suggestion but that property doesn’t really help because it doesn’t tell whether the toggle should be displayed or not.
Example:
The node group input has these inputs:
The modifier shows the Input Attribute Toggle button for Color1. Translation, on the other hand, doesn’t have that toggle in this case. But a vector input could also accept an attribute in another case if it’s a field input.
An image input can never be an attribute, so that’s not a problem.
So both, Color1 and Translation have the -"_use_attribute" property, even though Translation doesn’t in this case accept an attribute at all. So I would need to find some other way to check if an input is a field input.
Hi @HooglyBoogly, maybe you know if there’s any way to know if a GN group input accepts an attribute? It seems there’s no way but I just want to make sure whether the Modifier List addon can support all features in 3.0. Maybe for 3.1 some property could be added to the API (since it’s too late for 3.0)?
One hacky method might be checking the socket’s shape (diamonds or diamond dots would accept fields). We’re definitely considering refactoring this, no clear plans yet though.
Hey sorry for the late reply. I think it’s possible, but there are a few unfortunate technicalities that make this more complicated than it should be.
Using the fancy formatting like Face > and Boolean on the right doesn’t work from the Python API as far as I know.
It’s not clear where to make the list of accessible attributes available. Maybe on the modifier, with the names available_input_attributes, and available_output_attributes?
Normally I’m not sure if we expose properties that are a snapshot of the data “half-way through evaluation”. It’s probably fine, that’s something to check though.
One workaround might be using the attributes on the original mesh or the attributes on the evaluated mesh, depending on input vs. output lists in the modifier.
Thanks for the explanation. I created an operator that has a dynamic enum that contains user-defined attributes and vertex groups and uses invoke_search_popup to show a search from which a user can select an attribute or vertex group that then gets assigned to the appropriate property. It’s not quite as nice as the built-in search but it will do for now. It doesn’t seem that it would be worth spending time exposing the built-in search, for now. Maybe someday.