AnimGraphEvalTests now properly evaluates.
This commit is contained in:
@@ -48,6 +48,13 @@ struct AnimGraphBlendTree : public AnimNode {
|
||||
|
||||
// AnimNode overrides
|
||||
bool Init(AnimGraphContext& context) override;
|
||||
|
||||
/// Determines which nodes in the BlendTree are active.
|
||||
///
|
||||
/// Note: this does not use the provided input_connections, instead it marks
|
||||
/// all nodes directly connected to the BlendTree outputs as active and then
|
||||
/// propagates the node state throught the tree. For this each active node's
|
||||
/// AnimNode::MarkActiveInputs() gets called.
|
||||
void MarkActiveInputs(
|
||||
const std::vector<AnimGraphConnection>& input_connections) override;
|
||||
void CalcSyncTrack(
|
||||
|
||||
@@ -33,12 +33,12 @@ struct Blend2Node : public AnimNode {
|
||||
}
|
||||
|
||||
if (input.m_target_socket_name == "Input0" && *i_blend_weight < 0.999) {
|
||||
input_node->m_state = AnimNodeEvalState::Activated;
|
||||
input_node->Activate(m_tick_number);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (input.m_target_socket_name == "Input1" && *i_blend_weight > 0.001) {
|
||||
input_node->m_state = AnimNodeEvalState::Activated;
|
||||
input_node->Activate(m_tick_number);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,8 @@ struct NodeDescriptor<Blend2Node> : public NodeDescriptorBase {
|
||||
RegisterProperty("Sync", &node->m_sync_blend);
|
||||
}
|
||||
|
||||
virtual ~NodeDescriptor() = default;
|
||||
|
||||
void UpdateFlags() override {
|
||||
Socket* weight_input_socket = FindSocket("Weight", m_inputs);
|
||||
assert(weight_input_socket != nullptr);
|
||||
@@ -104,6 +106,8 @@ struct NodeDescriptor<SpeedScaleNode> : public NodeDescriptorBase {
|
||||
|
||||
RegisterOutput("Output", &node->o_output);
|
||||
}
|
||||
|
||||
virtual ~NodeDescriptor() = default;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -132,6 +136,8 @@ struct NodeDescriptor<AnimSamplerNode> : public NodeDescriptorBase {
|
||||
|
||||
RegisterProperty("Filename", &node->m_filename);
|
||||
}
|
||||
|
||||
virtual ~NodeDescriptor() = default;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -159,6 +165,8 @@ struct NodeDescriptor<LockTranslationNode> : public NodeDescriptorBase {
|
||||
RegisterProperty("LockAxisY", &node->m_lock_y);
|
||||
RegisterProperty("LockAxisZ", &node->m_lock_z);
|
||||
}
|
||||
|
||||
virtual ~NodeDescriptor() = default;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -177,6 +185,8 @@ struct NodeDescriptor<ConstScalarNode> : public NodeDescriptorBase {
|
||||
RegisterOutput("ScalarOutput", &node->o_value);
|
||||
RegisterProperty("ScalarValue", &node->value);
|
||||
}
|
||||
|
||||
virtual ~NodeDescriptor() = default;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -202,6 +212,8 @@ struct NodeDescriptor<MathAddNode> : public NodeDescriptorBase {
|
||||
RegisterInput("Input1", &node->i_input1);
|
||||
RegisterOutput("Output", &node->o_output);
|
||||
}
|
||||
|
||||
virtual ~NodeDescriptor() = default;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -232,6 +244,8 @@ struct NodeDescriptor<MathFloatToVec3Node> : public NodeDescriptorBase {
|
||||
RegisterInput("Input2", &node->i_input2);
|
||||
RegisterOutput("Output", &node->o_output);
|
||||
}
|
||||
|
||||
virtual ~NodeDescriptor() = default;
|
||||
};
|
||||
|
||||
AnimNode* AnimNodeFactory(const std::string& name);
|
||||
|
||||
@@ -45,8 +45,7 @@ struct AnimNode {
|
||||
for (const auto& input : input_connections) {
|
||||
AnimNode* input_node = input.m_source_node;
|
||||
if (input_node != nullptr) {
|
||||
input_node->m_tick_number = m_tick_number;
|
||||
input_node->m_state = AnimNodeEvalState::Activated;
|
||||
input_node->Activate(m_tick_number);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,13 +63,18 @@ struct AnimNode {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void UpdateTime(float time_last, float time_now) {
|
||||
virtual void UpdateTime(const float time_last, const float time_now) {
|
||||
m_time_last = time_last;
|
||||
m_time_now = time_now;
|
||||
m_state = AnimNodeEvalState::TimeUpdated;
|
||||
}
|
||||
|
||||
virtual void Evaluate(AnimGraphContext& context){};
|
||||
virtual void Evaluate(AnimGraphContext& context) {};
|
||||
|
||||
void Activate(const int tick_number) {
|
||||
m_tick_number = tick_number;
|
||||
m_state = AnimNodeEvalState::Activated;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //ANIMTESTBED_ANIMNODE_H
|
||||
|
||||
Reference in New Issue
Block a user