Browse Source

Make resource editor fallback to Object icon if none is found

Michael Alexsander 5 năm trước cách đây
mục cha
commit
22b9510558
1 tập tin đã thay đổi với 4 bổ sung12 xóa
  1. 4 12
      editor/editor_properties.cpp

+ 4 - 12
editor/editor_properties.cpp

@@ -2399,19 +2399,11 @@ void EditorPropertyResource::_update_menu_items() {
 
 				inheritors_array.push_back(t);
 
-				int id = TYPE_BASE_ID + idx;
-
-				if (!icon.is_valid() && has_icon(t, "EditorIcons")) {
-					icon = get_icon(t, "EditorIcons");
-				}
-
-				if (icon.is_valid()) {
+				if (!icon.is_valid())
+					icon = get_icon(has_icon(t, "EditorIcons") ? t : "Object", "EditorIcons");
 
-					menu->add_icon_item(icon, vformat(TTR("New %s"), t), id);
-				} else {
-
-					menu->add_item(vformat(TTR("New %s"), t), id);
-				}
+				int id = TYPE_BASE_ID + idx;
+				menu->add_icon_item(icon, vformat(TTR("New %s"), t), id);
 
 				idx++;
 			}