From 63e2bbdaffc8e7a5eb0ab0beb44cec010656a4e3 Mon Sep 17 00:00:00 2001 From: Shomy <61943525+shomykohai@users.noreply.github.com> Date: Sat, 29 Jun 2024 10:36:41 +0200 Subject: [PATCH] Prevent button's icons from expanding the inspector button (#179) --- .../ui/editor/inspector/entity_instance_browser_property.gd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/pandora/ui/editor/inspector/entity_instance_browser_property.gd b/addons/pandora/ui/editor/inspector/entity_instance_browser_property.gd index 30e2e0e..f2067e4 100644 --- a/addons/pandora/ui/editor/inspector/entity_instance_browser_property.gd +++ b/addons/pandora/ui/editor/inspector/entity_instance_browser_property.gd @@ -14,11 +14,16 @@ func _init(class_data: Dictionary) -> void: var id_counter = 0 var all_entities = _find_all_entities(class_data["path"]) + var editor_plugin: EditorPlugin = Engine.get_meta("PandoraEditorPlugin", null) + # Prevent button from expanding to selected icon size. + property_control.set_expand_icon(true) for entity in all_entities: property_control.get_popup().add_icon_item( load(entity.get_icon_path()), entity.get_entity_name(), id_counter ) + if editor_plugin: + property_control.get_popup().set_item_icon_max_width(id_counter, editor_plugin.get_editor_interface().get_editor_scale() * 16) # Godot 4.1+ if property_control.get_popup().has_method("set_item_icon_modulate"): property_control.get_popup().set_item_icon_modulate(id_counter, entity.get_icon_color())