Started working on graph initialization in ATP Editor.
This commit is contained in:
+23
-18
@@ -27,19 +27,26 @@ struct AnimGraph {
|
||||
|
||||
AnimDataAllocator m_anim_data_allocator;
|
||||
|
||||
~AnimGraph() {
|
||||
std::vector<AnimGraphConnection>& graph_outputs = m_node_input_connections[0];
|
||||
~AnimGraph() { dealloc(); }
|
||||
|
||||
for (size_t i = 0, n = graph_outputs.size(); i < n; i++) {
|
||||
AnimGraphConnection& connection = graph_outputs[i];
|
||||
if (connection.m_target_socket.m_type == SocketType::SocketTypeAnimation) {
|
||||
AnimData* graph_anim_output =
|
||||
static_cast<AnimData*>(connection.m_target_socket.m_reference.ptr);
|
||||
assert(graph_anim_output != nullptr);
|
||||
bool init(AnimGraphContext& context);
|
||||
void dealloc() {
|
||||
if (m_node_input_connections.size() > 0) {
|
||||
std::vector<AnimGraphConnection>& graph_outputs =
|
||||
m_node_input_connections[0];
|
||||
|
||||
// we have to explicitly call the destructor as the AnimData* was
|
||||
// initialized using a placement new operator.
|
||||
graph_anim_output->m_local_matrices.vector::~vector();
|
||||
for (size_t i = 0, n = graph_outputs.size(); i < n; i++) {
|
||||
AnimGraphConnection& connection = graph_outputs[i];
|
||||
if (connection.m_target_socket.m_type
|
||||
== SocketType::SocketTypeAnimation) {
|
||||
AnimData* graph_anim_output = static_cast<AnimData*>(
|
||||
connection.m_target_socket.m_reference.ptr);
|
||||
assert(graph_anim_output != nullptr);
|
||||
|
||||
// we have to explicitly call the destructor as the AnimData* was
|
||||
// initialized using a placement new operator.
|
||||
graph_anim_output->m_local_matrices.vector::~vector();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,8 +60,6 @@ struct AnimGraph {
|
||||
delete m_socket_accessor;
|
||||
}
|
||||
|
||||
bool init(AnimGraphContext& context);
|
||||
|
||||
void updateOrderedNodes();
|
||||
void updateOrderedNodesRecursive(int node_index);
|
||||
void markActiveNodes();
|
||||
@@ -70,7 +75,7 @@ struct AnimGraph {
|
||||
void evalSyncTracks();
|
||||
void updateTime(float dt);
|
||||
void evaluate(AnimGraphContext& context);
|
||||
void reset() {
|
||||
void resetNodeStates() {
|
||||
for (size_t i = 0, n = m_nodes.size(); i < n; i++) {
|
||||
m_nodes[i]->m_time_now = 0.f;
|
||||
m_nodes[i]->m_time_last = 0.f;
|
||||
@@ -102,7 +107,6 @@ struct AnimGraph {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
int getNodeEvalOrderIndex(const AnimNode* node) {
|
||||
for (size_t i = 0, n = m_eval_ordered_nodes.size(); i < n; i++) {
|
||||
if (m_eval_ordered_nodes[i] == node) {
|
||||
@@ -112,12 +116,13 @@ struct AnimGraph {
|
||||
|
||||
return -1;
|
||||
}
|
||||
const AnimNode* getAnimNodeForInput (
|
||||
const AnimNode* getAnimNodeForInput(
|
||||
size_t node_index,
|
||||
const std::string& input_name) const {
|
||||
assert(node_index < m_nodes.size());
|
||||
|
||||
const std::vector<AnimGraphConnection>& input_connection = m_node_input_connections[node_index];
|
||||
const std::vector<AnimGraphConnection>& input_connection =
|
||||
m_node_input_connections[node_index];
|
||||
for (size_t i = 0, n = input_connection.size(); i < n; i++) {
|
||||
if (input_connection[i].m_target_socket.m_name == input_name) {
|
||||
return input_connection[i].m_source_node;
|
||||
@@ -137,7 +142,7 @@ struct AnimGraph {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t getAnimNodeIndex (AnimNode* node) {
|
||||
size_t getAnimNodeIndex(AnimNode* node) {
|
||||
for (size_t i = 0; i < m_nodes.size(); i++) {
|
||||
if (m_nodes[i] == node) {
|
||||
return i;
|
||||
|
||||
Reference in New Issue
Block a user