From e8d6c848e9546b3fd31607425bb9012c8ac83616 Mon Sep 17 00:00:00 2001 From: pokepetter Date: Thu, 30 May 2024 20:58:40 +0200 Subject: [PATCH] fixed input always getting eaten correctly when returing True. fixed mouse not getting all the rebound keys as input. --- ursina/main.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ursina/main.py b/ursina/main.py index bebaa2b1..24a5b968 100644 --- a/ursina/main.py +++ b/ursina/main.py @@ -244,6 +244,9 @@ def input(self, key, is_raw=False): # internal method for handling input for key in bound_keys: __main__.input(key) + break_outer = False + + for e in scene.entities: if e.enabled is False or e.ignore or e.ignore_input: continue @@ -252,29 +255,33 @@ def input(self, key, is_raw=False): # internal method for handling input if e.has_disabled_ancestor(): continue + if break_outer: + break if hasattr(e, 'input') and callable(e.input): - break_outer = False for key in bound_keys: if break_outer: break if e.input(key): # if the input function returns True, eat the input break_outer = True - + break if hasattr(e, 'scripts'): - break_outer = False if break_outer: break for script in e.scripts: + if break_outer: + break + if script.enabled and hasattr(script, 'input') and callable(script.input): for key in bound_keys: if script.input(key): # if the input function returns True, eat the input break_outer = True break - mouse.input(key) + for key in bound_keys: + mouse.input(key) def text_input(self, key): # internal method for handling text input