Created by: Durman
Addressed problem description
Previous attempts: #2380 (closed) #2393
After a year from previous attempt I'm trying to handle this task again. I have made some code and it looks like the approach is correct. Actual result is a node tree is never recalculate everything (only if base node for all other was not changed). Also there are some extra logic which prevents from useless updates.
In general process can described in next steps:
- get signals from Blender
- analyze them with using tree reconstruction
- translate them into Sverchok events
- correct tree reconstruction according this events
- get outdated nodes from tree reconstruction
- try update given nodes
- colorize nodes after all
I splited all code into several modules:
- tree_recnstruction.py
This data structure is coping data structure of existing Sverchok node trees It helps to analyze changes which happens in a node tree Also it is used for walking on tree for searching nodes which should be recalculated It is always consistent to Blender trees So it can be used for searching connections between nodes The only problem is it has not any information about sockets for simplicity They can be added in future
- hashed_tree_data.py
This module keeps node and links instances of bpy.types.NodeTree objects They are available by their IDs It used for converting nodes of Reconstruction tree to Blender nodes But also can be used for any other purposes when collection of node_tree.links and node_tree.nodes are unchanged It is known that keeping such links can lead to Blender crash So all this data is refreshing if collection of nodes or links was changed This module can be adopted to getting links of a socket for constant time
- events.py
It used for getting signals of Blender, analyze them, keeping tree reconstruction, updating and colorizing nodes.
If someone would like to test keep in mind next things:
- Many things are broken now
-
node statics
andcolorize
panels can help to understand what is going on - also extra info can be get from console in debug mode
- not all node properties works correctly
- keep in mind what does not still work according list below
Preflight checklist
-
Code changes complete. -
handle reroutes -
handle frame nodes -
handle show in viewport node tree property -
handle freeze whole tree node tree property -
handle update current tree operator -
handle update all trees operator -
handle macros efficiently -
handle post load signal -
support monads -
support monads loops -
support color presets -
handle animation event -
handle animate node tree property -
handle undo event -
handle property update events with costume update function -
handle nodes_dict
-
open examples -
all nodes should calculate the data for all output nodes
-
-
Code documentation complete. -
Documentation for users complete. -
Manual testing done. -
open existing layouts -
open existing layouts with deprecated nodes -
export/import json
-
-
performance tests -
Unit-tests implemented. -
cleaning outdated code -
Ready for merge.