Merge pull request #15008 from AlmightyScientist/issue-15000
Animation Tree: Prevent cycle_test from being altered by past-test.
This commit is contained in:
commit
d26b6f284f
2 changed files with 15 additions and 5 deletions
|
@ -1138,6 +1138,9 @@ void AnimationTreePlayer::transition_node_set_input_count(const StringName &p_no
|
||||||
|
|
||||||
n->inputs.resize(p_inputs);
|
n->inputs.resize(p_inputs);
|
||||||
n->input_data.resize(p_inputs);
|
n->input_data.resize(p_inputs);
|
||||||
|
|
||||||
|
_clear_cycle_test();
|
||||||
|
|
||||||
last_error = _cycle_test(out_name);
|
last_error = _cycle_test(out_name);
|
||||||
}
|
}
|
||||||
void AnimationTreePlayer::transition_node_set_input_auto_advance(const StringName &p_node, int p_input, bool p_auto_advance) {
|
void AnimationTreePlayer::transition_node_set_input_auto_advance(const StringName &p_node, int p_input, bool p_auto_advance) {
|
||||||
|
@ -1358,6 +1361,8 @@ void AnimationTreePlayer::remove_node(const StringName &p_node) {
|
||||||
|
|
||||||
node_map.erase(p_node);
|
node_map.erase(p_node);
|
||||||
|
|
||||||
|
_clear_cycle_test();
|
||||||
|
|
||||||
// compute last error again, just in case
|
// compute last error again, just in case
|
||||||
last_error = _cycle_test(out_name);
|
last_error = _cycle_test(out_name);
|
||||||
dirty_caches = true;
|
dirty_caches = true;
|
||||||
|
@ -1385,6 +1390,14 @@ AnimationTreePlayer::ConnectError AnimationTreePlayer::_cycle_test(const StringN
|
||||||
return CONNECT_OK;
|
return CONNECT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use this function to not alter next complete _cycle_test().
|
||||||
|
void AnimationTreePlayer::_clear_cycle_test() {
|
||||||
|
for (Map<StringName, NodeBase *>::Element *E = node_map.front(); E; E = E->next()) {
|
||||||
|
NodeBase *nb = E->get();
|
||||||
|
nb->cycletest = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Error AnimationTreePlayer::connect_nodes(const StringName &p_src_node, const StringName &p_dst_node, int p_dst_input) {
|
Error AnimationTreePlayer::connect_nodes(const StringName &p_src_node, const StringName &p_dst_node, int p_dst_input) {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(!node_map.has(p_src_node), ERR_INVALID_PARAMETER);
|
ERR_FAIL_COND_V(!node_map.has(p_src_node), ERR_INVALID_PARAMETER);
|
||||||
|
@ -1409,11 +1422,7 @@ Error AnimationTreePlayer::connect_nodes(const StringName &p_src_node, const Str
|
||||||
|
|
||||||
dst->inputs[p_dst_input].node = p_src_node;
|
dst->inputs[p_dst_input].node = p_src_node;
|
||||||
|
|
||||||
for (Map<StringName, NodeBase *>::Element *E = node_map.front(); E; E = E->next()) {
|
_clear_cycle_test();
|
||||||
|
|
||||||
NodeBase *nb = E->get();
|
|
||||||
nb->cycletest = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
last_error = _cycle_test(out_name);
|
last_error = _cycle_test(out_name);
|
||||||
if (last_error) {
|
if (last_error) {
|
||||||
|
|
|
@ -317,6 +317,7 @@ private:
|
||||||
bool reset_request;
|
bool reset_request;
|
||||||
|
|
||||||
ConnectError _cycle_test(const StringName &p_at_node);
|
ConnectError _cycle_test(const StringName &p_at_node);
|
||||||
|
void _clear_cycle_test();
|
||||||
|
|
||||||
Track *_find_track(const NodePath &p_path);
|
Track *_find_track(const NodePath &p_path);
|
||||||
void _recompute_caches();
|
void _recompute_caches();
|
||||||
|
|
Loading…
Reference in a new issue