Nodes Modifier: Use runtime RNA definitions for input properties #113823

Open
opened 2023-10-17 12:38:01 +02:00 by Lukas Tönne · 1 comment
Member

Currently the Nodes modifier uses plain ID properties to store input values for the node group it executes. This causes some difficulties:

  • Animation paths use myobject['socketidentifier'] format, which does not match the actual socket name and makes it hard to tell which socket is animated.
  • ID property drawing requires a lot of extra data and is difficult to customize. This is a problem for the new Menu Switch nodes (#113445) that add an enum socket type and require a full enum items list for proper UI display.

In the past the ID property system has been extended to allow for more customization of generic property display, using subtypes, min/max ranges, property descriptions, etc. But this approach is only adding to an already complicated and confusing system. (https://archive.blender.org/developer/D9697)

The problems mentioned would be solved if there was a full RNA definition for the modifier inputs, instead of relying on generic ID property data. Such RNA definition will need to be generated dynamically at runtime because the modifier inputs are based on data (i.e. the node group used). At the time the ID property storage for the nodes modifier was implemented this dynamic RNA definition was not possible because only a small subset of RNA definitions could be generated at runtime. Now runtime RNA is a lot more capable and can be used to define all relevant properties for the modifier inputs.

The proposal includes the following:

  • Add a dynamic runtime RNA definition to MOD_nodes.cc, based on the node group.
  • Keep existing ID property storage. This will ensure that files remain backward and forward compatible, since ID-property-based paths remain valid.
Currently the Nodes modifier uses plain ID properties to store input values for the node group it executes. This causes some difficulties: - Animation paths use `myobject['socketidentifier']` format, which does not match the actual socket name and makes it hard to tell which socket is animated. - ID property drawing requires a lot of extra data and is difficult to customize. This is a problem for the new _Menu Switch_ nodes (#113445) that add an enum socket type and require a full enum items list for proper UI display. In the past the ID property system has been extended to allow for more customization of generic property display, using subtypes, min/max ranges, property descriptions, etc. But this approach is only adding to an already complicated and confusing system. (https://archive.blender.org/developer/D9697) The problems mentioned would be solved if there was a full RNA definition for the modifier inputs, instead of relying on generic ID property data. Such RNA definition will need to be generated dynamically **at runtime** because the modifier inputs are based on data (i.e. the node group used). At the time the ID property storage for the nodes modifier was implemented this dynamic RNA definition was not possible because only a small subset of RNA definitions could be generated at runtime. Now runtime RNA is a lot more capable and can be used to define all relevant properties for the modifier inputs. The proposal includes the following: - Add a dynamic runtime RNA definition to MOD_nodes.cc, based on the node group. - Keep existing ID property storage. This will ensure that files remain backward and forward compatible, since ID-property-based paths remain valid.
Lukas Tönne added the
Type
Design
label 2023-10-17 12:38:01 +02:00
Lukas Tönne added this to the Nodes & Physics project 2023-10-17 12:44:17 +02:00
Author
Member

Regarding animation paths: I'm not sure if we can avoid socket identifiers. The reason these are used is because

  1. They are unique, unlike socket names.
  2. They are persistent and allow renaming a socket without breaking animation paths.

So RNA-based paths would just turn myobject['socketidentifier'] into myobject.modifier['Nodes'].socketidentifier.
The socket identifier is also not strictly guaranteed to be directly usable as a property name. It gets auto-generated so whitespace and other invalid characters can be avoided, but there might be legacy identifiers from older files that break this assumption and there isn't any official restriction on built-in socket identifiers that can be chosen.

Regarding animation paths: I'm not sure if we can avoid socket identifiers. The reason these are used is because 1. They are unique, unlike socket names. 2. They are persistent and allow renaming a socket without breaking animation paths. So RNA-based paths would just turn `myobject['socketidentifier']` into `myobject.modifier['Nodes'].socketidentifier`. The socket identifier is also not strictly guaranteed to be directly usable as a property name. It gets auto-generated so whitespace and other invalid characters can be avoided, but there might be legacy identifiers from older files that break this assumption and there isn't any official restriction on built-in socket identifiers that can be chosen.
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 Assignees
1 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#113823
No description provided.