Forum

Active Node Tree - multiple Node Trees Prob.

22 September 2018 20:55
So i understand: … less "entry points" / only one, is best way to go, performance wise
Well, performance-wise, most importantly you must get rid of nesting and recursion. Nesting seems to be what kills the speed and recursion is a serious error that keeps your tree from working. For the entry points, you can have multiple of them, but this makes it very difficult to overlook the tree and understand what's going on because all the strands emerging from entry points are started simultaneously (unless they are called by JS). You have Selects in different strands (and even in functions!) acting at the same time - this is not disallowed and "works" (because it is translated into event-based code), but it is really bad syntax which is hard to read and work with.

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.
This is because your tree is so convoluted with errors that Blender has difficulty plowing through them all at the same time. Use border-select (B) and select the function in question. Then press CTRL+I (inverse selection) and X (delete) so that everything around the function is deleted. Now the error will appear. (Blender's node system is not very good at updating things.)

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 ?

This should give the same result for the sauna select section with much less nodes. But you must still repeat the green section for the 6 hits/Sauna objects. It is not possible to condense it more because in Logic Nodes, you cannot iterate over objects as you can in scripting. Basically, what you want in this section is to show one of the 6 groups and hide the other 5. In scripting, you could simply write this:
function select_cb() {
  var object_list = ["a","b","c","d","e","f"]
  var sel = arguments[0][0];
  for (i = 1; i <= 6; i++) {
    for (j in object_list) {
      var obj_ref = m_scs.get_object_by_name(object_list[j]+"_"+i);
      if (i==sel) m_scs.show_object(obj_ref);
             else m_scs.hide_object(obj_ref);
    }
  }
}
This little piece of code does the same as this:


24 September 2018 01:15
Hey thx a lot for the detailed describings !!!

Got it almost all. I have to say, to do stuff via code looks far more simple. I will simultaniously invest time into coding inside Blend4Web. But i want also learn how to use nodes the proper way !

In the green area is only Sauna_1 displayed. And all hits from the select node are going through the brnach and than to the Sauna_1. In my case i need to connect hit-1 with Sauna_1, hit-2 with Sauna-2, and so on. I guess i can just add the additional configuration like you showed in the green frame the same way with Sauna_2 but just connected with hit-2. This would be the right way….or what do you mean ?
24 September 2018 19:10
In the green area is only Sauna_1 displayed. And all hits from the select node are going through the brnach and than to the Sauna_1. In my case i need to connect hit-1 with Sauna_1, hit-2 with Sauna-2, and so on.
No, in the green area "Sauna_1" is either displayed or hidden, depending on "hit". And if you repeat that block for 1-6, the result will be that if you click plane X, only "Sauna_X" will be shown and the rest hidden. I attached this scenario. You can run it in fast preview. The six "plane buttons" are the blue planes, and the cubes represent the six Sauna objects with their children.

I thought this was the functionality you wanted, but of course I could be wrong because your tree is Chinese to me.
24 September 2018 19:52
"chinese", lol. Yeah, i mean to me its sometimes also chinese.

This is what i read from your "green-area"-pic: ->if hit-1 = true -> store variable "hit" =1 -> if variable "hit" =1 -> "show" Sauna_1. If "hit" = 0 -> "hide" Sauna_1. Am i wrong here ? I just wanted something like this in a node-tree :

(select-node)–>if hit-1 = true –> store variable "hit_Sauna_1" =1 –> if variable "hit_Sauna_1" =1 -> "show" Sauna_1. If "hit" = 0 -> "hide" Sauna_1
(select-node)–>if hit-2 = true –> store variable "hit_Sauna_2" =1 –> if variable "hit_Sauna_2" =1 -> "show" Sauna_2. If "hit" = 0 -> "hide" Sauna_2

When you say: " … if you click plane X, only "Sauna_X" will be shown and the rest hidden." So i click on –>Plane_6 in the end it can only be Sauna_1 "shown" / "hidden". Because i don´t see any node which will make Sauna_6 "shown", for example. I guess you meant it, if all 6x Saunas would be wired together, right ?

I will open your attatched file as soon, as possbile. Thx.
 
Please register or log in to leave a reply.