You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Merge pull request #81525 from KoBeWi/tweening_the_impossible
Check if property exists before tweening
This commit is contained in:
@@ -104,7 +104,15 @@ Ref<PropertyTweener> Tween::tween_property(const Object *p_target, const NodePat
|
|||||||
CHECK_VALID();
|
CHECK_VALID();
|
||||||
|
|
||||||
Vector<StringName> property_subnames = p_property.get_as_property_path().get_subnames();
|
Vector<StringName> property_subnames = p_property.get_as_property_path().get_subnames();
|
||||||
if (!_validate_type_match(p_target->get_indexed(property_subnames), p_to)) {
|
#ifdef DEBUG_ENABLED
|
||||||
|
bool prop_valid;
|
||||||
|
const Variant &prop_value = p_target->get_indexed(property_subnames, &prop_valid);
|
||||||
|
ERR_FAIL_COND_V_MSG(!prop_valid, nullptr, vformat("The tweened property \"%s\" does not exist in object \"%s\".", p_property, p_target));
|
||||||
|
#else
|
||||||
|
const Variant &prop_value = p_target->get_indexed(property_subnames);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!_validate_type_match(prop_value, p_to)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user