This article relates to the game "Dota 2". Click here for more information.
This article relates to the SDK/Workshop Tools for "Dota 2 Workshop Tools". Click here for more information.
This article's documentation is for Source 2. Click here for more information.

Animation

From Valve Developer Community
Jump to: navigation, search
English (en)
Edit

Animation files are stored in animation groups. A VMDL can have multiple animation groups and they can be internal or external.

Display

  • Click on an animation item to play that animation in the viewport. Use the timeline to play/pause, adjust play back speed, and scrub the animation.

Create

Edit

  • To add a material remap item, select the "Material Remap List" item and press the green "+" button in the property editor.
  • To edit a material remap item, select it in the outliner.

Data Structures

The vmdl animation reference data looks like this:

CVanimGroupReference[] m_pAnimGroups = 
[
	CVanimGroupReference
	{
		CVanimGroup* m_pObject = &CVanimGroup_0
		string m_sFileName = ""
	}
]

m_pAnimGroups

A list of CVanimGroupReference elements

CVanimGroupReference

A reference to an internal or external CVanimGroup

Attribute Friendly Name Description Type Default Value
m_pObject pointer to the internal CVanimGroup CVanimGroup*
m_sFileName content relative path to the external CVhitBoxSetList string
m_sScripts Scripts A list of script files string[]

CVanimGroup

Animation group, looks like this in the vmdl:

CVanimGroup CVanimGroup_0
{
	string m_Name = ""
	CVReferenceSkeletonReference m_pReferenceSkeleton = CVReferenceSkeletonReference
	{
		CVReferenceSkeleton* m_pObject = NULL
		string m_sFileName = ""
	}
	CVBoneFlagListReference m_pBoneFlagList = CVBoneFlagListReference
	{
		CVBoneFlagList* m_pObject = NULL
		string m_sFileName = ""
	}
	CVseqGroupReference m_pSeqGroup = CVseqGroupReference
	{
		CVseqGroup* m_pObject = NULL
		string m_sFileName = ""
	}
	CVanimGroupReference[] m_pAnimGroups = 
	[
		
	]
	CVanim[] m_Vanim = 
	[
		CVanim
		{
			string m_Animationname = "attack01"
			string m_Filepath = "models\\sdk_character\\dmx\\animation\\attack01.dmx"
			int m_nStartframe = 0
			int m_nEndframe = 54
			float m_flFps = 30.000000
			CAnimationLoop m_Loop = CAnimationLoop
			{
				bool m_bLoop = false
				bool m_bSmoothLoop = false
				int m_nSmoothLoopStart = 0
				int m_nSmoothLoopEnd = 0
				CVAnimCmdStartLoop m_StartLoop = CVAnimCmdStartLoop
				{
					bool m_bEnabled = false
					int m_nLoopRestart = 0
				}
			}
			bool m_bHidden = false
			CActivity[] m_Activities = 
			[
				
			]
			CAnimationEvent[] m_AnimationEvents = 
			[
				
			]
			CMotionFrame[] m_MotionFrames = 
			[
				CMotionFrame
				{
					int m_nFrame = 0
					bool m_bExtractTX = true
					bool m_bExtractTY = true
					bool m_bExtractTZ = false
					bool m_bExtractRX = false
					bool m_bExtractRY = false
					bool m_bExtractRZ = false
					bool m_bDiscardTX = false
					bool m_bDiscardTY = false
					bool m_bDiscardTZ = false
					bool m_bDiscardRX = false
					bool m_bDiscardRY = false
					bool m_bDiscardRZ = false
				}
			]
			CIKrule*[] m_pIkRules = 
			[
				
			]
			CAdjustAnimation m_adjustAnimation = CAdjustAnimation
			{
				float(3) m_translation = ( 0.000000, 0.000000, 0.000000 )
				float(3) m_rotation = ( 0.000000, 0.000000, 0.000000 )
			}
			string[] m_Keywords = 
			[
				
			]
		}
	]
	string[] m_sScripts = 
	[
		
	]
}

CVanimGroup

Attribute Friendly Name Description Type Default Value
m_name Name Name of the animation group string
m_pReferenceSkeleton Skeleton Pointer to a CVReferenceSkeleton CVReferenceSkeletonReference
m_pBoneFlagList Bone Encoding Flags Pointer to a CVBoneFlagList CVBoneFlagListReference
m_pSeqGroup Sequence Group Pointer to a CVseqGroup CVseqGroupReference
m_pAnimGroups Animation Group References A list of external animation groups CVanimGroupReference[]
m_Vanim Animations A list of CVanim files CVanim[]
Note.pngNote:m_pSeqGroup, and m_pReferenceSkeleton are not longer used.

CVanim

Attribute Friendly Name Description Type Default Value
m_Animationname Name Name of the animation string
m_Filepath File Path Content relative path to the source file string
m_nStartframe Start Frame Start frame of the animation int 0
m_nEndFrame End Frame End frame of the animation int 0
m_flFps FPS Frame rate of the animation float 30.0
m_Loop Animation Loop Commands CAnimationLoop
m_bHidden Hidden Hide the compiled sequence from the UI bool false
m_Activities Activities A list of CActivity elements CActivity[]
m_AnimationEvents Animation Events A list of CAnimationEvent elements CAnimationEvent[]
m_MotionFrames Motion Frames A list of CMotionFrame elements CMotionFrame[]
m_pIkRules IK Rules A list of CIKrule* elements CIKrule*[]
m_adjustAnimation Adjust Animation CAdjustAnimation element CAdjustAnimation
m_Keywords Keywords A list of keywords string[]

CAnimationLoop

Attribute Friendly Name Description Type Default Value
m_bLoop Loop Should the animation loop bool false
m_bSmoothLoop Smooth Loop Should the animation smooth out the loop bool false
m_nSmoothLoopStart Frames From Start Smooth this many frames in from the start int 0
m_nSmoothLoopEnd Frames From End Smooth this many frames in from the end int 0
m_StartLoop Animation Start Loop CVAnimCmdStartLoop

CVAnimCmdStartLoop

Attribute Friendly Name Description Type Default Value
m_bEnabled Start Loop Should the animation have a forced start loop bool false
m_nLoopRestart Loop Restart Frame to restart the loop on bool false

CActivity

Attribute Friendly Name Description Type Default Value
m_Name Name Name of the activity string
m_nWeight Weight Weight of the activity int 1

CAnimationEvent

Attribute Friendly Name Description Type Default Value
m_Event Event Animation event name string
m_nFrame Frame Frame the event is triggered on int 0
m_DataString Data String Additional information string

CMotionFrame

Attribute Friendly Name Description Type Default Value
m_nFrame Frame Frame to extract the motion from int 0
m_bExtractTX Extract TX Extract X translation bool false
m_bExtractTY Extract TY Extract Y translation bool false
m_bExtractTZ Extract TZ Extract Z translation bool false
m_bExtractRX Extract RX Extract X rotation bool false
m_bExtractRY Extract RY Extract Y rotation bool false
m_bExtractRZ Extract RZ Extract Z rotation bool false
m_bDiscardTX Discard TX Discard X translation bool false
m_bDiscardTY Discard TY Discard Y translation bool false
m_bDiscardTZ Discard TZ Discard Z translation bool false
m_bDiscardRX Discard RX Discard X rotation bool false
m_bDiscardRY Discard RY Discard Y rotation bool false
m_bDiscardRZ Discard RZ Discard Z rotation bool false
Tip.pngTip:adding a single motion frame on frame 0 of the animation will extract motion linearly across the entire animation.

CAdjustAnimation

Warning: Display title "Animation" overrides earlier display title "VMDL (Source 2)/Animation".
Attribute Friendly Name Description Type Default Value
m_translation Translation Adjust the translation of the animation by this amount float( 3 ) ( 0.000000, 0.000000, 0.000000 )
m_rotation Rotation Adjust the rotation of the animation by this amount float( 3 ) ( 0.000000, 0.000000, 0.000000 )