Character walking is fixed, using the new Movement Component State model.

This commit is contained in:
2026-02-14 00:24:52 -05:00
parent 107cb57b66
commit 96256d7836
10 changed files with 61 additions and 19 deletions

View File

@@ -5,13 +5,15 @@
ELogVerbosity::Type UlxBlueprintErrorLibrary::ConvertElxLogVerbosity(ElxLogVerbosity Verbosity) {
switch (Verbosity) {
case ElxLogVerbosity::Error: return ELogVerbosity::Error;
case ElxLogVerbosity::Warning: return ELogVerbosity::Warning;
case ElxLogVerbosity::Display: return ELogVerbosity::Display;
case ElxLogVerbosity::Log: return ELogVerbosity::Log;
case ElxLogVerbosity::Verbose: return ELogVerbosity::Verbose;
case ElxLogVerbosity::VeryVerbose: return ELogVerbosity::VeryVerbose;
case ElxLogVerbosity::Fatal: return ELogVerbosity::Fatal;
case ElxLogVerbosity::Error: return ELogVerbosity::Error;
case ElxLogVerbosity::Warning: return ELogVerbosity::Warning;
case ElxLogVerbosity::Display: return ELogVerbosity::Display;
case ElxLogVerbosity::Log: return ELogVerbosity::Log;
case ElxLogVerbosity::ThrottledDisplay: return ELogVerbosity::Display;
case ElxLogVerbosity::ThrottledLog: return ELogVerbosity::Log;
case ElxLogVerbosity::Verbose: return ELogVerbosity::Verbose;
case ElxLogVerbosity::VeryVerbose: return ELogVerbosity::VeryVerbose;
case ElxLogVerbosity::Fatal: return ELogVerbosity::Fatal;
}
}

View File

@@ -15,7 +15,7 @@
#include "BlueprintErrors.generated.h"
/*
/*
* enum class ElxLogVerbosity, below, contains all the same error severity levels
* as ELogVerbosity, but in a form that the blueprint editor can manipulate.
*
@@ -23,13 +23,17 @@
* We did that because we want the editor to default to 'Error' in most cases.
* Unfortunately, that means the numeric values of the two enums don't match up,
* so we will need a conversion function.
*
*
* ThrottledDisplay and ThrottledLog are not present in ELogVerbosity. They
* behave like Display and Log respectively, but suppress repeated messages
* with the same format pattern, logging at most once per second.
*
*/
/** Log Verbosity: The importance of an error message, which affects which logs the error
* message gets written to, and how that message gets filtered.
*
*
*/
UENUM(BlueprintType)
enum class ElxLogVerbosity : uint8 {
@@ -46,6 +50,12 @@ enum class ElxLogVerbosity : uint8 {
/* Prints a message to the log file, however, it does not print to the console. */
Log,
/* Like Display, but suppresses repeated messages with the same format pattern (at most once per second). */
ThrottledDisplay,
/* Like Log, but suppresses repeated messages with the same format pattern (at most once per second). */
ThrottledLog,
/* Prints a message to a log file only if Verbose logging is enabled for the given category. This is usually used for detailed logging. */
Verbose,

View File

@@ -575,6 +575,23 @@ UK2Node_FormatLogMessage::UK2Node_FormatLogMessage(const FObjectInitializer& Obj
void UK2Node_FormatMessage::FormatLogMessageInternal(UObject *Context, ElxLogVerbosity Verbosity, const FString &InPattern, TArray<FFormatArgumentData> InArgs)
{
// For throttled verbosity levels, suppress repeated messages with the
// same format pattern. We key on the blueprint name + format pattern,
// and allow at most one message per second per key.
//
if (Verbosity == ElxLogVerbosity::ThrottledDisplay || Verbosity == ElxLogVerbosity::ThrottledLog)
{
static TMap<FString, double> LastLogTime;
double Now = FPlatformTime::Seconds();
FString Key = Context->GetClass()->GetName() + TEXT("::") + InPattern;
double &Last = LastLogTime.FindOrAdd(Key, 0.0);
if (Now - Last < 1.0)
{
return;
}
Last = Now;
}
// Generate the formatted string.
//
FText InPatternText(FText::FromString(InPattern));

View File

@@ -55,6 +55,10 @@ FlxMovementComponentState UlxMovementComponentStateLibrary::SetFakeMovementCompo
{
if (!Actor) return State;
UlxTangible *Tangible = UlxTangible::GetActorTangibleOrLog(Actor);
if (Tangible) Tangible->FakeMovementComponentState = State;
if (Tangible)
{
UE_LOG(LogTemp, Display, TEXT("SetFakeMovementComponentState(%s): %s"), *Actor->GetName(), *DebugString(State));
Tangible->FakeMovementComponentState = State;
}
return State;
}

View File

@@ -124,6 +124,6 @@ public:
// state is usually read by the animation blueprint
// when the real movement component is disabled.
//
UFUNCTION(BlueprintCallable, Category = "Luprex|Movement Component State", meta = (AutoCreateRefTerm = "State"))
UFUNCTION(BlueprintCallable, Category = "Luprex|Movement Component State", meta = (DefaultToSelf = "Actor", AutoCreateRefTerm = "State"))
static FlxMovementComponentState SetFakeMovementComponentState(AActor *Actor, const FlxMovementComponentState &State);
};

View File

@@ -253,7 +253,7 @@ void UlxTangible::FinishedAnimation(AActor *target, const FlxAnimationStep &step
tan->AnimTracker.FinishedAnimation(step.Hash);
if (AutoUpdate) tan->AutoUpdatePosition();
FString DebugString = UlxAnimationStepLibrary::AnimationStepDebugString(step);
UE_LOG(LogLuprex, Display, TEXT("Animation Finished: %s"), *DebugString);
// UE_LOG(LogLuprex, Display, TEXT("FinishedAnimation: %s"), *DebugString);
}
bool UlxTangible::AnimationStepIsFinished(AActor *target, const FlxAnimationStep &step)