Gui pick_node trouble (SOLVED)


My current project’s gui fails to pick nodes during on_input. (using action’s x and y) I have another project with a similar gui set up which works fine. So I’ve done something wrong. I tried a test suggested in another Question post. [get the node. Get its position. Test the position with gui.pick_node]

self.brushes["01_bigTree"] = gui.get_node("01_bigTree")
gPos = gui.get_position(self.brushes["01_bigTree"])
print(gui.pick_node(self.brushes["01_bigTree"], gPos.x, gPos.y))

…but the test fails. I’m using default settings, plus Monarch. Could that cause this problem?
(see the print output outlined in red at the bottom of this image) There are no errors listed in the console output.



Have you tried using action.screen_x / action.screen_y ?

1 Like


Strange. Are you using the default render script? I noticed that you have DefOS as a dependency. Are you resizing the window?

Can you pick a box node added to the root of the node hierarchy and added to the lower left corner of the screen? Or in the middle?

1 Like


Good morning! (my time zone)

I tried screen_ , but no change.

I’m using the default render script. Nor am I making any calls to DefOS (yet) .

However, I was able to get the test code to work on a text node at the root of the Node folder. So it sounds like the Tools box is messing with its subordinate boxes. Doesn’t pick_node handle all the hierarchical coordinate deltas?



After investigating the differences between the non-working project and the working project, the only significant difference I can find is that the non-working project has its gui inside a game object inside a collection that is treated by Monarch as a screen. Could that be relevant?



Hmm, no I don’t think so. Are you able to share (send to a minimal project with the problem?

1 Like


pick_node (9.2 MB)

Thanks for asking, @britzl . Good luck.



I started your project and moved the mouse on top of the tree image:

The log:

DEBUG:SCRIPT: vmath.vector3(-240, 480, 0)
DEBUG:SCRIPT: test's up
DEBUG:SCRIPT: picked: 01_bigTree
ERROR:GAMEOBJECT: Instance '/scriptsObj' could not be found when dispatching message 'set_the_brush' sent from Worksheet:/works#piecesTools

It looks like I’m able to pick the item, at least based on the log output. But there is also an error about a missing game object instance.



Thanks for running the example. I don’t get that error, but it did pick the right object. So the reduced version works. (I didn’t see it because gui.get_position returns the object’s relative position, and the highlight goes into negative land. (my bad) )

So I took the working, minimal example and re-implemented the removed functionality. It’s now working. What can you do but call code black magic sometimes?

EDIT: I figured out why you got the error. There was an obsolete script file that my copy found that’s not in yours. So the message couldn’t get passed. Whereas, on my system the message went to the wrong file. I wish I had gotten the error!