コード例 #1
0
SkeletonRenderer::~SkeletonRenderer () {
	if (_ownsSkeletonData) spSkeletonData_dispose(_skeleton->data);
	spSkeleton_dispose(_skeleton);
	if (_atlas) spAtlas_dispose(_atlas);
	if (_attachmentLoader) spAttachmentLoader_dispose(_attachmentLoader);
	delete _worldVertices;
}
コード例 #2
0
Skeleton::~Skeleton()
{
    spAnimationStateData_dispose(animation_data_);
    spAnimationState_dispose(state_);
    spSkeleton_dispose(skeleton_);
    spSkeletonData_dispose(data_);
    spAtlas_dispose(atlas_);
}
コード例 #3
0
 SpineDrawable::~SpineDrawable()
 {
     if (bounds) spSkeletonBounds_dispose(bounds);
     if (atlas) spAtlas_dispose(atlas);
     if (animationState) spAnimationState_dispose(animationState);
     if (animationStateData) spAnimationStateData_dispose(animationStateData);
     if (skeleton) spSkeleton_dispose(skeleton);
     if (skeletonData) spSkeletonData_dispose(skeletonData);
 }
コード例 #4
0
static void testRunner(const char* jsonName, const char* atlasName)
{
	///////////////////////////////////////////////////////////////////////////
	// Global Animation Information
	spAtlas* atlas = spAtlas_createFromFile(atlasName, 0);
	ASSERT(atlas != 0);

	spSkeletonData* skeletonData = readSkeletonJsonData(jsonName, atlas);
	ASSERT(skeletonData != 0);

	spAnimationStateData* stateData = spAnimationStateData_create(skeletonData);
	ASSERT(stateData != 0);
	stateData->defaultMix = 0.2f; // force mixing

	///////////////////////////////////////////////////////////////////////////
	// Animation Instance 
	spSkeleton* skeleton = spSkeleton_create(skeletonData);
	ASSERT(skeleton != 0);

	spAnimationState* state = spAnimationState_create(stateData);
	ASSERT(state != 0);


	///////////////////////////////////////////////////////////////////////////
	// Run animation
	spSkeleton_setToSetupPose(skeleton);
	SpineEventMonitor eventMonitor(state);
//	eventMonitor.SetDebugLogging(true);


	AnimList anims; // Let's chain all the animations together as a test
	size_t count = enumerateAnimations(anims, skeletonData);
	if (count > 0) spAnimationState_setAnimationByName(state, 0, anims[0].c_str(), false);
	for (size_t i = 1; i < count; ++i) {
		spAnimationState_addAnimationByName(state, 0, anims[i].c_str(), false, 0.0f);
	}

	// Run Loop
	for (int i = 0; i < MAX_RUN_TIME && eventMonitor.isAnimationPlaying(); ++i) {
		const float timeSlice = 1.0f / 60.0f;
		spSkeleton_update(skeleton, timeSlice);
		spAnimationState_update(state, timeSlice);
		spAnimationState_apply(state, skeleton);
	}

	
	///////////////////////////////////////////////////////////////////////////
	// Dispose Instance
	spSkeleton_dispose(skeleton);
	spAnimationState_dispose(state);

	///////////////////////////////////////////////////////////////////////////
	// Dispose Global
	spAnimationStateData_dispose(stateData);
	spSkeletonData_dispose(skeletonData);
	spAtlas_dispose(atlas);
}
コード例 #5
0
void USpineSkeletonDataAsset::BeginDestroy () {
	if (this->skeletonData) {
		spSkeletonData_dispose(this->skeletonData);
		this->skeletonData = nullptr;
	}
	if (this->animationStateData) {
		spAnimationStateData_dispose(this->animationStateData);
		this->animationStateData = nullptr;
	}
	Super::BeginDestroy();
}
コード例 #6
0
static void DisposeAll(spSkeleton* skeleton, spAnimationState* state, spAnimationStateData* stateData, spSkeletonData* skeletonData, spAtlas* atlas)
{
	///////////////////////////////////////////////////////////////////////////
	// Dispose Instance
	spSkeleton_dispose(skeleton);
	spAnimationState_dispose(state);

	///////////////////////////////////////////////////////////////////////////
	// Dispose Global
	spAnimationStateData_dispose(stateData);
	spSkeletonData_dispose(skeletonData);
	spAtlas_dispose(atlas);
}
コード例 #7
0
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;
}
コード例 #8
0
void SkeletonAnimationFbo::releaseSkeletonRelatedData()
{
    if (mspAnimationState){
        spAnimationStateData_dispose(mspAnimationState->data);
        spAnimationState_dispose(mspAnimationState);
        mspAnimationState = 0;
    }

    if (mspSkeleton)
        spSkeletonData_dispose(mspSkeleton->data);

    if (mspAtlas){
        spAtlas_dispose(mspAtlas);
        mspAtlas = 0;
    }

    if (mspSkeleton) {
        spSkeleton_dispose(mspSkeleton);
        mspSkeleton = 0;
    }

    mSkeletonLoaded = false;
    mShouldRelaseCacheTexture = true;
}
コード例 #9
0
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;
}
コード例 #10
0
Skeleton::~Skeleton () {
	if (ownsSkeletonData) spSkeletonData_dispose(skeleton->data);
	if (atlas) spAtlas_dispose(atlas);
	spSkeleton_dispose(skeleton);
}