@vvfx/artis 0.0.1-alpha.0
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/LICENSE +22 -0
- package/dist/artis/artis.d.ts +44 -0
- package/dist/artis/base-artis.d.ts +520 -0
- package/dist/artis/canvas-layer-order.d.ts +19 -0
- package/dist/artis/create-info-to-schema.d.ts +21 -0
- package/dist/artis/index.d.ts +15 -0
- package/dist/artis/operations/index.d.ts +3 -0
- package/dist/artis/operations/operations.d.ts +362 -0
- package/dist/artis/operations/scene-operations.d.ts +26 -0
- package/dist/artis/operations/types.d.ts +39 -0
- package/dist/artis/scene-artis.d.ts +386 -0
- package/dist/artis/screenshot-service.d.ts +83 -0
- package/dist/artis/types.d.ts +130 -0
- package/dist/artis/wiring/index.d.ts +17 -0
- package/dist/artis/wiring/register-commands.d.ts +44 -0
- package/dist/artis/wiring/setup-commands.d.ts +5 -0
- package/dist/artis/wiring/setup-event-bindings.d.ts +16 -0
- package/dist/artis/wiring/setup-keybindings.d.ts +38 -0
- package/dist/artis/wiring/setup-plugins.d.ts +5 -0
- package/dist/artis/wiring/wiring-context.d.ts +34 -0
- package/dist/artis-sdk/artis-sdk.d.ts +1117 -0
- package/dist/artis-sdk/index.d.ts +1 -0
- package/dist/core/asset/asset-manager.d.ts +288 -0
- package/dist/core/asset/index.d.ts +3 -0
- package/dist/core/command/command-service.d.ts +315 -0
- package/dist/core/command/commands/composite-command.d.ts +45 -0
- package/dist/core/command/commands/frame-layout-command.d.ts +81 -0
- package/dist/core/command/commands/frame-layout-mode-command.d.ts +55 -0
- package/dist/core/command/commands/frame-move-in-command.d.ts +54 -0
- package/dist/core/command/commands/frame-move-out-command.d.ts +54 -0
- package/dist/core/command/commands/group-children-detach-command.d.ts +28 -0
- package/dist/core/command/commands/index.d.ts +98 -0
- package/dist/core/command/commands/item-align-command.d.ts +52 -0
- package/dist/core/command/commands/item-create-command.d.ts +66 -0
- package/dist/core/command/commands/item-delete-command.d.ts +40 -0
- package/dist/core/command/commands/item-distribute-command.d.ts +53 -0
- package/dist/core/command/commands/item-group-command.d.ts +41 -0
- package/dist/core/command/commands/item-reorder-command.d.ts +41 -0
- package/dist/core/command/commands/item-replace-source-command.d.ts +48 -0
- package/dist/core/command/commands/item-set-font-family-command.d.ts +46 -0
- package/dist/core/command/commands/item-set-generator-resource-command.d.ts +40 -0
- package/dist/core/command/commands/item-transform-command.d.ts +51 -0
- package/dist/core/command/commands/item-ungroup-command.d.ts +34 -0
- package/dist/core/command/commands/item-update-property-by-create-info-command.d.ts +41 -0
- package/dist/core/command/commands/item-update-property-command.d.ts +82 -0
- package/dist/core/command/commands/mask-commit-command.d.ts +53 -0
- package/dist/core/command/commands/page-auto-layout-command.d.ts +53 -0
- package/dist/core/command/commands/picture-cut-commit-command.d.ts +43 -0
- package/dist/core/command/commands/picture-expand-commit-command.d.ts +35 -0
- package/dist/core/command/commands/scene-switch-command.d.ts +35 -0
- package/dist/core/command/commands/selection-set-command.d.ts +38 -0
- package/dist/core/command/commands/sprite-image-command.d.ts +36 -0
- package/dist/core/command/commands/sprite-text-edit-commit-command.d.ts +43 -0
- package/dist/core/command/commands/state-hand-command.d.ts +14 -0
- package/dist/core/command/commands/state-image-cut-command.d.ts +14 -0
- package/dist/core/command/commands/state-image-expand-command.d.ts +14 -0
- package/dist/core/command/commands/state-image-mask-command.d.ts +15 -0
- package/dist/core/command/commands/state-image-text-edit-command.d.ts +14 -0
- package/dist/core/command/commands/state-item-create-command.d.ts +34 -0
- package/dist/core/command/commands/state-move-command.d.ts +14 -0
- package/dist/core/command/commands/state-switch-command-base.d.ts +41 -0
- package/dist/core/command/commands/text-move-command.d.ts +47 -0
- package/dist/core/command/commands/text-rotate-command.d.ts +52 -0
- package/dist/core/command/commands/text-scale-command.d.ts +56 -0
- package/dist/core/command/commands/text-update-content-command.d.ts +51 -0
- package/dist/core/command/commands/transform-move-command.d.ts +56 -0
- package/dist/core/command/commands/transform-move-with-frame-change-command.d.ts +80 -0
- package/dist/core/command/commands/transform-move-with-layout-command.d.ts +56 -0
- package/dist/core/command/commands/transform-rotate-command.d.ts +51 -0
- package/dist/core/command/commands/transform-scale-command.d.ts +54 -0
- package/dist/core/command/commands/video-play-command.d.ts +28 -0
- package/dist/core/command/commands/video-source-command.d.ts +39 -0
- package/dist/core/command/commands/viewport-fit-to-box-command.d.ts +37 -0
- package/dist/core/command/commands/viewport-fit-to-items-command.d.ts +43 -0
- package/dist/core/command/commands/viewport-move-command.d.ts +34 -0
- package/dist/core/command/commands/viewport-zoom-command.d.ts +35 -0
- package/dist/core/command/index.d.ts +5 -0
- package/dist/core/command/registry.d.ts +246 -0
- package/dist/core/command/types.d.ts +124 -0
- package/dist/core/element-registry/element-facade.d.ts +35 -0
- package/dist/core/element-registry/element-identity-strategy.d.ts +75 -0
- package/dist/core/element-registry/element-registry.d.ts +72 -0
- package/dist/core/element-registry/index.d.ts +5 -0
- package/dist/core/element-registry/types.d.ts +15 -0
- package/dist/core/gizmo/gizmo-bootstrap.d.ts +70 -0
- package/dist/core/gizmo/gizmo-command-binder.d.ts +55 -0
- package/dist/core/gizmo/gizmo-config-override.d.ts +24 -0
- package/dist/core/gizmo/gizmo-registry.d.ts +39 -0
- package/dist/core/gizmo/index.d.ts +19 -0
- package/dist/core/gizmo/register-gizmo-command-bindings.d.ts +20 -0
- package/dist/core/gizmo/state-gizmo-controller.d.ts +20 -0
- package/dist/core/history/history-manager.d.ts +174 -0
- package/dist/core/history/index.d.ts +1 -0
- package/dist/core/index.d.ts +25 -0
- package/dist/core/item/base-item.d.ts +154 -0
- package/dist/core/item/card-item.d.ts +91 -0
- package/dist/core/item/default-item-schema.d.ts +20 -0
- package/dist/core/item/effects-item.d.ts +99 -0
- package/dist/core/item/frame-item.d.ts +153 -0
- package/dist/core/item/generator-item.d.ts +114 -0
- package/dist/core/item/group-item.d.ts +51 -0
- package/dist/core/item/index.d.ts +25 -0
- package/dist/core/item/sprite-item.d.ts +80 -0
- package/dist/core/item/text-item.d.ts +171 -0
- package/dist/core/item/types.d.ts +158 -0
- package/dist/core/item/video-item.d.ts +120 -0
- package/dist/core/keybinding/index.d.ts +11 -0
- package/dist/core/keybinding/key-binding-controller.d.ts +44 -0
- package/dist/core/keybinding/key-binding-registry.d.ts +92 -0
- package/dist/core/keybinding/key-binding-store.d.ts +29 -0
- package/dist/core/keybinding/key-matcher.d.ts +24 -0
- package/dist/core/keybinding/types.d.ts +84 -0
- package/dist/core/plugin/index.d.ts +3 -0
- package/dist/core/plugin/io-plugin.d.ts +167 -0
- package/dist/core/plugin/plugin-system.d.ts +77 -0
- package/dist/core/predict/align-predict.d.ts +20 -0
- package/dist/core/predict/base/box-ops.d.ts +40 -0
- package/dist/core/predict/base/index.d.ts +14 -0
- package/dist/core/predict/base/parent-coord.d.ts +29 -0
- package/dist/core/predict/base/schema-box.d.ts +21 -0
- package/dist/core/predict/distribute-predict.d.ts +19 -0
- package/dist/core/predict/frame-layout-predict.d.ts +24 -0
- package/dist/core/predict/index.d.ts +12 -0
- package/dist/core/preferences/index.d.ts +2 -0
- package/dist/core/preferences/user-preferences-manager.d.ts +130 -0
- package/dist/core/quality/error-monitor/error-monitor-facade.d.ts +73 -0
- package/dist/core/quality/error-monitor/error-monitor.d.ts +106 -0
- package/dist/core/quality/error-monitor/index.d.ts +4 -0
- package/dist/core/quality/error-monitor/types.d.ts +198 -0
- package/dist/core/quality/index.d.ts +3 -0
- package/dist/core/quality/perf-monitor/index.d.ts +5 -0
- package/dist/core/quality/perf-monitor/perf-monitor-facade.d.ts +45 -0
- package/dist/core/quality/perf-monitor/perf-monitor.d.ts +60 -0
- package/dist/core/quality/perf-monitor/types.d.ts +66 -0
- package/dist/core/quality/stability-monitor/index.d.ts +5 -0
- package/dist/core/quality/stability-monitor/stability-monitor-facade.d.ts +50 -0
- package/dist/core/quality/stability-monitor/stability-monitor.d.ts +61 -0
- package/dist/core/quality/stability-monitor/types.d.ts +69 -0
- package/dist/core/renderer/background-controller.d.ts +56 -0
- package/dist/core/renderer/index.d.ts +5 -0
- package/dist/core/renderer/player-adapter.d.ts +129 -0
- package/dist/core/renderer/renderer.d.ts +134 -0
- package/dist/core/service/frame-service.d.ts +116 -0
- package/dist/core/service/index.d.ts +9 -0
- package/dist/core/service/interaction-providers.d.ts +20 -0
- package/dist/core/service/interaction-service.d.ts +211 -0
- package/dist/core/service/item-asset-service.d.ts +120 -0
- package/dist/core/service/item-creator-service.d.ts +211 -0
- package/dist/core/service/item-service.d.ts +641 -0
- package/dist/core/service/item-sync-service.d.ts +66 -0
- package/dist/core/service/json-scene-sync-service.d.ts +140 -0
- package/dist/core/service/refresh-animation-base-service.d.ts +1 -0
- package/dist/core/service/scene-data-assembler.d.ts +166 -0
- package/dist/core/service/view-service.d.ts +202 -0
- package/dist/core/state/base-state.d.ts +28 -0
- package/dist/core/state/index.d.ts +6 -0
- package/dist/core/state/presets.d.ts +25 -0
- package/dist/core/state/state-manager.d.ts +50 -0
- package/dist/core/state/types.d.ts +52 -0
- package/dist/core/store/index.d.ts +3 -0
- package/dist/core/store/scene-store.d.ts +194 -0
- package/dist/core/store/store.d.ts +36 -0
- package/dist/core/types/artis-config.d.ts +186 -0
- package/dist/core/types/artis-events.d.ts +101 -0
- package/dist/core/types/frame.d.ts +3 -0
- package/dist/core/types/generator.d.ts +28 -0
- package/dist/core/types/index.d.ts +15 -0
- package/dist/core/types/item-create-info.d.ts +205 -0
- package/dist/core/types/item-property.d.ts +149 -0
- package/dist/core/types/item-reorder.d.ts +12 -0
- package/dist/core/types/item-schema.d.ts +263 -0
- package/dist/core/types/item-set-property.d.ts +48 -0
- package/dist/core/types/page.d.ts +40 -0
- package/dist/core/types/sdk.d.ts +28 -0
- package/dist/core/types/view.d.ts +39 -0
- package/dist/helper/exporter/config.d.ts +18 -0
- package/dist/helper/exporter/const.d.ts +71 -0
- package/dist/helper/exporter/export-media.d.ts +189 -0
- package/dist/helper/exporter/exporter.d.ts +58 -0
- package/dist/helper/exporter/index.d.ts +2 -0
- package/dist/helper/exporter/types.d.ts +194 -0
- package/dist/helper/exporter/utils.d.ts +71 -0
- package/dist/helper/exporter/wav-audio.d.ts +35 -0
- package/dist/helper/html-overlay/anchor-navigation-runtime.d.ts +1 -0
- package/dist/helper/html-overlay/auto-height-layout.d.ts +16 -0
- package/dist/helper/html-overlay/auto-height-runtime.d.ts +40 -0
- package/dist/helper/html-overlay/document-runtime.d.ts +18 -0
- package/dist/helper/html-overlay/document-transform.d.ts +46 -0
- package/dist/helper/html-overlay/dom-order.d.ts +5 -0
- package/dist/helper/html-overlay/host-message-runtime.d.ts +15 -0
- package/dist/helper/html-overlay/html-capture-runtime.d.ts +12 -0
- package/dist/helper/html-overlay/html-card-service.d.ts +287 -0
- package/dist/helper/html-overlay/html-viewport-style.d.ts +6 -0
- package/dist/helper/html-overlay/index.d.ts +1 -0
- package/dist/helper/html-overlay/inline-script-json.d.ts +1 -0
- package/dist/helper/html-overlay/mime-utils.d.ts +13 -0
- package/dist/helper/html-overlay/overlay-transform.d.ts +30 -0
- package/dist/helper/html-overlay/path-utils.d.ts +34 -0
- package/dist/helper/html-overlay/runtime-context.d.ts +2 -0
- package/dist/helper/html-overlay/shell-runtime.d.ts +13 -0
- package/dist/helper/index.d.ts +5 -0
- package/dist/helper/scene-builder.d.ts +111 -0
- package/dist/helper/screen-shot.d.ts +51 -0
- package/dist/helper/size-adapt.d.ts +88 -0
- package/dist/index.cjs +69350 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.mjs +68963 -0
- package/dist/index.mjs.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/player.d.ts +9 -0
- package/dist/utils/background-manager.d.ts +76 -0
- package/dist/utils/common-utils.d.ts +39 -0
- package/dist/utils/container-size.d.ts +7 -0
- package/dist/utils/find-player-item.d.ts +9 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/json-data-utils.d.ts +198 -0
- package/dist/utils/layout-utils.d.ts +144 -0
- package/dist/utils/pixel-box-utils.d.ts +26 -0
- package/dist/utils/player-data-utils.d.ts +9 -0
- package/dist/utils/player-utils.d.ts +42 -0
- package/dist/utils/replay-utils.d.ts +22 -0
- package/dist/utils/types.d.ts +130 -0
- package/package.json +66 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './player';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import '@galacean/effects';
|
|
2
|
+
export { spec, VFXItem, Player, math, Composition, type Region, EventEmitter, assertExist, SpriteComponent, TextComponent, FrameComponent, Texture, generateGUID, version as PlayerVersion, CompositionComponent, Control, } from '@galacean/effects';
|
|
3
|
+
import '@galacean/effects-plugin-rich-text';
|
|
4
|
+
export { RichTextComponent } from '@galacean/effects-plugin-rich-text';
|
|
5
|
+
import '@galacean/effects-plugin-model';
|
|
6
|
+
import '@galacean/effects-plugin-multimedia';
|
|
7
|
+
export { VideoComponent } from '@galacean/effects-plugin-multimedia';
|
|
8
|
+
import '@galacean/effects-plugin-spine';
|
|
9
|
+
import '@galacean/effects-plugin-ffd';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { BackgroundGridConfig, BackgroundPreset } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 背景管理器
|
|
4
|
+
* 负责管理画布背景的配置、渲染和跟随变换
|
|
5
|
+
*/
|
|
6
|
+
export declare class BackgroundManager {
|
|
7
|
+
/**
|
|
8
|
+
* 默认网格配置
|
|
9
|
+
*/
|
|
10
|
+
static readonly DEFAULT_GRID_CONFIG: BackgroundGridConfig;
|
|
11
|
+
/**
|
|
12
|
+
* 背景预设配置
|
|
13
|
+
*/
|
|
14
|
+
static readonly PRESETS: Record<string, BackgroundPreset>;
|
|
15
|
+
private container;
|
|
16
|
+
private config;
|
|
17
|
+
/**
|
|
18
|
+
* 当前背景位置(用于跟随移动)
|
|
19
|
+
*/
|
|
20
|
+
private offsetX;
|
|
21
|
+
private offsetY;
|
|
22
|
+
constructor(config?: Partial<BackgroundGridConfig>);
|
|
23
|
+
/**
|
|
24
|
+
* 绑定容器元素
|
|
25
|
+
* @param element 画布容器元素
|
|
26
|
+
*/
|
|
27
|
+
attach(element: HTMLElement): void;
|
|
28
|
+
/**
|
|
29
|
+
* 解绑容器元素
|
|
30
|
+
*/
|
|
31
|
+
detach(): void;
|
|
32
|
+
/**
|
|
33
|
+
* 应用背景预设
|
|
34
|
+
* @param presetName 预设名称
|
|
35
|
+
* @param color 可选的背景色覆盖
|
|
36
|
+
* @returns 是否成功应用(容器或预设不存在时返回 false)
|
|
37
|
+
*/
|
|
38
|
+
applyPreset(presetName: string, color?: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 设置纯色背景
|
|
41
|
+
* @param color 颜色值
|
|
42
|
+
*/
|
|
43
|
+
setColorBackground(color: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* 设置图片背景
|
|
46
|
+
* @param url 图片 URL
|
|
47
|
+
*/
|
|
48
|
+
setImageBackground(url: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* 更新背景变换(跟随画布移动和缩放)
|
|
51
|
+
* @param shift 画布移动的偏移量
|
|
52
|
+
* @param zoom 当前缩放比例
|
|
53
|
+
*/
|
|
54
|
+
updateTransform(shift: {
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
}, zoom: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* 重置背景位置和大小
|
|
60
|
+
*/
|
|
61
|
+
reset(): void;
|
|
62
|
+
/**
|
|
63
|
+
* 清除背景样式
|
|
64
|
+
* @param element 需要清除背景样式的元素
|
|
65
|
+
*/
|
|
66
|
+
private clearBackground;
|
|
67
|
+
/**
|
|
68
|
+
* 计算循环缩放比例
|
|
69
|
+
* zoom 在 [1, 2) 时,bgZoom = zoom
|
|
70
|
+
* zoom 在 [2, 4) 时,bgZoom = zoom / 2
|
|
71
|
+
* zoom 在 [0.5, 1) 时,bgZoom = zoom / 0.5
|
|
72
|
+
* @param zoom 当前缩放比例
|
|
73
|
+
* @returns 归一化到单个缩放周期内的比例
|
|
74
|
+
*/
|
|
75
|
+
private calculateZoomCycle;
|
|
76
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare function deepClone<T>(target: T): T;
|
|
2
|
+
export { assertExist } from '@galacean/effects';
|
|
3
|
+
/**
|
|
4
|
+
* 向数组添加元素,已存在(基本类型按值去重)则跳过
|
|
5
|
+
*/
|
|
6
|
+
export declare function arrAdd<T>(arr: T[], item: T): void;
|
|
7
|
+
/**
|
|
8
|
+
* 判断是否为对象(含数组),排除 null 与基本类型
|
|
9
|
+
*/
|
|
10
|
+
export declare function isObj(value: unknown): value is object;
|
|
11
|
+
/**
|
|
12
|
+
* 深度相等比较,支持对象/数组/Date/RegExp
|
|
13
|
+
*/
|
|
14
|
+
export declare function isEqual(a: unknown, b: unknown): boolean;
|
|
15
|
+
/** isEqual 的别名 */
|
|
16
|
+
export declare const deepEquals: typeof isEqual;
|
|
17
|
+
/**
|
|
18
|
+
* 在已有名称集合中生成不重复的名称,冲突时追加 " (n)"
|
|
19
|
+
*/
|
|
20
|
+
export declare function getUniqueName(base: string, existing: string[]): string;
|
|
21
|
+
type NormalizeColor = [number, number, number, number];
|
|
22
|
+
/**
|
|
23
|
+
* 归一化颜色 [0~1] -> RGBA [0~255, 0~1]
|
|
24
|
+
*/
|
|
25
|
+
export declare function getColorByNormalizeColor(color: NormalizeColor): NormalizeColor;
|
|
26
|
+
/**
|
|
27
|
+
* RGBA [0~255, 0~1] -> 归一化颜色 [0~1]
|
|
28
|
+
*/
|
|
29
|
+
export declare function getNormalizeColorByColor(color: NormalizeColor): NormalizeColor;
|
|
30
|
+
export declare function asserts(condition: any, msg?: string): asserts condition;
|
|
31
|
+
/**
|
|
32
|
+
* @example
|
|
33
|
+
* Input: logger('log', ['VVFX', 'SDK'], 'xx is required');
|
|
34
|
+
* Output: [VVFX SDK] xx is required
|
|
35
|
+
*/
|
|
36
|
+
type Level = 'error' | 'info' | 'debug' | 'warn' | 'log';
|
|
37
|
+
export declare function logger(level: Level, prefixs: string[], ...args: any[]): void;
|
|
38
|
+
export declare function loadScriptAsync(src: string, attrs?: Record<string, string>): Promise<unknown>;
|
|
39
|
+
export declare function downloadBlob(buffer: BlobPart | BlobPart[], filename: string, mimeType?: string): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VFXItem } from '../shared';
|
|
2
|
+
/**
|
|
3
|
+
* 递归遍历组合树,返回首个 instanceId 匹配的节点。
|
|
4
|
+
*
|
|
5
|
+
* @param items 组合树根节点列表(Player composition.items)
|
|
6
|
+
* @param id 目标元素实例 ID
|
|
7
|
+
* @returns 命中节点;未命中返回 undefined
|
|
8
|
+
*/
|
|
9
|
+
export declare function findPlayerItemByInstanceId(items: VFXItem[] | undefined, id: string): VFXItem | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './common-utils';
|
|
2
|
+
export * from './background-manager';
|
|
3
|
+
export * from './json-data-utils';
|
|
4
|
+
export * from './layout-utils';
|
|
5
|
+
export * from './pixel-box-utils';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export * from './player-data-utils';
|
|
8
|
+
export * from './player-utils';
|
|
9
|
+
export * from './find-player-item';
|
|
10
|
+
export { getContainerSize } from './container-size';
|
|
11
|
+
export * from './replay-utils';
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { Vector2, Vector3 } from '@vvfx/gizmo';
|
|
2
|
+
import { spec } from '@galacean/effects';
|
|
3
|
+
import { ItemJSONInfo } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* 创建 Frame 元素的内部合成场景
|
|
6
|
+
* @param frameId Frame 元素ID(用于标识)
|
|
7
|
+
* @param size 场景尺寸 [width, height]
|
|
8
|
+
* @param name 场景名称
|
|
9
|
+
* @returns Frame 内部的合成场景
|
|
10
|
+
*/
|
|
11
|
+
export declare function createFrameCompositionScene(size: spec.vec2, name: string, compositionId?: string): spec.JSONScene;
|
|
12
|
+
/**
|
|
13
|
+
* 创建基础场景信息
|
|
14
|
+
* @param viewSize 画布大小
|
|
15
|
+
* @returns 场景信息
|
|
16
|
+
*/
|
|
17
|
+
export declare function getBasicScene(viewSize?: number[], name?: string): spec.JSONScene;
|
|
18
|
+
/**
|
|
19
|
+
* 构建导出用 JSONScene 骨架:composition + 空 CompositionComponent + 空 TimelineAsset(miscs 内)。
|
|
20
|
+
*
|
|
21
|
+
* 与 {@link getBasicScene} 的差异(导出口径):
|
|
22
|
+
* - compositionId 由调用方传入(exportScene 复用现有 composition.id;createSceneByItemIds 用新生成 id),
|
|
23
|
+
* 不自建。
|
|
24
|
+
* - `endBehavior` 固定 restart(getBasicScene 为 forward)。
|
|
25
|
+
* - `camera` 由调用方传入:exportScene 用无 aspect 默认相机;createSceneByItemIds 用
|
|
26
|
+
* `getBasicScene(previewSize).camera`(带 aspect)。
|
|
27
|
+
* - 初始化 `videos` 字段(getBasicScene 未初始化)。
|
|
28
|
+
*
|
|
29
|
+
* 元素的 item/components/tracks/资源 + ObjectBindingTrack/sceneBindings 不在此处组装,
|
|
30
|
+
* 由调用方逐个 {@link addItemInfoToScene} 委托(绑定契约真源在本模块)。scene.images/videos/textures
|
|
31
|
+
* 为内部新建的空数组,调用方可直接拿这些引用作 serializeItemToJSON 的 out-param,收集后即挂在 scene 上。
|
|
32
|
+
*
|
|
33
|
+
* @param compositionId 合成 ID
|
|
34
|
+
* @param name 合成名称
|
|
35
|
+
* @param previewSize 预览尺寸
|
|
36
|
+
* @param camera 相机配置
|
|
37
|
+
* @returns 导出用 JSONScene 骨架(images/videos/textures 为空数组,供调用方累加)
|
|
38
|
+
*/
|
|
39
|
+
export declare function createExportableScene(compositionId: string, name: string, previewSize: spec.vec2, camera: spec.CameraOptions): spec.JSONScene;
|
|
40
|
+
export declare function createSpriteItemJSON(spriteId: string, position: Vector3, rotation: Vector3, size: Vector2, scale: Vector3, name: string, texture?: string): ItemJSONInfo;
|
|
41
|
+
/**
|
|
42
|
+
* 创建视频生成器 Item JSON
|
|
43
|
+
* 以 SpriteItem 形式渲染,但设置透明颜色
|
|
44
|
+
* 在 content 中存储 isVideoGenerator 标记
|
|
45
|
+
*/
|
|
46
|
+
export declare function createVideoGeneratorItemJSON(id: string, position: Vector3, rotation: Vector3, size: Vector2, scale: Vector3, name: string): ItemJSONInfo;
|
|
47
|
+
export declare function createNullItemJSON(nullId: string, name: string, position: Vector3, scale?: Vector2, rotation?: Vector3, worldSize?: Vector2): ItemJSONInfo;
|
|
48
|
+
export declare function createTextItemJSON(textId: string, name: string, position: Vector3, rotation: Vector3, size: Vector2, fontInfo: spec.TextContentOptions): ItemJSONInfo;
|
|
49
|
+
export declare function createVideoItemJSON(videoId: string, position: Vector3, rotation: Vector3, size: Vector2, scale: Vector3, name: string, isMuted?: boolean, transparent?: boolean, volume?: number, playbackRate?: number, texture?: string, video?: string): ItemJSONInfo;
|
|
50
|
+
/**
|
|
51
|
+
* 创建预合成元素
|
|
52
|
+
* @param effectsId 预合成元素ID
|
|
53
|
+
* @param position 位置信息
|
|
54
|
+
* @param rotation 旋转信息
|
|
55
|
+
* @param scale 缩放信息
|
|
56
|
+
* @param name 名称
|
|
57
|
+
*/
|
|
58
|
+
export declare function createCompositionItemJSON(effectsId: string, position: Vector3, rotation: Vector3, scale: Vector3, name: string): {
|
|
59
|
+
item: spec.VFXItemData;
|
|
60
|
+
components: never[];
|
|
61
|
+
tracks: {
|
|
62
|
+
id: string;
|
|
63
|
+
dataType: spec.DataType;
|
|
64
|
+
children: never[];
|
|
65
|
+
clips: {
|
|
66
|
+
start: number;
|
|
67
|
+
duration: number;
|
|
68
|
+
endBehavior: spec.EndBehavior;
|
|
69
|
+
asset: {
|
|
70
|
+
id: string;
|
|
71
|
+
};
|
|
72
|
+
}[];
|
|
73
|
+
}[];
|
|
74
|
+
playableAssets: {
|
|
75
|
+
id: string;
|
|
76
|
+
dataType: spec.DataType;
|
|
77
|
+
}[];
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* 添加元素信息到JSON
|
|
81
|
+
* @param scene 场景信息
|
|
82
|
+
* @param itemInfo 元素信息
|
|
83
|
+
*/
|
|
84
|
+
export declare function addItemInfoToScene(scene: spec.JSONScene, itemInfo: ItemJSONInfo): void;
|
|
85
|
+
/**
|
|
86
|
+
* 设置元素父节点信息
|
|
87
|
+
* @param scene 场景信息
|
|
88
|
+
* @param itemId 元素Id
|
|
89
|
+
* @param parentId 父节点Id
|
|
90
|
+
*/
|
|
91
|
+
export declare function setItemJSONParentId(scene: spec.JSONScene, itemId: string, parentId: string): void;
|
|
92
|
+
/**
|
|
93
|
+
* 清理元素父节点信息
|
|
94
|
+
* @param scene 场景信息
|
|
95
|
+
* @param itemId 元素Id
|
|
96
|
+
*/
|
|
97
|
+
export declare function clearItemParentInfo(scene: spec.JSONScene, itemId: string): void;
|
|
98
|
+
/**
|
|
99
|
+
* 删除元素信息
|
|
100
|
+
* @param scene 场景信息
|
|
101
|
+
* @param itemId 元素Id
|
|
102
|
+
*/
|
|
103
|
+
export declare function deleteItemInfoFromScene(scene: spec.JSONScene, itemId: string): spec.JSONScene | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* 从场景中移除并获取元素的完整 ItemJSONInfo
|
|
106
|
+
* @param scene 场景信息
|
|
107
|
+
* @param itemId 元素ID
|
|
108
|
+
* @returns ItemJSONInfo 或 undefined(如果元素不存在)
|
|
109
|
+
*/
|
|
110
|
+
export declare function removeItemInfoFromScene(scene: spec.JSONScene, itemId: string): ItemJSONInfo | undefined;
|
|
111
|
+
export declare function getTextureUrlById(scene: spec.JSONScene, itemId: string): string | undefined;
|
|
112
|
+
export declare function addCompositionItemByComposition(main: spec.JSONScene, inputChild: spec.JSONScene, compositionItemId: string, parentId?: string): spec.JSONScene;
|
|
113
|
+
/**
|
|
114
|
+
* 删除预合成数据
|
|
115
|
+
* @param scene 场景数据
|
|
116
|
+
* @param itemId 预合成ID
|
|
117
|
+
* @returns 场景数据
|
|
118
|
+
*/
|
|
119
|
+
export declare function deleteCompositionItemFromScene(scene: spec.JSONScene, itemIds: string[]): spec.JSONScene;
|
|
120
|
+
/**
|
|
121
|
+
* 删除合成信息
|
|
122
|
+
* @param scene 场景数据
|
|
123
|
+
* @param compositionId 合成ID
|
|
124
|
+
*/
|
|
125
|
+
export declare function deleteCompositionFromScene(scene: spec.JSONScene, compositionId: string): void;
|
|
126
|
+
/**
|
|
127
|
+
* 重置元素ID - 加载时会新建guid,需要保持一致
|
|
128
|
+
* @param scene 场景数据
|
|
129
|
+
* @param idMap id名称列表
|
|
130
|
+
*/
|
|
131
|
+
export declare function resetSubCompositionItemId(scene: spec.JSONScene, idMap: Map<string, string>): void;
|
|
132
|
+
/**
|
|
133
|
+
* 设置场景中元素名称
|
|
134
|
+
* @param scene 场景数据
|
|
135
|
+
* @param itemId 元素ID
|
|
136
|
+
* @param name 名称
|
|
137
|
+
*/
|
|
138
|
+
export declare function setJSONItemName(scene: spec.JSONScene, itemId: string, name: string): void;
|
|
139
|
+
/**
|
|
140
|
+
* 元素变换选项
|
|
141
|
+
*/
|
|
142
|
+
export type MoveItemTransformOptions = {
|
|
143
|
+
position?: {
|
|
144
|
+
x: number;
|
|
145
|
+
y: number;
|
|
146
|
+
z: number;
|
|
147
|
+
};
|
|
148
|
+
size?: {
|
|
149
|
+
x: number;
|
|
150
|
+
y: number;
|
|
151
|
+
};
|
|
152
|
+
scale?: {
|
|
153
|
+
x: number;
|
|
154
|
+
y: number;
|
|
155
|
+
z: number;
|
|
156
|
+
};
|
|
157
|
+
rotation?: {
|
|
158
|
+
x: number;
|
|
159
|
+
y: number;
|
|
160
|
+
z: number;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* 将元素从一个合成移动到另一个合成
|
|
165
|
+
* @param scene 场景数据
|
|
166
|
+
* @param itemId 元素ID
|
|
167
|
+
* @param targetCompositionId 目标合成ID,为null时表示移动到主合成
|
|
168
|
+
* @param options 可选的位置、大小、缩放、旋转信息
|
|
169
|
+
* @returns 是否移动成功
|
|
170
|
+
*/
|
|
171
|
+
export declare function moveItemBetweenCompositions(scene: spec.JSONScene, itemId: string, targetCompositionId: string | null, options?: MoveItemTransformOptions): boolean;
|
|
172
|
+
export declare function getCompositionIdByRefCompositionItemId(scene: spec.JSONScene, compositionItemId: string): any;
|
|
173
|
+
/**
|
|
174
|
+
* 获取预合成元素所指向的合成数据
|
|
175
|
+
* @param scene 场景数据
|
|
176
|
+
* @param compositionItemId 预合成元素ID
|
|
177
|
+
* @returns 对应的合成数据 (CompositionData),如果未找到则返回 undefined
|
|
178
|
+
*/
|
|
179
|
+
export declare function getCompositionDataByRefCompositionItemId(scene: spec.JSONScene, compositionItemId: string): spec.CompositionData | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* 提取子合成元素及其所有关联资源为独立的 JSONScene
|
|
182
|
+
* @param scene 主场景数据
|
|
183
|
+
* @param compositionItemId 预合成元素ID(子合成元素ID)
|
|
184
|
+
* @returns 独立的子合成场景 JSONScene,如果未找到则返回 undefined
|
|
185
|
+
*/
|
|
186
|
+
export declare function extractSubCompositionToScene(scene: spec.JSONScene, compositionItemId: string): spec.JSONScene | undefined;
|
|
187
|
+
export declare function fixStandardJSON(scene: spec.JSONScene): void;
|
|
188
|
+
/**
|
|
189
|
+
* 创建遮罩合成场景:把入参 BaseScene 以预合成形式挂到新建的 MaskScene 主合成下,
|
|
190
|
+
* 并在预合成父级加一个带 FrameComponent 的空节点(界外遮罩画板)。
|
|
191
|
+
*
|
|
192
|
+
* - MaskScene 主合成的 previewSize / camera 与 BaseScene 主合成一致
|
|
193
|
+
* - 空节点(null + FrameComponent)为预合成 item 的父级,size 由相机参数换算的世界尺寸铺满视口
|
|
194
|
+
* - FrameComponent 以 FrameComponentData 序列化进 MaskScene.components,加载后由 runtime 装配
|
|
195
|
+
* @param scene BaseScene(被包裹的原始场景)
|
|
196
|
+
* @returns MaskScene(外层遮罩合成场景)
|
|
197
|
+
*/
|
|
198
|
+
export declare function createMaskScene(scene: spec.JSONScene): spec.JSONScene;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { LayoutPosition } from '@vvfx/gizmo';
|
|
2
|
+
import { Box2 } from '@vvfx/gizmo';
|
|
3
|
+
import { type ArtisItem, type FrameItem } from '../core';
|
|
4
|
+
import { type AutoLayoutConfig, type LayoutInfo } from '../core/types';
|
|
5
|
+
/**
|
|
6
|
+
* 布局元素信息
|
|
7
|
+
*/
|
|
8
|
+
export type LayoutItem = {
|
|
9
|
+
id: string;
|
|
10
|
+
box: Box2;
|
|
11
|
+
row?: number;
|
|
12
|
+
column?: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 布局结果项
|
|
16
|
+
*/
|
|
17
|
+
export type LayoutResultItem = {
|
|
18
|
+
id: string;
|
|
19
|
+
position: [number, number];
|
|
20
|
+
row: number;
|
|
21
|
+
column: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 自动排布配置
|
|
25
|
+
*/
|
|
26
|
+
export type AutoLayoutOptions = {
|
|
27
|
+
padding?: number;
|
|
28
|
+
gap?: number;
|
|
29
|
+
config?: AutoLayoutConfig;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* 自动排布结果
|
|
33
|
+
*/
|
|
34
|
+
export type AutoLayoutResult = {
|
|
35
|
+
items: LayoutResultItem[];
|
|
36
|
+
size: [number, number];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* 全局自适应排布元素
|
|
40
|
+
*/
|
|
41
|
+
export type LayoutElement = {
|
|
42
|
+
id: string;
|
|
43
|
+
box: Box2;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* 全局自适应排布结果
|
|
47
|
+
*/
|
|
48
|
+
export type GlobalAutoLayoutResult = {
|
|
49
|
+
items: {
|
|
50
|
+
id: string;
|
|
51
|
+
position: [number, number];
|
|
52
|
+
}[];
|
|
53
|
+
boundingBox: Box2;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* 全局自适应排布配置
|
|
57
|
+
*/
|
|
58
|
+
export type GlobalAutoLayoutOptions = {
|
|
59
|
+
/**
|
|
60
|
+
* 元素间隔(默认10)
|
|
61
|
+
*/
|
|
62
|
+
gap?: number;
|
|
63
|
+
/**
|
|
64
|
+
* 目标宽高比(默认1:1正方形)
|
|
65
|
+
*/
|
|
66
|
+
targetAspectRatio?: number;
|
|
67
|
+
/**
|
|
68
|
+
* 排布模式
|
|
69
|
+
* - 'adaptive': 基于元素包围盒自适应排布(MaxRects算法,更紧凑)
|
|
70
|
+
* - 'ordered': 基于元素顺序的行列排布(保持输入顺序,流式行排布,行优先)
|
|
71
|
+
*/
|
|
72
|
+
mode?: GlobalLayoutMode;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* 全局自适应排布模式
|
|
76
|
+
*/
|
|
77
|
+
export declare enum GlobalLayoutMode {
|
|
78
|
+
ADAPTIVE = "adaptive",
|
|
79
|
+
ORDERED = "ordered"
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 自动排布函数
|
|
83
|
+
* 根据元素信息中的行列数参数进行排布:
|
|
84
|
+
* - 如果元素有 row/column,则按指定行列排布
|
|
85
|
+
* - 如果元素没有 row/column,则使用 Shelf 算法自动生成行列数,再排布
|
|
86
|
+
*
|
|
87
|
+
* @param canvasBox 画布范围(Box2),min为左上角,max为右下角
|
|
88
|
+
* @param items 元素信息列表(包含 ID、Box2、可选的 row/column)
|
|
89
|
+
* @param options 可选配置(padding, gap)
|
|
90
|
+
* @returns 各元素的位置信息和整体尺寸
|
|
91
|
+
*/
|
|
92
|
+
export declare function autoLayout(items: LayoutItem[], options?: AutoLayoutOptions): AutoLayoutResult;
|
|
93
|
+
/**
|
|
94
|
+
* 计算元素到目标位置的位移
|
|
95
|
+
* @param currentPosition 当前位置 [x, y]
|
|
96
|
+
* @param targetPosition 目标位置 [x, y]
|
|
97
|
+
* @returns 位移向量 [dx, dy]
|
|
98
|
+
*/
|
|
99
|
+
export declare function calculateDisplacement(currentPosition: [number, number], targetPosition: [number, number]): [number, number];
|
|
100
|
+
/**
|
|
101
|
+
* 为 autoLayout 结果计算位移信息
|
|
102
|
+
* @param items 元素列表(包含当前位置)
|
|
103
|
+
* @param layoutResult autoLayout 的返回结果
|
|
104
|
+
* @returns 每个元素的位移信息
|
|
105
|
+
*/
|
|
106
|
+
export declare function calculateLayoutDisplacements(items: {
|
|
107
|
+
id: string;
|
|
108
|
+
currentPosition: [number, number];
|
|
109
|
+
}[], layoutResult: AutoLayoutResult): {
|
|
110
|
+
id: string;
|
|
111
|
+
displacement: [number, number];
|
|
112
|
+
targetPosition: [number, number];
|
|
113
|
+
}[];
|
|
114
|
+
/**
|
|
115
|
+
* 更新元素的 layoutInfo
|
|
116
|
+
* @param item 要更新的元素
|
|
117
|
+
* @param parent 父画板
|
|
118
|
+
* @param layoutPosition 新的布局位置
|
|
119
|
+
*/
|
|
120
|
+
export declare function updateItemLayoutInfo(item: ArtisItem, parent: FrameItem, layoutPosition: LayoutPosition): void;
|
|
121
|
+
/**
|
|
122
|
+
* 全局自适应排布
|
|
123
|
+
* 支持两种模式:
|
|
124
|
+
* 1. 'adaptive'(默认): 基于元素包围盒自适应排布(MaxRects算法,更紧凑)
|
|
125
|
+
* 2. 'ordered': 基于元素顺序的流式行排布(保持输入顺序,每行尽可能多放元素)
|
|
126
|
+
*
|
|
127
|
+
* @param elements 元素列表(包含ID和包围盒)
|
|
128
|
+
* @param options 配置选项
|
|
129
|
+
* @returns 各元素位置和整体包围盒
|
|
130
|
+
*/
|
|
131
|
+
export declare function globalAutoLayout(elements: LayoutElement[], options?: GlobalAutoLayoutOptions): GlobalAutoLayoutResult;
|
|
132
|
+
/**
|
|
133
|
+
* 调整其他元素的行列信息
|
|
134
|
+
* 当被拖拽元素移动到新位置时,需要调整其他受影响的元素:
|
|
135
|
+
* 1. 同行内移动:原位置到新位置之间的元素需要相应调整列号
|
|
136
|
+
* 2. 跨行移动:原行中后面的元素前移,目标行中后面的元素后移
|
|
137
|
+
* @param originLayoutInfos 原始布局信息
|
|
138
|
+
* @param draggedItemId 被拖拽的元素ID
|
|
139
|
+
* @param fromRow 原始行号
|
|
140
|
+
* @param fromColumn 原始列号
|
|
141
|
+
* @param toRow 目标行号
|
|
142
|
+
* @param toColumn 目标列号
|
|
143
|
+
*/
|
|
144
|
+
export declare function adjustOtherElementsLayoutInfo(originLayoutInfos: Record<string, LayoutInfo>, draggedItemId: string, fromRow: number, fromColumn: number, toRow: number, toColumn: number): Record<string, LayoutInfo>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Box2 } from '@vvfx/gizmo';
|
|
2
|
+
import { type ItemSchema } from '../core/types';
|
|
3
|
+
/**
|
|
4
|
+
* 按单个 ItemSchema 计算像素包围盒(基准像素空间、含 rotation、size 补乘 scale)。
|
|
5
|
+
*
|
|
6
|
+
* 纯计算、不依赖任何运行时服务 / Player 实例,供「手上有 ItemSchema 而非运行时 artisItem」的
|
|
7
|
+
* 离线场景(导出 / 复制粘贴 / 布局)按数据算盒。GROUP(空节点)无自身尺寸,直接返回空盒——
|
|
8
|
+
* 批量场景下空节点按子元素 union 的口径见 {@link getPixelBoxBySchemas};text 高度缺省取 lineHeight;
|
|
9
|
+
* effects 等缺宽高的返回空盒。
|
|
10
|
+
*
|
|
11
|
+
* @param schema 元素 Schema
|
|
12
|
+
* @returns 基准像素包围盒;无有效尺寸时返回空盒
|
|
13
|
+
*/
|
|
14
|
+
export declare function getPixelBoxBySchema(schema: ItemSchema): Box2;
|
|
15
|
+
/**
|
|
16
|
+
* 按 ItemSchema 批量计算像素包围盒(离线口径,不依赖 Player 实例)。
|
|
17
|
+
*
|
|
18
|
+
* - 非空节点(sprite / text / video / generator / effects / frame / card):直接按 position +
|
|
19
|
+
* width/height 补乘 scale + rotation 算盒(复用 {@link getPixelBoxBySchema});
|
|
20
|
+
* - 空节点(GROUP):自身无尺寸,需等本批所有非空节点算完后,按其 children 包围盒做 union 得到
|
|
21
|
+
* (支持 GROUP 嵌套,按依赖顺序迭代到收敛;存在环或引用本批外元素时填空盒,不死循环)。
|
|
22
|
+
*
|
|
23
|
+
* @param schemas 元素 Schema 列表
|
|
24
|
+
* @returns 元素 ID → 像素包围盒映射(无 id 的 schema 跳过;GROUP 子元素不在本批内时不贡献面积)
|
|
25
|
+
*/
|
|
26
|
+
export declare function getPixelBoxBySchemas(schemas: ItemSchema[]): Map<string, Box2>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 此文件的实现已迁移至 `@vvfx/gizmo (internal/player-data-utils.ts)`(gizmo 依赖收口的单一来源)。
|
|
3
|
+
* 此处反向 re-export 该文件实际对外暴露的符号,保持 `utils` barrel 与现有深路径引用不变。
|
|
4
|
+
*
|
|
5
|
+
* 注意:这里显式列举需要的符号而非 `export * from '@vvfx/gizmo'`,以免把 gizmo 全部导出
|
|
6
|
+
* (含 FrameLayoutMode/AutoLayoutConfig/LayoutInfo 等)带入 artis barrel,与 artis 本地定义的
|
|
7
|
+
* 同名类型产生重复导出冲突。
|
|
8
|
+
*/
|
|
9
|
+
export { DefaultVFXItems, VFXItemFactory } from '@vvfx/gizmo';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { VFXItem } from '@galacean/effects';
|
|
2
|
+
import { MoveItemTransformOptions } from './json-data-utils';
|
|
3
|
+
/**
|
|
4
|
+
* 计算元素在新父节点下保持世界绝对 transform 不变时所需的局部 transform
|
|
5
|
+
*
|
|
6
|
+
* 返回 position / size / scale / **rotation**。历史实现经 `decompose` 解出旋转却未返回,
|
|
7
|
+
* 导致带旋转的元素移入 / 移出 Frame 时旋转丢失;补齐 rotation(角度,与 effects
|
|
8
|
+
* `setRotation` / `eulerHint` 单位一致,参考 item-service decompose→Euler.setFromQuaternion 模式)。
|
|
9
|
+
*
|
|
10
|
+
* @param item 要移动的元素
|
|
11
|
+
* @param targetParentVFXItem 目标父 VFXItem(移入 Frame 时为 compositionItem,移出 Frame 时为 composition.rootItem)
|
|
12
|
+
*/
|
|
13
|
+
export declare function getItemTransformUnderParent(item: VFXItem, targetParentVFXItem: VFXItem): MoveItemTransformOptions | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* 将单个元素移入画板(Frame)合成,并应用保持世界 transform 的局部 transform。
|
|
16
|
+
* @param item 要移动的元素
|
|
17
|
+
* @param frameCompositionItem 画板合成元素
|
|
18
|
+
* @param targetTransformInfo getItemTransformUnderParent 计算出的局部 transform
|
|
19
|
+
*/
|
|
20
|
+
export declare function moveItemToFrame(item: VFXItem, frameCompositionItem: VFXItem, targetTransformInfo: MoveItemTransformOptions): void;
|
|
21
|
+
/**
|
|
22
|
+
* 将单个元素移出画板(Frame)合成。
|
|
23
|
+
* 仅当移回根(parentId 为空)时写入 transform;移到中间父级时仅变更父子关系。
|
|
24
|
+
* @param item 要移动的元素
|
|
25
|
+
* @param parentId 目标父 id(移回根时为 undefined)
|
|
26
|
+
* @param parentItem 目标父元素
|
|
27
|
+
* @param targetTransformInfo getItemTransformUnderParent 计算出的局部 transform
|
|
28
|
+
*/
|
|
29
|
+
export declare function moveItemOutOfFrame(item: VFXItem, parentId: string | undefined, parentItem: VFXItem, targetTransformInfo: MoveItemTransformOptions): void;
|
|
30
|
+
/**
|
|
31
|
+
* 把元素提升到合成根节点,并按世界 transform 重新计算 local
|
|
32
|
+
*
|
|
33
|
+
* 用于取消打组 / 脱离父容器:reparent 到 root 的同时 bake 世界 transform,
|
|
34
|
+
* 使元素在父级变更后世界位置 / 旋转 / 缩放保持不变。
|
|
35
|
+
* 内部复用 getItemTransformUnderParent + moveItemOutOfFrame 的「移回根(!parentId)」路径,
|
|
36
|
+
* 与 frame-service.moveItemsOutOfFrame 走同一套矩阵 decompose 方案。
|
|
37
|
+
*
|
|
38
|
+
* @param item 要提升的元素
|
|
39
|
+
* @param rootItem 合成根元素(composition.sceneRoot)
|
|
40
|
+
* @returns 是否成功完成 reparent + bake(info 算不出时返回 false)
|
|
41
|
+
*/
|
|
42
|
+
export declare function moveItemToRoot(item: VFXItem, rootItem: VFXItem): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replay args 序列化:把 Command 工厂入参(单参对象)序列化为 JSON-safe 数据,
|
|
3
|
+
* 用于错误上报快照中携带"可重放"的操作上下文。
|
|
4
|
+
*
|
|
5
|
+
* 入参为<b>单参对象</b>(与命令 args 形状同源,key-value)。按 key 逐字段应用清洗规则,产出
|
|
6
|
+
* `Record<string, unknown>`——比历史位置数组更稳定(无下标约定耦合,复现页按具名 key 解构)。
|
|
7
|
+
*
|
|
8
|
+
* 规则(每字段):
|
|
9
|
+
* - 函数直接丢弃(记为 null),replayable 置 false
|
|
10
|
+
* - 不可 JSON 序列化的对象(循环引用 / Symbol / 不可枚举宿主对象)→ 丢弃该项、replayable 置 false
|
|
11
|
+
* - 类实例(Vector2/Box2/Matrix 等,constructor 非 Object)JSON 会剥掉原型 → 标 replayable=false,
|
|
12
|
+
* 避免重放时方法丢失(如 setZoom 调 anchor.add())崩溃
|
|
13
|
+
* - 其余纯数据对象/数组用 deepClone(复用 common-utils,与全工程同语义)克隆为 JSON-safe
|
|
14
|
+
* - undefined 字段直接保留为 undefined
|
|
15
|
+
*
|
|
16
|
+
* @param args Command 工厂单参入参对象
|
|
17
|
+
* @returns 序列化后的 args(对象)与是否可完整重放标志
|
|
18
|
+
*/
|
|
19
|
+
export declare function serializeReplayArgs(args: unknown): {
|
|
20
|
+
args: Record<string, unknown>;
|
|
21
|
+
replayable: boolean;
|
|
22
|
+
};
|