//-----------------------------------------------------------------------------
// Purpose: Called when an object that we depend on has changed.
//-----------------------------------------------------------------------------
void CMapKeyFrame::OnNotifyDependent(CMapClass *pObject, Notify_Dependent_t eNotifyType)
{
	CMapClass::OnNotifyDependent(pObject, eNotifyType);

	if ((pObject == m_pAnimator) && (eNotifyType == Notify_Removed))
	{
		SetAnimator(NULL);
	}

	//
	// If our next keyframe was deleted, try to link to the one after it.
	//
	if ((pObject == m_pNextKeyFrame) && (eNotifyType == Notify_Removed))
	{
		CMapEntity *pNextParent = m_pNextKeyFrame->GetParentEntity();
		CMapEntity *pParent = GetParentEntity();

		if ( pNextParent && pParent )
		{
			const char *szNext = pNextParent->GetKeyValue("NextKey");
			pParent->SetKeyValue("NextKey", szNext);
		}
	}

	m_bRebuildPath = true;
}
Exemple #2
0
MAS::Widget::Widget()
:MAS::Rect(0,0,0,0),
   flags(0),
   key(0),
   callbackID(-1),
   bitmap(-1),
   parent(NULL),
   animator(NULL),
   animLength(1),
   animType(Animator::NONE),
   tooltipText(NULL)
{
   skin = NULL;
   SetSkin(MAS::theSkin);

   SetAnimator(new Animator);

   normalizedRect = Rect(-1,-1,-1,-1);
}
Exemple #3
0
/*
================
idAF::Restore
================
*/
void idAF::Restore( idRestoreGame *savefile )
{
	savefile->ReadObject( reinterpret_cast<idClass *&>( self ) );
	savefile->ReadString( name );
	savefile->ReadBool( hasBindConstraints );
	savefile->ReadVec3( baseOrigin );
	savefile->ReadMat3( baseAxis );
	savefile->ReadInt( poseTime );
	savefile->ReadInt( restStartTime );
	savefile->ReadBool( isLoaded );
	savefile->ReadBool( isActive );
	
	animator = NULL;
	modifiedAnim = 0;
	
	if( self )
	{
		SetAnimator( self->GetAnimator() );
		Load( self, name );
		if( hasBindConstraints )
		{
			AddBindConstraints();
		}
	}
	
	savefile->ReadStaticObject( physicsObj );
	
	if( self )
	{
		if( isActive )
		{
			// clear all animations
			animator->ClearAllAnims( gameLocal.time, 0 );
			animator->ClearAllJoints();
			
			// switch to articulated figure physics
			self->RestorePhysics( &physicsObj );
			physicsObj.EnableClip();
		}
		UpdateAnimation();
	}
}