spSkeletonData* USpineSkeletonDataAsset::GetSkeletonData (spAtlas* Atlas, bool ForceReload) {
	if (!skeletonData || ForceReload) {
		if (skeletonData) {
			spSkeletonData_dispose(skeletonData);
			skeletonData = nullptr;
		}		
		int dataLen = rawData.Num();
		if (skeletonDataFileName.GetPlainNameString().Contains(TEXT(".json"))) {
			spSkeletonJson* json = spSkeletonJson_create(Atlas);
			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);
		} else {
			spSkeletonBinary* binary = spSkeletonBinary_create(Atlas);
			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);
		}
		if (animationStateData) {
			spAnimationStateData_dispose(animationStateData);
			GetAnimationStateData(Atlas);
		}
		lastAtlas = Atlas;
	}
	return this->skeletonData;
}
spSkeletonData* USpineSkeletonDataAsset::GetSkeletonData (spAtlas* Atlas, bool ForceReload) {
	if (!skeletonData || ForceReload) {
		if (skeletonData) {
			spSkeletonData_dispose(skeletonData);
			skeletonData = nullptr;
		}		
		int dataLen = rawData.Num();
		if (skeletonDataFileName.GetPlainNameString().Contains(TEXT(".json"))) {
			spSkeletonJson* json = spSkeletonJson_create(Atlas);
			this->skeletonData = spSkeletonJson_readSkeletonData(json, (const char*)rawData.GetData());
			spSkeletonJson_dispose(json);
		} else {
			spSkeletonBinary* binary = spSkeletonBinary_create(Atlas);
			this->skeletonData = spSkeletonBinary_readSkeletonData(binary, (const unsigned char*)rawData.GetData(), (int)rawData.Num());
			spSkeletonBinary_dispose(binary);
		}
		if (animationStateData) {
			spAnimationStateData_dispose(animationStateData);
			GetAnimationStateData(Atlas);
		}
		lastAtlas = Atlas;
	}
	return this->skeletonData;
}