- User Since
- Oct 10 2018, 11:35 PM (71 w, 4 h)
Sat, Feb 15
Thu, Feb 13
Ok so just to be sure to understand clearly: are you suggesting to build a runtime model based on the node graph, only at startup and later on when the datablock is updated, and then we can process this runtime model the way we want? And there's no other choice than to entirely rebuild the runtime model from zero, when the dadtablock is updated?
Indeed I'm on a specific project: a custom renderer :) So I'm interested in all info you can give.
Ha! I think we're talking from the start about getting notified about updated values, but of course our conceptions differ from your knowledge.
I agree on that. But then socket values which are not linked are constants or come from the animation system, right? I mean, you said a couple of minutes ago that the graph could be evaluated on the GPU, but how is it achievable if at every node we'd had to query CPU-side for values?
I can't find any page related to a new node system, can you please give a link?
So you're essentially saying that the model should ask the view about values? I admit values can be animated so any model depends on Blender's animation features, or one would have to reproduce it to be independent of Blender.
Sep 12 2019
It may sound complex, but actually I believe MVC leads to a cleaner code, easier to implement and to maintain, and therefore saves time overall. It pays off even for only a few node types. You may be afraid if you never experienced it before... well if you only have a few node types, I can be a good opportunity to try, so that you'll grasp the concept faster, and you'll be ready for bigger projects later :)
Then I already explained how to achieve that. Let's not flood this thread; if you still don't get it, contact me. It's good that Blender is in charge of the view only, the model is somewhat free. If you want to do without separating the model from the view, i.e. your node classes inherited from bpy.types.Node are also responsible for computing stuffs, then you need to traverse the graph by yourself, which will be actually more painful, both to implement and to maintain.
If you're talking about the manually set value for a non-connected input socket, it's surprisingly available as the socket instance's default_value (whose doc is Input value used for unconnected socket) for already available sockets for primitive types (NodeSocketFloat, NodeSocketVector, ...). Try that out: change a socket value in the editor, and display its default_value in Python (D.node_groups[...].nodes[...].inputs[...].default_value). For custom sockets, there are properties defined in the respective classes.
Sep 11 2019
The trick comes from studying Sverchok source code :)
Aug 20 2019
I also vote for this feature. I'm designing an addon, and I prefer to have a clean separation between model and view (think MVC), where the model should work without Blender and includes a graph, so I want to represent it with Blender nodes but these are only a facade. What I want to achieve is whenever the user changes a value of a node (internal property, or input socket value, or input socket connection), the model is notified, and could lead to some computations. However it is currently impossible to have this notification. My fallback relies on the application handler depsgraph_update_pre, and this isn't great.
Oct 14 2018
Well I just clicked on "Submit Addon" :) I opened https://devtalk.blender.org/t/blender-addon-registry/2436 .