|Topic was automatically imported from the old Question2Answer platform.
I am implementing an inventory system, and I have different control nodes that use gui input signal to a parent node script to handle those inputs. I noticed that when you press the mouse on the child nodes, the gui input signal continues to be fired from the same control you originally clicked on up until you release the button. I would have thought the input would propagate across the nodes, but printing out every input event when gui_input is fired, the same control node fires the signal until you let go of the button.
I am trying to implement a drag-n-drop style inventory, and when I click on an item, I can latch it to the mouse, but the same control will continue firing input signals until I release the mouse button, so I can’t release my item over a different control node to re-assign the item’s location.
I would have thought that each action’s pressed / released mode would be handled independently, so how do I go about fixing this?
I tried changing it to utilize mouse_entered / mouse_exited on the control nodes and leaving boolean values for this in the parent script, and using the parent’s input(ev) function to do a similar thing - but it still has the same problem - if I start clicking when on one control, mouse_exited does not signal and mouse_entered does not signal on the new control as long as the mouse button is pressed.
Hammer2000 | 2018-10-04 01:16
This user apparently has the exact same problem and I saw no solution there. Been searching these questions forums for a while and haven’t found a solution or where I’m mislead in my thinking.
Hammer2000 | 2018-10-04 01:42
If anyone checks this out, I just found the drag and drop demo in the demo projects and it seems I am mislead in how to approach this problem, as the demo shows you can utilize the built in functions for controls to approach this problem. Seeing if it solves my issues.
Hammer2000 | 2018-10-04 01:58
If anyone else has a problem getting get_drag_data to work with can_drop_data, make sure the control you want to drop on has the mouse filter set to Stop, as Pass will not allow you to drag and drop to that control.
Hammer2000 | 2018-10-04 13:38