Gui.set_scale with Z = 0 makes the node unable to respond (DEF-3066) (SOLVED)


#1

Context
I use gui.animate() to make “myNode” scale up then down, but the player may cancel this animation by disabling the node (can’t prevent him to do that, question of UI design), if it happens, the node will stay scaled up forver, even if it is animated again. So I use :

local node = gui.get_node("myNode")
gui.set_scale(node, vmath.vector3(1,1,0))

and the the node is correctly rescaled but, the problem looks solved but I can’t click on the node anymore, if I delete this line everything works good, but I still have the previous problem.

PS : If you know any way to reset scale without gui.set_scale() it could be nice :sweat_smile:


#2

I managed to reproduce the problem. If you set scale to vmath.vector3(1,1,1) it works, Not sure why the z-value makes a difference. Maybe @Mathias_Westerdahl or @sven knows?


#3

It works!
It is wierd because I use gui.animate() with vmath.vector3(2,2,0) as the third parameter, making the Z scale of the node equal to 0 regardless the gui.scale() line.


#4

What’s curious, is that it doesn’t throw a Lua error for you when you call set scale, since we check for <= 0 and will throw an error then. (go.animate doesn’t do that though)

I believe the main reason is that we want to avoid passing scale == 0 to physics components.

Sorry, I was talking about game objects. But looking at the gui code, I didn’t see any obvious reason for this issue.
I added ticket DEF-3066 for this.


#5

Solved in 1.2.145