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
This commit is contained in:
committed by
Hans Goudey
parent
f7388e3be5
commit
1d6464cf97
@@ -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'}
|
||||
|
||||
Reference in New Issue
Block a user