Active Node Tree - multiple Node Trees Prob.

29 August 2018 17:43
Hello Blend4web

First of all, a big compliment to the creators of "Blend4Web". This Tools is awesome in terms of compatibility and performance. I used other different WebGL solutions, but there were not that satisfied as Blend4Web.

Back to topic:
I got a question about "Active Node Tree" or Node Trees in general. We are able to make many Node-Trees. But we are forced to have only one 1x Node-Tree active. Is this correct ? So i tried to avoid this prob, by using "call func" and "define func" from my active node tree to an another node tree. This way it should be possible to use my "other 20x node-trees" while only 1x node-tree is active.
Sadly this doesn´t work. I got this error trying calling a func in an other node-tree:
Uncaught TypeError: Cannot read property 'func' of undefined

"Call func"-node only works in the same node-tree. Is this true ? If its = true, than the purpose of many node-trees doesn´t really makes sense ?!

I hope one of you experts can help me, with my node-tree-struggle. Or just give me hints understanding how node-trees should work. Would be great !!!

My 1x active node-tree gets soo big and complex, that i cant work anymore inside the ui-window. It stutters. Changing the connections between the node takes 10sec. So it isn´t productive anymore of this slow speed! This is why i need : working "multiple node trees" !!!
30 August 2018 18:39
We are able to make many Node-Trees. But we are forced to have only one 1x Node-Tree active. Is this correct ?

…it should be possible to use my "other 20x node-trees" while only 1x node-tree is active.
No, because ONLY your active logic tree will be exported. You cannot use the other ones since they don't even exist at runtime. You can easily confirm this yourself by looking at your exported files: If you export a scene with two or more trees and look at the resulting HTML/JSON file, you will ONLY find the Logic Node names ("unique identifiers") from the tree you set as "active", never the ones from your other trees.

See also this thread: Logic Editor per Object, as well as per Scene
At the moment, we see the Logic Editor in context of a single script per scene which is important for usability. A single tree is easier to understand: all logic is described on a single sheet and you do not have to switch to other trees. With the current set of nodes, this method is quite optimal.
This still seems to be the case as of 2018 (v18.05).
31 August 2018 13:27

thank you for the fast respond.

Hm, sad to hear that, only one "active tree" is allowed. Even if it is this way, i don´t see any reason (maybe performancewise) why don´t to update Blend4Web to multi-node-tree-system, giving users better overview of their Logic-Nodes. I guess everybody can understand structuring his code / logic nodes is really helpfull when projects getting big / complex.

Or if i have only "1x active Node-Tree", i could use the other "not active" trees as containers, when doing a "call function" script in my "active tree". But even this is not possible.

From the old thread:
"…which is important for usability": i don´t agree 100% to this. Sure, better usability when you doing few nodes. But when having more nodes, usability isn´t anymore there.

Anyways. Thx ! for the clarification. I thought i oversaw something. Maybe they are working on this, and we will have something more powerfull in the future.
31 August 2018 19:33
Sooner or later, you will have to turn to scripting once your project reaches a certain level of complexity. Logic Nodes are alright, but they only go so far, and certain things that can be easily scripted are cumbersome with Nodes or even impossible.

A good way to start would be to use JS_Callbacks to delegate at least those cumbersome parts of the tree to scripting. Maybe you'd like to upload your project so we can have a look.
05 September 2018 21:29
Hey @Blend4Life,

thx a lot, for offering help ! You are right about, sooner or later to get into coding. This is my first time using Blender / Blend4web. So i wanted to do some stuff with internal node system. After that, i wanted to go deeper into coding with blend4web, and optimizing a lot. This is the way i would like to go, also to learn "more" about Blender & Blend4web.

I am coming from Cinema4D & Unity. So i think i could catch up with Blender & Blend4web really good. I like to understand software and their workflows.

For the upload: … is it possible to send stuff via PM ? …because its a client-project. Otherwise i would try to modify the scene, so only the logic system is connected with dummy objects. Or is it also OK, just to upload the node-tree, without objects ?
06 September 2018 19:42
Naturally, it would be cool to see the full project. After you bragged about your node tree being 50+ square miles, I'm intrigued what this could be about.

is it possible to send stuff via PM ?
I don't think there is PM on this forum!? You could send the .zip (i.e. the file you get with B4W Project Manager->Export Projects) to <myusername> if it's less than the 25 MB attachment size limit.

If you only want to upload the tree here, the safest way would be to start Blender with the default scene and append (Shift+F1) the logic tree from the project .blend, then save+upload the new .blend. That way, it's guaranteed that it's an empty scene with just the tree.
10 September 2018 17:56
Lol , 50+ square miles. Your are right, my describing sounds like that

I figured some things out !!! (about fluid work with node-trees)
1.) i got the prob with "lagging". So if i have 50+ nodes inside my node-tree, you cant work in realtime anymore. My solution for this is, to collapse all nodes !!! This way, it speeds up. Don´t know why it happens, but i am glad, this helps. So i can collapse / show all nodes easily.

2.) Second thing is, "select-node". If i got 5+ hit-outgoings, it lags like hell in my 50+ nodetree. Includes compiling (which takes about min. 10minutes). This doesn´t makes fun. Compiling time is another story. But without the "select-node" my nodetree speeds-up +70% !!!

In my opinion this takes too much. Minimum 10min. With my node-tree configuration. I don´t have any solution here. It looks like i need to go away from nodes, to code. I am not sure, right now.

I try to upload only my node-tree here, so you can see, if i can improve something! Thx.
20 September 2018 00:24
Hey… i managed to export these nodes:

So it should be possible to load it fast into Blender. When Scene is loaded, follow the instuction as in the pic above. After this connection, the missery begins. You will recognize that it will take a while until the nodes are refreshed. When you hit preview, it will go fast. But if you would got the whole original scene, preview / export would take 4 hours !!! (not normal anymore)

I hope you / someone else can find anything in my node-tree configuration that causes this error.

Download Link:
20 September 2018 20:36
Hello again!

Unfortunately there are some huge problems with this tree:

1. First of all, the lag is not caused by the size of the tree (it's not that big), but by its structure: you have a giant amount of entry points, function calls and especially nested function calls (functions which call functions which call functions…).

For example, connecting the tree as you suggest in your attached image takes 200 seconds on my system. But if you skip the first Call/Define Function pair, that is, if you plug the entry point right into the Select, the connection time goes down from 200 to 10 seconds, 20 times faster, even though you removed only 2 out of ~400 nodes. This is because with those two nodes you removed one level of function nesting.

2. You have recursion in every function containing a Select because you have a habit of returning to the Selects by recalling the function instead of using a connection. This is not allowed (a function must not call itself).

The proper way is to replace the final function call with a connection that goes back to the Select.

3. The structure is near impossible to read because of the many entry points, and also ineffective. For example, you spend 100+ nodes and many functions on the Sauna Select part. All the blue-colored lines of nodes do the same, they could be reduced from six strands to one (not to mention the final function call is illegal recursion). The entire part could be reduced to ~40 nodes without any function calls with a different setup storing the hit number and then adding 6 successive blocks of Branch->Show/Hide.

To clean up this tree is a huge task. You'll have to get rid of all the recursion, reduce the nesting, improve the structure…
22 September 2018 18:49
Hey Blend4Life.

This is the input / info that i needed !

1.) So i understand: … less "entry points" / only one, is best way to go, performance wise. This rule applies also to the "function calls" ?! Hm, i will try to re-organize my nodes. Hope it works …

2.) By a "call back" i wanted to minimize the connection-lines. So i thought, "call function" (back to the start) is the same as a connection-line which goes back to the start of the "select node". But you say (alert inside node) : this is not the case !
I don´t know why, but this "alert" in "call function" doesn´t apper in my setup. Strange. I am on Blender v2.79 & Blend4Web v18.

3.) I don´t get everything here. F.e.: "…All the blue-colored lines of nodes do the same…" ? Maybe you can make a pic, for better understanding.
By "…without any function calls…" & "storing the hit number" you mean to check the stored number (1or 0) and do a "if / else" with the "branch"-node to execute the next "show / hide" , right ? So its a bad idea to do "call functions" within the "select"-node ? Or bad in generall to execute things after "select" ? Best way would be just to do "store variables" after "select" ?
Please register or log in to leave a reply.