From aa1d469ffb8624118849a006304497617e7f08f5 Mon Sep 17 00:00:00 2001 From: aaronp64 Date: Fri, 18 Oct 2024 12:10:19 -0400 Subject: [PATCH] Avoid unnecessary Dictionary conversions in GDScriptInstance::validate_property Updated GDScriptInstance::validate_property to only convert PropertyInfo to Dictionary if _validate_property function is found. --- modules/gdscript/gdscript.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 18f2ccc455ee..ecffe88d6e6b 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -1835,14 +1835,14 @@ Variant::Type GDScriptInstance::get_property_type(const StringName &p_name, bool } void GDScriptInstance::validate_property(PropertyInfo &p_property) const { - Variant property = (Dictionary)p_property; - const Variant *args[1] = { &property }; - const GDScript *sptr = script.ptr(); while (sptr) { if (likely(sptr->valid)) { HashMap::ConstIterator E = sptr->member_functions.find(GDScriptLanguage::get_singleton()->strings._validate_property); if (E) { + Variant property = (Dictionary)p_property; + const Variant *args[1] = { &property }; + Callable::CallError err; Variant ret = E->value->call(const_cast(this), args, 1, err); if (err.error == Callable::CallError::CALL_OK) {