void SkeletonAnimationFbo::setSkin(const QString & value) { if (mSkin == value) return; mSkin = value; Q_EMIT skinChanged(); if (isSkeletonValid()){ const bool res = spSkeleton_setSkinByName(mspSkeleton, mSkin.toStdString().c_str()); if (!res) qDebug()<<"SkeletonAnimation::setSkin Error: Invalid skin:"<<mSkin; } }
void SkeletonAnimationFbo::loadSkeletonAndAtlasData() { releaseSkeletonRelatedData(); if (mAtlasFile.isEmpty() || !mAtlasFile.isValid()){ qDebug()<<"SkeletonAnimation::loadSkeletonAndAtlasData Error: Invalid AtlasFile:"<<mAtlasFile; return; } if (mSkeletonDataFile.isEmpty() || !mSkeletonDataFile.isValid()){ qDebug()<<"SkeletonAnimation::loadSkeletonAndAtlasData Error: Invalid SkeletonDataFile:"<<mSkeletonDataFile; return; } std::string atlasFile = QQmlFile::urlToLocalFileOrQrc(mAtlasFile).toStdString(); mspAtlas = spAtlas_createFromFile(atlasFile.c_str(), 0); if (!mspAtlas){ qDebug()<<"SkeletonAnimation::loadSkeletonAndAtlasData Error: Atals is null. AtlasFile:"<<mAtlasFile; return; } spSkeletonJson* json = spSkeletonJson_create(mspAtlas); json->scale = mScale; std::string skeletonFile = QQmlFile::urlToLocalFileOrQrc(mSkeletonDataFile).toStdString(); spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(json, skeletonFile.c_str()); if (!skeletonData){ qDebug()<<"SkeletonAnimation::loadSkeletonAndAtlasData Error: Failed to load json. jason error:"<<(json->error ? json->error : "null."); releaseSkeletonRelatedData(); return; } spSkeletonJson_dispose(json); mspSkeleton = spSkeleton_create(skeletonData); mspRootBone = mspSkeleton->bones[0]; const bool res = spSkeleton_setSkinByName(mspSkeleton, mSkin.toStdString().c_str()); if (!res && !mSkin.isEmpty()) qDebug()<<"SkeletonAnimation::loadSkeletonAndAtlasData Error: Invalid skin:"<<mSkin; mspAnimationState = spAnimationState_create(spAnimationStateData_create(mspSkeleton->data)); mspAnimationState->rendererObject = this; mspAnimationState->listener = animationCallback; mSkeletonLoaded = true; mTimer.invalidate(); }
bool SkeletonRenderer::setSkin (const char* skinName) { return spSkeleton_setSkinByName(_skeleton, skinName) ? true : false; }
bool SkeletonRenderer::setSkin (const std::string& skinName) { return spSkeleton_setSkinByName(_skeleton, skinName.empty() ? 0 : skinName.c_str()) ? true : false; }
void Skeleton::set_skin(const char* skin) { spSkeleton_setSkinByName(skeleton_, skin); spSkeleton_setToSetupPose(skeleton_); }
bool CCSkeleton::setSkin (const char* skinName) { return spSkeleton_setSkinByName(skeleton, skinName) ? true : false; }