From 1d6464cf978116ba11cf9b50ef767536f1c718c3 Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Mon, 15 May 2023 15:38:35 +0200 Subject: [PATCH] Fix error when adding a simulation zone while using i18n When adding a new simulation zone, the input and output would be accessed by their name, however the name can be translated if the user has enabled translation of data. Instead, get the first socket of type 'GEOMETRY' in the simulation input and output nodes. Pull Request: https://projects.blender.org/blender/blender/pulls/107819 --- scripts/startup/bl_operators/node.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/startup/bl_operators/node.py b/scripts/startup/bl_operators/node.py index 854db8f0ce7..9c1b14c6ae5 100644 --- a/scripts/startup/bl_operators/node.py +++ b/scripts/startup/bl_operators/node.py @@ -184,8 +184,9 @@ class NODE_OT_add_simulation_zone(NodeAddOperator, Operator): output_node.location += Vector(self.offset) # Connect geometry sockets by default. - from_socket = input_node.outputs.get("Geometry") - to_socket = output_node.inputs.get("Geometry") + # Get the sockets by their types, because the name is not guaranteed due to i18n. + from_socket = next(s for s in input_node.outputs if s.type == 'GEOMETRY') + to_socket = next(s for s in output_node.inputs if s.type == 'GEOMETRY') tree.links.new(to_socket, from_socket) return {'FINISHED'}