48 lines
1.7 KiB
C++
48 lines
1.7 KiB
C++
// Lot AP7 (Docs/Migration/20_Chaine_Animations.md) : choix de la methode de transformation par les commandlets.
|
|
//
|
|
// -Methode=<id> impose une methode de Tools/anim/methodes ; -Methode=auto (ou absent) la deduit du profil du
|
|
// squelette source (clip de reference), par LPPoseMeasure::MethodForProfile. A appeler avant tout autre
|
|
// echantillonnage : les calques (pose A ou T) sont construits par LPPoseMeasure::Sample.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "LPPoseMeasure.h"
|
|
|
|
namespace LPAnimMethodSelect
|
|
{
|
|
// false (avec la cause dans Error) si la methode est inconnue, factice, ou introuvable pour le profil source.
|
|
inline bool Apply(const FString& Params, const FString& RefClipPath, FString& Error)
|
|
{
|
|
FString Wanted;
|
|
FParse::Value(*Params, TEXT("Methode="), Wanted);
|
|
if (Wanted.IsEmpty() || Wanted.Equals(TEXT("auto"), ESearchCase::IgnoreCase))
|
|
{
|
|
LPPoseMeasure::SetMethod(FString());
|
|
FLPPose Probe;
|
|
if (!LPPoseMeasure::Sample(RefClipPath, 0.f, Probe) || Probe.Profile.IsEmpty())
|
|
{
|
|
Error = FString::Printf(TEXT("methode auto : squelette source non identifie (%s)"), *RefClipPath);
|
|
return false;
|
|
}
|
|
const FLPTransformMethod* Found = LPPoseMeasure::MethodForProfile(Probe.Profile);
|
|
if (!Found)
|
|
{
|
|
Error = FString::Printf(TEXT("methode auto : aucune methode pour le profil %s"), *Probe.Profile);
|
|
return false;
|
|
}
|
|
Wanted = Found->Id;
|
|
}
|
|
if (!LPPoseMeasure::SetMethod(Wanted))
|
|
{
|
|
Error = FString::Printf(TEXT("methode inconnue : %s"), *Wanted);
|
|
return false;
|
|
}
|
|
if (LPPoseMeasure::CurrentMethod().bDummy)
|
|
{
|
|
Error = FString::Printf(TEXT("methode %s declaree mais non implementee"), *Wanted);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|