Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix inspector object selector min size

Giganzo51da0908554a
diff --git a/editor/gui/editor_object_selector.cpp b/editor/gui/editor_object_selector.cpp
index a7a5cc6fdb4..82bb00d235a 100644
--- a/editor/gui/editor_object_selector.cpp
+++ b/editor/gui/editor_object_selector.cpp
@@ -38,9 +38,7 @@
#include "scene/gui/margin_container.h"
Size2 EditorObjectSelector::get_minimum_size() const {
- Ref<Font> font = get_theme_font(SceneStringName(font));
- int font_size = get_theme_font_size(SceneStringName(font_size));
- return Button::get_minimum_size() + Size2(0, font->get_height(font_size));
+ return main_mc->get_minimum_size();
}
void EditorObjectSelector::_add_children_to_popup(Object *p_obj, int p_depth) {
@@ -209,7 +207,7 @@ void EditorObjectSelector::_notification(int p_what) {
EditorObjectSelector::EditorObjectSelector(EditorSelectionHistory *p_history) {
history = p_history;
- MarginContainer *main_mc = memnew(MarginContainer);
+ main_mc = memnew(MarginContainer);
main_mc->set_theme_type_variation("ObjectSelectorMargin");
main_mc->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
add_child(main_mc);
diff --git a/editor/gui/editor_object_selector.h b/editor/gui/editor_object_selector.h
index a08da5ebbf7..7c46c29105a 100644
--- a/editor/gui/editor_object_selector.h
+++ b/editor/gui/editor_object_selector.h
@@ -36,12 +36,14 @@
#include "scene/gui/texture_rect.h"
class EditorSelectionHistory;
+class MarginContainer;
class EditorObjectSelector : public Button {
GDCLASS(EditorObjectSelector, Button);
EditorSelectionHistory *history = nullptr;
+ MarginContainer *main_mc = nullptr;
TextureRect *current_object_icon = nullptr;
Label *current_object_label = nullptr;
TextureRect *sub_objects_icon = nullptr;