Skip to content

Add localized engine render config API#557

Open
Changdw wants to merge 2 commits into
cocos:mainfrom
Changdw:feature/render-config
Open

Add localized engine render config API#557
Changdw wants to merge 2 commits into
cocos:mainfrom
Changdw:feature/render-config

Conversation

@Changdw
Copy link
Copy Markdown
Contributor

@Changdw Changdw commented May 13, 2026

  • core/engine 新增翻译版 render-config 查询能力:
    • getLocalizedEngineRenderConfig()
    • Engine.queryLocalizedRenderConfig()
  • 读取 engine 仓库中的 editor/engine-features/render-config.json,并按当前语言把其中的 i18n: 文案展开成可直接展示的文本
  • 在 API 层新增 engine-get-render-config / EngineApi.getRenderConfig(),返回项目设置可直接使用的渲染配置数据
  • 保留原有 queryRenderConfig() 原始读取能力,避免影响现有调用方

@Changdw Changdw requested review from dogodo-cc and yanOO1497 and removed request for yanOO1497 May 13, 2026 10:12
Comment thread src/api/engine/engine.ts Outdated
@title('Get Engine Render Config')
@description('Get translated render-config.json data from the current engine repository for project settings rendering configuration display.')
@result(SchemaRenderConfigResult)
async getRenderConfig(): Promise<CommonResultType<TRenderConfigResult>> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要暴露在 lib 而不是 API 层,这个 API 层没啥用,而且这个不需要暴露在 mcp 里加重 tools 负担,纯粹 PinK 需要而已

Comment thread tests/engine-api.test.ts Outdated
import { COMMON_STATUS } from '../src/api/base/schema-base';
import { EngineApi } from '../src/api/engine/engine';

describe('EngineApi', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该测 lib/engine 里的接口 ,实际上 CLI 里的 API 层现在是一个待废弃的设计。只需要 mcp 层就行了。

}

if (typeof value === 'string') {
return translateRenderConfigText(value, localization) as T;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前 CLI 还缺失一个步骤是关于 engine 模块默认值的获取,需要从 render config 里解析出来默认值作为 CLI engine 裁切设置的默认值。现在写死的是因为还没有对接。

@Changdw
Copy link
Copy Markdown
Contributor Author

Changdw commented May 14, 2026

  • src/lib/engine/engine.ts 新增 getRenderConfig(),直接返回当前 engine 仓库中已完成 i18n 翻译的 render-config 数据
  • 撤回 src/api/engine/engine.ts 中新增的 render-config tool,避免增加 MCP tools 负担
  • settings/engine.json 的默认 engine 模块配置改为从 render-config 动态推导,覆盖 cache / flags / includeModules
  • 新建项目写入默认 settings 时,改为按当前 engine 仓库生成默认模块配置;仓库 render-config 不可用时回退到 CLI 内置副本
  • 测试从 API 层迁移到 lib 层,并补充 project settings template 默认值来源测试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants