From 4949d80336fe530b4abacc31265bde14ca6fb749 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 28 Oct 2024 15:03:38 +0100 Subject: [PATCH] Dont duplicate arrays --- bt/tasks/bt_task.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bt/tasks/bt_task.cpp b/bt/tasks/bt_task.cpp index 2528c103..c1707787 100644 --- a/bt/tasks/bt_task.cpp +++ b/bt/tasks/bt_task.cpp @@ -208,11 +208,11 @@ Ref BTTask::clone() const { res = duplicates[res]; inst->set(prop.name, res); } else if (prop_value.get_type() == Variant::ARRAY) { - // Duplicate arrays and handle arrays of BBParams. + // Duplicate BBParams instances inside an array. // - This code doesn't handle arrays of arrays. // - A partial workaround for: https://github.com/godotengine/godot/issues/74918 // - We actually don't want to duplicate resources in clone() except for BBParam subtypes. - Array arr = prop_value.duplicate(true); + Array arr = prop_value; if (arr.is_typed() && ClassDB::is_parent_class(arr.get_typed_class_name(), LW_NAME(BBParam))) { for (int j = 0; j < arr.size(); j++) { Ref bb_param = arr[j]; @@ -221,10 +221,6 @@ Ref BTTask::clone() const { } } } - inst->set(prop.name, arr); - } else if (prop_value.get_type() > Variant::ARRAY) { - // Duplicate other array types. - inst->set(prop.name, prop_value.duplicate(false)); } }