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

Functions

std::map< u16, std::set< std::string > > nnl::action::GetAnimationNames (const ActionConfig &action_config)
 Returns a map of animation IDs and names of all actions in which those animations were used.
template<class... Ts, class Node>
std::tuple< Ts... > nnl::action::ReadArgs (std::size_t main_node_ind, const std::vector< Node > &nodes)
 Extracts arguments from a series of nodes.
template<class... Ts, class Node>
void nnl::action::WriteArgs (std::size_t main_node_ind, std::vector< Node > &nodes, const Ts &&... args)
 Converts arguments to a series of nodes.
template<class Node>
std::size_t nnl::action::NextNodeInd (std::size_t main_node_ind, const std::vector< Node > &nodes)
 Calculates the absolute index of the next main node in a vector.

Detailed Description

Function Documentation

◆ GetAnimationNames()

std::map< u16, std::set< std::string > > nnl::action::GetAnimationNames ( const ActionConfig & action_config)

Returns a map of animation IDs and names of all actions in which those animations were used.

Parameters
action_configAn ActionConfig object containing actions.
Returns
A map where the key is the animation id and the value is a set of action names that use the corresponding animation.

◆ NextNodeInd()

template<class Node>
std::size_t nnl::action::NextNodeInd ( std::size_t main_node_ind,
const std::vector< Node > & nodes )
inline

Calculates the absolute index of the next main node in a vector.

Template Parameters
NodeThe type of the node (deduced).
Parameters
main_node_indIndex of the main node in a vector.
nodesA vector that stores nodes.
Returns
The absolute index of the next main node in the nodes vector

◆ ReadArgs()

template<class... Ts, class Node>
std::tuple< Ts... > nnl::action::ReadArgs ( std::size_t main_node_ind,
const std::vector< Node > & nodes )
inline

Extracts arguments from a series of nodes.

This function reads arguments from argument nodes of a given main node, taking alignment into account, and stores them in a tuple.

For example, given a node chain consisting of [{main}, {u16, u8, u8}, {f32}], 3 arguments can be extracted as follows:

auto [a0, a1, a2] = Read<u16, u8, f32>(0, nodes);
Template Parameters
TsTypes of the arguments to be extracted.
NodeThe type of the node (deduced)
Parameters
main_node_indIndex of the main node in a vector of nodes from which to extract arguments.
nodesA vector that stores nodes.
Returns
A tuple containing the extracted arguments.

◆ WriteArgs()

template<class... Ts, class Node>
void nnl::action::WriteArgs ( std::size_t main_node_ind,
std::vector< Node > & nodes,
const Ts &&... args )
inline

Converts arguments to a series of nodes.

This function converts arguments to nodes, taking alignment into account. It will expand the provided vector of nodes if there's not enough space. For example, writing to a chain with a single [{main}] node can be done as follows:

// Initial chain: [{main}]
// Resulting chain: [{main}, {u16, u8, u8}, {f32}]
Write<u16, u8, f32>(0, nodes, 0x10, 0x1, 1.0f);

If next_main_node is not 0, an error is thrown in case the write operation exceeds the existing memory region for arguments.

If next_main_node is 0, the value is updated to the correct number.

Template Parameters
TsTypes of the arguments to be extracted.
NodeThe type of the node. This can be deduced automatically.
Parameters
main_node_indIndex of the main node in a vector of nodes for which to write arguments.
nodesA vector that stores nodes.
argsA variadic number of values to be converted to nodes.