Unreal Python Blueprint Assets
本 Skill 记录 UE 5.8 项目里用 UnrealEditor-Cmd -run=pythonscript 创建、配置、保存和验证 Blueprint 类资产的兜底流程。优先使用 MCP/Toolset;当 MCP 不可用或缺少安全资产编辑面时,再用本流程。
工作流
- 先读取
../orion-asset-management/SKILL.md,确认资产路径和命名。 - 如果是 UMG/Widget Blueprint,再读取
../orion-umg/SKILL.md;如果是 MCP 失败后的兜底,再读取../orion-mcp-workflow/SKILL.md。 - 把临时 Python 放到
Saved/OrionUE/Agents,不要放进正式Source或Content。 - 用
UnrealEditor-Cmd.exe <Project>.uproject -run=pythonscript -script=<script.py> -unattended -nop4 -nosplash -NullRHI -NoSound -NoLiveCoding执行。 - 保存后验证
.uasset落盘、日志存在Compiling Blueprint/Saving Package/Python script executed successfully,必要时再用二进制文本搜索确认关键默认值。
路由
- 创建、命名或保存正式资产前,先读取
../orion-asset-management/SKILL.md。 - 创建或修改 UMG / Widget Blueprint 时,配合
../orion-umg/SKILL.md。 - MCP 可用时优先读取并使用
../orion-mcp-workflow/SKILL.md;只有 MCP 失败、HTTP 502 或工具面不足时才使用本命令行 Python 兜底。 - 修改临时脚本或生成代码文件时,遵守
../orion-code-style/SKILL.md的 CRLF 和缩进要求。
详细步骤、脚本模板和已验证坑位见:
references/orion-python-blueprint-assets.zh-CN.md
关键约束
- 不编辑引擎源码;只执行引擎命令行工具。
- 缺失资产检查先用
EditorAssetLibrary.does_asset_exist,不要直接load_asset让日志产生错误。 generated_class在 UE Python 里可能是属性,也可能是方法,脚本必须兼容两种形式。KismetCompilerLibrary不一定暴露;优先尝试BlueprintEditorLibrary.compile_blueprint,没有编译入口时记录 warning 并保存。- 普通
Blueprint不一定能通过get_editor_property("parent_class")读取父类;重设父类优先用BlueprintEditorLibrary.reparent_blueprint,验证父类时读取 GeneratedClass/CDO 可用属性或用.uasset二进制字符串确认NativeParentClass。 - 任务完成后仍要跑项目代码风格检查和目标构建;资产保存不等于代码可编译。