Skip to content

Commit

Permalink
Dont duplicate arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
limbonaut committed Oct 28, 2024
1 parent 92c6bc7 commit 4949d80
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions bt/tasks/bt_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ Ref<BTTask> 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<Resource> bb_param = arr[j];
Expand All @@ -221,10 +221,6 @@ Ref<BTTask> 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));
}
}

Expand Down

0 comments on commit 4949d80

Please sign in to comment.