diff options
author | Andreas Haas <Hinsbart@users.noreply.github.com> | 2017-04-14 17:50:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-14 17:50:29 +0200 |
commit | 4e7c5eb498f338e6157665976b975016bd54505c (patch) | |
tree | 99268ffb5e88f73f401f89ac45bb625f1792ca94 | |
parent | 58edf265009933a97d13d46b0e49dfdd117e8d39 (diff) | |
parent | c3e6759ca1324447b8d51362e622f3a19403cb4e (diff) |
Merge pull request #8356 from volzhs/texture-view-master
Prevent to take too much space for long vertical texture
-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 86136fa78b..77de27a651 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -2388,6 +2388,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_class("Texture")) { int tw = EditorSettings::get_singleton()->get("docks/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, ""); @@ -3618,6 +3622,10 @@ void PropertyEditor::update_tree() { if (res->is_class("Texture")) { int tw = EditorSettings::get_singleton()->get("docks/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, ""); |