Skip to content

Commit

Permalink
Prevent button's icons from expanding the inspector button (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
shomykohai authored Jun 29, 2024
1 parent 0fcafa5 commit 63e2bbd
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 63e2bbd

Please sign in to comment.