Including node group attribute into NodeTreePath #82812

Open
opened 2020-11-18 12:55:17 +01:00 by Sergey · 13 comments

At this moment SpaceNodeEditorPath has method append with parameters node_tree and node. This method is adding NodeTreePath into path. But event if node parameter was added into append method the NodeTreePath object does not have any information about root node of group tree.
bpy.types.SpaceNodeEditorPath, bpy.types.NodeTreePath

According the fact that one group tree can be used by many group nodes it quite important to have information about via which group node the group tree is eddited. Sverchok addon is used to color problem nodes. Without information about group nodes in path it is impossible to mark such nodes.

I would not bother if there was any workaround. What I actually was trying:

node_tree_path.name = 'group_node'
AttributeError: 'NodeTreePath' object has no attribute 'name'

bpy.types.NodeTreePath.node = bpy.props.StringProperty()
node_tree_path.node = 'name'
AttributeError: 'NodeTreePath' object attribute 'node' is read-only

node_tree_path['node_name'] = 'name'
TypeError: bpy_struct[key] = val: id properties not supported for this type

area_names = {}
area_names[node_tree_path] = 'my_name'

Even last example would not work for several reasons. ID of path can be changed on undo event for example. If area is splitting into two I'm not able to update second area in the dictionary.

I think, for API consistency, either node parameter should be removed out from the update method or node attribute should be added to NodeTreePath object. I would prefer second choice.

At this moment `SpaceNodeEditorPath` has method append with parameters `node_tree` and `node`. This method is adding `NodeTreePath` into path. But event if `node` parameter was added into `append` method the `NodeTreePath` object does not have any information about root node of group tree. [bpy.types.SpaceNodeEditorPath](https://docs.blender.org/api/current/bpy.types.SpaceNodeEditorPath.html#bpy.types.SpaceNodeEditorPath.append), [bpy.types.NodeTreePath](https://docs.blender.org/api/current/bpy.types.NodeTreePath.html) ![](https://archive.blender.org/developer/file/9316/9316594/2020-11-18_15-04-26.png) According the fact that one group tree can be used by many group nodes it quite important to have information about via which group node the group tree is eddited. Sverchok addon is used to color problem nodes. Without information about group nodes in path it is impossible to mark such nodes. I would not bother if there was any workaround. What I actually was trying: ``` node_tree_path.name = 'group_node' AttributeError: 'NodeTreePath' object has no attribute 'name' bpy.types.NodeTreePath.node = bpy.props.StringProperty() node_tree_path.node = 'name' AttributeError: 'NodeTreePath' object attribute 'node' is read-only node_tree_path['node_name'] = 'name' TypeError: bpy_struct[key] = val: id properties not supported for this type area_names = {} area_names[node_tree_path] = 'my_name' ``` Even last example would not work for several reasons. ID of path can be changed on undo event for example. If area is splitting into two I'm not able to update second area in the dictionary. I think, for API consistency, either `node` parameter should be removed out from the `update` method or `node` attribute should be added to `NodeTreePath` object. I would prefer second choice.
Author

Added subscriber: @randum

Added subscriber: @randum
Fabian Schempp self-assigned this 2021-03-12 08:59:08 +01:00
Fabian Schempp removed their assignment 2021-03-12 08:59:19 +01:00
Member

Added subscriber: @FabianSchempp

Added subscriber: @FabianSchempp
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

I am not exactly sure if I understand correctly.

(note: it is always useful to have an example file where some of this is set up already, just speeds up the process a bit, this was lacking here).

So I have a test file:
#82812.blend

And I thought I got what you are after (see my comment in the file), but I am not sure I understand your usecase:

  • if a node makes problems in a tree, shouldnt all group nodes using the tree have problems?
  • not sure yet why you really have to pass the node to SpaceNodeEditorPath.append() -- you are right, on first sight this seems not necessary.

Anyways, would like to hear about my first question first.

I am not exactly sure if I understand correctly. (note: it is always useful to have an example file where some of this is set up already, just speeds up the process a bit, this was lacking here). So I have a test file: [#82812.blend](https://archive.blender.org/developer/F9899847/T82812.blend) And I thought I got what you are after (see my comment in the file), but I am not sure I understand your usecase: - if a node makes problems in a tree, shouldnt **all** group nodes using the tree have problems? - not sure yet why you really have to pass the node to SpaceNodeEditorPath.append() -- you are right, on first sight this seems not necessary. Anyways, would like to hear about my first question first.
Author

Sorry, did not thought that example file will be useful here.

It's possible to consider node group as a function. Its output is dependent on what was passed into its input. In the video below I show example of two nodes which share the same node group.

2021-03-22 14-18-39.mp4

The difference is in input data. Second node purposely has senseless connection so it could produce an error. For debug purposes we color error nodes with red color in Sverchok. So when I'm entering node group of the second node I can see which cause the error. There is no error in node group of first node so there is no nodes with red color there.

Without information from UI about which node is root of an opened node group it's impossible to show any debug information because execution context is not known. I have to store this information in a node group tree and update this information via entering into node group operator so it could work. But solution is really fragile. If there is several node editors opened then one editor can override the variable and broke the logic.

If path could store any information about root node it would help greatly.

Sorry, did not thought that example file will be useful here. It's possible to consider node group as a function. Its output is dependent on what was passed into its input. In the video below I show example of two nodes which share the same node group. [2021-03-22 14-18-39.mp4](https://archive.blender.org/developer/F9903842/2021-03-22_14-18-39.mp4) The difference is in input data. Second node purposely has senseless connection so it could produce an error. For debug purposes we color error nodes with red color in Sverchok. So when I'm entering node group of the second node I can see which cause the error. There is no error in node group of first node so there is no nodes with red color there. Without information from UI about which node is root of an opened node group it's impossible to show any debug information because execution context is not known. I have to store this information in a node group tree and update this information via entering into node group operator so it could work. But solution is really fragile. If there is several node editors opened then one editor can override the variable and broke the logic. If path could store any information about root node it would help greatly.
Member

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

Ah, get it now.

@JacquesLucke might also be interested here.

Ah, get it now. @JacquesLucke might also be interested here.
Member

It might be good to keep an eye on D10874: Nodes: Separate node name and display name in bNodeTreePath. -- or join the discussion there.

It might be good to keep an eye on [D10874: Nodes: Separate node name and display name in bNodeTreePath.](https://archive.blender.org/developer/D10874) -- or join the discussion there.
Member

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
Member

Not sure how ED_node_tree_push really works here without checking further.
But to not let this wait longer (hopefully... -- and sorry this has been lying around for so long in the first place), I would kindly ask the #nodes_physics devs to commnet on this.
Note though that this does not really seem to be a bug, just some clarification needed afaict.

Not sure how `ED_node_tree_push` really works here without checking further. But to not let this wait longer (hopefully... -- and sorry this has been lying around for so long in the first place), I would kindly ask the #nodes_physics devs to commnet on this. Note though that this does not really seem to be a bug, just some clarification needed afaict.
Member

This is indeed related to b00727950c. Right now, I don't see a strong reason for not exposing bNodeTreePath.node_name in the Python api.

This is indeed related to b00727950c. Right now, I don't see a strong reason for not exposing `bNodeTreePath.node_name` in the Python api.
Philipp Oeser removed the
Interest
Nodes & Physics
label 2023-02-10 08:45:09 +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
4 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#82812
No description provided.