NSUNI/NSLAR Library a250670
Loading...
Searching...
No Matches

Classes

struct  nnl::visanimation::KeyFrame
 Represents a keyframe in a visibility animation. More...
struct  nnl::visanimation::Animation
 Represents a single visibility animation. More...
struct  nnl::visanimation::AnimationContainer
 Holds a collection of visibility animations. More...

Functions

AnimationContainer nnl::visanimation::Convert (std::vector< SVisibilityAnimation > &&sanimations)
 Converts multiple simple visibility animations to the in-game format.
std::vector< SVisibilityAnimationnnl::visanimation::Convert (const AnimationContainer &animation_container)
 Converts multiple in-game visibility animations to a simpler format.
bool nnl::visanimation::IsOfType (BufferView buffer)
 Tests if the provided file is a visibility animation.
AnimationContainer nnl::visanimation::Import (BufferView buffer)
 Imports animations from a binary file.
Buffer nnl::visanimation::Export (const AnimationContainer &animation_container)
 Exports animations to a binary file format.

Detailed Description


Class Documentation

◆ nnl::visanimation::KeyFrame

struct nnl::visanimation::KeyFrame

Represents a keyframe in a visibility animation.

This struct encapsulates the time at which the keyframe occurs in the animation timeline, as well as flags that enable specific mesh groups.

See also
nnl::visanimation::Animation

Public Attributes

u16 time_tick = 0
u16 flags_enable_groups = 0b0000000000000000

Member Data Documentation

◆ flags_enable_groups

u16 nnl::visanimation::KeyFrame::flags_enable_groups = 0b0000000000000000

A set of 16 bit flags that specify which mesh groups should be enabled (a value of 0 does not disable them)

◆ time_tick

u16 nnl::visanimation::KeyFrame::time_tick = 0

Time in ticks. This value must be less than the duration of the respective main animation

◆ nnl::visanimation::Animation

struct nnl::visanimation::Animation

Represents a single visibility animation.

This struct represents a "sub" animation that is played along the main SRT animation and that controls the visibility of mesh groups. This struct contains two channels of keyframes that may be associated with the left and the right hands of a character. The values from those channels are combined together to determine the visibility status of a mesh group.

See also
nnl::visanimation::AnimationContainer

Public Attributes

std::vector< KeyFrameleft_channel
 Keyframes for the left channel of the animation.
std::vector< KeyFrameright_channel
 Keyframes for the right channel of the animation.

Member Data Documentation

◆ left_channel

std::vector<KeyFrame> nnl::visanimation::Animation::left_channel

Keyframes for the left channel of the animation.

◆ right_channel

std::vector<KeyFrame> nnl::visanimation::Animation::right_channel

Keyframes for the right channel of the animation.

◆ nnl::visanimation::AnimationContainer

struct nnl::visanimation::AnimationContainer

Holds a collection of visibility animations.

This struct serves as a container for multiple animations that control the visibility of mesh groups during the playback of main SRT animations.

When a model is spawned, all mesh groups are enabled by default. As keyframes are encountered, the following rules apply:

  • All groups specified in the disable flags are deactivated.
  • All groups specified in the enable flags of a keyframe are reactivated.
  • If a group is not included in the disable flags, it always remains visible.
  • When a keyframe with enable flags set to all 0's is encountered, the two groups (for both left and right channels) that were set to 1 in the lowest bits of the disable flags are re-enabled anyway.
  • The resulting values from the right and left channels are combined using a bitwise OR operation.
Note
This animation can also be (rarely) controlled from an action configuration or can be hardcoded.

If visibility animation is used, the number of animations in this container must match the number of regular SRT animations.

This struct stores only a portion of the data that may be required by a 3D asset to function properly. Its binary representation must be used as part of a larger container that must also include regular SRT animations and possibly other data.
See also
nnl::asset::Asset
nnl::asset::Asset3D
nnl::model::Model
nnl::animation::AnimationContainer
nnl::action::ActionConfig

Public Attributes

u16 flags_disable_left_channel = 0b0000000000000000
u16 flags_disable_right_channel = 0b0000000000000000
std::vector< Animationanimations

Member Data Documentation

◆ animations

std::vector<Animation> nnl::visanimation::AnimationContainer::animations

A collection of visibility "sub" animations. The size of this vector must match the number of main SRT animations.

◆ flags_disable_left_channel

u16 nnl::visanimation::AnimationContainer::flags_disable_left_channel = 0b0000000000000000

flags to disable the mesh groups for keyframes of the left channel. The value of 1 disables them, 0 does nothing.

◆ flags_disable_right_channel

u16 nnl::visanimation::AnimationContainer::flags_disable_right_channel = 0b0000000000000000

flags to disable the mesh groups for keyframes of the right channel. The value of 1 disables them, 0 does nothing.

Function Documentation

◆ Convert() [1/2]

std::vector< SVisibilityAnimation > nnl::visanimation::Convert ( const AnimationContainer & animation_container)

Converts multiple in-game visibility animations to a simpler format.

This function takes an AnimationContainer object and converts all contained animations into a format suitable for exporting to other formats.

Parameters
animation_containerThe container of in-game animations to be converted.
Returns
A vector of converted animations.

◆ Convert() [2/2]

AnimationContainer nnl::visanimation::Convert ( std::vector< SVisibilityAnimation > && sanimations)

Converts multiple simple visibility animations to the in-game format.

This function takes a vector of SVisibilityAnimation objects and converts them into an AnimationContainer.

Parameters
sanimationsThe vector of animations to be converted.
Returns
AnimationContainer The converted container of in-game visibility animations.
Note
Use std::move when passing an existing object.

◆ Export()

Buffer nnl::visanimation::Export ( const AnimationContainer & animation_container)
nodiscard

Exports animations to a binary file format.

This function takes an AnimationContainer and exports it into a binary file buffer.

Parameters
animation_containerThe container of animations to be exported.
Returns
The exported animations in the binary format.

◆ Import()

AnimationContainer nnl::visanimation::Import ( BufferView buffer)

Imports animations from a binary file.

This function takes a file buffer, parses its contents, and returns an AnimationContainer.

Parameters
bufferThe binary file to be imported.
Returns
AnimationContainer The imported container of animations.
See also
nnl::visanimation::IsOfType
nnl::visanimation::Export

◆ IsOfType()

bool nnl::visanimation::IsOfType ( BufferView buffer)

Tests if the provided file is a visibility animation.

This function takes data representing a file and checks whether it corresponds to the in-game visibility animation format.

Parameters
bufferThe binary file to be tested.
Returns
Returns true if the file is identified as a animation container.
See also
nnl::visanimation::Import