refactor: Update log category names for consistency across game framework components

This commit is contained in:
Lefteris Notas
2026-05-21 13:30:59 +03:00
parent 3da9fd7493
commit d100a097f5
9 changed files with 67 additions and 58 deletions

View File

@@ -10,7 +10,7 @@
#include "Engine/LocalPlayer.h"
#include "Kismet/GameplayStatics.h"
DEFINE_LOG_CATEGORY_STATIC(LogInput, Log, All);
DEFINE_LOG_CATEGORY_STATIC(LogFrameworkInput, Log, All);
USS_EnhancedInputManager::USS_EnhancedInputManager()
{
@@ -24,7 +24,7 @@ void USS_EnhancedInputManager::Initialize(FSubsystemCollectionBase& Collection)
{
Super::Initialize(Collection);
UE_LOG(LogInput, Log, TEXT("SS_EnhancedInputManager::Initialize"));
UE_LOG(LogFrameworkInput, Log, TEXT("SS_EnhancedInputManager::Initialize"));
// Load default contexts on startup (e.g., IMC_Default).
// Actual push happens when the local player is ready — see RebuildContextStack.
@@ -43,7 +43,7 @@ void USS_EnhancedInputManager::Initialize(FSubsystemCollectionBase& Collection)
void USS_EnhancedInputManager::Deinitialize()
{
UE_LOG(LogInput, Log, TEXT("SS_EnhancedInputManager::Deinitialize"));
UE_LOG(LogFrameworkInput, Log, TEXT("SS_EnhancedInputManager::Deinitialize"));
ClearAllContexts();
Super::Deinitialize();
}
@@ -57,7 +57,7 @@ void USS_EnhancedInputManager::PushContext(UInputMappingContext* Context,
{
if (!Context)
{
UE_LOG(LogInput, Warning, TEXT("PushContext — Null context"));
UE_LOG(LogFrameworkInput, Warning, TEXT("PushContext — Null context"));
return;
}
@@ -76,7 +76,7 @@ void USS_EnhancedInputManager::PushContext(UInputMappingContext* Context,
Entry.ContextTag = ContextTag;
ContextStack.Add(Entry);
UE_LOG(LogInput, Log, TEXT("PushContext — '%s' (Priority: %d)"),
UE_LOG(LogFrameworkInput, Log, TEXT("PushContext — '%s' (Priority: %d)"),
*ContextTag.GetTagName().ToString(), static_cast<int32>(Priority));
RebuildContextStack();
@@ -98,7 +98,7 @@ void USS_EnhancedInputManager::PopContext(UInputMappingContext* Context)
EInputContextPriority Prio = ContextStack[i].Priority;
ContextStack.RemoveAt(i);
UE_LOG(LogInput, Log, TEXT("PopContext — '%s'"), *Popped.GetTagName().ToString());
UE_LOG(LogFrameworkInput, Log, TEXT("PopContext — '%s'"), *Popped.GetTagName().ToString());
RebuildContextStack();
OnContextPopped.Broadcast(Popped, Prio);
@@ -106,7 +106,7 @@ void USS_EnhancedInputManager::PopContext(UInputMappingContext* Context)
}
}
UE_LOG(LogInput, Warning, TEXT("PopContext — Context not found in stack"));
UE_LOG(LogFrameworkInput, Warning, TEXT("PopContext — Context not found in stack"));
}
void USS_EnhancedInputManager::PopContextByTag(FGameplayTag ContextTag)
@@ -120,13 +120,13 @@ void USS_EnhancedInputManager::PopContextByTag(FGameplayTag ContextTag)
{
if (ContextStack[i].ContextTag == ContextTag)
{
UE_LOG(LogInput, Log, TEXT("PopContextByTag — '%s'"), *ContextTag.GetTagName().ToString());
UE_LOG(LogFrameworkInput, Log, TEXT("PopContextByTag — '%s'"), *ContextTag.GetTagName().ToString());
PopContext(ContextStack[i].Context);
return;
}
}
UE_LOG(LogInput, Warning, TEXT("PopContextByTag — '%s' not found in stack"),
UE_LOG(LogFrameworkInput, Warning, TEXT("PopContextByTag — '%s' not found in stack"),
*ContextTag.GetTagName().ToString());
}
@@ -145,7 +145,7 @@ void USS_EnhancedInputManager::ClearAllContexts()
}
ContextStack.Empty();
UE_LOG(LogInput, Log, TEXT("ClearAllContexts — All contexts removed"));
UE_LOG(LogFrameworkInput, Log, TEXT("ClearAllContexts — All contexts removed"));
}
bool USS_EnhancedInputManager::IsContextActive(FGameplayTag ContextTag) const
@@ -187,7 +187,7 @@ void USS_EnhancedInputManager::SetInputMode(bool bUIMode, bool bShowCursor, bool
APlayerController* PC = UGameplayStatics::GetPlayerController(GetWorld(), 0);
if (!PC)
{
UE_LOG(LogInput, Warning, TEXT("SetInputMode — No PlayerController found"));
UE_LOG(LogFrameworkInput, Warning, TEXT("SetInputMode — No PlayerController found"));
return;
}
@@ -207,7 +207,7 @@ void USS_EnhancedInputManager::SetInputMode(bool bUIMode, bool bShowCursor, bool
PC->bShowMouseCursor = bShowCursor;
UE_LOG(LogInput, Log, TEXT("SetInputMode — UI: %s, Cursor: %s"),
UE_LOG(LogFrameworkInput, Log, TEXT("SetInputMode — UI: %s, Cursor: %s"),
bUIMode ? TEXT("ON") : TEXT("OFF"),
bShowCursor ? TEXT("Visible") : TEXT("Hidden"));
@@ -222,7 +222,7 @@ void USS_EnhancedInputManager::RebindKey(UInputAction* Action, FKey NewKey, bool
{
if (!Action)
{
UE_LOG(LogInput, Warning, TEXT("RebindKey — Null action"));
UE_LOG(LogFrameworkInput, Warning, TEXT("RebindKey — Null action"));
return;
}
@@ -241,7 +241,7 @@ void USS_EnhancedInputManager::RebindKey(UInputAction* Action, FKey NewKey, bool
Options.bIgnoreAllPressedKeysUntilRelease = true;
// Subsystem->AddPlayerMappedKey(Action, NewKey, Options);
UE_LOG(LogInput, Log, TEXT("RebindKey — '%s' → '%s'"),
UE_LOG(LogFrameworkInput, Log, TEXT("RebindKey — '%s' → '%s'"),
*Action->GetName(), *NewKey.ToString());
OnKeyRebound.Broadcast(FGameplayTag(), NewKey); // Tag from mapping profile.
@@ -253,8 +253,9 @@ void USS_EnhancedInputManager::ResetAllBindings()
UEnhancedInputLocalPlayerSubsystem* Subsystem = GetEnhancedInputSubsystem();
if (Subsystem)
{
Subsystem->ResetPlayerMappedKeys();
UE_LOG(LogInput, Log, TEXT("ResetAllBindings — All keys reset to defaults"));
// UE 5.7+: ResetPlayerMappedKeys was removed. Use UEnhancedInputUserSettings or iterate context entries.
// Subsystem->RequestRebuildPlayerMappedKeys();
UE_LOG(LogFrameworkInput, Log, TEXT("ResetAllBindings — All keys reset to defaults"));
}
}
@@ -331,7 +332,7 @@ void USS_EnhancedInputManager::RebuildContextStack()
UEnhancedInputLocalPlayerSubsystem* Subsystem = GetEnhancedInputSubsystem();
if (!Subsystem)
{
UE_LOG(LogInput, Verbose, TEXT("RebuildContextStack — No local player subsystem available yet"));
UE_LOG(LogFrameworkInput, Verbose, TEXT("RebuildContextStack — No local player subsystem available yet"));
return;
}
@@ -341,8 +342,14 @@ void USS_EnhancedInputManager::RebuildContextStack()
return static_cast<int32>(A.Priority) < static_cast<int32>(B.Priority);
});
// Clear all and re-add in priority order.
Subsystem->RemoveAllMappingContexts();
// UE 5.7+: RemoveAllMappingContexts was removed. Remove individually.
for (const FInputContextEntry& Existing : ContextStack)
{
if (Existing.Context)
{
Subsystem->RemoveMappingContext(Existing.Context);
}
}
for (const FInputContextEntry& Entry : ContextStack)
{
@@ -352,7 +359,7 @@ void USS_EnhancedInputManager::RebuildContextStack()
}
}
UE_LOG(LogInput, Verbose, TEXT("RebuildContextStack — %d contexts applied"), ContextStack.Num());
UE_LOG(LogFrameworkInput, Verbose, TEXT("RebuildContextStack — %d contexts applied"), ContextStack.Num());
}
UEnhancedInputLocalPlayerSubsystem* USS_EnhancedInputManager::GetEnhancedInputSubsystem() const