1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

If there's already a 3D object with the same name in the 3DShapeEdit selected object OptionButton, add a number next to it

This commit is contained in:
Emmanouil Papadeas 2024-04-10 02:09:18 +03:00
parent a4f06d8cbe
commit 018f95158e

View file

@ -463,8 +463,15 @@ func _fill_object_option_button() -> void:
return return
object_option_button.clear() object_option_button.clear()
object_option_button.add_item("None", 0) object_option_button.add_item("None", 0)
var existing_names := {}
for id in _cel.object_properties: for id in _cel.object_properties:
var item_name: String = _object_names[_cel.object_properties[id]["type"]] 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) object_option_button.add_item(item_name, id + 1)