@vvfx/ge-ir 0.0.1-beta.4 → 0.0.1-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @vvfx/ge-ir
2
2
 
3
3
  > 内部转换包。统一承载 Galacean Effects JSONScene 与 `@vvfx/animation-ir`
4
- > 之间的双向转换能力,供 monorepo 内的 `lottie2ge`、`dsl2ge`、调试页面等链路复用。
4
+ > 之间的双向转换能力,供 monorepo 内的 lottie2ge、dsl2ge、调试页面等链路复用。
5
5
 
6
6
  ## 能力范围
7
7
 
@@ -36,17 +36,44 @@ const roundTrippedScene = convertIRToGE(ir);
36
36
  - `get2dTo3dRatio`
37
37
  - `convert2dTo3dPoint`
38
38
 
39
- `src/shared/ge2ir-metadata.ts` 是 round-trip passthrough metadata 的共同真源。`ge2ir`
40
- 写入 `layer.metadata.ge2ir`,`ir2ge` 在生成 GE 时读取并复用原始 GE 动画和 mask 信息。
39
+ `IRLayerNode.specific.effects` 是 round-trip passthrough 数据的共同入口。ge2ir 写入暂时无法通过
40
+ 规范化 IR 无损表示的 GE 动画、mask、precomp 和原始层级信息,ir2ge 在生成 GE 时读取并复用。
41
41
 
42
- 当前支持的 metadata keys:
42
+ 当前支持的主要 passthrough keys:
43
43
 
44
44
  - `positionOverLifetime`
45
45
  - `rotationOverLifetime`
46
46
  - `sizeOverLifetime`
47
47
  - `colorOverLifetime`
48
- - `geComponentId`
49
- - `geMask`
48
+ - `sourceComponentId`
49
+ - `mask`
50
+ - `precompRefId`
51
+ - `precompContent`
52
+ - `sourceHierarchy`
53
+
54
+ `sourceHierarchy` 保留 GE 原始的 `single-item` / `null-sprite-pair` 结构。编辑 anchor、
55
+ rotation 或 scale 后会使该提示失效,后续由 GE lowering 重新按动画语义决策。
56
+
57
+ ### Passthrough 辅助函数
58
+
59
+ ```ts
60
+ import { getEffectsLayerSpecific, invalidateEffectsLayerSpecific } from '@vvfx/ge-ir';
61
+
62
+ const effectsData = getEffectsLayerSpecific(composition, layer);
63
+
64
+ layer.transform = {
65
+ ...layer.transform,
66
+ opacity: { keyframed: false, value: 0.5 },
67
+ };
68
+
69
+ invalidateEffectsLayerSpecific(layer, 'opacity');
70
+ ```
71
+
72
+ 修改已经存在等价保真数据的规范化字段后,应调用 `invalidateEffectsLayerSpecific`,避免旧的 GE
73
+ payload 在 lowering 时覆盖编辑结果。函数会返回被删除的字段,并自动清理已经为空的容器。
74
+
75
+ 公共辅助 API 还包括 `getEffectsCompositionSpecific`、`hasEffectsAnimationPassthrough` 和
76
+ `hasEffectsColorAnimationPassthrough`。
50
77
 
51
78
  `src/shared/types.ts` 放置不属于单一方向的 GE wire/pool 基础结构:
52
79
 
@@ -62,5 +89,5 @@ const roundTrippedScene = convertIRToGE(ir);
62
89
  `src/index.ts` 按三层导出:
63
90
 
64
91
  - 公开/主链路:`convertIRToGE`、`convertGEToIR`、基础类型。
65
- - sibling 包 API:`readLottieSpecific`、`isTransformOnlyParentLink`、部分 GE 处理中间类型。
66
- - debug internals:bezier/timeline/post-process/utils 等调试链路会用到的内部符号。
92
+ - sibling 包 API:`readLottieSpecific`、`hasIndependentParentLifetime`、部分 GE 处理中间类型。
93
+ - debug internals:bezier/timeline/post-process/utils 等调试链路会用到的内部符号。
@@ -1,3 +1,3 @@
1
- import type { IRComposition } from '@vvfx/animation-ir';
1
+ import { type IRComposition } from '@vvfx/animation-ir';
2
2
  import type { GE2IROptions } from './types';
3
3
  export declare function convertGEToIR(scene: Record<string, unknown>, options: GE2IROptions): IRComposition;
@@ -9,7 +9,7 @@ export interface ComponentData {
9
9
  blendMode?: IRBlendMode;
10
10
  anchorScale?: [number, number];
11
11
  /** Original GE component id — rendezvous key for cross-component references (masks). */
12
- geComponentId?: string;
12
+ GEComponentId?: string;
13
13
  /** Raw GE component-level `mask` object (source: {isMask:true,...}, target: {isMask:false,reference,inverted}). */
14
14
  rawMask?: Record<string, unknown>;
15
15
  }
@@ -1,7 +1,7 @@
1
1
  import type { IRBezierHandle, IRKeyframe } from '@vvfx/animation-ir';
2
2
  export declare function parseBezierKeyframes(curves: unknown[], startFrame: number, endFrame: number): IRKeyframe<number>[];
3
3
  export declare function parsePositionTimingKeyframes(curves: unknown[], startFrame: number, endFrame: number): Array<{
4
- t: number;
4
+ frame: number;
5
5
  outTangent?: IRBezierHandle;
6
6
  inTangent?: IRBezierHandle;
7
7
  }>;
@@ -1,2 +1,2 @@
1
1
  import type { IRBlendMode as IRBlendModeType } from '@vvfx/animation-ir';
2
- export declare function reverseBlendMode(geCode: number | undefined): IRBlendModeType | undefined;
2
+ export declare function reverseBlendMode(GECode: number | undefined): IRBlendModeType | undefined;
@@ -1,3 +1,3 @@
1
1
  import type { IREndBehavior as IREndBehaviorType } from '@vvfx/animation-ir';
2
- export declare function reverseEndBehavior(geBehavior: number | undefined): IREndBehaviorType | undefined;
3
- export declare function reverseCompositionEndBehavior(geBehavior: number | undefined): IREndBehaviorType | undefined;
2
+ export declare function reverseEndBehavior(GEBehavior: number | undefined): IREndBehaviorType | undefined;
3
+ export declare function reverseCompositionEndBehavior(GEBehavior: number | undefined): IREndBehaviorType | undefined;
@@ -3,7 +3,6 @@ import type { GEPoolIndex } from '../shared/types';
3
3
  export interface GE2IROptions {
4
4
  frameRate: number;
5
5
  }
6
- export type { GE2IRPassthroughMetadata } from '../shared/ge2ir-metadata';
7
6
  export interface GESceneContext {
8
7
  compositionId: string;
9
8
  width: number;
package/dist/index.d.ts CHANGED
@@ -2,13 +2,14 @@ export { convertIRToGE } from './ir2ge/assembly/generator';
2
2
  export { convertGEToIR } from './ge2ir/converter';
3
3
  export type { GE2IROptions } from './ge2ir/types';
4
4
  export type { DataPath, JSONScene } from '@galacean/effects-specification';
5
+ export { getEffectsCompositionSpecific, getEffectsLayerSpecific, hasEffectsAnimationPassthrough, hasEffectsColorAnimationPassthrough, invalidateEffectsLayerSpecific, } from './passthrough';
6
+ export type { EffectsLayerSpecificInvalidationTarget } from './passthrough';
5
7
  export { readLottieSpecific } from './ir2ge/ir/specific';
6
8
  export type { LottieLayerSpecific } from './ir2ge/ir/specific';
7
- export { isTransformOnlyParentLink } from './ir2ge/ir/parent-link';
9
+ export { hasIndependentParentLifetime } from './ir2ge/ir/parent-link';
8
10
  export type { ECSCollector, GEDataPath, GEItem, GEPoolIndex, GERecord, GETransform } from './shared/types';
9
11
  export type { ProcessedItem, TransformAnimation } from './ir2ge/types';
10
12
  export { DEFAULT_CAMERA_Z, DEFAULT_CAMERA_FOV, DEFAULT_CLIP_MODE, get2dTo3dRatio, convert2dTo3dPoint, } from './shared/coordinate';
11
- export type { GE2IRPassthroughMetadata } from './shared/ge2ir-metadata';
12
13
  export { assembleScene } from './ir2ge/assembly/scene-assembly';
13
14
  export { estimateTextWidth, roundNumber, lerp, createId, toDataPath } from './ir2ge/utils';
14
15
  export { irScalarKeyframesToGE, irVectorKeyframesToGE, irPositionKeyframesToGE, shouldUseKeyframeMode, } from './ir2ge/builders/bezier';