Source 2 Animation System VScript API/CModelVScriptCompile.CreateSequence

From Valve Developer Community
< Source 2 Animation System VScript API
Revision as of 11:09, 15 December 2016 by Rectus (talk | contribs) (Created page with "== Function Description == ''' IVSSequence CModelVScriptCompile::CreateSequence(table ''parameters'') ''' Generates a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Description

IVSSequence CModelVScriptCompile::CreateSequence(table parameters)

Generates a new animation sequence in the model. The generated sequences can be used the same way as animations imported to the model from external software.

Parameters that take sequence names also accept imported animations.


Example
-- Creates a new sequence named "my_sequence", imports the first two frames from the animation "my_animation" and switches their order.
model:CreateSequence(
	{
		name = "my_sequence",
		fadeInTime = 0.2,
		fadeOutTime = 0.2,
		fps = 30,
		cmds = {
			{ cmd = "fetchframe", sequence = "my_animation", frame = 0, dst = 1 },
			{ cmd = "fetchframe", sequence = "my_animation", frame = 1, dst = 0 },
		}
	}
)

Parameters

Type Name Description
table parameters Sequence parameters (see below).

Returns

IVSSequence - Handle of the created sequence.

Sequence Parameters

The parameters are added as keys in the parameters table. Many of the parameters used are analogues to the $animation and $sequence QC commands used in Source 1.

Todo: This list is likely incomplete.
Name Type Description
name string The name of the sequence. (Required)
activities array List of activities to link the sequence to. Syntax: { { < name = "$" >, < weight = "#" > }, ... }
addlayer array Adds a list of sequences to play when this one plays.
animevents array Adds a list of Animation Events. Syntax: { { < name|event = "$" >, < frame|cycle = # > [, option = "$" ] }, ... }
autoplay bool Makes the sequence play at all times, on top of any other animations, no matter what the model is doing.
blendlayer array [Todo] Possible syntax: { { < sequence = "$" >, < startframe = # >, < peakframe = # >, < tailframe = # >, < endframe = # > }, ... }
cmds array Adds a list of commands to run. See below for a list of commands. Syntax: { { < cmd = "$" >, ... }, ... }
delta bool
fadeintime float Override how long this animation spends fading in. Default is 0.2.
fadeouttime float Override how long this animation spends fading out. Default is 0.2.
fps int Sets the animations speed in frames per second.
framecacheable
framerangesequence string
Todo: Possibly sets the sequence length to that of the specified sequence
hidden bool Prevents the sequence from being listed in user interfaces. Useful for sequences which serve only as layers of others.
node
numframes
poseParamX string or int Adds a pose parameter to the sequence, either by index or name.
poseParamY string or int Adds a second pose parameter to the sequence. poseParamX must also be specified
sequences array Sequences to be included in this one. Also used to set a matrix of sequences for pose parameters to blend between. Syntax: { { < sequence_name >, ... }, ... }
snap bool Remove all blending when transitioning to this animation. This is useful for reaction animations that are the result of sudden and violent changes in the model's state, such as a creature flinching or a weapon firing.
transition array Syntax: { { < entry = "$" >, < exit = "$" > }, ... }
weightlist string or int


Commands

These commands are used in the cmds parameter.

Todo: This list is likely incomplete.
Name Syntax Description
add
blend
copy
fetchcycle
fetchframe { cmd = "fetchframe", sequence = "$", frame = #, dst = # } Fetches a frame from the specified sequence.
fetchframerange
iklockinplace
ikrestoreall
lineardelta
nop {cmd = "nop"} [Todo]
Todo: No operation ?
reversesequence { cmd = "reversesequence", sequence = "$", dst = # }
scale
sequence { cmd = "sequence", sequence = "$", dst = # },
slerp { cmd = "slerp", dst = #, src = # }
subtract { cmd = "subtract", dst = #, src = # } Subtracts the destination frame from the source frame and places the result in the destination.
transform
worldspace