Skip to content

Commit

Permalink
feat: add flags config (#17848)
Browse files Browse the repository at this point in the history
* feat: add flags config

* feat: update doc
  • Loading branch information
dogodo-cc authored Nov 13, 2024
1 parent 21e6d0c commit c2d429d
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 3 deletions.
30 changes: 27 additions & 3 deletions editor/engine-features/render-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,15 @@
"label": "i18n:ENGINE.features.physics_ammo.label",
"description": "i18n:ENGINE.features.physics_ammo.description",
"default": true,
"isNativeModule": true
"isNativeModule": true,
"flags": {
"LOAD_BULLET_MANUALLY": {
"label": "i18n:ENGINE.features.flags.bullet.loadManual.label",
"description": "i18n:ENGINE.features.flags.bullet.loadManual.description",
"default": false,
"ui-type": "checkbox"
}
}
},
"physics-cannon": {
"label": "i18n:ENGINE.features.physics_cannon.label",
Expand All @@ -113,7 +121,15 @@
"label": "i18n:ENGINE.features.physics_physx.label",
"cmakeConfig": "USE_PHYSICS_PHYSX",
"description": "i18n:ENGINE.features.physics_physx.description",
"isNativeModule": true
"isNativeModule": true,
"flags": {
"LOAD_PHYSX_MANUALLY": {
"label": "i18n:ENGINE.features.flags.physx.loadManual.label",
"description": "i18n:ENGINE.features.flags.physx.loadManual.description",
"default": false,
"ui-type": "checkbox"
}
}
},
"physics-builtin": {
"label": "i18n:ENGINE.features.physics_builtin.label",
Expand Down Expand Up @@ -293,7 +309,15 @@
"category": "2d",
"dependencies": [
"2d"
]
],
"flags": {
"LOAD_SPINE_MANUALLY": {
"label": "i18n:ENGINE.features.flags.spine.loadManual.label",
"description": "i18n:ENGINE.features.flags.spine.loadManual.description",
"ui-type": "checkbox",
"default": false
}
}
},
"dragon-bones": {
"default": true,
Expand Down
6 changes: 6 additions & 0 deletions editor/engine-features/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
},
"required": {
"type": "boolean"
},
"flags": {
"type": "object"
}
},
"type": "object"
Expand Down Expand Up @@ -241,6 +244,9 @@
},
"required": {
"type": "boolean"
},
"flags": {
"type": "object"
}
},
"type": "object"
Expand Down
6 changes: 6 additions & 0 deletions editor/engine-features/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ export interface BaseItem {
* @en Whether it is a required module. When adding a new module, the old version will be forced to select this module after the upgrade, otherwise it will not be selected.
*/
required?: boolean;

/**
* @zh 当选择了某个模块时,可以做些附加的配置
* @en When a module is selected, additional configurations can be made
*/
flags: {[k: string]: Pick<BaseItem, 'default' | 'label' | 'description' > & {'ui-type': 'checkbox' | 'select'}}
}

export interface IFeatureItem extends BaseItem {
Expand Down
26 changes: 26 additions & 0 deletions editor/i18n/en/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,32 @@ module.exports = link(mixin({
label: "WebSocket Server",
description: "Enable WebSocket Server for native. Note: WebSocket must also be enabled.",
},
flags: {
spine: {
loadManual: {
label: 'Load Manually',
description: `Whether to load Spine Wasm/AsmJS moudle manually by 'loadWasmModuleSpine' API ?`,
},
},
box2d: {
loadManual: {
label: 'Load Manually',
description: `Whether to load Box2D Wasm/AsmJS moudle manually by 'loadWasmModuleBox2D' API ?`,
},
},
bullet: {
loadManual: {
label: 'Load Manually',
description: `Whether to load Bullet Wasm/AsmJS moudle manually by 'loadWasmModuleBullet' API ?`,
},
},
physx: {
loadManual: {
label: 'Load Manually',
description: `Whether to load PhysX Wasm/AsmJS moudle manually by 'loadWasmModulePhysX' API ?`,
},
},
},
},
renderable_2d: {
srcBlendFactor: 'Specifies the source blend mode, <br>it will clone a new material object.',
Expand Down
26 changes: 26 additions & 0 deletions editor/i18n/zh/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,32 @@ module.exports = link(mixin({
label: "WebSocket Server",
description: "对原生启用 WebSocket Server。注意: 必须同时启用 WebSocket。",
},
flags: {
spine: {
loadManual: {
label: '手动加载',
description: `是否通过 'loadWasmModuleSpine' API 手动加载 Spine Wasm/AsmJS 模块 ?`,
},
},
box2d: {
loadManual: {
label: '手动加载',
description: `是否通过 'loadWasmModuleBox2D' API 手动加载 Box2D Wasm/AsmJS 模块 ?`,
},
},
bullet: {
loadManual: {
label: '手动加载',
description: `是否通过 'loadWasmModuleBullet' API 手动加载 Bullet Wasm/AsmJS 模块 ?`,
},
},
physx: {
loadManual: {
label: '手动加载',
description: `是否通过 'loadWasmModulePhysX' API 手动加载 PhysX Wasm/AsmJS 模块 ?`,
},
},
},
},
renderable_2d: {
srcBlendFactor: '指定源的混合模式,这会克隆一个新的材质对象,注意这带来的性能和内存损耗',
Expand Down

0 comments on commit c2d429d

Please sign in to comment.