Fix #109295: Adding simulation item inconsistent with group interface

Use not only index of active slot, but also name and socket type.

Pull Request: https://projects.blender.org/blender/blender/pulls/109303
This commit is contained in:
Iliya Katueshenock
2023-06-26 14:07:26 +02:00
committed by Hans Goudey
parent 497f9a6941
commit 0f36f44db8

View File

@@ -286,9 +286,16 @@ class SimulationZoneItemAddOperator(SimulationZoneOperator, Operator):
state_items = node.state_items
# Remember index to move the item.
dst_index = min(node.active_index + 1, len(state_items))
# Empty name so it is based on the type only.
state_items.new(self.default_socket_type, "")
if node.active_item:
dst_index = node.active_index + 1
dst_type = node.active_item.socket_type
dst_name = node.active_item.name
else:
dst_index = len(state_items)
dst_type = self.default_socket_type
# Empty name so it is based on the type.
dst_name = ""
state_items.new(dst_type, dst_name)
state_items.move(len(state_items) - 1, dst_index)
node.active_index = dst_index