@vvfx/ge-ir 0.0.1-beat.2 → 0.0.1-beta.11
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 +290 -42
- package/dist/common/anchor-mapping.d.ts +3 -0
- package/dist/common/coordinate-mapping.d.ts +19 -0
- package/dist/common/data-path.d.ts +14 -0
- package/dist/common/id.d.ts +2 -0
- package/dist/common/json-normalization.d.ts +3 -0
- package/dist/common/math.d.ts +4 -0
- package/dist/common/particle-expression.d.ts +4 -0
- package/dist/conversion.d.ts +21 -0
- package/dist/ge2ir/assemble.d.ts +4 -0
- package/dist/ge2ir/convert.d.ts +4 -0
- package/dist/ge2ir/extract-particle-source-data.d.ts +5 -0
- package/dist/ge2ir/mapping.d.ts +5 -0
- package/dist/ge2ir/{parsers/animation-parser.d.ts → parser/animation.d.ts} +2 -2
- package/dist/ge2ir/parser/component.d.ts +22 -0
- package/dist/ge2ir/{parsers/keyframe-parser.d.ts → parser/keyframe.d.ts} +1 -1
- package/dist/ge2ir/parser/layer.d.ts +13 -0
- package/dist/ge2ir/parser/parse-particle-component.d.ts +7 -0
- package/dist/ge2ir/parser/scene.d.ts +4 -0
- package/dist/ge2ir/{parsers/timeline-parser.d.ts → parser/timeline.d.ts} +5 -3
- package/dist/ge2ir/parser/transform.d.ts +3 -0
- package/dist/ge2ir/post-process/mask.d.ts +10 -0
- package/dist/ge2ir/{merge/merge.d.ts → post-process.d.ts} +5 -3
- package/dist/ge2ir/types.d.ts +31 -11
- package/dist/index.d.ts +11 -17
- package/dist/index.js +10025 -4210
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10022 -4191
- package/dist/index.mjs.map +1 -1
- package/dist/ir2ge/assemble.d.ts +9 -0
- package/dist/ir2ge/convert.d.ts +9 -0
- package/dist/ir2ge/converter/animation.d.ts +5 -0
- package/dist/ir2ge/converter/bezier.d.ts +35 -0
- package/dist/ir2ge/converter/normalized-animation.d.ts +15 -0
- package/dist/ir2ge/converter/opacity.d.ts +8 -0
- package/dist/ir2ge/converter/precomp.d.ts +17 -0
- package/dist/ir2ge/converter/timing.d.ts +9 -0
- package/dist/ir2ge/converter/transform.d.ts +14 -0
- package/dist/ir2ge/generator/build-particle-component.d.ts +3 -0
- package/dist/ir2ge/generator/component-preservation.d.ts +5 -0
- package/dist/ir2ge/generator/component.d.ts +10 -0
- package/dist/ir2ge/generator/layer-strategy.d.ts +19 -0
- package/dist/ir2ge/generator/layer.d.ts +6 -0
- package/dist/ir2ge/generator/timeline.d.ts +8 -0
- package/dist/ir2ge/map-particle-layout-to-ge-transform.d.ts +30 -0
- package/dist/ir2ge/mapping.d.ts +6 -0
- package/dist/ir2ge/post-process/cross-composition-mask.d.ts +4 -0
- package/dist/ir2ge/post-process/ge-mask-remap.d.ts +3 -15
- package/dist/ir2ge/post-process/mask-geometry.d.ts +16 -0
- package/dist/ir2ge/post-process/mask.d.ts +29 -22
- package/dist/ir2ge/post-process/matte.d.ts +5 -0
- package/dist/ir2ge/post-process/merge-preserved-resources.d.ts +3 -0
- package/dist/ir2ge/post-process/parenting.d.ts +3 -3
- package/dist/ir2ge/post-process/pipeline.d.ts +25 -0
- package/dist/ir2ge/post-process/visibility.d.ts +14 -18
- package/dist/ir2ge/types.d.ts +55 -24
- package/dist/layer-preserved-data.d.ts +11 -0
- package/dist/particle/merge-particle-fragment.d.ts +12 -0
- package/dist/particle/merge-particle-scenes.d.ts +21 -0
- package/dist/particle/particle-fragment.d.ts +10 -0
- package/dist/preserved-data.d.ts +66 -0
- package/dist/update-preserved-data.d.ts +12 -0
- package/package.json +19 -4
- package/dist/ge2ir/converter.d.ts +0 -3
- package/dist/ge2ir/index.d.ts +0 -2
- package/dist/ge2ir/parsers/component-parser.d.ts +0 -16
- package/dist/ge2ir/parsers/transform-parser.d.ts +0 -3
- package/dist/ge2ir/pool/pool.d.ts +0 -4
- package/dist/ge2ir/reverse/blend-mode.d.ts +0 -2
- package/dist/ge2ir/reverse/coordinate.d.ts +0 -1
- package/dist/ge2ir/reverse/end-behavior.d.ts +0 -3
- package/dist/ge2ir/reverse/timing.d.ts +0 -2
- package/dist/ge2ir/scene-reader.d.ts +0 -3
- package/dist/ir2ge/assembly/generator.d.ts +0 -23
- package/dist/ir2ge/assembly/scene-assembly.d.ts +0 -11
- package/dist/ir2ge/builders/animation.d.ts +0 -4
- package/dist/ir2ge/builders/bezier.d.ts +0 -44
- package/dist/ir2ge/builders/component.d.ts +0 -13
- package/dist/ir2ge/builders/effects.d.ts +0 -9
- package/dist/ir2ge/builders/layer.d.ts +0 -5
- package/dist/ir2ge/builders/timeline.d.ts +0 -9
- package/dist/ir2ge/builders/timing.d.ts +0 -17
- package/dist/ir2ge/index.d.ts +0 -14
- package/dist/ir2ge/ir/anchor-strategy.d.ts +0 -24
- package/dist/ir2ge/ir/layer-dimensions.d.ts +0 -13
- package/dist/ir2ge/ir/layer-utils.d.ts +0 -14
- package/dist/ir2ge/ir/parent-link.d.ts +0 -15
- package/dist/ir2ge/ir/specific.d.ts +0 -14
- package/dist/ir2ge/post-process/index.d.ts +0 -31
- package/dist/ir2ge/utils.d.ts +0 -14
- package/dist/shared/coordinate.d.ts +0 -11
- package/dist/shared/ge2ir-metadata.d.ts +0 -17
- package/dist/shared/types.d.ts +0 -60
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type IRScene } from '@vvfx/animation-ir';
|
|
2
|
+
import type { JSONScene } from '@galacean/effects-specification';
|
|
3
|
+
import type { GEToIRPreservedData } from '../preserved-data';
|
|
4
|
+
import type { ECSCollector, GeneratedCompositionData } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Assemble a GE JSONScene from generated pools and preserved source resources.
|
|
7
|
+
* `duration` overrides the value derived from the IR frame bounds.
|
|
8
|
+
*/
|
|
9
|
+
export declare function assembleGEScene(irScene: IRScene, collector: ECSCollector, generatedCompositions: GeneratedCompositionData[], duration?: number, preservedData?: GEToIRPreservedData): JSONScene;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type IRScene } from '@vvfx/animation-ir';
|
|
2
|
+
import type { IRToGEOptions, IRToGEResult } from '../conversion';
|
|
3
|
+
/**
|
|
4
|
+
* Convert the entry Composition of an IR Scene to a GE JSONScene.
|
|
5
|
+
*
|
|
6
|
+
* `options.preservedData` restores compatible GE-owned data when supplied.
|
|
7
|
+
* `options.duration` overrides the range derived from the IR frame bounds.
|
|
8
|
+
*/
|
|
9
|
+
export declare function convertIRToGE(irScene: IRScene, options?: IRToGEOptions): IRToGEResult;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IRAnimatedProperty, IRLayer } from '@vvfx/animation-ir';
|
|
2
|
+
import type { ColorOverLifetime } from '@galacean/effects-specification';
|
|
3
|
+
import type { GEAnimationPayload, LayerGenerationContext, TransformAnimation } from '../types';
|
|
4
|
+
export declare function buildTransformAnimation(layer: IRLayer, ctx: LayerGenerationContext): TransformAnimation;
|
|
5
|
+
export declare function buildColorAnimation(layer: IRLayer, ctx: LayerGenerationContext, inheritedOpacity?: IRAnimatedProperty<number>): GEAnimationPayload<ColorOverLifetime> | undefined;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encode IR keyframes as GE BezierKeyframeValue payloads.
|
|
3
|
+
*
|
|
4
|
+
* Wire format:
|
|
5
|
+
* - First: [EASE_OUT(3), [t, v, out_cp_x, out_cp_y]]
|
|
6
|
+
* - Middle: [EASE(1), [in_cp_x, in_cp_y, t, v, out_cp_x, out_cp_y]]
|
|
7
|
+
* - Last: [EASE_IN(2), [in_cp_x, in_cp_y, t, v]]
|
|
8
|
+
*
|
|
9
|
+
* Time is normalized to the layer's visible frame range.
|
|
10
|
+
*/
|
|
11
|
+
import type { IRAnimatedProperty, IRVec3 } from '@vvfx/animation-ir';
|
|
12
|
+
import { type BezierKeyframeValue } from '@galacean/effects-specification';
|
|
13
|
+
export interface IRToGETimeContext {
|
|
14
|
+
/** Layer visible start frame. */
|
|
15
|
+
inFrame: number;
|
|
16
|
+
/** Layer visible end frame. */
|
|
17
|
+
outFrame: number;
|
|
18
|
+
}
|
|
19
|
+
interface GEPositionAnimationData {
|
|
20
|
+
/** One-dimensional timing curves in BezierKeyframeValue format. */
|
|
21
|
+
curves: BezierKeyframeValue[][];
|
|
22
|
+
/** Segment endpoints as `[[startX, startY], [endX, endY]]`. */
|
|
23
|
+
pathPoints: [[number, number], [number, number]][];
|
|
24
|
+
/** Segment control offsets as `[[outX, outY], [inX, inY]]`. */
|
|
25
|
+
controlPoints: [[number, number], [number, number]][];
|
|
26
|
+
}
|
|
27
|
+
/** Convert a scalar property to a single GE Bezier curve. */
|
|
28
|
+
export declare function convertIRScalarKeyframesToGE(property: IRAnimatedProperty<number>, timeContext: IRToGETimeContext): BezierKeyframeValue[][] | undefined;
|
|
29
|
+
/** Convert a vector property to one GE Bezier curve per dimension. */
|
|
30
|
+
export declare function convertIRVectorKeyframesToGE(property: IRAnimatedProperty<IRVec3>, timeContext: IRToGETimeContext): BezierKeyframeValue[][] | undefined;
|
|
31
|
+
/** Convert position keyframes to GE path, control-point, and timing payloads. */
|
|
32
|
+
export declare function convertIRPositionKeyframesToGE(property: IRAnimatedProperty<IRVec3>, timeContext: IRToGETimeContext): GEPositionAnimationData | undefined;
|
|
33
|
+
/** Return whether GE's compact keyframe fields are required for this property. */
|
|
34
|
+
export declare function shouldUseKeyframeMode(property: IRAnimatedProperty): boolean;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IRLayer } from '@vvfx/animation-ir';
|
|
2
|
+
import type { ColorOverLifetime, TransformPlayableAssetData } from '@galacean/effects-specification';
|
|
3
|
+
interface NormalizedAnimationContext {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
type NormalizedTransformAnimation = Pick<TransformPlayableAssetData, 'positionOverLifetime' | 'rotationOverLifetime' | 'sizeOverLifetime'>;
|
|
8
|
+
/**
|
|
9
|
+
* Encode normalized IR transform channels as GE timeline payloads without
|
|
10
|
+
* consulting composition-specific passthrough data.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildNormalizedTransformAnimation(layer: IRLayer, ctx: NormalizedAnimationContext): NormalizedTransformAnimation;
|
|
13
|
+
/** Encode normalized IR opacity as a GE color-over-lifetime payload. */
|
|
14
|
+
export declare function buildNormalizedColorAnimation(layer: IRLayer): ColorOverLifetime | undefined;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IRAnimatedProperty, IRPrecompLayer } from '@vvfx/animation-ir';
|
|
2
|
+
import type { IRComposition } from '@vvfx/animation-ir';
|
|
3
|
+
/** Multiply two opacity channels in one Composition time domain. */
|
|
4
|
+
export declare function multiplyOpacityProperties(left: IRAnimatedProperty<number> | undefined, right: IRAnimatedProperty<number> | undefined, inFrame: number, outFrame: number): IRAnimatedProperty<number> | undefined;
|
|
5
|
+
/** Map an instance opacity channel from its parent timeline into referenced Composition frames. */
|
|
6
|
+
export declare function mapOpacityToReferencedComposition(opacity: IRAnimatedProperty<number> | undefined, layer: IRPrecompLayer, parent: IRComposition, referenced: IRComposition): IRAnimatedProperty<number> | undefined;
|
|
7
|
+
export declare function isDefaultOpacity(opacity: IRAnimatedProperty<number> | undefined): boolean;
|
|
8
|
+
export declare function hasAnimatedOpacity(opacity: IRAnimatedProperty<number> | undefined): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type IRAnimatedProperty, type IRComposition, type IRScene, type IRPrecompLayer } from '@vvfx/animation-ir';
|
|
2
|
+
import type { ConversionDiagnostic } from '@vvfx/animation-ir/adapter';
|
|
3
|
+
interface CompositionGenerationRequest {
|
|
4
|
+
id: string;
|
|
5
|
+
ir: IRComposition;
|
|
6
|
+
inheritedOpacity?: IRAnimatedProperty<number>;
|
|
7
|
+
precompOutputIdByLayerId: Map<string, string>;
|
|
8
|
+
}
|
|
9
|
+
interface CompositionGenerationPlan {
|
|
10
|
+
compositionById: ReadonlyMap<string, IRComposition>;
|
|
11
|
+
requests: CompositionGenerationRequest[];
|
|
12
|
+
}
|
|
13
|
+
/** Plan source Compositions and the instance-specific variants required by GE. */
|
|
14
|
+
export declare function buildCompositionGenerationPlan(irScene: IRScene, diagnostics: ConversionDiagnostic[]): CompositionGenerationPlan;
|
|
15
|
+
/** Report GE runtime limitations that apply to a source Precomp instance. */
|
|
16
|
+
export declare function collectPrecompExportDiagnostics(layer: IRPrecompLayer, compositionById: ReadonlyMap<string, IRComposition>, composition: IRComposition, diagnostics: ConversionDiagnostic[]): void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IRLayer } from '@vvfx/animation-ir';
|
|
2
|
+
/**
|
|
3
|
+
* Convert a Layer activation range from parent-Composition frames to GE seconds.
|
|
4
|
+
* Precomp sourceStartFrame/stretch affect source sampling, not activation.
|
|
5
|
+
*/
|
|
6
|
+
export declare function computeLayerTiming(layer: IRLayer, frameRate: number, compositionInPoint?: number): {
|
|
7
|
+
delay: number;
|
|
8
|
+
layerDuration: number;
|
|
9
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IRLayer, IRLocalBounds } from '@vvfx/animation-ir';
|
|
2
|
+
import type { IRToGETimeContext } from './bezier';
|
|
3
|
+
import type { LayerGenerationContext } from '../types';
|
|
4
|
+
export declare function getLayerLocalBounds(layer: IRLayer, fallback?: IRLocalBounds): IRLocalBounds;
|
|
5
|
+
export declare function computeStaticPosition(layer: IRLayer, ctx: LayerGenerationContext, anchorOffsetX?: number, anchorOffsetY?: number): [number, number, number];
|
|
6
|
+
export declare function getStaticAnchor(layer: IRLayer): [number, number];
|
|
7
|
+
export declare function applyScalePositionAdjust(position: [number, number, number], layer: IRLayer, bounds: IRLocalBounds, ratio: number): [number, number, number];
|
|
8
|
+
export declare function computeAnchorInfo(layer: IRLayer, bounds: IRLocalBounds): {
|
|
9
|
+
anchorScaleX: number;
|
|
10
|
+
anchorScaleY: number;
|
|
11
|
+
anchorOffsetX: number;
|
|
12
|
+
anchorOffsetY: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function getTimeContext(layer: IRLayer): IRToGETimeContext;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IRParticleLayer } from '@vvfx/animation-ir';
|
|
2
|
+
import type { LayerGenerationContext } from '../types';
|
|
3
|
+
export declare function buildParticleComponent(layer: IRParticleLayer, itemId: string, anchorScaleX: number, anchorScaleY: number, ctx: LayerGenerationContext): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IRLayer } from '@vvfx/animation-ir';
|
|
2
|
+
import type { GeneratedComponentData, LayerGenerationContext } from '../types';
|
|
3
|
+
export declare function resolveComponentId(layer: IRLayer, ctx: LayerGenerationContext): string;
|
|
4
|
+
/** Copy a preserved GE mask whose target references are remapped after generation. */
|
|
5
|
+
export declare function copyPreservedMaskToComponent(layer: IRLayer, component: GeneratedComponentData, ctx: LayerGenerationContext): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IRLayer, IRShape, IRShapePaint, IRShapeStroke } from '@vvfx/animation-ir';
|
|
2
|
+
import type { LayerGenerationContext } from '../types';
|
|
3
|
+
export declare function buildComponent(layer: IRLayer, itemId: string, anchorScaleX: number, anchorScaleY: number, ctx: LayerGenerationContext): string | undefined;
|
|
4
|
+
export declare function buildShapeOptions(shapeData: IRShape, ratio: number, ctx?: LayerGenerationContext, renderStyle?: ShapeRenderStyle): Record<string, unknown>;
|
|
5
|
+
export interface ShapeRenderStyle {
|
|
6
|
+
fills: IRShapePaint[];
|
|
7
|
+
strokes: IRShapeStroke[];
|
|
8
|
+
}
|
|
9
|
+
/** Split only when GE's component-level stroke geometry would lose an authored style. */
|
|
10
|
+
export declare function buildShapeRenderStyles(shape: IRShape): ShapeRenderStyle[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IRLayer } from '@vvfx/animation-ir';
|
|
2
|
+
import type { EffectsLayerPreservedData } from '../../preserved-data';
|
|
3
|
+
/**
|
|
4
|
+
* Anchor encoding strategy.
|
|
5
|
+
*
|
|
6
|
+
* - `inline-anchor` encodes the renderer anchor and compensates item position.
|
|
7
|
+
* - `split-null-sprite` places transforms on a null parent and visual content
|
|
8
|
+
* on an anchor-offset child.
|
|
9
|
+
* Effects passthrough data may request the source hierarchy.
|
|
10
|
+
*/
|
|
11
|
+
type LayerGenerationStrategy = {
|
|
12
|
+
kind: 'inline-anchor';
|
|
13
|
+
anchorScale: [number, number];
|
|
14
|
+
anchorOffset: [number, number];
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'split-null-sprite';
|
|
17
|
+
};
|
|
18
|
+
export declare function resolveLayerGenerationStrategy(layer: IRLayer, preservedData?: EffectsLayerPreservedData): LayerGenerationStrategy;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IRLayer, IRPrecompLayer } from '@vvfx/animation-ir';
|
|
2
|
+
import type { LayerGenerationContext } from '../types';
|
|
3
|
+
export declare function appendNullLayer(layer: IRLayer, ctx: LayerGenerationContext): void;
|
|
4
|
+
export declare function appendPrecompLayer(layer: IRPrecompLayer, ctx: LayerGenerationContext): void;
|
|
5
|
+
export declare function appendParentLayer(layer: IRLayer, ctx: LayerGenerationContext): void;
|
|
6
|
+
export declare function appendVisualLayer(layer: IRLayer, ctx: LayerGenerationContext): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type EndBehavior, ItemType } from '@galacean/effects-specification';
|
|
2
|
+
import type { TransformAnimation } from '../types';
|
|
3
|
+
interface TimelineTrackCollector {
|
|
4
|
+
miscs: Record<string, unknown>[];
|
|
5
|
+
}
|
|
6
|
+
/** Build binding, activation, transform, and supported renderer-color tracks for one Item. */
|
|
7
|
+
export declare function buildTimelineTracks(collector: TimelineTrackCollector, delay: number, duration: number, endBehavior: EndBehavior, animation: TransformAnimation, itemType: ItemType, precompTimeOffset?: number): string;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface GEParticleTargetRegion {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
center: readonly [x: number, y: number];
|
|
5
|
+
}
|
|
6
|
+
export interface ParticleLayoutMappingOptions {
|
|
7
|
+
targetRegion: GEParticleTargetRegion;
|
|
8
|
+
hostComposition: Record<string, unknown>;
|
|
9
|
+
sourceComposition: Record<string, unknown>;
|
|
10
|
+
authoringBounds: readonly [x: number, y: number, width: number, height: number];
|
|
11
|
+
}
|
|
12
|
+
export interface GEParticleLayoutTransform {
|
|
13
|
+
position: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
z: 0;
|
|
17
|
+
};
|
|
18
|
+
eulerHint: {
|
|
19
|
+
x: 0;
|
|
20
|
+
y: 0;
|
|
21
|
+
z: 0;
|
|
22
|
+
};
|
|
23
|
+
scale: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
z: 1;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Map one planned particle region from pixel layout into a GE transform. */
|
|
30
|
+
export declare function mapParticleLayoutToGETransform(options: ParticleLayoutMappingOptions): GEParticleLayoutTransform;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IRBlendMode, IREndBehavior, type IRLayerType } from '@vvfx/animation-ir';
|
|
2
|
+
import { BlendingMode, EndBehavior, ItemType } from '@galacean/effects-specification';
|
|
3
|
+
export declare function mapBlendModeToGE(blendMode: IRBlendMode | undefined): BlendingMode | undefined;
|
|
4
|
+
export declare function mapEndBehaviorToGE(endBehavior: IREndBehavior): EndBehavior;
|
|
5
|
+
export declare function mapLayerTypeToGETimelineItemType(type: IRLayerType): ItemType;
|
|
6
|
+
export declare function mapLayerTypeToGEVFXItemType(type: IRLayerType): ItemType;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ECSCollector, GeneratedCompositionData } from '../types';
|
|
2
|
+
import { type RuntimeMaskState } from './mask';
|
|
3
|
+
/** Propagate Precomp mask sources through generated Composition boundaries. */
|
|
4
|
+
export declare function applyCrossCompositionMasks(generatedCompositions: GeneratedCompositionData[], collector: ECSCollector, runtimeMaskState: RuntimeMaskState): void;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import type { ECSCollector } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* Remap
|
|
4
|
-
*
|
|
5
|
-
* ge2ir carries each masked component's raw `mask` object verbatim (via
|
|
6
|
-
* `IRLayerNode.metadata.ge2ir.geMask`), but `mask.reference.id` still points at the
|
|
7
|
-
* ORIGINAL (GE1) mask-source component id, which ir2ge has regenerated. This
|
|
8
|
-
* pass rewrites every target's `reference.id` from the stale GE1 id to the
|
|
9
|
-
* freshly-minted GE2 component id, using the `geComponentId → newId` map built
|
|
10
|
-
* during the layer walk.
|
|
11
|
-
*
|
|
12
|
-
* Mirrors `applyParenting`: an IR-side reference (here the stale id stored in
|
|
13
|
-
* data) → map → regenerated id → written in place. Mask SOURCE components have
|
|
14
|
-
* no `reference` and are skipped. Dangling references (source not regenerated —
|
|
15
|
-
* e.g. dropped by the null+sprite merger) have their `mask` removed so the GE
|
|
16
|
-
* runtime doesn't choke on an id that resolves to nothing.
|
|
3
|
+
* Remap preserved mask targets from source component IDs to regenerated IDs.
|
|
4
|
+
* Source masks have no reference; unresolved target masks are removed.
|
|
17
5
|
*/
|
|
18
|
-
export declare function
|
|
6
|
+
export declare function applyGEMaskRemap(collector: ECSCollector, GEComponentIdToNewId: Record<string, string>): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type IRMask } from '@vvfx/animation-ir';
|
|
2
|
+
import type { GeneratedCompositionData, GeneratedMiscData, GeneratedVFXItemData } from '../types';
|
|
3
|
+
interface Point2D {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
/** A positive, closed mask boundary expressed in one Composition's local space. */
|
|
8
|
+
export interface RuntimeMaskGeometry {
|
|
9
|
+
points: Point2D[];
|
|
10
|
+
}
|
|
11
|
+
export type MaskContainment = 'equal' | 'existing-contains-source' | 'source-contains-existing' | 'none';
|
|
12
|
+
export declare function buildRuntimeMaskGeometry(mask: IRMask, ratio: number, coordinateOrigin: [number, number]): RuntimeMaskGeometry | undefined;
|
|
13
|
+
export declare function mapMaskGeometryIntoPrecomp(geometry: RuntimeMaskGeometry | undefined, precompItem: GeneratedVFXItemData, items: GeneratedVFXItemData[], animatedItemIds: ReadonlySet<string>): RuntimeMaskGeometry | undefined;
|
|
14
|
+
export declare function collectAnimatedTransformItemIds(generatedCompositions: GeneratedCompositionData[], miscs: GeneratedMiscData[]): Set<string>;
|
|
15
|
+
export declare function compareMaskContainment(existing: RuntimeMaskGeometry | undefined, source: RuntimeMaskGeometry | undefined): MaskContainment;
|
|
16
|
+
export {};
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* component or — for parent layers — to descendant renderers.
|
|
5
|
-
*
|
|
6
|
-
* The decision to emit (per-layer) is gated solely on `layer.mask != null`,
|
|
7
|
-
* so any IR producer can opt in by writing the field. Currently only lottie
|
|
8
|
-
* IR has masks; dsl IR leaves `mask` undefined and this module no-ops for it.
|
|
9
|
-
*
|
|
10
|
-
* The lookup callbacks let each pipeline plug in its own layer-to-emitted-id
|
|
11
|
-
* mapping — lottie keeps `layerToItemId`/`layerToComponentId`/`parentIndexSet`
|
|
12
|
-
* during emission, dsl tracks differently. Mask handling stays generic.
|
|
13
|
-
*/
|
|
14
|
-
import type { IRComposition } from '@vvfx/animation-ir';
|
|
15
|
-
import type { ECSCollector, ProcessedItem } from '../types';
|
|
16
|
-
/**
|
|
17
|
-
* Pipeline-specific lookups consumed during mask emission. A pipeline that
|
|
18
|
-
* never produces masks can pass stub callbacks (the iterator skips layers
|
|
19
|
-
* without `mask`, so the callbacks are never invoked in that case).
|
|
2
|
+
* Generate GE mask items for masked IR layers and attach references to direct
|
|
3
|
+
* or descendant renderer components.
|
|
20
4
|
*/
|
|
5
|
+
import { type IRComposition, type IRMask } from '@vvfx/animation-ir';
|
|
6
|
+
import { type RuntimeMaskGeometry } from './mask-geometry';
|
|
7
|
+
import type { ECSCollector, GeneratedItemBinding } from '../types';
|
|
8
|
+
/** Resolve stable IR Layer IDs to generated items and components. */
|
|
21
9
|
export interface MaskLayerLookup {
|
|
22
|
-
getItemId(
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
getItemId(layerId: string): string | undefined;
|
|
11
|
+
getMaskParentItemId(layerId: string): string | undefined;
|
|
12
|
+
getMaskCoordinateOrigin(layerId: string): [number, number] | undefined;
|
|
13
|
+
getComponentId(layerId: string): string | undefined;
|
|
14
|
+
isParentLayer(layerId: string): boolean;
|
|
15
|
+
}
|
|
16
|
+
type MaskOrigin = 'authored' | 'clip';
|
|
17
|
+
/** Internal ownership metadata for each renderer's single Runtime mask slot. */
|
|
18
|
+
export interface RuntimeMaskSourceMeta {
|
|
19
|
+
origin: MaskOrigin;
|
|
20
|
+
area: number;
|
|
21
|
+
geometry?: RuntimeMaskGeometry;
|
|
22
|
+
specificity: number;
|
|
23
|
+
}
|
|
24
|
+
/** Shared single-mask arbitration state across every generated Composition. */
|
|
25
|
+
export interface RuntimeMaskState {
|
|
26
|
+
slots: Map<string, RuntimeMaskSourceMeta>;
|
|
27
|
+
sources: Map<string, RuntimeMaskSourceMeta>;
|
|
25
28
|
}
|
|
26
|
-
export declare function
|
|
29
|
+
export declare function createRuntimeMaskState(): RuntimeMaskState;
|
|
30
|
+
export declare function applyMasks(ir: IRComposition, collector: ECSCollector, itemBindings: GeneratedItemBinding[], ratio: number, _width: number, _height: number, frameRate: number, lookup: MaskLayerLookup, compositionById?: ReadonlyMap<string, IRComposition>, runtimeMaskState?: RuntimeMaskState): void;
|
|
31
|
+
/** Fold the source-neutral Mask operation and path polarity into GE's single inversion flag. */
|
|
32
|
+
export declare function resolveGEMaskInverted(mask: Pick<IRMask, 'mode' | 'inverted'>): boolean;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type IRComposition } from '@vvfx/animation-ir';
|
|
2
|
+
import type { ConversionDiagnostic } from '@vvfx/animation-ir/adapter';
|
|
3
|
+
import type { ECSCollector } from '../types';
|
|
4
|
+
/** Lower Layer-reference mattes to GE's component mask source/target relationship. */
|
|
5
|
+
export declare function applyLayerMattes(ir: IRComposition, collector: ECSCollector, layerToComponentId: Readonly<Record<string, string>>, diagnostics: ConversionDiagnostic[]): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { GEToIRPreservedData } from '../../preserved-data';
|
|
2
|
+
/** Merge source GE objects that are outside Composition graphs regenerated from IR. */
|
|
3
|
+
export declare function mergePreservedResources(generated: Record<string, unknown>, preservedData?: GEToIRPreservedData): Record<string, unknown>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export declare function applyParenting(layers:
|
|
1
|
+
import type { IRLayer } from '@vvfx/animation-ir';
|
|
2
|
+
import type { GeneratedVFXItemData } from '../types';
|
|
3
|
+
export declare function applyParenting(layers: IRLayer[], items: GeneratedVFXItemData[], layerToItemId: Record<string, string>, ratio: number, width: number, height: number): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { IRComposition } from '@vvfx/animation-ir';
|
|
2
|
+
import type { ConversionDiagnostic } from '@vvfx/animation-ir/adapter';
|
|
3
|
+
import type { ECSCollector, GeneratedItemBinding } from '../types';
|
|
4
|
+
import type { EffectsLayerPreservedData } from '../../preserved-data';
|
|
5
|
+
import { type MaskLayerLookup, type RuntimeMaskState } from './mask';
|
|
6
|
+
/** Complete generation state consumed by the ordered post-processing pipeline. */
|
|
7
|
+
interface PostProcessState {
|
|
8
|
+
collector: ECSCollector;
|
|
9
|
+
itemBindings: GeneratedItemBinding[];
|
|
10
|
+
compositionById: ReadonlyMap<string, IRComposition>;
|
|
11
|
+
maskLookup: MaskLayerLookup;
|
|
12
|
+
runtimeMaskState: RuntimeMaskState;
|
|
13
|
+
layerToItemId: Record<string, string>;
|
|
14
|
+
layerToComponentId: Record<string, string>;
|
|
15
|
+
ratio: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
frameRate: number;
|
|
19
|
+
geComponentIdToNewId: Record<string, string>;
|
|
20
|
+
layerDataById: Readonly<Record<string, EffectsLayerPreservedData>>;
|
|
21
|
+
diagnostics: ConversionDiagnostic[];
|
|
22
|
+
}
|
|
23
|
+
/** Run ordered post-generation passes before scene assembly. */
|
|
24
|
+
export declare function applyPostProcess(ir: IRComposition, state: PostProcessState): void;
|
|
25
|
+
export {};
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import type { VFXItemData } from '@galacean/effects-specification';
|
|
2
|
+
import type { GeneratedMiscData } from '../types';
|
|
3
|
+
type VisibilityItem = Pick<VFXItemData, 'id' | 'delay' | 'duration' | 'parentId'>;
|
|
4
|
+
interface GeneratedItemBindingRef {
|
|
2
5
|
itemId: string;
|
|
3
|
-
objectBindingTrackId
|
|
6
|
+
objectBindingTrackId?: string;
|
|
4
7
|
}
|
|
5
8
|
interface NormalizeVisibilityParams {
|
|
6
|
-
items:
|
|
7
|
-
miscs:
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
items: VisibilityItem[];
|
|
10
|
+
miscs: GeneratedMiscData[];
|
|
11
|
+
itemBindings: GeneratedItemBindingRef[];
|
|
12
|
+
/** Generated item IDs corresponding to IR Layers with a Transform Parent. */
|
|
13
|
+
transformParentChildItemIds?: Set<string>;
|
|
11
14
|
roundNumber: (value: number, precision: number) => number;
|
|
12
15
|
}
|
|
13
16
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* its parent's delay/duration are already finalized. For transform-only
|
|
18
|
-
* parent-link children, we instead advance the parent's delay/duration so the
|
|
19
|
-
* child can render from its own start time (GE requires the parent to be active
|
|
20
|
-
* for transform inheritance, but the parent-link relationship does not propagate
|
|
21
|
-
* visibility). Only the ActivationTrack clip is updated; TransformTrack
|
|
22
|
-
* keyframes are normalized to the original time range and would hold their
|
|
23
|
-
* first frame value if the track started earlier.
|
|
17
|
+
* Keep IR Transform Parents active across every descendant's interval, then
|
|
18
|
+
* normalize internal generated child items in parent-first order. Parent
|
|
19
|
+
* activation changes do not alter Transform keyframe time domains.
|
|
24
20
|
*/
|
|
25
|
-
export declare function normalizeChildVisibilityByParentDelays({ items, miscs,
|
|
21
|
+
export declare function normalizeChildVisibilityByParentDelays({ items, miscs, itemBindings, transformParentChildItemIds, roundNumber, }: NormalizeVisibilityParams): void;
|
|
26
22
|
export {};
|
package/dist/ir2ge/types.d.ts
CHANGED
|
@@ -1,37 +1,68 @@
|
|
|
1
|
-
import type { IRComposition } from '@vvfx/animation-ir';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import type { IRAnimatedProperty, IRComposition, IRFontAsset, IRImageAsset } from '@vvfx/animation-ir';
|
|
2
|
+
import type { ConversionDiagnostic } from '@vvfx/animation-ir/adapter';
|
|
3
|
+
import type { ColorOverLifetime, ComponentData, DataPath, EffectsObjectData, JSONScene, PositionOverLifetime, RotationOverLifetime, SizeOverLifetime, VFXItemData } from '@galacean/effects-specification';
|
|
4
|
+
import type { EffectsLayerPreservedData } from '../preserved-data';
|
|
5
|
+
/** Generated item with a required transform and optional deprecated content. */
|
|
6
|
+
export type GeneratedVFXItemData = Omit<VFXItemData, 'content' | 'transform'> & Partial<Pick<VFXItemData, 'content'>> & Required<Pick<VFXItemData, 'transform'>>;
|
|
7
|
+
/** Generated component with specification fields and preserved extension data. */
|
|
8
|
+
export type GeneratedComponentData = ComponentData & Record<string, unknown>;
|
|
9
|
+
/** Generated misc object with specification fields and timeline payloads. */
|
|
10
|
+
export type GeneratedMiscData = EffectsObjectData & Record<string, unknown>;
|
|
11
|
+
/** Pools collected while building a GE JSONScene. */
|
|
12
|
+
export interface ECSCollector {
|
|
13
|
+
images: JSONScene['images'];
|
|
14
|
+
fonts: NonNullable<JSONScene['fonts']>;
|
|
15
|
+
components: GeneratedComponentData[];
|
|
16
|
+
items: GeneratedVFXItemData[];
|
|
17
|
+
textures: NonNullable<JSONScene['textures']>;
|
|
18
|
+
miscs: GeneratedMiscData[];
|
|
19
|
+
}
|
|
20
|
+
/** Generated pools and bindings owned by one IR Composition. */
|
|
21
|
+
export interface GeneratedCompositionData {
|
|
22
|
+
id: string;
|
|
23
|
+
ir: IRComposition;
|
|
24
|
+
itemBindings: GeneratedItemBinding[];
|
|
25
|
+
items: GeneratedVFXItemData[];
|
|
26
|
+
precompOutputIdByLayerId: ReadonlyMap<string, string>;
|
|
27
|
+
}
|
|
28
|
+
/** Links a generated item and its binding track to the originating IR layer. */
|
|
29
|
+
export interface GeneratedItemBinding {
|
|
12
30
|
itemId: string;
|
|
13
|
-
objectBindingTrackId
|
|
14
|
-
|
|
31
|
+
objectBindingTrackId?: string;
|
|
32
|
+
layerId?: string;
|
|
15
33
|
}
|
|
34
|
+
/** Specification-defined GE animation data or an opaque preserved payload. */
|
|
35
|
+
export type GEAnimationPayload<T> = T | Record<string, unknown>;
|
|
16
36
|
/** Per-channel animation payload consumed by the timeline tracks. */
|
|
17
37
|
export interface TransformAnimation {
|
|
18
|
-
positionOverLifetime?:
|
|
19
|
-
rotationOverLifetime?:
|
|
20
|
-
sizeOverLifetime?:
|
|
21
|
-
colorOverLifetime?:
|
|
38
|
+
positionOverLifetime?: GEAnimationPayload<PositionOverLifetime>;
|
|
39
|
+
rotationOverLifetime?: GEAnimationPayload<RotationOverLifetime>;
|
|
40
|
+
sizeOverLifetime?: GEAnimationPayload<SizeOverLifetime>;
|
|
41
|
+
colorOverLifetime?: GEAnimationPayload<ColorOverLifetime>;
|
|
22
42
|
}
|
|
23
|
-
/**
|
|
24
|
-
export interface
|
|
25
|
-
/**
|
|
43
|
+
/** Shared context for layer generation. */
|
|
44
|
+
export interface LayerGenerationContext {
|
|
45
|
+
/** IR Composition used for normalized semantics. */
|
|
26
46
|
ir: IRComposition;
|
|
47
|
+
layerDataById: Readonly<Record<string, EffectsLayerPreservedData>>;
|
|
48
|
+
compositionById: ReadonlyMap<string, IRComposition>;
|
|
49
|
+
inheritedOpacity?: IRAnimatedProperty<number>;
|
|
50
|
+
precompOutputIdByLayerId: ReadonlyMap<string, string>;
|
|
27
51
|
collector: ECSCollector;
|
|
28
|
-
|
|
29
|
-
layerToItemId: Record<
|
|
30
|
-
layerToComponentId: Record<
|
|
52
|
+
itemBindings: GeneratedItemBinding[];
|
|
53
|
+
layerToItemId: Record<string, string>;
|
|
54
|
+
layerToComponentId: Record<string, string>;
|
|
31
55
|
textureCache: Map<string, DataPath>;
|
|
32
|
-
|
|
56
|
+
imageAssetById: ReadonlyMap<string, IRImageAsset>;
|
|
57
|
+
fontAssetById: ReadonlyMap<string, IRFontAsset>;
|
|
58
|
+
parentLayerIdSet: Set<string>;
|
|
33
59
|
ratio: number;
|
|
34
60
|
width: number;
|
|
35
61
|
height: number;
|
|
36
62
|
frameRate: number;
|
|
63
|
+
diagnostics: ConversionDiagnostic[];
|
|
64
|
+
/** Visual item that owns a layer-local mask source. */
|
|
65
|
+
layerToMaskParentItemId: Record<string, string>;
|
|
66
|
+
/** Layer-local point represented by the generated mask parent's origin. */
|
|
67
|
+
layerToMaskCoordinateOrigin: Record<string, [number, number]>;
|
|
37
68
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EffectsLayerPreservedData, GEToIRPreservedData } from './preserved-data';
|
|
2
|
+
/** Normalized field whose conflicting GE-owned Layer data should be removed. */
|
|
3
|
+
export type EffectsLayerPreservedDataInvalidationTarget = 'position' | 'rotation' | 'scale' | 'color' | 'opacity' | 'anchor' | 'asset' | 'mask' | 'precomp' | 'particle';
|
|
4
|
+
/** Resolve GE-owned data by its scoped IR Composition and Layer identities. */
|
|
5
|
+
export declare function getEffectsLayerPreservedData(preservedData: GEToIRPreservedData | undefined, compositionId: string, layerId: string): EffectsLayerPreservedData | undefined;
|
|
6
|
+
/** Remove raw GE values that would otherwise shadow an edited normalized field. */
|
|
7
|
+
export declare function invalidateEffectsLayerPreservedData(preservedData: GEToIRPreservedData | undefined, compositionId: string, layerId: string, target: EffectsLayerPreservedDataInvalidationTarget): (keyof EffectsLayerPreservedData)[];
|
|
8
|
+
/** Whether invalidating opacity would also discard a preserved GE color animation. */
|
|
9
|
+
export declare function hasEffectsColorAnimationPreservedData(layerData: EffectsLayerPreservedData | undefined): boolean;
|
|
10
|
+
/** Whether the Layer retains any raw GE animation payload. */
|
|
11
|
+
export declare function hasEffectsAnimationPreservedData(layerData: EffectsLayerPreservedData | undefined): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResolvedGEParticlePlacement } from './merge-particle-scenes';
|
|
2
|
+
import { type ParticleFragment } from './particle-fragment';
|
|
3
|
+
interface AppendParticleFragmentOptions {
|
|
4
|
+
usedIds: Set<string>;
|
|
5
|
+
itemZById: Map<string, number>;
|
|
6
|
+
wrapperItemIds: Set<string>;
|
|
7
|
+
}
|
|
8
|
+
/** Append one dependency-closed particle effect fragment to a GE host. */
|
|
9
|
+
export declare function appendParticleFragmentToGE(hostScene: Record<string, unknown>, fragment: ParticleFragment, placement: ResolvedGEParticlePlacement, options: AppendParticleFragmentOptions): void;
|
|
10
|
+
export declare function collectGEIds(value: unknown, ids?: Set<string>, visited?: WeakSet<object>): Set<string>;
|
|
11
|
+
export declare function mergeGEPlayerVersion(hostScene: Record<string, unknown>, sourceScene: Record<string, unknown>): void;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { JSONScene } from '@galacean/effects-specification';
|
|
2
|
+
import type { GEParticleAuthoringBounds, GEToIRPreservedData } from '../preserved-data';
|
|
3
|
+
/** Host-canvas placement for an effect group or one bound particle system. */
|
|
4
|
+
export interface GEParticlePlacement {
|
|
5
|
+
effectGroupId: string;
|
|
6
|
+
irLayerId?: string;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
position: readonly [x: number, y: number, z: number];
|
|
10
|
+
}
|
|
11
|
+
export interface ParticleSceneMergeInput {
|
|
12
|
+
scene: unknown;
|
|
13
|
+
preservedData: GEToIRPreservedData;
|
|
14
|
+
placements: readonly GEParticlePlacement[];
|
|
15
|
+
}
|
|
16
|
+
export interface ResolvedGEParticlePlacement extends GEParticlePlacement {
|
|
17
|
+
irCompositionId: string;
|
|
18
|
+
authoringBounds: Readonly<GEParticleAuthoringBounds>;
|
|
19
|
+
}
|
|
20
|
+
/** Merge multiple restored particle GE scenes while preserving one shared painter-order calculation. */
|
|
21
|
+
export declare function mergeParticleScenes(hostScene: unknown, sources: readonly ParticleSceneMergeInput[], hostStackingOrder?: ReadonlyMap<string, number>): JSONScene;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GEToIRPreservedData } from '../preserved-data';
|
|
2
|
+
import type { ResolvedGEParticlePlacement } from './merge-particle-scenes';
|
|
3
|
+
export interface ParticleFragment {
|
|
4
|
+
scene: Record<string, unknown>;
|
|
5
|
+
sourceCompositionId: string;
|
|
6
|
+
rootItemIds: string[];
|
|
7
|
+
}
|
|
8
|
+
/** Extract one complete particle effect group from a restored GE scene. */
|
|
9
|
+
export declare function buildParticleFragment(sourceScene: Record<string, unknown>, preservedData: GEToIRPreservedData, placement: ResolvedGEParticlePlacement): ParticleFragment;
|
|
10
|
+
export declare function resolveCompositionRuntime(composition: Record<string, unknown>, componentById: ReadonlyMap<string, Record<string, unknown>>): Record<string, unknown>;
|