Is node collection ordered? #82350

Closed
opened 2020-11-03 06:12:49 +01:00 by Sergey · 6 comments

I actually have found that it is and it represents selection order. Probably it is worth mentioning in the documentation if it is going to be persistent between Blender releases?

nodes collection.gif

https://docs.blender.org/api/current/bpy.types.Nodes.html

I actually have found that it is and it represents selection order. Probably it is worth mentioning in the documentation if it is going to be persistent between Blender releases? ![nodes collection.gif](https://archive.blender.org/developer/F9176681/nodes_collection.gif) https://docs.blender.org/api/current/bpy.types.Nodes.html
Author

Added subscriber: @randum

Added subscriber: @randum
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

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

Changed status from 'Needs Triage' to: 'Archived'
Jacques Lucke self-assigned this 2020-11-03 15:16:08 +01:00
Member

Right, the nodes are ordered so that last selected node is at the end. This way it is drawn last, i.e. at the top. I don't really want to document this behavior though. I don't want anyone to rely on this order. See ED_node_sort for more details.

Right, the nodes are ordered so that last selected node is at the end. This way it is drawn last, i.e. at the top. I don't really want to document this behavior though. I don't want anyone to rely on this order. See `ED_node_sort` for more details.
Author

Well I was going to rely on it. I have the problem of determining of active output node of a group tree. There is tree.active_output attribute which looks doing nothing. It always (almost) points to last node in node collection (my guess). I think its purpose is to be corrected manually so it could point to any you like.

With assuming that nodes collection is order this task becomes simple I just have to find last output node in nodes collection. Otherwise I was thinking about adding draw handler to node tree to track nodes selection but I would like to avoid this solution if possible. Are you going to change this behavior soon?

Well I was going to rely on it. I have the problem of determining of active output node of a group tree. There is `tree.active_output` attribute which looks doing nothing. It always (almost) points to last node in node collection (my guess). I think its purpose is to be corrected manually so it could point to any you like. With assuming that nodes collection is order this task becomes simple I just have to find last output node in nodes collection. Otherwise I was thinking about adding `draw handler` to node tree to track nodes selection but I would like to avoid this solution if possible. Are you going to change this behavior soon?
Member

You might be able to use the is_active_output property of output nodes. And yes, I think the active node is set by simply selecting the node. Since this node is also the active node, it will be moved to the back of the nodes list. So you can kinda depend on this fact for now, but I won't promise nor document that this won't change in a future release.

The tree.active_output selects the active output socket I think, not the active output node.

You might be able to use the `is_active_output` property of output nodes. And yes, I think the active node is set by simply selecting the node. Since this node is also the active node, it will be moved to the back of the nodes list. So you can kinda depend on this fact for now, but I won't promise nor document that this won't change in a future release. The `tree.active_output` selects the active output socket I think, not the active output node.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 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-manual#82350
No description provided.