From cf6212bd50323876ad0d8097cc9449829981dacf Mon Sep 17 00:00:00 2001 From: knoxHuang Date: Fri, 22 Nov 2024 14:09:14 +0800 Subject: [PATCH] Improve spine i18n --- cocos/spine/skeleton.ts | 16 --------- editor/i18n/en/localization.js | 10 ------ editor/i18n/en/modules/ui.js | 61 ++++++++++++++++++++++++++++++++++ editor/i18n/zh/localization.js | 10 ------ editor/i18n/zh/modules/ui.js | 59 ++++++++++++++++++++++++++++++++ 5 files changed, 120 insertions(+), 36 deletions(-) diff --git a/cocos/spine/skeleton.ts b/cocos/spine/skeleton.ts index 62e7446cacd..c27c2ef7b05 100644 --- a/cocos/spine/skeleton.ts +++ b/cocos/spine/skeleton.ts @@ -353,7 +353,6 @@ export class Skeleton extends UIRenderer { */ @editable @type(SkeletonData) - @displayName('SkeletonData') get skeletonData (): SkeletonData | null { return this._skeletonData; } @@ -374,9 +373,7 @@ export class Skeleton extends UIRenderer { /** * @engineInternal */ - @displayName('Default Skin') @type(DefaultSkinsEnum) - @tooltip('i18n:COMPONENT.skeleton.default_skin') get _defaultSkinIndex (): number { if (this.skeletonData) { const skinsEnum = this.skeletonData.getSkinsEnum(); @@ -425,9 +422,7 @@ export class Skeleton extends UIRenderer { /** * @engineInternal */ - @displayName('Animation') @type(SpineDefaultAnimsEnum) - @tooltip('i18n:COMPONENT.skeleton.animation') get _animationIndex (): number { const animationName = EDITOR_NOT_IN_PREVIEW ? this.defaultAnimation : this.animation; if (this.skeletonData) { @@ -475,8 +470,6 @@ export class Skeleton extends UIRenderer { * @en Animation mode, with options for real-time mode, private cached, or public cached mode. * @zh 动画模式,可选实时模式,私有 cached 或公共 cached 模式。 */ - @displayName('Animation Cache Mode') - @tooltip('i18n:COMPONENT.skeleton.animation_cache_mode') @editable @type(SpineAnimationCacheMode) get defaultCacheMode (): SpineAnimationCacheMode { @@ -492,7 +485,6 @@ export class Skeleton extends UIRenderer { * @zh 是否启用 alpha 预乘。 */ @editable - @tooltip('i18n:COMPONENT.skeleton.premultipliedAlpha') get premultipliedAlpha (): boolean { return this._premultipliedAlpha; } set premultipliedAlpha (v: boolean) { if (v !== this._premultipliedAlpha) { @@ -507,14 +499,12 @@ export class Skeleton extends UIRenderer { * @zh 是否循环播放当前骨骼动画。 */ @serializable - @tooltip('i18n:COMPONENT.skeleton.loop') public loop = true; /** * @en The time scale of this skeleton. * @zh 当前骨骼中所有动画的时间缩放率。 */ - @tooltip('i18n:COMPONENT.skeleton.time_scale') @editable get timeScale (): number { return this._timeScale; } set timeScale (value) { @@ -530,7 +520,6 @@ export class Skeleton extends UIRenderer { * @zh 是否启用染色效果。 */ @editable - @tooltip('i18n:COMPONENT.skeleton.use_tint') get useTint (): boolean { return this._useTint; } set useTint (value) { if (value !== this._useTint) { @@ -545,7 +534,6 @@ export class Skeleton extends UIRenderer { * @zh 如果渲染大量相同纹理,且结构简单的骨骼动画,开启合批可以降低 draw call 数量提升渲染性能。 */ @editable - @tooltip('i18n:COMPONENT.skeleton.enabled_batch') get enableBatch (): boolean { return this._enableBatch; } set enableBatch (value) { if (value !== this._enableBatch) { @@ -561,7 +549,6 @@ export class Skeleton extends UIRenderer { * 当前动画组件维护的挂点数组。一个挂点组件包括动画节点路径和目标节点。 */ @type([SpineSocket]) - @tooltip('i18n:animation.sockets') get sockets (): SpineSocket[] { return this._sockets; } @@ -579,7 +566,6 @@ export class Skeleton extends UIRenderer { * @zh 是否显示 slot 的 debug 信息。 */ @editable - @tooltip('i18n:COMPONENT.skeleton.debug_slots') get debugSlots (): boolean { return this._debugSlots; } set debugSlots (v: boolean) { if (v !== this._debugSlots) { @@ -594,7 +580,6 @@ export class Skeleton extends UIRenderer { * @zh 是否显示 bone 的 debug 信息。 */ @editable - @tooltip('i18n:COMPONENT.skeleton.debug_bones') get debugBones (): boolean { return this._debugBones; } set debugBones (v: boolean) { if (v !== this._debugBones) { @@ -609,7 +594,6 @@ export class Skeleton extends UIRenderer { * @zh 是否显示 mesh 的 debug 信息。 */ @editable - @tooltip('i18n:COMPONENT.skeleton.debug_mesh') get debugMesh (): boolean { return this._debugMesh; } set debugMesh (value) { if (value !== this._debugMesh) { diff --git a/editor/i18n/en/localization.js b/editor/i18n/en/localization.js index 1b9f07c7e4c..12479d3e241 100755 --- a/editor/i18n/en/localization.js +++ b/editor/i18n/en/localization.js @@ -668,16 +668,6 @@ module.exports = link(mixin({ design_size: 'Design resolution of the SubContextView, dynamic updates at runtime is not possible', fps: 'Update frame rate for the SubContextView', }, - skeleton: { - skeleton_data: 'The skeleton data contains the skeleton information,
drag the json file exported from Spine to get started.', - default_skin: 'Choose the default skin.', - animation: 'The name of current playing animation.', - loop: 'Whether loop current animation', - time_scale: 'The time scale of animations of this skeleton', - debug_slots: 'Indicates whether show debug slots.', - debug_bones: 'Indicates whether show debug bones.', - premultipliedAlpha: 'Indicates whether to enable premultiplied alpha.', - }, dragon_bones: { dragon_bones_asset: 'The json data contains the DragonBones information,
drag the json file exported from DragonBones to get started.', diff --git a/editor/i18n/en/modules/ui.js b/editor/i18n/en/modules/ui.js index c4724350a81..7c5da212f97 100644 --- a/editor/i18n/en/modules/ui.js +++ b/editor/i18n/en/modules/ui.js @@ -236,5 +236,66 @@ module.exports = { }, }, }, + 'sp': { + 'Skeleton': { + properties: { + __extends__: 'classes.cc.UIRenderer.properties', + 'skeletonData': { + displayName: 'SkeletonData', + tooltip: 'The skeleton data contains the skeleton information,
drag the json file exported from Spine to get started.', + }, + '_defaultSkinIndex': { + displayName: 'Default skin', + tooltip: 'Choose the default skin.', + }, + '_animationIndex': { + displayName: 'Animation', + tooltip: 'The name of current playing animation.', + }, + 'defaultCacheMode': { + displayName: 'Animation Cache Mode', + tooltip: 'Animation mode, with options for real-time mode,
private cached, or public cached mode.', + }, + 'loop': { + displayName: 'Loop', + tooltip: 'Whether loop current animation', + }, + 'timeScale': { + displayName: 'Time Scale', + tooltip: 'The time scale of animations of this skeleton', + }, + 'debugSlots': { + displayName: 'Debug Slots', + tooltip: 'Indicates whether show debug slots.', + }, + 'debugBones': { + displayName: 'Debug Bones', + tooltip: 'Indicates whether show debug bones.', + }, + 'debugMesh': { + displayName: 'Debug Mesh', + tooltip: 'Indicates whether open debug mesh.', + }, + 'useTint': { + displayName: 'Use Tint', + tooltip: 'Enabled two color tint.', + }, + 'premultipliedAlpha': { + displayName: 'Premultiplied Alpha', + tooltip: 'Indicates whether to enable premultiplied alpha.', + }, + 'enableBatch': { + displayName: 'Enable Batch', + tooltip: 'If rendering a large number of identical textures and simple skeletal animations,
' + + 'enabling batching can reduce the number of draw calls and improve rendering performance.', + }, + 'sockets': { + displayName: 'Sockets', + tooltip: 'The bone sockets this animation component maintains.
' + + 'A SpineSocket object contains a path reference to bone, and a target node.', + }, + }, + }, + }, }, }; diff --git a/editor/i18n/zh/localization.js b/editor/i18n/zh/localization.js index 9b68c2c0c19..7fd7f56d43f 100755 --- a/editor/i18n/zh/localization.js +++ b/editor/i18n/zh/localization.js @@ -653,16 +653,6 @@ module.exports = link(mixin({ design_size: '开放数据域的设计分辨率,禁止在运行时动态更新', fps: '主域更新开放数据域贴图的频率', }, - skeleton: { - skeleton_data: '骨骼信息数据,拖拽 Spine 导出的骨骼动画信息 json 资源到这里来开始使用', - default_skin: '选择默认的皮肤', - animation: '正在播放的动画名称', - loop: '是否循环播放当前动画', - time_scale: '当前骨骼中所有动画的时间缩放率', - debug_slots: '是否显示 slot 的 debug 信息', - debug_bones: '是否显示 bone 的 debug 信息', - premultipliedAlpha: '是否启用贴图预乘', - }, dragon_bones: { dragon_bones_asset: '骨骼信息数据,拖拽 Dragon Bones 导出的骨骼动画信息 json 资源到这里来开始使用', dragon_bones_atlas_asset: 'Texture 信息数据,拖拽 Dragon Bones 导出的 Texture 信息 json 资源到这里来开始使用', diff --git a/editor/i18n/zh/modules/ui.js b/editor/i18n/zh/modules/ui.js index 4e7afd6879f..a32bd7fe44f 100644 --- a/editor/i18n/zh/modules/ui.js +++ b/editor/i18n/zh/modules/ui.js @@ -224,5 +224,64 @@ module.exports = { }, }, }, + 'sp': { + 'Skeleton': { + properties: { + __extends__: 'classes.cc.UIRenderer.properties', + 'skeletonData': { + displayName: 'SkeletonData', + tooltip: '骨骼信息数据,拖拽 Spine 导出的骨骼动画信息 json 资源到这里来开始使用', + }, + '_defaultSkinIndex': { + displayName: 'Default skin', + tooltip: '选择默认的皮肤', + }, + '_animationIndex': { + displayName: 'Animation', + tooltip: '正在播放的动画名称', + }, + 'defaultCacheMode': { + displayName: 'Animation Cache Mode', + tooltip: '动画模式,可选实时模式,私有 cached 或公共 cached 模式', + }, + 'loop': { + displayName: 'Loop', + tooltip: '是否循环播放当前动画', + }, + 'timeScale': { + displayName: 'Time Scale', + tooltip: '当前骨骼中所有动画的时间缩放率', + }, + 'debugSlots': { + displayName: 'Debug Slots', + tooltip: '是否显示 slot 的 debug 信息', + }, + 'debugBones': { + displayName: 'Debug Bones', + tooltip: '是否显示 bone 的 debug 信息', + }, + 'debugMesh': { + displayName: 'Debug Mesh', + tooltip: '是否显示 mesh 的 debug 信息', + }, + 'useTint': { + displayName: 'Use Tint', + tooltip: '是否启用染色效果', + }, + 'premultipliedAlpha': { + displayName: 'Premultiplied Alpha', + tooltip: '是否启用贴图预乘', + }, + 'enableBatch': { + displayName: 'Enable Batch', + tooltip: '如果渲染大量相同纹理,且结构简单的骨骼动画,开启合批可以降低 draw call 数量提升渲染性能', + }, + 'sockets': { + displayName: 'Sockets', + tooltip: '当前动画组件维护的挂点数组。一个挂点组件包括动画节点路径和目标节点', + }, + }, + }, + }, }, };