mirror of
https://github.com/litruv/PNGTuber-Plus.git
synced 2026-07-24 02:26:02 +10:00
Performance Optimization
This commit is contained in:
@@ -594,7 +594,7 @@ func _on_background_input_capture_bg_key_pressed(node, keys_pressed):
|
||||
var has_alt = keys_pressed.has(KEY_ALT) and keys_pressed[KEY_ALT]
|
||||
var has_meta = keys_pressed.has(KEY_META) and keys_pressed[KEY_META] # Command key on macOS
|
||||
|
||||
# Use appropriate modifier names based on platform
|
||||
# Build modifier prefix once
|
||||
if has_ctrl:
|
||||
modifiers.append("Ctrl")
|
||||
if has_shift:
|
||||
@@ -604,25 +604,19 @@ func _on_background_input_capture_bg_key_pressed(node, keys_pressed):
|
||||
if has_meta:
|
||||
modifiers.append("Cmd") # Command key on macOS
|
||||
|
||||
# Get non-modifier keys
|
||||
var regular_keys = []
|
||||
var modifier_prefix = ""
|
||||
if modifiers.size() > 0:
|
||||
modifier_prefix = "+".join(modifiers) + "+"
|
||||
|
||||
# Single pass: build key strings directly
|
||||
for i in keys_pressed:
|
||||
if keys_pressed[i]:
|
||||
# Skip modifier keys when building the regular key list
|
||||
# Skip modifier keys
|
||||
if i == KEY_CTRL or i == KEY_SHIFT or i == KEY_ALT or i == KEY_META:
|
||||
continue
|
||||
regular_keys.append(OS.get_keycode_string(i) if !OS.get_keycode_string(i).strip_edges().is_empty() else "Keycode" + str(i))
|
||||
|
||||
# Create combined key strings
|
||||
if modifiers.size() > 0 and regular_keys.size() > 0:
|
||||
# Create modifier combination strings
|
||||
for key in regular_keys:
|
||||
var combined_key = "+".join(modifiers) + "+" + key
|
||||
keyStrings.append(combined_key)
|
||||
else:
|
||||
# No modifiers, use regular keys
|
||||
for key in regular_keys:
|
||||
keyStrings.append(key)
|
||||
|
||||
var key_name = OS.get_keycode_string(i) if !OS.get_keycode_string(i).strip_edges().is_empty() else "Keycode" + str(i)
|
||||
keyStrings.append(modifier_prefix + key_name)
|
||||
|
||||
if fileSystemOpen:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user