diff options
| author | volzhs | 2017-04-11 19:29:44 +0900 |
|---|---|---|
| committer | volzhs | 2017-04-11 20:29:35 +0900 |
| commit | 21edeebfdbea38340b33ad45bd64ff19048ce80e (patch) | |
| tree | 60f66480469dd78c13dca1c5245fff2992244f25 /editor/property_editor.cpp | |
| parent | 2515ff55774b2b3c3f83ceeb140680661fa8462c (diff) | |
| download | godot-21edeebfdbea38340b33ad45bd64ff19048ce80e.tar.gz godot-21edeebfdbea38340b33ad45bd64ff19048ce80e.tar.zst godot-21edeebfdbea38340b33ad45bd64ff19048ce80e.zip | |
Prevent to take too much space for long vertical texture
fix #8176
Diffstat (limited to '')
| -rw-r--r-- | editor/property_editor.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 39ed889e9..17f28e13e 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -2062,6 +2062,10 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String &p RES res = obj->get(p_name).operator RefPtr(); if (res->is_type("Texture")) { int tw = EditorSettings::get_singleton()->get("property_editor/texture_preview_width"); + Vector2 size(res->call("get_width"), res->call("get_height")); + if (size.width < size.height) { + tw = MAX((size.width / size.height) * tw, 1); + } p_item->set_icon_max_width(1, tw); p_item->set_icon(1, res); p_item->set_text(1, ""); @@ -3206,6 +3210,10 @@ void PropertyEditor::update_tree() { if (res->is_type("Texture")) { int tw = EditorSettings::get_singleton()->get("property_editor/texture_preview_width"); + Vector2 size(res->call("get_width"), res->call("get_height")); + if (size.width < size.height) { + tw = MAX((size.width / size.height) * tw, 1); + } item->set_icon_max_width(1, tw); item->set_icon(1, res); item->set_text(1, ""); |
