Skip to content

Commit e3ae3ed

Browse files
authored
Merge pull request #102 from Cafezinhu/main
Fix InputMap load removing spatial_editor actions in editor
2 parents 380d186 + 91d6eb0 commit e3ae3ed

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

addons/block_code/ui/picker/categories/category_factory.gd

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,16 @@ static func get_built_in_blocks(_class_name: String) -> Array[Block]:
691691
static func _get_input_blocks() -> Array[Block]:
692692
var block_list: Array[Block]
693693

694+
var editor_input_actions: Dictionary = {}
695+
var editor_input_action_deadzones: Dictionary = {}
696+
if Engine.is_editor_hint():
697+
var actions := InputMap.get_actions()
698+
for action in actions:
699+
if action.begins_with("spatial_editor"):
700+
var events := InputMap.action_get_events(action)
701+
editor_input_actions[action] = events
702+
editor_input_action_deadzones[action] = InputMap.action_get_deadzone(action)
703+
694704
InputMap.load_from_project_settings()
695705

696706
var block: Block = BLOCKS["parameter_block"].instantiate()
@@ -701,4 +711,10 @@ static func _get_input_blocks() -> Array[Block]:
701711
block.category = "Input"
702712
block_list.append(block)
703713

714+
if Engine.is_editor_hint():
715+
for action in editor_input_actions.keys():
716+
InputMap.add_action(action, editor_input_action_deadzones[action])
717+
for event in editor_input_actions[action]:
718+
InputMap.action_add_event(action, event)
719+
704720
return block_list

0 commit comments

Comments
 (0)