Attempting to pick gui node results in node becoming disabled (DEF-1605) (SOLVED)

When I attempt to pick a gui node within roughly 20 frames of having created the gui-object it results in the gui object becoming disabled (as if it was set_enabled false). It is only a problem on the first pick, so my workaround is to put this into my init-function:

gui.pick_node(node, 0, 0)
gui.set_enabled(node, true)
1 Like

I’m not really able to reproduce this. Is this for a cloned node or a node that existed from the start? I did this:

function init(self)
	self.frame_count = 0
	self.box = gui.get_node("box")
	self.box_pos = gui.get_position(self.box)
end

function update(self, dt)
	print("ENABLED", gui.is_enabled(self.box))
	self.frame_count = self.frame_count + 1
	if self.frame_count == 20 then
		print("PICKING NODE")
		gui.pick_node(self.box, self.box_pos.x, self.box_pos.y)
	end
end

And from the output you can see that the node remains enabled:

INFO:DLIB: SSDP: Started on address 172.19.12.176
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: PICKING NODE
DEBUG:SCRIPT: ENABLED	true
DEBUG:SCRIPT: ENABLED	true
1 Like

Oh sorry, I’m being unclear.

It’s when it happens within less than 20 frames so there should be no delay added. The node was created through script in the init-function.

1 Like

I’m still not able to reproduce this. Could you please post a minimal example? This is what I did:

function init(self)
	local box = gui.new_box_node(vmath.vector3(100, 100, 0), vmath.vector3(100, 100, 100))
	local box_pos = gui.get_position(box)
	gui.pick_node(box, box_pos.x, box_pos.y)
	print("ENABLED", gui.is_enabled(box))
end
1 Like

Alright, it seems to have to do with parented nodes, try this, and then try commenting out the set_enabled:

function init(self)
	local node = gui.new_box_node(vmath.vector3(0,0,0), vmath.vector3(32,32,0))
	gui.set_color(node, vmath.vector4(0,0,0,1))
	
	local parent_node = gui.new_box_node(vmath.vector3(300,200,0), vmath.vector3(64,64,0))
	gui.set_parent(node, parent_node)
		
	gui.pick_node(node, 0, 0)
	gui.set_enabled(node, true)
end
1 Like

There is a bug (DEF-1605) that could possibly show like this, a fix for it is coming in todays beta and will land in stable this monday. Are you on Windows?

2 Likes

Ah, I see. @Mathias_Westerdahl mentioned to me that there’s a fix for an issue with an uninitialised variable and parent nodes coming in the next beta release later today. This fix could very likely be related to what you are seeing Emil. I suggest that we wait until the beta and try again.

EDIT: Doh, Sven beat me to the punch!

3 Likes

Yes, I feel very confident it’s the issue DEF-1605 that should be fixed with todays’ beta release.
You can verify it by adding an extra line (which should make the bug go away):

gui.pick_node(parent_node, 0, 0) -- Updates the parent's local transform
gui.pick_node(node, 0, 0)
2 Likes

Could you verify that release 1.2.75 fixes this problem for you? :blush:

Yes, the problem no longer occurs for me when picking nodes! :slight_smile:

2 Likes