Skip to content

Commit

Permalink
Improve spine i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
knoxHuang committed Nov 22, 2024
1 parent 8884807 commit cf6212b
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 36 deletions.
16 changes: 0 additions & 16 deletions cocos/spine/skeleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ export class Skeleton extends UIRenderer {
*/
@editable
@type(SkeletonData)
@displayName('SkeletonData')
get skeletonData (): SkeletonData | null {
return this._skeletonData;
}
Expand All @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -561,7 +549,6 @@ export class Skeleton extends UIRenderer {
* 当前动画组件维护的挂点数组。一个挂点组件包括动画节点路径和目标节点。
*/
@type([SpineSocket])
@tooltip('i18n:animation.sockets')
get sockets (): SpineSocket[] {
return this._sockets;
}
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down
10 changes: 0 additions & 10 deletions editor/i18n/en/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, <br>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, <br>drag the json file exported from DragonBones to get started.',
Expand Down
61 changes: 61 additions & 0 deletions editor/i18n/en/modules/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, <br>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, <br>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,<br>' +
'enabling batching can reduce the number of draw calls and improve rendering performance.',
},
'sockets': {
displayName: 'Sockets',
tooltip: 'The bone sockets this animation component maintains.<br>' +
'A SpineSocket object contains a path reference to bone, and a target node.',
},
},
},
},
},
};
10 changes: 0 additions & 10 deletions editor/i18n/zh/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 资源到这里来开始使用',
Expand Down
59 changes: 59 additions & 0 deletions editor/i18n/zh/modules/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '当前动画组件维护的挂点数组。一个挂点组件包括动画节点路径和目标节点',
},
},
},
},
},
};

0 comments on commit cf6212b

Please sign in to comment.