[ue4] Initial set of blueprint functions

This commit is contained in:
badlogic 2016-12-01 14:33:48 +01:00
parent a46839336a
commit f31c298528
3 changed files with 57 additions and 3 deletions

View File

@ -59,4 +59,40 @@ void USpineSkeletonComponent::FinishDestroy () {
Super::FinishDestroy();
}
void USpineSkeletonComponent::SetAnimation (int trackIndex, FString animationName, bool loop) {
if (state) {
spAnimationState_setAnimationByName(state, trackIndex, TCHAR_TO_UTF8(*animationName), loop ? 1 : 0);
}
}
void USpineSkeletonComponent::AddAnimation (int trackIndex, FString animationName, bool loop, float delay) {
if (state) {
spAnimationState_addAnimationByName(state, trackIndex, TCHAR_TO_UTF8(*animationName), loop ? 1 : 0, delay);
}
}
void USpineSkeletonComponent::SetEmptyAnimation (int trackIndex, float mixDuration) {
if (state) {
spAnimationState_setEmptyAnimation(state, trackIndex, mixDuration);
}
}
void USpineSkeletonComponent::AddEmptyAnimation (int trackIndex, float mixDuration, float delay) {
if (state) {
spAnimationState_addAnimationByName(state, trackIndex, mixDuration, delay);
}
}
void USpineSkeletonComponent::ClearTracks () {
if (state) {
spAnimationState_clearTracks(state);
}
}
void USpineSkeletonComponent::ClearTrack (int trackIndex) {
if (state) {
spAnimationState_clearTrack(state, trackIndex);
}
}
#undef LOCTEXT_NAMESPACE

View File

@ -40,8 +40,7 @@ void USpineSkeletonRendererComponent::TickComponent (float DeltaTime, ELevelTick
pageToMaterial.Add(currPage, material);
currPage = currPage->next;
}
}
else {
} else {
pageToMaterial.Empty();
spAtlasPage* currPage = skeleton->Atlas->GetAtlas(false)->pages;
for (int i = 0; i < skeleton->Atlas->atlasPages.Num(); i++) {

View File

@ -31,7 +31,26 @@ public:
virtual void TickComponent (float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
virtual void FinishDestroy () override;
// Blueprint functions
UFUNCTION(BlueprintCallable, Category="Components|Spine")
void SetAnimation (int trackIndex, FString animationName, bool loop);
UFUNCTION(BlueprintCallable, Category="Components|Spine")
void AddAnimation (int trackIndex, FString animationName, bool loop, float delay);
UFUNCTION(BlueprintCallable, Category="Components|Spine")
void SetEmptyAnimation (int trackIndex, float mixDuration);
UFUNCTION(BlueprintCallable, Category="Components|Spine")
void AddEmptyAnimation (int trackIndex, float mixDuration, float delay);
UFUNCTION(BlueprintCallable, Category="Components|Spine")
void ClearTracks ();
UFUNCTION(BlueprintCallable, Category="Components|Spine")
void ClearTrack (int trackIndex);
protected:
void DisposeState();