Source 2 Animation System VScript API
The model animation system in the Dota 2 and SteamVR Workshop Tools features a VScript interface, allowing the use of Lua scripts to create advanced animation sequences. The sequences work analogous to the $animation and $sequence QC commands used in Source 1.
Classes
CModelVScriptCompile
Reference to the model. Accessed from the model
variable in the animation script.
Function | Signature | Description |
---|---|---|
CreateIKChain | int CreateIKChain(string chainName, table parameters)
|
Define an IK chain. This only seems to be available in run-time scripts. |
CreateIKControlRig | int CreateIKControlRig(string unknown, table parameters)
|
|
CreatePoseParameter | int CreatePoseParameter(string name, float min, float max, float loopPoint, boolean looping)
|
Adds or merges the pose parameter range of the specified pose parameter. |
CreateSequence | IVSSequence CreateSequence(table parameters)
|
Create a new sequence on the model by specifying the sequence type (string), name and a table of parameters. |
CreateTransitionGraph | bool CreateTransitionGraph(table parameters)
|
Create the transition graph on the model by specifying a table of parameters. |
CreateTransitionStateGraph | bool CreateTransitionStateGraph(table parameters)
|
Create a transition graph on the model by specifying a table of parameters, conditions, states, and transitions |
CreateWeightlist | int CreateWeightlist(string name, array weights)
|
Creates a weightlist on the model. Array syntax: { { string bone, float weight }, ... } |
GetAnimationList | table GetAnimationList()
|
Get the list of animation names for the model. |
GetModelName | string GetModelName()
|
Returns the name of the model. |
GetSequence | IVSSequence GetSequence(int index = -1, string sequence = nil)
|
Given a name or a sequence index, returns an instance of the sequence class. |
GetSequenceList | table GetSequenceList()
|
Get the list of sequence instances on the model. |
LookupAnimation | int LookupAnimation(string name)
|
Find a named animation index for the model. |
LookupPoseParameter | int LookupPoseParameter(string name)
|
Find a named pose parameter index for the model. |
LookupSequence | int LookupSequence(string name)
|
Find a named sequence index for the model. |
LookupWeightlist | int LookupWeightlist(string name)
|
Find a named weightlist index for the model. |
SequenceGetName | string SequenceGetName(int index)
|
Returns the sequence name given the sequence index. |
SetSkeletonInstanceIKContextParameters | int SetSkeletonInstanceIKContextParameters(table parameters)
|
IVSSequence
Instance of a scripted sequence.
Function | Signature | Description |
---|---|---|
AddEventTypeFlags | unknown AddEventTypeFlags(unknown...)
|
Adds the the specified type flags for specified event on the sequence. |
ClearFlag | unknown ClearFlag(unknown...)
|
Clears the flags given the specified flag mask. |
CPS | unknown CPS(unknown...)
|
Returns the cyclerate (cycles per second) for the sequence given the specified (optional) pose parameters. |
Duration | unknown Duration(unknown...)
|
Returns the duration for the sequence given the specified (optional) pose parameters. |
EntryNode | unknown EntryNode(unknown...)
|
Returns the index of the entry node for the sequence. |
ExitNode | unknown ExitNode(unknown...)
|
Returns the index of the exit node for the sequence. |
FindDistance | unknown FindDistance(unknown...)
|
Returns the distance for the specified distance for the sequence given the specified (optional) pose parameters. |
FPS | unknown FPS(unknown...)
|
Returns the framerate (frames per second) for the sequence given the specified (optional) pose parameters. |
GetActivityName | unknown GetActivityName(unknown...)
|
Returns the name of the activity at the specified index. |
GetActivityType | unknown GetActivityType(unknown...)
|
Returns the type of the activity at the specified index. |
GetActivityWeight | unknown GetActivityWeight(unknown...)
|
Returns the weight of the activity at the specified index. |
GetAllAnimations | unknown GetAllAnimations(unknown...)
|
Returns an array of int's which are the indices of all of the animations this sequence references.
The indices are relative to the model containing this sequence. |
GetAllSequences | unknown GetAllSequences(unknown...)
|
Returns an array of int's which are the indices of all of the sequences this sequence references.
The indices are relative to the model containing this sequence. |
GetAssetInfo | unknown GetAssetInfo(unknown...)
|
Returns a table representing the asset info or nil if there is no asset info on the sequence.
The table is of the form: { name = '<string>, schemaType = <string>, searchName = <string>, sourceFile = <string>, lineNumber = <int> }. |
GetEvent | unknown GetEvent(unknown...)
|
Returns a table representing the animation event at the specified index, form:
{ frame = <float>, cycle = <float>, event = <int>, type = <int> } |
GetFadeInTime | unknown GetFadeInTime(unknown...)
|
Returns the fade in time for the sequence. |
GetFadeOutTime | unknown GetFadeOutTime(unknown...)
|
Returns the fade out time for the sequence. |
GetMaxBounds | unknown GetMaxBounds(unknown...)
|
Returns an array representing the maxiumum bounding box of the sequence, form:
{ min = <Vector>, max = <Vector } |
GetModel | unknown GetModel(unknown...)
|
Get the model this sequence belongs to. |
GetName | unknown GetName(unknown...)
|
Returns the name of the sequence. |
GetNextSequence | unknown GetNextSequence(unknown...)
|
Returns the next sequence and direction given the specified sequence, returns a table of the form
{ sequence = <int>, dir = <int> } |
GetNodeFlags | unknown GetNodeFlags(unknown...)
|
Returns the node flags for the sequence. |
GetPoseParameter | unknown GetPoseParameter(unknown...)
|
Returns the model relative index of the pose parameter at the specified sequence relative pose parameter index. |
GetPoseSettingName | unknown GetPoseSettingName(unknown...)
|
Returns the name of the pose setting at the specified index on the sequence. |
GetPoseSettingValue | unknown GetPoseSettingValue(unknown...)
|
Returns the value of the pose setting at the specified index on the sequence. |
GetRagdollBoneWeights | unknown GetRagdollBoneWeights(unknown...)
|
Returns an array of floats which are the bone weights for weightlist 0 on the sequence. |
IsAnimation | unknown IsAnimation(unknown...)
|
Returns true if the sequence is a single animation sequence. |
IsAutoplay | unknown IsAutoplay(unknown...)
|
Returns true if the sequence is flagged as autoplay |
IsDelta | unknown IsDelta(unknown...)
|
Returns true if the sequence is flagged as delta. |
IsFlagSet | unknown IsFlagSet(unknown...)
|
Returns true if the flag is set given the specified flag mask. |
IsFrameCacheable | unknown IsFrameCacheable(unknown...)
|
Returns true if the sequence is frame cacheable. |
IsHidden | unknown IsHidden(unknown...)
|
Returns true if the sequence is flagged as hidden. |
IsLooping | unknown IsLooping(unknown...)
|
Returns true if the sequence is flagged as looping. |
IsMulti | unknown IsMulti(unknown...)
|
Returns true if the sequence is flagged as multi. |
IsSnapped | unknown IsSnapped(unknown...)
|
Returns true if the sequence is flagged as snapped |
IsVScript | unknown IsVScript(unknown...)
|
Returns true if the sequence is a script based sequence. |
KeyValueText | unknown KeyValueText(unknown...)
|
Returns the KeyValueText on a sequence as a table. |
KeyValueTextString | unknown KeyValueTextString(unknown...)
|
Returns the KeyValueText on a sequence as a string. |
LookupPoseSetting | unknown LookupPoseSetting(unknown...)
|
RReturns the index to the pose setting specified by name. |
MaxFrame | unknown MaxFrame(unknown...)
|
Given a pose parameter array, return the highest frame number for the sequence. |
Movement | unknown Movement(unknown...)
|
Returns the movement and rotation over the specified cycle range for the sequence
given the specified (optional) pose parameters in a table, form: { deltaMovement = <Vector>, deltaAngle = <QAngle> }. If Movement cannot be computed, nil is returned. |
MovementAndDuration | unknown MovementAndDuration(unknown...)
|
Returns the movement and duration over the specified cycle range for the sequence given the
specified (optional) pose parameters in a table, form: { duration = <float>, deltaMovement = <Vector> } |
NumActivities | unknown NumActivities(unknown...)
|
Returns the number of activities defined on the sequence. |
NumEvents | unknown NumEvents(unknown...)
|
Returns the number of events defined on the sequence. |
NumIKRules | unknown NumIKRules(unknown...)
|
Returns the number of IkRules on the sequence. |
NumPoseParameters | unknown NumPoseParameters(unknown...)
|
Returns the number of pose parameters on the sequence. |
NumPoseSettings | unknown NumPoseSettings(unknown...)
|
Returns the number of pose settings on the sequence. |
RemoveEventTypeFlags | unknown RemoveEventTypeFlags(unknown...)
|
Removes the the specified type flags for specified event on the sequence. |
SetActivityType | unknown SetActivityType(unknown...)
|
Sets the activity type for the activity at the specified index on the sequence. |
SetEventIndex | unknown SetEventIndex(unknown...)
|
Sets the event index for the specified event on the sequence. |
SetFlag | unknown SetFlag(unknown...)
|
Sets the flags given the specified flag mask. |
Velocity | unknown Velocity(unknown...)
|
Returns the instantaneous velocity vector at the specified cycle time for the sequence given the
specified (optional) pose parameters. Returns nil if the velocity vector cannot be computed. |