Overhaul of tangible/blueprint animation interface

This commit is contained in:
2023-10-02 15:48:42 -04:00
parent 642b444d13
commit a2e49338cf
7 changed files with 197 additions and 186 deletions

View File

@@ -75,17 +75,12 @@ void UlxTangible::SetActorBlueprintClass(TSubclassOf<AActor> bp) {
void UlxTangible::UpdateAnimationQueue(std::string_view aq) {
AnimTracker.Update(aq);
TArray<uint64> aborted = AnimTracker.GetAborted();
for (uint64 hash : aborted) {
IlxTangibleInterface::Execute_AbortAnimation(GetActor(), hash);
}
FlxAnimationStep step;
ElxAnimationMode mode = AnimTracker.GetNextStep(step);
if (mode != ElxAnimationMode::INVALID) {
bool started = IlxTangibleInterface::Execute_StartAnimation(GetActor(), mode, step);
if (started) {
AnimTracker.StartedStep(step.Hash);
}
int limit = 3;
while (AnimTracker.IsChanged()) {
if (limit == 0) break;
limit -= 1;
AnimTracker.ClearChanged();
IlxTangibleInterface::Execute_AnimationStateChanged(GetActor());
}
}
@@ -108,15 +103,27 @@ void UlxTangible::Destroy() {
NearAccordingToUnreal = false;
}
FString UlxTangible::GetTangiblePlane(AActor* actor) {
static UlxTangible *GetActorTangible(AActor *actor) {
UlxTangibleComponent* comp = actor->GetComponentByClass<UlxTangibleComponent>();
check(comp != nullptr);
return comp->Tangible->Plane.ToString();
UlxTangible *result = comp->Tangible.Get();
check(result != nullptr);
return result;
}
void UlxTangible::SetTangiblePlane(AActor* actor, const FString& plane) {
UlxTangibleComponent* comp = actor->GetComponentByClass<UlxTangibleComponent>();
check(comp != nullptr);
comp->Tangible->Plane = FName(plane);
void UlxTangible::GetCurrentAnimation(AActor *target, FlxAnimationStep &step) {
step = GetActorTangible(target)->AnimTracker.GetCurrentAnimation();
}
void UlxTangible::FinishedAnimation(AActor *target, const FlxAnimationStep &step) {
GetActorTangible(target)->AnimTracker.FinishedAnimation(step.Hash);
}
FString UlxTangible::GetTangiblePlane(AActor* target) {
return GetActorTangible(target)->Plane.ToString();
}
void UlxTangible::SetTangiblePlane(AActor* target, const FString& plane) {
GetActorTangible(target)->Plane = FName(plane);
}