Hotkeys working now

This commit is contained in:
2025-06-02 19:21:17 -04:00
parent 7e8b96cb84
commit 8940dd9e70
14 changed files with 82 additions and 20 deletions

View File

@@ -134,6 +134,15 @@ FFormatArgumentData UlxFormatDataLibrary::FormatArgumentDataName(FName Value, co
return Result;
}
FFormatArgumentData UlxFormatDataLibrary::FormatArgumentDataKey(FKey Value, const FString &Name)
{
FFormatArgumentData Result;
Result.ArgumentValueType = EFormatArgumentType::Text;
Result.ArgumentName = Name;
Result.ArgumentValue = UKismetTextLibrary::Conv_NameToText(Value.GetFName());
return Result;
}
FFormatArgumentData UlxFormatDataLibrary::FormatArgumentDataGender(ETextGender Value, const FString &Name)
{
FFormatArgumentData Result;

View File

@@ -125,6 +125,9 @@ public:
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
static FFormatArgumentData FormatArgumentDataName(FName Value, const FString &Name);
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
static FFormatArgumentData FormatArgumentDataKey(FKey Value, const FString &Name);
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
static FFormatArgumentData FormatArgumentDataGender(ETextGender Value, const FString &Name);

View File

@@ -37,6 +37,12 @@ enum class ElxSuccessOrError : uint8 {
Error,
};
UENUM(BlueprintType)
enum class ElxValidOrNotValid : uint8 {
Valid,
NotValid,
};
UENUM(BlueprintType)
enum class ElxFoundOrNotFound : uint8 {
Found,

View File

@@ -227,3 +227,14 @@ ElxUsedOrNotUsed UlxUtilityLibrary::IsKeyUsedByMappingContext(const FKey &Key, c
return ElxUsedOrNotUsed::NotUsed;
}
FKey UlxUtilityLibrary::GetKeyByName(const FName &Name)
{
FKey Key = FKey(Name);
return Key.IsValid() ? Key : FKey();
}
FKey UlxUtilityLibrary::GetKeyByNameString(const FString &Name)
{
FKey Key = FKey(FName(*Name));
return Key.IsValid() ? Key : FKey();
}

View File

@@ -140,4 +140,18 @@ public:
//
UFUNCTION(BlueprintCallable, Category = "Input", meta = (ExpandEnumAsExecs="ReturnValue"))
static ElxUsedOrNotUsed IsKeyUsedByMappingContext(const FKey &Key, const UInputMappingContext *MappingContext);
// Get a key by name.
//
// Returns the null key if there is no such key.
//
UFUNCTION(BlueprintPure, Category = "Input|Key")
static FKey GetKeyByName(const FName &Name);
// Get a key by name string.
//
// Returns the null key if there is no such key.
//
UFUNCTION(BlueprintPure, Category = "Input|Key")
static FKey GetKeyByNameString(const FString &Name);
};