diff options
Diffstat (limited to 'source/blender/modifiers/intern')
-rw-r--r-- | source/blender/modifiers/intern/MOD_fluid.c | 44 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_nodes.cc | 9 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_nodes_evaluator.cc | 1 |
3 files changed, 49 insertions, 5 deletions
diff --git a/source/blender/modifiers/intern/MOD_fluid.c b/source/blender/modifiers/intern/MOD_fluid.c index a14d582063a..e087b8411f8 100644 --- a/source/blender/modifiers/intern/MOD_fluid.c +++ b/source/blender/modifiers/intern/MOD_fluid.c @@ -25,6 +25,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_task.h" #include "BLI_utildefines.h" #include "BLT_translation.h" @@ -112,6 +113,31 @@ static void requiredDataMask(Object *UNUSED(ob), } } +typedef struct FluidIsolationData { + Depsgraph *depsgraph; + Object *object; + Mesh *mesh; + FluidModifierData *fmd; + + Mesh *result; +} FluidIsolationData; + +#ifdef WITH_FLUID +static void fluid_modifier_do_isolated(void *userdata) +{ + FluidIsolationData *isolation_data = (FluidIsolationData *)userdata; + + Scene *scene = DEG_get_evaluated_scene(isolation_data->depsgraph); + + Mesh *result = BKE_fluid_modifier_do(isolation_data->fmd, + isolation_data->depsgraph, + scene, + isolation_data->object, + isolation_data->mesh); + isolation_data->result = result ? result : isolation_data->mesh; +} +#endif /* WITH_FLUID */ + static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *me) { #ifndef WITH_FLUID @@ -119,16 +145,24 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return me; #else FluidModifierData *fmd = (FluidModifierData *)md; - Mesh *result = NULL; if (ctx->flag & MOD_APPLY_ORCO) { return me; } - Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph); - - result = BKE_fluid_modifier_do(fmd, ctx->depsgraph, scene, ctx->object, me); - return result ? result : me; + /* Isolate execution of Mantaflow when running from dependency graph. The reason for this is + * because Mantaflow uses TBB to parallel its own computation which without isolation will start + * stealing tasks from dependency graph. Stealing tasks from the dependency graph might cause + * a recursive lock when Python drivers are used (because Mantaflow is interfaced via Python as + * well. */ + FluidIsolationData isolation_data; + isolation_data.depsgraph = ctx->depsgraph; + isolation_data.object = ctx->object; + isolation_data.mesh = me; + isolation_data.fmd = fmd; + BLI_task_isolate(fluid_modifier_do_isolated, &isolation_data); + + return isolation_data.result; #endif /* WITH_FLUID */ } diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index e6cc7663c58..c88940c00c2 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -917,6 +917,10 @@ static void store_output_value_in_geometry(GeometrySet &geometry_set, CurveComponent &component = geometry_set.get_component_for_write<CurveComponent>(); store_field_on_geometry_component(component, attribute_name, domain, field); } + if (geometry_set.has_instances()) { + InstancesComponent &component = geometry_set.get_component_for_write<InstancesComponent>(); + store_field_on_geometry_component(component, attribute_name, domain, field); + } } /** @@ -1424,13 +1428,18 @@ static void output_attribute_panel_draw(const bContext *UNUSED(C), Panel *panel) uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, true); + bool has_output_attribute = false; if (nmd->node_group != nullptr && nmd->settings.properties != nullptr) { LISTBASE_FOREACH (bNodeSocket *, socket, &nmd->node_group->outputs) { if (socket_type_has_attribute_toggle(*socket)) { + has_output_attribute = true; draw_property_for_output_socket(layout, *nmd, ptr, *socket); } } } + if (!has_output_attribute) { + uiItemL(layout, IFACE_("No group output attributes connected."), ICON_INFO); + } } static void panelRegister(ARegionType *region_type) diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc index 69132f6c177..a312872f5d9 100644 --- a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc +++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc @@ -1455,6 +1455,7 @@ class GeometryNodesEvaluator { } void *converted_buffer = allocator.allocate(required_type.size(), required_type.alignment()); this->convert_value(type, required_type, buffer, converted_buffer); + type.destruct(buffer); return {required_type, converted_buffer}; } |