Modifier Keys (alt, ctrl shift)
Using CTRL, ALT, and SHIFT in your tools
is_shift_down = unreal.InputLibrary.modifier_keys_state_is_shift_down(
unreal.InputLibrary.get_modifier_keys_state()
)is_alt_down = unreal.InputLibrary.modifier_keys_state_is_alt_down(
unreal.InputLibrary.get_modifier_keys_state()
)is_ctrl_down = unreal.InputLibrary.modifier_keys_state_is_control_down(
unreal.InputLibrary.get_modifier_keys_state()
)EditorActorSubsystem = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)
selection = set()
def update_selection():
"""Set or update the current selection"""
global selection
new_selection = EditorActorSubsystem.get_selected_level_actors() or []
is_shift_down = unreal.InputLibrary.modifier_keys_state_is_shift_down(
unreal.InputLibrary.get_modifier_keys_state()
)
# If shift is down, add to the selection
# otherwise, replace the selection
if is_shift_down:
selection |= set(new_selection)
else:
selection = set(new_selection)
print("Current Selection:")
for actor in selection:
print(f"\t{actor.get_actor_label()}")Last updated