Forum

variable from another node tree[solved]

09 January 2016 00:01
I have Two entry points in my node-tree. Is it possible to check a variable declared in one tree in another?
My tests make me believe that each entry point has independent R1 R2 R3's variables…
09 January 2016 10:52
Unfortunately, now you can't use variables from different trees. You should make your logic so that those two trees turned into one.
Alexander (Blend4Web Team)
twitter
10 January 2016 00:29
But how?
They must be a solution with a Timer…
Hope i can make it!
10 January 2016 01:17
But how?

It depends on concrete case. I could help if you talk us about the details.

For timing issues you can use Delay node.
Alexander (Blend4Web Team)
twitter
10 January 2016 17:34
Well I tried to tackle my collision probleme by in stead checking a variable at a certain time ( based on the duration of a particular animation) but when i setup my nodes i cant get a functioning tree. I got a no subtree problem then the loop was only triggered if i played the character control so it wasn't checking for the variable on time or it screwed the export…
Here is the blend. I have a first tree to control the character another tree looping and increment R3 to 40 so that after 4 seconds i could check where the character is. I now where he is by checking R1 in the first tree. I did the loop hoping that i could switch from one tree to another but the switch select stops everything until i click…
10 January 2016 19:52
Try to use Deprecated Select node. It has "Do not wait" option, so there will no freezing during selection detection.
EDITED
I forgot, it will not work because Delay node resets the selection state even if "Do not wait" is set.
We will surely implement mechanisms for thread synchronization. But now, unfortunately, it is not possible to solve your issue with the Logic Editor.
Alexander (Blend4Web Team)
twitter
10 January 2016 22:30
Ok. Thanks for taking the time to try to workaround my problem.
I don't know if that would the easiest thing to implement but if variables could be kind of public so that they could be seen in another tree would solve most of the cases i can think of.

Would the select node with do not wait enabled go for a miss output automatically if nothing happens?
10 January 2016 23:06

I don't know if that would the easiest thing to implement but if variables could be kind of public so that they could be seen in another tree would solve most of the cases i can think of.
Variables have been made private on purpose to avoid concurency issues that would be difficult to debug. Perhaps, it make sense to create global scope.

In any case, I also think that this is a significant shortcoming. And thanks for your interest!

Would the select node with do not wait enabled go for a miss output automatically if nothing happens?
Yes.
Alexander (Blend4Web Team)
twitter
11 January 2016 11:42
Well the select(deprecated) node saved my life!
On the scope of the variables maybe a global scope could be a option for new variables ( not the R1 -> R8). That way the build in register variables would stay private and shouldn't create concurrency and new variables with a global scope would be explicitly declared as global by the user. That should keep the problem at the lower level possible but giving a option to use two or more simple trees and avoid noodle hell like a submitted for the Xmass competition

I would love it anyway. Because with the select node with the do not wait option i had to add a lot of conditional jumps. Switch select is much more convenient to use but you would need a global scope to achieve what i did. (or collision detection with nodes)

Anyway, enough chatting, i think you must have understood my point by now.

Thanks again for the help!
 
Please register or log in to leave a reply.