parent
2515ff5577
commit
21edeebfdb
1 changed files with 8 additions and 0 deletions
|
@ -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();
|
RES res = obj->get(p_name).operator RefPtr();
|
||||||
if (res->is_type("Texture")) {
|
if (res->is_type("Texture")) {
|
||||||
int tw = EditorSettings::get_singleton()->get("property_editor/texture_preview_width");
|
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_max_width(1, tw);
|
||||||
p_item->set_icon(1, res);
|
p_item->set_icon(1, res);
|
||||||
p_item->set_text(1, "");
|
p_item->set_text(1, "");
|
||||||
|
@ -3206,6 +3210,10 @@ void PropertyEditor::update_tree() {
|
||||||
|
|
||||||
if (res->is_type("Texture")) {
|
if (res->is_type("Texture")) {
|
||||||
int tw = EditorSettings::get_singleton()->get("property_editor/texture_preview_width");
|
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_max_width(1, tw);
|
||||||
item->set_icon(1, res);
|
item->set_icon(1, res);
|
||||||
item->set_text(1, "");
|
item->set_text(1, "");
|
||||||
|
|
Loading…
Reference in a new issue