Python API: Geometry Nodes object and collection inputs appear disabled in custom panel #89876

Open
opened 2021-07-15 15:47:19 +02:00 by Antti Tikka · 12 comments

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: 468d59e496
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

geometry_nodes_object_and_collection_inputs_disabled_bug.blend

**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: `468d59e496` 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 [geometry_nodes_object_and_collection_inputs_disabled_bug.blend](https://archive.blender.org/developer/F10225113/geometry_nodes_object_and_collection_inputs_disabled_bug.blend)
Author

Added subscriber: @Symstract

Added subscriber: @Symstract

Added subscriber: @Stefakapapy

Added subscriber: @Stefakapapy

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

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

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Probably has the same roots as #88655 (PyAPI: template_modifiers doesn't work in the viewport)

Probably has the same roots as #88655 (PyAPI: template_modifiers doesn't work in the viewport)
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Member

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.

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](https://archive.blender.org/developer/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.
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

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}"]', bpy.data, "collections", text=name). Obviously "collections" should be repaced with "objects" for object sockets.

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}"]', bpy.data, "collections", text=name)`. Obviously `"collections"` should be repaced with `"objects"` for object sockets.
Author

@JacquesLucke Thanks for the workaround!

@JacquesLucke Thanks for the workaround!
Member

Normally I'd close this, since I think in this case there is no real bug, all of the involved code is working as expected. But keeping this around as a known issue might help in case someone else runs into this.

We were discussing changing the way geometry nodes inputs are stored. If we do that, there's a chance there could be an API for drawing the input.

If another developer would prefer to close this issue, that's okay for me.

Normally I'd close this, since I think in this case there is no real bug, all of the involved code is working as expected. But keeping this around as a known issue might help in case someone else runs into this. We were discussing changing the way geometry nodes inputs are stored. If we do that, there's a chance there could be an API for drawing the input. If another developer would prefer to close this issue, that's okay for me.
Philipp Oeser removed the
Interest
Nodes & Physics
label 2023-02-10 08:44:38 +01:00
Philipp Oeser added the
Interest
Modeling
label 2023-02-10 11:18:21 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#89876
No description provided.