From eb0d216dc1caab515eb7cf1ef6bb1632e5ca8fae Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 18 Oct 2021 11:40:00 +0200 Subject: Geometry Nodes: decouple multi-function lifetimes from modifier Previously, some multi-functions were allocated in a resource scope. This was fine as long as the multi-functions were only needed during the current evaluation of the node tree. However, now cases arise that require the multi-functions to be alive after the modifier is finished. For example, we want to evaluate fields created with geometry nodes outside of geometry nodes. To make this work, `std::shared_ptr` has to be used in a few more places. Realistically, this shouldn't have a noticable impact on performance. If this does become a bottleneck in the future, we can think about ways to make this work without using `shared_ptr` for multi-functions that are only used once. --- source/blender/functions/intern/field.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/functions/intern') diff --git a/source/blender/functions/intern/field.cc b/source/blender/functions/intern/field.cc index 39688ef3daf..03af3f53065 100644 --- a/source/blender/functions/intern/field.cc +++ b/source/blender/functions/intern/field.cc @@ -534,7 +534,7 @@ const GVArray *IndexFieldInput::get_varray_for_context(const fn::FieldContext &U * FieldOperation. */ -FieldOperation::FieldOperation(std::unique_ptr function, +FieldOperation::FieldOperation(std::shared_ptr function, Vector inputs) : FieldOperation(*function, std::move(inputs)) { -- cgit v1.2.3