FOR_EACH_COLLECTION(i, textureTimelineDict) { SkeletonSlotModel* slotModel = i->Key; StringTimelineModel* timelineModel = i->Value; SkeletonSlot* slot = skeleton->FindSlot(slotModel->Name()); SkeletonSlotAttachmentNameTimeline* timeline = new SkeletonSlotAttachmentNameTimeline(timelineModel, true); timeline->Initialize(slot); mTimelines.Add(timeline); }
FOR_EACH_COLLECTION(i, vertexTimelineDcit) { const KeyValuePair<SkeletonSlotModel*, ISkeletonAttachmentModel*>& p = i->Key; SkeletonSlotModel* slotModel = p.Key; ISkeletonAttachmentModel* attachmentModel = p.Value; SkeletonSlot* slot = skeleton->FindSlot(slotModel->Name()); VertexTimelineModel* timelineModel = i->Value; SkeletonSlotVertexTimeline* timeline = new SkeletonSlotVertexTimeline(timelineModel, attachmentModel); timeline->Initialize(slot); mTimelines.Add(timeline); }
ISkeleton::ISkeleton(StringRef name, const Share<ISkeletonModel>& model) :INode(name), mModel(model), mAvatarModel(nullptr), mIsBoneVisible(false), mIsSlotVisible(true) { Start(); SetSize(model->GetBoundingSize()); SetAvatarModel(mModel->DefaultAvatar()); //create bones const List<SkeletonBoneModel*>& bones = mModel->Bones(); for (auto boneModel : bones) { SkeletonBone* bone = new SkeletonBone(boneModel); bone->SetSkeleton(this); mBones.Add(bone); mBoneDict.Add(boneModel->Name(), bone); } for (auto bone : mBones) { SkeletonBoneModel* parentBoneModel = bone->Model()->Parent(); if (parentBoneModel != nullptr) { SkeletonBone* parentBone = FindBone(parentBoneModel->Name()); parentBone->AddBone(bone); } } //create slots const List<SkeletonSlotModel*>& slots = mModel->Slots(); uintp slotCount = slots.Count(); FOR_EACH_SIZE(i, slotCount) { SkeletonSlotModel* slotModel = slots[i]; SkeletonBone* bone = FindBone(slotModel->ParentBone()->Name()); SkeletonSlot* slot = new SkeletonSlot(this, slotModel); slot->EnableManaged(); //slot->SetLogicZ(i); bone->AddSlot(slot); mSlots.Add(slot); mSlotDict.Add(slotModel->Name(), slot); AddChild(slot); }
bool SkeletonAnimation::Initialize(void* target) { RETURN_FALSE_IF_FALSE(BaseFiniteRepeatableAction::Initialize(target)); //create time lines ISkeleton* skeleton = (ISkeleton*)target; const Dictionary<SkeletonSlotModel*, ColorTimelineModel*>& colorTimelineDict = mModel->ColorTimelineDict(); FOR_EACH_COLLECTION(i, colorTimelineDict) { SkeletonSlotModel* slotModel = i->Key; ColorTimelineModel* timelineModel = i->Value; SkeletonSlot* slot = skeleton->FindSlot(slotModel->Name()); ColorTimeline* timeline = new ColorTimeline(timelineModel, true); timeline->Initialize(slot); mTimelines.Add(timeline); }