Page MenuHome

Python API: Geometry Nodes object and collection inputs appear disabled in custom panel
Confirmed, NormalPublic


System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce RTX 2070 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.89

Blender Version
Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-07-15 12:22, hash: rB468d59e496eb
Worked: -

Short description of error
Geometry Nodes object and collection inputs appear disabled when they are shown in a custom panel. Other types of properties do work. The properties can be accessed as follows: layout.prop(modifier, '["Input_2"]').

Exact steps for others to reproduce the error
Based on the attached file:

  1. Run the script in the text editor to create a panel into the sidebar into a category called "Geometry Nodes"
  2. See that the panel shows the object and collection inputs of the Geometry Nodes modifier of the active cube as disabled

Event Timeline

This is really an annoying problem. Please fix it.
Thank you for reporting

I'm not sure about that conclusion. Here's my guess:

  • The nodes modifier settings properties are dynamic IDProperties rather than regular RNA pointer properties
  • That means they don't have the builtin "type" information, like which IDs to look for in search lists.
  • In the modifier panel they are drawn with uiItemPointerR (prop_search in Python) to avoid this problem
  • Without that information they are disabled somewhere in the drawing process.

I remember that last part from investigating this when writing the code to display them in the modifier before, but I didn't actually see it when stepping through the code this time. (It's easy to miss though).
I was hoping the IDProperty UI data refactor in D9697 might give us a better way to tell the UI what ID type to show in search lists. We'll see, not sure yet.

Just to make more explicit what Hans already said. This problem can be worked around in Python by using prop_search. More specifically layout.prop_search(mod, f'["{prop_id}"]',, "collections", text=name). Obviously "collections" should be repaced with "objects" for object sockets.