void dModel::InitFromModel (const dModel& source) { while (m_skeleton.GetCount()) { RemoveSkeleton(m_skeleton.GetFirst()->GetInfo()); } while (m_meshList.GetCount()) { RemoveMesh(m_meshList.GetFirst()->GetInfo().m_mesh); } while (m_animations.GetCount()) { RemoveAnimation(m_animations.GetFirst()->GetInfo()); } for (dList<dBone*>::dListNode* node = source.m_skeleton.GetFirst(); node; node = node->GetNext()) { int stack = 1; dBone* pool[64]; dBone* parentBones[64]; parentBones[0] = NULL; dBone* rootBone = NULL; pool[0] = node->GetInfo(); while (stack) { stack --; dBone* parent = parentBones[stack]; dBone* sourceBone = pool[stack]; dBone* bone = new dBone (*sourceBone, parent); if (!rootBone) { rootBone = bone; } for (sourceBone = sourceBone->GetChild(); sourceBone; sourceBone = sourceBone->GetSibling()) { pool[stack] = sourceBone; parentBones[stack] = bone; stack ++; } } AddSkeleton(rootBone); rootBone->Release(); } for (dList<dAnimationClip*>::dListNode* node = source.m_animations.GetFirst(); node; node = node->GetNext()) { AddAnimation(node->GetInfo()); } for (dList<dMeshInstance>::dListNode* node = source.m_meshList.GetFirst(); node; node = node->GetNext()) { AddMesh(node->GetInfo().m_mesh); dMeshInstance& instance = m_meshList.GetLast()->GetInfo(); instance.m_boneID = node->GetInfo().m_boneID; if (node->GetInfo().GetModifier()) { instance.SetModifier(node->GetInfo().GetModifier()->CreateCopy (instance, *this)); } } }
void CAnimationFrame::RemoveAnimation(TCallBack* aFunc) { if (iFuncs) { TInt index = iFuncs->Find(aFunc); if (index != KErrNotFound) { RemoveAnimation(index); } } }
SelectionMarkerEntity::~SelectionMarkerEntity() { ((KinematicBody*)m_pBody)->DetachMotionController(); PhysicsFn->DestroyController( m_pController ); m_pController = NULL; // Animation data RemoveAnimation(); // Graphic data RemoveGraphics(); }
// for use with limited time (non-repeating) animations like attack void AnimationController::PushAnimation(Type type) { switch(type) { case ATTACK: attack_animation->Reset(); animation_stack.push(attack_animation); break; case STUCK: RemoveAnimation(ATTACK); stuck_animation->Reset(); animation_stack.push(stuck_animation); break; case HIT: RemoveAnimation(HIT); RemoveAnimation(ATTACK); hit_animation->Reset(); animation_stack.push(hit_animation); break; } animation_stack.top()->SetRow(int(direction)); }
void DocumentTimeline::WillRefresh(mozilla::TimeStamp aTime) { MOZ_ASSERT(mIsObservingRefreshDriver); MOZ_ASSERT(GetRefreshDriver(), "Should be able to reach refresh driver from within WillRefresh"); bool needsTicks = false; nsTArray<Animation*> animationsToRemove(mAnimations.Count()); nsAutoAnimationMutationBatch mb(mDocument); for (Animation* animation = mAnimationOrder.getFirst(); animation; animation = animation->getNext()) { // Skip any animations that are longer need associated with this timeline. if (animation->GetTimeline() != this) { // If animation has some other timeline, it better not be also in the // animation list of this timeline object! MOZ_ASSERT(!animation->GetTimeline()); animationsToRemove.AppendElement(animation); continue; } needsTicks |= animation->NeedsTicks(); // Even if |animation| doesn't need future ticks, we should still // Tick it this time around since it might just need a one-off tick in // order to dispatch events. animation->Tick(); if (!animation->IsRelevant() && !animation->NeedsTicks()) { animationsToRemove.AppendElement(animation); } } for (Animation* animation : animationsToRemove) { RemoveAnimation(animation); } if (!needsTicks) { // We already assert that GetRefreshDriver() is non-null at the beginning // of this function but we check it again here to be sure that ticking // animations does not have any side effects that cause us to lose the // connection with the refresh driver, such as triggering the destruction // of mDocument's PresShell. MOZ_ASSERT(GetRefreshDriver(), "Refresh driver should still be valid at end of WillRefresh"); UnregisterFromRefreshDriver(); } }
CharEntity::~CharEntity() { if ( m_bPathTrackingMode ) EndPathTracking(); ((KinematicBody*)m_pBody)->DetachMotionController(); PhysicsFn->DestroyController( m_pController ); m_pController = NULL; // Animation data RemoveAnimation(); // Graphic data RemoveGraphics(); }
void AnimatorBar::OnRClickAnimation(NMHDR *pNMHDR, LRESULT *pResult) { if (application == NULL) return; CPoint Pt; GetCursorPos(&Pt); animations.ScreenToClient(&Pt); if (animations.HitTest(Pt)) animations.SelectItem(animations.HitTest(Pt)); curHTreeItem = animations.GetSelectedItem(); if(animations.GetCount() == 0) return; //Theres no animations in this tree, so the object doesn't have animations // Check for this if (!animations.HitTest(Pt)) { curHTreeItem = TVI_ROOT; m_pCurrentAnimation = m_pAnimation; } else m_pCurrentAnimation = (CAnimation*)animations.GetItemData(curHTreeItem); POINT MousePosition; GetCursorPos(&MousePosition); CExtPopupMenuWnd * popup = new CExtPopupMenuWnd; popup->LoadMenu(m_hWnd, IDR_BLANK, true, false); popup->ItemRemove(0); UINT ChosenItem = 0; // Add menu items popup->ItemInsertCommand(1, -1, AB_ADDNEWANIMATION, NULL, NULL); if (curHTreeItem != TVI_ROOT) popup->ItemInsertCommand(2, -1, AB_ADDSUBANIMATION, NULL, NULL); if (curHTreeItem != TVI_ROOT) { popup->ItemInsert(); popup->ItemInsertCommand(3, -1, AB_ADDNEWANGLE, NULL, NULL); } if (curHTreeItem != TVI_ROOT) { popup->ItemInsert(); popup->ItemInsertCommand(4, -1, REMOVE, NULL, NULL); } popup->TrackPopupMenu(TPMX_DO_MESSAGE_LOOP | TPMX_NO_WM_COMMAND | TPMX_NO_CMD_UI, MousePosition.x, MousePosition.y, NULL, NULL, NULL, &ChosenItem); if (ChosenItem == 1) AddAnimation(); else if (ChosenItem == 2) AddSubAnimation(); else if (ChosenItem == 3) AddAngle(); else if (ChosenItem == 4) RemoveAnimation(); }