mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-06 18:56:54 +08:00
[ue4] Added error dialogs when skeleton and atlas couldn't be loaded.
This commit is contained in:
parent
be834c5145
commit
71c0887dab
@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include "SpinePluginPrivatePCH.h"
|
#include "SpinePluginPrivatePCH.h"
|
||||||
|
|
||||||
|
DEFINE_LOG_CATEGORY(SpineLog);
|
||||||
|
|
||||||
class FSpinePlugin : public SpinePlugin {
|
class FSpinePlugin : public SpinePlugin {
|
||||||
virtual void StartupModule() override;
|
virtual void StartupModule() override;
|
||||||
virtual void ShutdownModule() override;
|
virtual void ShutdownModule() override;
|
||||||
|
|||||||
@ -107,12 +107,14 @@ void USpineSkeletonAnimationComponent::CheckState () {
|
|||||||
|
|
||||||
if (Atlas && SkeletonData) {
|
if (Atlas && SkeletonData) {
|
||||||
spSkeletonData* data = SkeletonData->GetSkeletonData(Atlas->GetAtlas(false), false);
|
spSkeletonData* data = SkeletonData->GetSkeletonData(Atlas->GetAtlas(false), false);
|
||||||
skeleton = spSkeleton_create(data);
|
if (data) {
|
||||||
spAnimationStateData* stateData = SkeletonData->GetAnimationStateData(Atlas->GetAtlas(false));
|
skeleton = spSkeleton_create(data);
|
||||||
state = spAnimationState_create(stateData);
|
spAnimationStateData* stateData = SkeletonData->GetAnimationStateData(Atlas->GetAtlas(false));
|
||||||
state->rendererObject = (void*)this;
|
state = spAnimationState_create(stateData);
|
||||||
state->listener = callback;
|
state->rendererObject = (void*)this;
|
||||||
trackEntries.Empty();
|
state->listener = callback;
|
||||||
|
trackEntries.Empty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastAtlas = Atlas;
|
lastAtlas = Atlas;
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "Runtime/Core/Public/Misc/MessageDialog.h"
|
||||||
|
|
||||||
#define LOCTEXT_NAMESPACE "Spine"
|
#define LOCTEXT_NAMESPACE "Spine"
|
||||||
|
|
||||||
@ -103,10 +104,22 @@ spSkeletonData* USpineSkeletonDataAsset::GetSkeletonData (spAtlas* Atlas, bool F
|
|||||||
if (skeletonDataFileName.GetPlainNameString().Contains(TEXT(".json"))) {
|
if (skeletonDataFileName.GetPlainNameString().Contains(TEXT(".json"))) {
|
||||||
spSkeletonJson* json = spSkeletonJson_create(Atlas);
|
spSkeletonJson* json = spSkeletonJson_create(Atlas);
|
||||||
this->skeletonData = spSkeletonJson_readSkeletonData(json, (const char*)rawData.GetData());
|
this->skeletonData = spSkeletonJson_readSkeletonData(json, (const char*)rawData.GetData());
|
||||||
|
if (!skeletonData) {
|
||||||
|
#if WITH_EDITORONLY_DATA
|
||||||
|
FMessageDialog::Debugf(FText::FromString(UTF8_TO_TCHAR(json->error)));
|
||||||
|
#endif
|
||||||
|
UE_LOG(SpineLog, Error, TEXT("Couldn't load skeleton data and atlas: %s"), UTF8_TO_TCHAR(json->error));
|
||||||
|
}
|
||||||
spSkeletonJson_dispose(json);
|
spSkeletonJson_dispose(json);
|
||||||
} else {
|
} else {
|
||||||
spSkeletonBinary* binary = spSkeletonBinary_create(Atlas);
|
spSkeletonBinary* binary = spSkeletonBinary_create(Atlas);
|
||||||
this->skeletonData = spSkeletonBinary_readSkeletonData(binary, (const unsigned char*)rawData.GetData(), (int)rawData.Num());
|
this->skeletonData = spSkeletonBinary_readSkeletonData(binary, (const unsigned char*)rawData.GetData(), (int)rawData.Num());
|
||||||
|
if (!skeletonData) {
|
||||||
|
#if WITH_EDITORONLY_DATA
|
||||||
|
FMessageDialog::Debugf(FText::FromString(UTF8_TO_TCHAR(binary->error)));
|
||||||
|
#endif
|
||||||
|
UE_LOG(SpineLog, Error, TEXT("Couldn't load skeleton data and atlas: %s"), UTF8_TO_TCHAR(binary->error));
|
||||||
|
}
|
||||||
spSkeletonBinary_dispose(binary);
|
spSkeletonBinary_dispose(binary);
|
||||||
}
|
}
|
||||||
if (animationStateData) {
|
if (animationStateData) {
|
||||||
|
|||||||
@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
#include "ModuleManager.h"
|
#include "ModuleManager.h"
|
||||||
|
|
||||||
|
DECLARE_LOG_CATEGORY_EXTERN(SpineLog, Log, All);
|
||||||
|
|
||||||
class SPINEPLUGIN_API SpinePlugin : public IModuleInterface {
|
class SPINEPLUGIN_API SpinePlugin : public IModuleInterface {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user