Including node group attribute into NodeTreePath #82812

Open
opened 2 years ago by randum · 13 comments
randum commented 2 years ago

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.

https://docs.blender.org/api/current/bpy.types.SpaceNodeEditorPath.html#bpy.types.SpaceNodeEditorPath.append
https://docs.blender.org/api/current/bpy.types.NodeTreePath.html

{F9316594, size=full}

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. https://docs.blender.org/api/current/bpy.types.SpaceNodeEditorPath.html#bpy.types.SpaceNodeEditorPath.append https://docs.blender.org/api/current/bpy.types.NodeTreePath.html {[F9316594](https://archive.blender.org/developer/F9316594/2020-11-18_15-04-26.png), size=full} 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.
randum commented 2 years ago
Poster

Added subscriber: @randum

Added subscriber: @randum
FabianSchempp self-assigned this 2 years ago
FabianSchempp removed their assignment 2 years ago
Collaborator

Added subscriber: @FabianSchempp

Added subscriber: @FabianSchempp
Collaborator

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Collaborator

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

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

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.
randum commented 2 years ago
Poster

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.
Collaborator

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

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

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Collaborator

Ah, get it now.

@JacquesLucke might also be interested here.

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

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.
Collaborator

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

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

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.
Collaborator

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.
lichtwerk removed the
legacy module/Nodes & Physics
label 6 hours ago
lichtwerk removed the
Interest/Nodes & Physics
label 6 hours ago
lichtwerk removed the
legacy module/Python API
label 3 hours ago
lichtwerk removed the
legacy module/User Interface
label 3 hours ago
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/Collada
Interest/Compositing
Interest/Core
Interest/Cycles
Interest/Dependency Graph
Interest/Development Management
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/Modeling
Interest/Modifiers
Interest/Motion Tracking
Interest/Nodes & Physics
Interest/Overrides
Interest/Performance
Interest/Performance
Interest/Physics
Interest/Pipeline, Assets & I/O
Interest/Platforms, Builds, Tests & Devices
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
legacy module/Animation & Rigging
legacy module/Core
legacy module/Development Management
legacy module/Eevee & Viewport
legacy module/Grease Pencil
legacy module/Modeling
legacy module/Nodes & Physics
legacy module/Pipeline, Assets & IO
legacy module/Platforms, Builds, Tests & Devices
legacy module/Python API
legacy module/Rendering & Cycles
legacy module/Sculpt, Paint & Texture
legacy module/Triaging
legacy module/User Interface
legacy module/VFX & Video
legacy project/1.0.0-beta.2
legacy project/Asset Browser (Archived)
legacy project/BF Blender: 2.8
legacy project/BF Blender: After Release
legacy project/BF Blender: Next
legacy project/BF Blender: Regressions
legacy project/BF Blender: Unconfirmed
legacy project/Blender 2.70
legacy project/Code Quest
legacy project/Datablocks and Libraries
legacy project/Eevee
legacy project/Game Animation
legacy project/Game Audio
legacy project/Game Data Conversion
legacy project/Game Engine
legacy project/Game Logic
legacy project/Game Physics
legacy project/Game Python
legacy project/Game Rendering
legacy project/Game UI
legacy project/GPU / Viewport
legacy project/GSoC
legacy project/Infrastructure: Websites
legacy project/LibOverrides - Usability and UX
legacy project/Milestone 1: Basic, Local Asset Browser
legacy project/Nodes
legacy project/OpenGL Error
legacy project/Papercut
legacy project/Pose Library Basics
legacy project/Retrospective
legacy project/Tracker Curfew
legacy project/Wintab High Frequency
Meta/Good First Issue
Meta/Papercut
migration/requires-manual-verification
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 & Devices
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 Information 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

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#82812
Loading…
There is no content yet.