Replicating Geometry Nodes modifier's UI with Python in Blender 3.0, some questions

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 in advance!

1 Like

API is really weird
try C.object.modifiers[0]["Input_1_use_attribute"]

Thanks for the suggestion but that property doesn’t really help because it doesn’t tell whether the toggle should be displayed or not.


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.

These are the attributes the modifier has:

print([k for k in md.keys()])
['Input_2', 'Input_2_use_attribute', 'Input_2_attribute_name', 'Input_3', 'Input_4', 'Input_4_use_attribute', 'Input_4_attribute_name']

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.

You could perhaps try to search in your nodegroup input node input sockets

Unfortunately, NodeSocketInterfaces don’t seem to have that information. Even knowing the socket shape would be enough…

['NWViewerSocket', '__doc__', '__module__', '__slots__', 'attribute_domain', 'bl_label', 'bl_rna', 'bl_socket_idname', 'default_value', 'description', 'draw', 'draw_color', 'hide_value', 'identifier', 'is_output', 'name', 'rna_type', 'type']

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.

1 Like

Unfortunately, the inputs don’t seem to have that info:

['NWViewerSocket', '__doc__', '__module__', '__slots__', 'attribute_domain', 'bl_label', 'bl_rna', 'bl_socket_idname', 'default_value', 'description', 'draw', 'draw_color', 'hide_value', 'identifier', 'is_output', 'name', 'rna_type', 'type']

Anyway, glad to hear that this may improve in the future. :slight_smile:

Right, I mean the shape of the corresponding sockets in the node’s group input nodes.

Ah, so I need to find one input node and use that. Not too elegant but works. Thanks!

@HooglyBoogly Sorry to bother you again but could the attribute / vertex group search be added to the API in the future? That would be helpful. :slight_smile: