예제 #1
0
void CCharEntity::StopOverlayAnimation(nTime FadeIn)
{
	OverlayAnimNames.Clear();
	OverlayAnimWeights.Clear();
	RestartOverlayAnim = 0;
	if (!BaseAnimNames.Empty()) ActivateAnimations(BaseAnimNames, BaseAnimWeights, FadeIn);
}
예제 #2
0
void CCharEntity::SetOverlayAnimationMix(const nArray<nString>& AnimNames, const nArray<float>& Weights,
										 nTime FadeIn, nTime OverrideDuration)
{
	n_assert(AnimNames.Size() >= 1);
	n_assert(Weights.Size() >= 1);
	n_assert(pNCharacter);
	n_assert(pCharacterSet);
	n_assert(pNCharacter->GetSkinAnimator());

	const nString& MappedName = GfxSrv->GetAnimationName(AnimMapping, AnimNames[0]).Name;
	int Idx = pNCharacter->GetSkinAnimator()->GetClipIndexByName(MappedName);
	if (Idx != INVALID_INDEX)
	{
		OverlayAnimNames = AnimNames;
		OverlayAnimWeights = Weights;
		OverlayAnimStarted = GetEntityTime();
		if (OverrideDuration > 0.0) OverlayAnimDuration = OverrideDuration;
		else if (TimeFactor > 0.0f)
		{
			OverlayAnimDuration = (pNCharacter->GetSkinAnimator()->GetClipDuration(Idx) - FadeIn) / TimeFactor;
			if (OverlayAnimDuration < 0.0) BaseAnimDuration = 0.0;
		}
		else OverlayAnimDuration = 0.0;

		RestartOverlayAnim = 1;
		OverlayEndFadeIn = FadeIn;

		ActivateAnimations(OverlayAnimNames, OverlayAnimWeights, FadeIn);
	}
}
예제 #3
0
void MythScreenType::aboutToHide(void)
{
    if (!m_FullScreen)
    {
        if (!GetMythMainWindow()->GetPaintWindow()->mask().isEmpty())
        {
            // remove this screen's area from the mask so any embedded video is
            // shown which was covered by this screen
            if (!m_SavedMask.isEmpty())
                GetMythMainWindow()->GetPaintWindow()->setMask(m_SavedMask);
        }
    }

    ActivateAnimations(MythUIAnimation::AboutToHide);
}
예제 #4
0
void MythScreenType::aboutToShow(void)
{
    if (!m_FullScreen)
    {
        if (!GetMythMainWindow()->GetPaintWindow()->mask().isEmpty())
        {
            // add this screens area to the mask so any embedded video isn't
            // shown in front of this screen
            QRegion region = GetMythMainWindow()->GetPaintWindow()->mask();
            m_SavedMask = region;
            region = region.unite(QRegion(m_Area));
            GetMythMainWindow()->GetPaintWindow()->setMask(region);
        }
    }

    ActivateAnimations(MythUIAnimation::AboutToShow);
}
예제 #5
0
// This method checks whether the current overlay animation is over and the base animation must be re-activated.
void CCharEntity::OnRenderBefore()
{
	CShapeEntity::OnRenderBefore();

	if (pNCharacter)
	{
		if (IsOverlayAnimationActive())
		{
			// HACK: overlay animation needs to be stopped slightly before it's computed end time to avoid plopping
			static const nTime OverlayAnimStopBuffer = 0.3; // to assert overlay stopping before animation has finished
			nTime EndTime = OverlayAnimStarted + OverlayAnimDuration - OverlayAnimStopBuffer;
			if (GetEntityTime() >= EndTime)
			{
				StopOverlayAnimation(OverlayEndFadeIn);

				if (ActivateNewBaseAnim && BaseAnimNames.Size() > 0)
				{
					n_assert(BaseAnimWeights.Size() == BaseAnimNames.Size());
					ActivateNewBaseAnim = false;
					ActivateAnimations(BaseAnimNames, BaseAnimWeights, BaseAnimFadeIn);
				}
			}
		}

		// emit animation events
		n_assert(pNCharacter);
		float CurrTime = float(GetEntityTime());
		pNCharacter->EmitAnimEvents(CurrTime - (float)(GfxSrv->EntityTimeSrc->GetFrameTime()) * TimeFactor, CurrTime);
	}

	//if (IsChar3Mode)
	//{
	//	n_assert(pCharacter3Node);
	//	SetLocalBox(pCharacter3Node->GetLocalBox());
	//}
}
예제 #6
0
void CCharEntity::SetBaseAnimationMix(const nArray<nString>& AnimNames, const nArray<float>& Weights,
									  nTime FadeIn, nTime Offset)
{
	n_assert(AnimNames.Size() >= 1);
	n_assert(Weights.Size() >= 1);
	n_assert(pNCharacter);
	n_assert(pCharacterSet);
	n_assert(pNCharacter->GetSkinAnimator());

	const nString& MappedName = GfxSrv->GetAnimationName(AnimMapping, AnimNames[0]).Name;
	int Idx = pNCharacter->GetSkinAnimator()->GetClipIndexByName(MappedName);
	if (Idx != INVALID_INDEX)
	{
		BaseAnimNames = AnimNames;
		BaseAnimWeights = Weights;
		BaseAnimStarted = GetEntityTime();
		BaseAnimFadeIn = FadeIn;
		if (TimeFactor > 0.0f)
		{
			BaseAnimDuration = (pNCharacter->GetSkinAnimator()->GetClipDuration(Idx) - FadeIn) / TimeFactor;
			if (BaseAnimDuration < 0.0) BaseAnimDuration = 0.0;
		}
		else BaseAnimDuration = 0.0;
		BaseAnimOffset = Offset;

		if (!IsOverlayAnimationActive()) ActivateAnimations(BaseAnimNames, BaseAnimWeights, FadeIn);
		else ActivateNewBaseAnim = true;
	}
	else
	{
#ifdef _DEBUG
		n_printf("CCharEntity::SetBaseAnimationMix:: AnimColumn: %s AnimRow: %s -> Animation %s not found! \n",
			AnimMapping.Get(), AnimNames[0].Get(), MappedName.Get());
#endif
	}
}