Skip to content

Commit

Permalink
Animation components localization (#15701)
Browse files Browse the repository at this point in the history
Fix
  • Loading branch information
shrinktofit authored Jul 21, 2023
1 parent 775b794 commit 3ca7d08
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 14 deletions.
6 changes: 3 additions & 3 deletions cocos/3d/skeletal-animation/skeletal-animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

import {
ccclass, executeInEditMode, executionOrder, help, menu, tooltip, type, serializable, editable,
ccclass, executeInEditMode, executionOrder, help, menu, type, serializable, editable,
} from 'cc.decorator';
import { SkinnedMeshRenderer } from '../skinned-mesh-renderer';
import { Mat4, cclegacy, js, assertIsTrue } from '../../core';
Expand Down Expand Up @@ -107,7 +107,7 @@ export class SkeletalAnimation extends Animation {
* 当前动画组件维护的挂点数组。要挂载自定义节点到受动画驱动的骨骼上,必须先在此注册挂点。
*/
@type([Socket])
@tooltip('i18n:animation.sockets')
@editable
get sockets (): Socket[] {
return this._sockets;
}
Expand All @@ -131,7 +131,7 @@ export class SkeletalAnimation extends Animation {
* 是否使用预烘焙动画,默认启用,可以大幅提高运行效时率,但所有动画效果会被彻底固定,不支持任何形式的编辑和混合。<br>
* 运行时动态修改此选项会在播放下一条动画片段时生效。
*/
@tooltip('i18n:animation.use_baked_animation')
@editable
get useBakedAnimation (): boolean {
return this._useBakedAnimation;
}
Expand Down
6 changes: 2 additions & 4 deletions cocos/animation/animation-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
THE SOFTWARE.
*/

import { ccclass, executeInEditMode, executionOrder, help, menu, tooltip, type, serializable } from 'cc.decorator';
import { ccclass, executeInEditMode, executionOrder, help, menu, type, serializable, editable } from 'cc.decorator';
import { EDITOR_NOT_IN_PREVIEW, TEST } from 'internal:constants';
import { Component } from '../scene-graph/component';
import { Eventify, warnID, js, cclegacy } from '../core';
Expand Down Expand Up @@ -60,7 +60,6 @@ export class Animation extends Eventify(Component) {
* 设置时,已有剪辑关联的动画状态将被停止;若默认剪辑不在新的动画剪辑中,将被重置为空。
*/
@type([AnimationClip])
@tooltip('i18n:animation.clips')
get clips (): (AnimationClip | null)[] {
return this._clips;
}
Expand Down Expand Up @@ -103,7 +102,6 @@ export class Animation extends Eventify(Component) {
* @see [[playOnLoad]]
*/
@type(AnimationClip)
@tooltip('i18n:animation.default_clip')
get defaultClip (): AnimationClip | null {
return this._defaultClip;
}
Expand Down Expand Up @@ -131,7 +129,7 @@ export class Animation extends Eventify(Component) {
* 注意,若在组件开始运行前调用了 `crossFade` 或 `play()`,此字段将不会生效。
*/
@serializable
@tooltip('i18n:animation.play_on_load')
@editable
public playOnLoad = false;

/**
Expand Down
40 changes: 40 additions & 0 deletions editor/i18n/en/animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,47 @@ module.exports = {

classes: {
'cc': {
'Animation': {
'properties': {
'clips': {
displayName: 'Clips',
tooltip: 'All clips this component governs.',
},
'defaultClip': {
displayName: 'Default Clip',
tooltip: 'The default clip to play.',
},
'playOnLoad': {
displayName: 'Play On Load',
tooltip: 'Whether automatically play the default clip after component loaded.',
},
},
},
'SkeletalAnimation': {
'properties': {
__extends__: 'classes.cc.Animation.properties',
'sockets': {
displayName: 'Sockets',
tooltip: 'The joint sockets this animation component maintains. ' +
'Sockets have to be registered here before attaching custom nodes to animated joints.',
},
'useBakedAnimation': {
displayName: 'Use Baked Animation',
tooltip: `Whether to bake animations. Default to true, ` +
`which substantially increases performance while making all animations completely fixed.` +
`Dynamically changing this property will take effect when playing the next animation clip.`,
},
},
},
'animation': {
'AnimationController': {
properties: {
'graph': {
displayName: 'Graph',
tooltip: 'The animation graph or animation graph variant associated with this animation controller.',
},
},
},
'PoseGraphOutputNode': {
displayName: 'Output Pose',
},
Expand Down
37 changes: 37 additions & 0 deletions editor/i18n/zh/animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,44 @@ module.exports = {

classes: {
'cc': {
'Animation': {
'properties': {
'clips': {
displayName: '剪辑列表',
tooltip: '此组件管理的所有剪辑。',
},
'defaultClip': {
displayName: '默认剪辑',
tooltip: '默认播放的剪辑。',
},
'playOnLoad': {
displayName: '加载后播放',
tooltip: '是否在组件加载完成后自动播放默认剪辑。',
},
},
},
'SkeletalAnimation': {
'properties': {
__extends__: 'classes.cc.Animation.properties',
'sockets': {
displayName: '挂点列表',
tooltip: '当前动画组件维护的挂点列表。要挂载自定义节点到受动画驱动的骨骼上,必须先在此注册挂点。',
},
'useBakedAnimation': {
displayName: '预烘培动画',
tooltip: '是否预烘焙动画,默认启用,可以大幅提高运行效时率,但所有动画效果会被彻底固定,不支持任何形式的编辑和混合。',
},
},
},
'animation': {
'AnimationController': {
properties: {
'graph': {
displayName: '图',
tooltip: '此动画控制器所关联的动画图或动画图变体。',
},
},
},
'PoseGraphOutputNode': {
displayName: '输出姿态',
},
Expand Down
7 changes: 0 additions & 7 deletions editor/i18n/zh/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,6 @@ module.exports = link(mixin({
shadowMapSize: '阴影贴图分辨率,目前支持 Low_256x256、Medium_512x512、High_1024x1024、Ultra_2048x2048 四种精度的纹理',
maxReceived: '产生阴影的有效光源数量',
},
animation: {
default_clip: '在勾选自动播放或调用 play() 时默认播放的动画 clip。',
clips: '通过脚本可以访问并播放的 AnimationClip 列表',
play_on_load: '是否在运行游戏后自动播放默认动画 clip。',
use_baked_animation: '是否使用预烘焙动画,默认启用,可以大幅提高运行效时率,<br>但所有动画效果会被彻底固定,不支持任何形式的编辑',
sockets: '当前动画组件维护的挂点数组。要挂载自定义节点到受动画驱动的骨骼上,必须先在此注册挂点',
},
audio: {
clip: '通过该组件播放的默认 AudioClip 引用',
volume: '音频的音量',
Expand Down

0 comments on commit 3ca7d08

Please sign in to comment.