From 018f95158eb46fdc04b44dca92cf71ef80e0f637 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Wed, 10 Apr 2024 02:09:18 +0300 Subject: [PATCH] If there's already a 3D object with the same name in the 3DShapeEdit selected object OptionButton, add a number next to it --- src/Tools/3DTools/3DShapeEdit.gd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Tools/3DTools/3DShapeEdit.gd b/src/Tools/3DTools/3DShapeEdit.gd index 15c19b8ea..2614def9f 100644 --- a/src/Tools/3DTools/3DShapeEdit.gd +++ b/src/Tools/3DTools/3DShapeEdit.gd @@ -463,8 +463,15 @@ func _fill_object_option_button() -> void: return object_option_button.clear() object_option_button.add_item("None", 0) + var existing_names := {} for id in _cel.object_properties: var item_name: String = _object_names[_cel.object_properties[id]["type"]] + if item_name in existing_names: + # If there is already an object with the same name, under a number next to it + existing_names[item_name] += 1 + item_name += " (%s)" % existing_names[item_name] + else: + existing_names[item_name] = 1 object_option_button.add_item(item_name, id + 1)