首页 > 解决方案 > unreal.EditorStaticMeshLibrary 中没有 get_lod_build_settings()。(UE4 Python)

问题描述

我找不到获取和修改静态网格上的构建设置的方法。我正在编写一个 python 脚本并在 Unreal 编辑器中运行它。(虚幻编辑器版本 4.25)

我尝试使用文档说具有 get_lod_build_settings() 功能的 EditorStaticMeshLibrary,但错误消息又回来了,好像它是无效的。任何人都可以看到我的问题或建议从 Python 访问 LOD 构建设置的另一种方法吗?谢谢。

import unreal

selected_items = unreal.EditorUtilityLibrary.get_selected_assets()

print 'Num of items selected = ' + str(len(selected_items))
for item in selected_items:    
    print 'Name=' + item.get_name() + '  Class=' + item.get_class().get_name()
    num_lods = unreal.EditorStaticMeshLibrary.get_lod_count(item)
    print 'Num LODs=' + str(num_lods)       
    build_data = unreal.EditorStaticMeshLibrary.get_lod_build_settings(item, 0)

这是输出:

LogPython: Num of items selected = 1
LogPython: Name=30_06_Cartridge_SM  Class=StaticMesh
LogPython: Num LODs=1
LogPython: Error: Traceback (most recent call last):
LogPython: Error:   File "C:/PL/console/HL/Content/Python/meshtest.py", line 10, in <module>
LogPython: Error:     build_data = unreal.EditorStaticMeshLibrary.get_lod_build_settings(item, 0)
LogPython: Error: AttributeError: type object 'EditorStaticMeshLibrary' has no attribute 'get_lod_build_settings'

文档: https ://docs.unrealengine.com/en-US/PythonAPI/class/EditorStaticMeshLibrary.html?highlight=get_lod_build_settings#unreal.EditorStaticMeshLibrary.get_lod_build_settings

标签: pythonunreal-engine4

解决方案


我收到了 Epic 的回复,显然这已在 4.26 版中修复


推荐阅读