Merge pull request #107005 from TokageItLab/fix-anim-node-param-type
Fix ambiguous AnimationNode's parameter type in default value and make `validate_type_match()` static function
This commit is contained in:
@ -77,7 +77,11 @@ void AnimationNode::set_parameter(const StringName &p_name, const Variant &p_val
|
||||
|
||||
const AHashMap<StringName, int>::Iterator it = property_cache.find(p_name);
|
||||
if (it) {
|
||||
process_state->tree->property_map.get_by_index(it->value).value.first = p_value;
|
||||
Pair<Variant, bool> &prop = process_state->tree->property_map.get_by_index(it->value).value;
|
||||
Variant value = p_value;
|
||||
if (Animation::validate_type_match(prop.first, value)) {
|
||||
prop.first = value;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -919,7 +923,11 @@ bool AnimationTree::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (is_inside_tree() && property_map[p_name].second) {
|
||||
return false; // Prevent to set property by user.
|
||||
}
|
||||
property_map[p_name].first = p_value;
|
||||
Pair<Variant, bool> &prop = property_map[p_name];
|
||||
Variant value = p_value;
|
||||
if (Animation::validate_type_match(prop.first, value)) {
|
||||
prop.first = value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user