You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
This allows custom anim blueprints to either: a) Allow Sequencer to swap out their anim instance during playback (swapping it back after). This is similar to checking the 'Force Custom Mode' checkbox on a Skeletal Animation track section, but at the blueprint level without having to change anything in Sequencer. b) Provide a list of valid Anim Slot names for the Sequencer Skeletal Animation track section UI to choose from. When provided by a blueprint with the interface, a valid slot will always be chosen when creating new skeletal animation sections. These features will allow UEFN devs to better manage Sequencer takeover of pawn animation without the user having to edit a SlotName in the Sequencer UI. To use these features will require them editing their anim blueprints to use this interface. I had considered as part of this change hiding the Slot Name UI entirely in UEFN when there is no choice to be made, but decided against it for less UEFN-specific code. [REVIEW] [at]ue-sequencer [at]guillaume.guay #jira UE-199199, UE-199200 #rb Max.Chen [CL 29316313 by david bromberg in ue5-main branch]
65 lines
2.3 KiB
C++
65 lines
2.3 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
#pragma once
|
|
#include "CoreTypes.h"
|
|
#include "HAL/Platform.h"
|
|
#include "UObject/Interface.h"
|
|
#include "UObject/Object.h"
|
|
#include "UObject/ObjectMacros.h"
|
|
#include "UObject/UObjectGlobals.h"
|
|
#include "Animation/AnimInstance.h"
|
|
#include "Components/SkeletalMeshComponent.h"
|
|
|
|
#include "SequencerAnimationOverride.generated.h"
|
|
|
|
/**
|
|
* Sequencer Animation Track Override interface.
|
|
* Anim blueprints can override this to provide Sequencer with instructions on how to override this blueprint during Sequencer takeover.
|
|
*/
|
|
UINTERFACE(Blueprintable)
|
|
class ANIMGRAPHRUNTIME_API USequencerAnimationOverride : public UInterface
|
|
{
|
|
GENERATED_BODY()
|
|
};
|
|
|
|
class ANIMGRAPHRUNTIME_API ISequencerAnimationOverride
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
|
|
// Whether this animation blueprint allows Sequencer to nuke this anim instance and replace it during Sequencer playback.
|
|
UFUNCTION(BlueprintNativeEvent, Category = "Sequencer", meta = (CallInEditor = "true"))
|
|
bool AllowsCinematicOverride() const;
|
|
|
|
virtual bool AllowsCinematicOverride_Implementation() const { return false; }
|
|
|
|
// Should return a list of valid slot names for Sequencer to output to in the case that Sequencer is not permitted to nuke the anim instance.
|
|
// Will be chosen by the user in drop down on the skeletal animation section properties. Should be named descriptively, as in some contexts (UEFN), the user
|
|
// will not be able to view the animation blueprint itself to determine the mixing behavior of the slot.
|
|
UFUNCTION(BlueprintNativeEvent, Category = "Sequencer", meta = (CallInEditor = "true"))
|
|
TArray<FName> GetSequencerAnimSlotNames() const;
|
|
|
|
virtual TArray<FName> GetSequencerAnimSlotName_Implementation() const { return TArray<FName>(); }
|
|
|
|
static TScriptInterface<ISequencerAnimationOverride> GetSequencerAnimOverride(USkeletalMeshComponent* SkeletalMeshComponent)
|
|
{
|
|
if (TSubclassOf<UAnimInstance> AnimInstanceClass = SkeletalMeshComponent->GetAnimClass())
|
|
{
|
|
if (UAnimInstance* AnimInstance = AnimInstanceClass->GetDefaultObject<UAnimInstance>())
|
|
{
|
|
if (AnimInstance->Implements<USequencerAnimationOverride>())
|
|
{
|
|
TScriptInterface<ISequencerAnimationOverride> AnimOverride = AnimInstance;
|
|
if (AnimOverride.GetObject())
|
|
{
|
|
return AnimOverride;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return nullptr;
|
|
}
|
|
};
|
|
|
|
|