Example #1
0
def _extOnPopulateKeys(caller: unrealsdk.UObject,
                       function: unrealsdk.UFunction,
                       params: unrealsdk.FStruct) -> bool:
    """
    This function is called to load the list of keybinds. We add our own binds onto the end of the
     list after it's called.
    """
    global _modded_keybind_map

    unrealsdk.DoInjectedCallNext()
    caller.extOnPopulateKeys()

    _modded_keybind_map = {}
    for mod in MenuManager.GetOrderedModList():
        if not mod.IsEnabled:
            continue

        if all(isinstance(k, Keybind) and k.IsHidden for k in mod.Keybinds):
            continue

        tag = f"{_TAG_SEPERATOR}.{mod.Name}"
        idx = caller.AddKeyBindEntry(tag, tag, mod.Name)
        caller.KeyBinds[idx].CurrentKey = "None"

        for input in mod.Keybinds:
            name: str
            key: str
            rebindable: bool
            if isinstance(input, Keybind):
                if input.IsHidden:
                    continue
                name = input.Name
                key = input.Key
                rebindable = input.IsRebindable
            else:
                dh.PrintWarning(Keybind._list_deprecation_warning)
                name = input[0]
                key = input[1]
                rebindable = True

            tag = (_TAG_INPUT if rebindable else
                   _TAG_UNREBINDABLE) + f".{mod.Name}.{name}"
            idx = caller.AddKeyBindEntry(tag, tag, " " * _INDENT + name)

            _modded_keybind_map[idx] = input

            if not rebindable:
                key = "[ ]" if key == "None" else f"[ {key} ]"
            caller.KeyBinds[idx].CurrentKey = key

    return False
Example #2
0
def _extOnPopulateKeys(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool:
    """
    This function is called to load the list of keybinds. We add our own binds onto the end of the
     list after it's called.
    """
    global _modded_keybind_map

    unrealsdk.DoInjectedCallNext()
    caller.extOnPopulateKeys()

    _modded_keybind_map = {}
    for mod in MenuManager.GetOrderedModList():
        if not mod.IsEnabled:
            continue

        if len(mod.Keybinds) > 0:
            tag = f"{_TAG_SEPERATOR}.{mod.Name}"
            idx = caller.AddKeyBindEntry(tag, tag, mod.Name)
            caller.KeyBinds[idx].CurrentKey = "None"

        for input in mod.Keybinds:
            name: str
            key: str
            if isinstance(input, Keybind):
                name = input.Name
                key = input.Key
            else:
                dh.PrintWarning(Keybind._list_deprecation_warning)
                name = input[0]
                key = input[1]

            tag = f"{_TAG_INPUT}.{mod.Name}.{name}"
            idx = caller.AddKeyBindEntry(tag, tag, " " * _INDENT + name)
            _modded_keybind_map[idx] = input
            caller.KeyBinds[idx].CurrentKey = key

    return False