@cocos/pink-types 0.0.0-bootstrap.0 → 0.0.12-beta.1

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/pink.d.ts CHANGED
@@ -0,0 +1,1509 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) SUD. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ /*---------------------------------------------------------------------------------------------
7
+ * AUTO-GENERATED by build/lib/pink-dts-generator.ts — DO NOT EDIT
8
+ * Regenerate with: npx gulp generate-pink-dts
9
+ *--------------------------------------------------------------------------------------------*/
10
+
11
+ /// <reference path="./pink.vscode.d.ts" />
12
+
13
+ declare module 'pink' {
14
+ /** @internal */
15
+ namespace _cli {
16
+ // ── Inlined from @cocos/cocos-cli-types/engine ──
17
+
18
+ export interface ModuleRenderConfig {
19
+ $schema?: string;
20
+
21
+ /**
22
+ * The modules info
23
+ */
24
+ features: Features;
25
+
26
+ /**
27
+ * The categories info
28
+ */
29
+ categories: { [category: string]: CategoryInfo };
30
+
31
+ version: string;
32
+
33
+ /**
34
+ * The script to migrate, this script should export a const migrations: Migration[]`.
35
+ */
36
+ migrationScript?: string;
37
+ }
38
+
39
+ export interface CategoryInfo {
40
+ label?: string;
41
+ description?: string;
42
+ checkable?: boolean;
43
+ required?: boolean;
44
+ }
45
+
46
+ export interface Features {
47
+ [feature: string]: IModuleItem;
48
+ }
49
+
50
+ export type IModuleItem = IFeatureItem | IFeatureGroup;
51
+
52
+ export interface IFeatureGroup extends BaseItem {
53
+ options: { [feature: string]: IFeatureItem };
54
+ }
55
+
56
+ export interface IFeatureItem extends BaseItem {
57
+ /**
58
+ * @zh 是否默认以及允许包含在上传的各个小游戏引擎插件内,目前由于部分引擎模块包体较大,默认不会打包在官方的微信引擎分离插件内。(临时方案)
59
+ * @en Whether it is included in the upload of the various engine plugins by default. Currently, because some engine modules are packaged in a large package, the official WeChat engine separation plugin does not package them by default. (Temporary solution)
60
+ */
61
+ enginePlugin?: boolean;
62
+
63
+ /**
64
+ * @zh 限定的使用环境,允许宏的组合条件判断,默认为空支持任意环境,配置后限定为指定环境。如设置为 "$NATIVE || $HTML5" 则仅在 native 和 html5 环境下生效。
65
+ * @en The restricted usage environment allows for conditional judgments using macro combinations. By default, it supports any environment, but once configured, it is limited to the specified environment. For example, if set to "$NATIVE || $HTML5", it will only take effect in native and HTML5 environments.
66
+ */
67
+ envCondition?: string;
68
+
69
+ /**
70
+ * @zh 当环境不符合限定的使用环境时,自动回退的模块名称。仅当 `envCondition` 配置后才有效。
71
+ * @en The name of the engine feature to automatically fall back to when the environment does not meet the restricted usage conditions. This is only effective when `envCondition` is configured.
72
+ */
73
+ fallback?: string;
74
+
75
+ /**
76
+ * @zh 当选择了某个模块时,可以做些附加的配置
77
+ * @en When a module is selected, additional configurations can be made
78
+ */
79
+ flags: { [k: string]: Pick<BaseItem, 'default' | 'label' | 'description'> & { 'ui-type': 'checkbox' | 'select' } }
80
+
81
+ /**
82
+ * @zh 是否为原生模块,这部分模块的编译模式可能是 wasm 也可能是共存或只有 asmjs,为 true 的模块,如果模块勾选构建面板上才会显示原生代码打包模式的配置。
83
+ * @en Whether it is a native module. This part of the module may be compiled as wasm or asmjs, and the module with this attribute will be displayed in the packaging mode configuration in the build panel if it is selected.
84
+ */
85
+ isNativeModule?: boolean;
86
+
87
+ /**
88
+ * @zh 在原生引擎的模块宏配置,如果在原生端有原生实现,在此处补充对应字段,后续根据项目设置的配置情况,会将选择值设置到 `cmake` 配置内。
89
+ * @en The macro configuration of the native module in the native engine. If there is a native implementation in the native engine, please fill in the corresponding fields here. The value will be set to `cmake` configuration according to the project settings.
90
+ */
91
+ cmakeConfig?: string;
92
+ }
93
+
94
+ export interface BaseItem {
95
+ /**
96
+ * @zh 在项目设置上显示的模块名称,支持 i18n 格式
97
+ * @en the module name displayed on the project settings, can be configured in i18n format.
98
+ */
99
+ label?: string;
100
+
101
+ /**
102
+ * @zh 模块详细描述,将会显示在模块鼠标上移后的提示,支持 `i18n` 的格式
103
+ * @en the detailed description of the module, which will be displayed in the tooltip when the mouse is moved over the module, can be configured in i18n format.
104
+ */
105
+ description?: string;
106
+
107
+ /**
108
+ * @zh 是否默认包含该模块
109
+ * @en whether the module is included by default.
110
+ */
111
+ default: boolean;
112
+
113
+ /**
114
+ * @zh 标识是否为只读模块,设为 `true` 后用户无法开启或关闭该模块。
115
+ * @en whether the module is read-only. If set to true, users cannot modify this module.
116
+ */
117
+ readonly?: boolean;
118
+
119
+ /**
120
+ * @zh 是否在项目设置上隐藏该模块,设为 `true` 后将不会显示在项目设置中。
121
+ * @en Whether to hide the module in the project settings. If set to true, it will not be displayed in the project settings.
122
+ */
123
+ hidden?: boolean;
124
+
125
+ /**
126
+ * @zh 默认的模块分组归属,对应 `features` 字段同级的 `categories` 中配置的目录。
127
+ * @en The default module group belongs to, corresponding to the directory configured under the `categories` field at the same level of the `features` field.
128
+ */
129
+ category?: string;
130
+
131
+ /**
132
+ * @zh 是否为必选模块,新增模块为必选模块时,旧版本升级后会强制选择此模块,否则不会选择。
133
+ * @en Whether it is a required module. When adding a new module, the old version will be forced to select this module after the upgrade, otherwise it will not be selected.
134
+ */
135
+ required?: boolean;
136
+
137
+ /**
138
+ * @zh 该模块依赖的其他模块,如果依赖了其他模块,则此模块勾选后,依赖模块也会被自动勾选。反过来,依赖的模块被移除勾选,此模块也会被一并移除。
139
+ * @en The other modules that this module depends on. If the module depends on other modules, the dependent modules will be automatically selected. In addition, if the dependent module is removed, this module will also be removed.
140
+ */
141
+ dependencies?: string[];
142
+ }
143
+
144
+ export interface IEngineConfig extends IEngineModuleConfig {
145
+ physicsConfig: IPhysicsConfig;
146
+ macroConfig?: Record<string, string | number | boolean>;
147
+ graphics?: IEngineGraphicsConfig;
148
+ sortingLayers: { id: number, name: string, value: number }[];
149
+ customLayers: { name: string, value: number }[];
150
+ renderPipeline?: string;
151
+ // 是否使用自定义管线,如与其他模块配置不匹配将会以当前选项为准
152
+ customPipeline?: boolean;
153
+ highQuality: boolean;
154
+
155
+ macroCustom: MacroItem[];
156
+
157
+ customJointTextureLayouts: ICustomJointTextureLayout[];
158
+ designResolution: IDesignResolution;
159
+ splashScreen: ISplashSetting;
160
+ downloadMaxConcurrency: number;
161
+ }
162
+
163
+ export interface ISplashSetting {
164
+ displayRatio: number;
165
+ totalTime: number;
166
+ watermarkLocation: 'default' | 'topLeft' | 'topRight' | 'topCenter' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
167
+ autoFit: boolean;
168
+
169
+ logo?: {
170
+ type: 'default' | 'none' | 'custom';
171
+ image?: string;
172
+ base64?: string;
173
+ }
174
+ background?: {
175
+ type: 'default' | 'color' | 'custom';
176
+ color?: ISplashBackgroundColor;
177
+ image?: string;
178
+ base64?: string;
179
+ }
180
+ }
181
+
182
+ export interface ISplashBackgroundColor {
183
+ x: number;
184
+ y: number;
185
+ z: number;
186
+ w: number;
187
+ }
188
+
189
+ /**
190
+ * 构建使用的设计分辨率数据
191
+ */
192
+ export interface IDesignResolution {
193
+ height: number;
194
+ width: number;
195
+ fitWidth?: boolean;
196
+ fitHeight?: boolean;
197
+ policy?: number;
198
+ }
199
+
200
+ export interface ICustomJointTextureLayout {
201
+ textureLength: number;
202
+ contents: IChunkContent[];
203
+ }
204
+
205
+ export interface IChunkContent {
206
+ skeleton: null | string;
207
+ clips: string[];
208
+ }
209
+
210
+ export type MacroItem = {
211
+ key: string;
212
+ value: boolean;
213
+ }
214
+
215
+ export interface IEngineGraphicsConfig {
216
+ pipeline?: IEngineGraphicsPipeline;
217
+ 'custom-pipeline-post-process'?: boolean;
218
+ }
219
+
220
+ export type IEngineGraphicsPipeline = 'custom-pipeline' | 'legacy-pipeline';
221
+
222
+ export interface IPhysicsConfig {
223
+ gravity: IVec3Like; // (0,-10, 0)
224
+ allowSleep: boolean; // true
225
+ sleepThreshold: number; // 0.1,最小 0
226
+ autoSimulation: boolean; // true
227
+ fixedTimeStep: number; // 1 / 60 ,最小 0
228
+ maxSubSteps: number; // 1,最小 0
229
+ defaultMaterial?: string; // 物理材质 uuid
230
+ useNodeChains: boolean; // true
231
+ collisionMatrix: ICollisionMatrix;
232
+ physicsEngine: string;
233
+ physX?: {
234
+ notPackPhysXLibs: boolean;
235
+ multiThread: boolean;
236
+ subThreadCount: number;
237
+ epsilon: number;
238
+ };
239
+ }
240
+
241
+ export interface ICollisionMatrix {
242
+ [x: string]: number;
243
+ }
244
+
245
+ export interface IVec3Like {
246
+ x: number;
247
+ y: number;
248
+ z: number;
249
+ }
250
+
251
+ export interface IEngineModuleConfig {
252
+ // ---- 模块配置相关 ----
253
+ includeModules: string[];
254
+ flags?: IFlags;
255
+ noDeprecatedFeatures?: { value: boolean, version: string };
256
+ }
257
+
258
+ export type IFlags = Record<string, boolean | number>;
259
+
260
+ export interface EngineInfo {
261
+ typescript: {
262
+ type: 'builtin' | 'custom'; // 当前使用的引擎类型(内置或自定义)
263
+ builtin: string, // 内置引擎地址
264
+ path: string; // 当前使用的 ts 引擎路径
265
+ },
266
+ native: {
267
+ type: 'builtin' | 'custom'; // 当前使用的引擎类型(内置或自定义)
268
+ builtin: string, // 内置引擎地址
269
+ path: string; // 当前使用的原生引擎路径
270
+ },
271
+ tmpDir: string;
272
+ version: string;
273
+ }
274
+
275
+ // ── Inlined from @cocos/cocos-cli-types/assets ──
276
+
277
+ export interface IAssetInfo {
278
+ name: string; // 资源名字
279
+ source: string; // url 地址
280
+ loadUrl: string; // loader 加载的层级地址
281
+ url: string; // loader 加载地址会去掉扩展名,这个参数不去掉
282
+ file: string; // 绝对路径
283
+ uuid: string; // 资源的唯一 ID
284
+ importer: AssetHandlerType; // 使用的导入器名字
285
+ imported: boolean; // 是否结束导入过程
286
+ invalid: boolean; // 是否导入成功
287
+ type: IAssetType; // 类型
288
+ isDirectory: boolean; // 是否是文件夹
289
+ library: { [key: string]: string }; // 导入资源的 map
290
+
291
+ // dataKeys 作用范围
292
+ isBundle?: boolean; // 是否是文件夹
293
+ displayName?: string; // 资源用于显示的名字
294
+ readonly?: boolean; // 是否只读
295
+ visible?: boolean; // 是否显示
296
+ subAssets?: { [key: string]: IAssetInfo }; // 子资源 map
297
+ // 虚拟资源可以实例化成实体的话,会带上这个扩展名
298
+ instantiation?: string;
299
+ redirect?: IRedirectInfo; // 跳转指向资源
300
+ meta?: IAssetMeta,
301
+ parent?: {
302
+ source: string;
303
+ library: { [key: string]: string };
304
+ uuid: string;
305
+ };
306
+ extends?: string[]; // 资源的继承链信息
307
+ mtime?: number; // 资源文件的 mtime
308
+ depends?: string[]; // 依赖的资源 uuid 信息
309
+ dependeds?: string[]; // 被依赖的资源 uuid 信息
310
+ temp?: string; // 资源临时文件目录
311
+ }
312
+
313
+ export interface IAssetMeta<T extends ISupportCreateType | 'unknown' = 'unknown'> {
314
+ ver: string;
315
+ importer: AssetHandlerType;
316
+ imported: boolean;
317
+ uuid: string;
318
+ files: string[];
319
+ subMetas: {
320
+ [index: string]: IAssetMeta<'unknown'>;
321
+ };
322
+ userData: AssetUserDataMap[T extends keyof AssetUserDataMap ? T : 'unknown'];
323
+ displayName?: string;
324
+ id?: string;
325
+ name?: string;
326
+ }
327
+
328
+ export interface AssetUserDataMap {
329
+ 'animation-clip': AnimationClipAssetUserData;
330
+ 'auto-atlas': AutoAtlasAssetUserData;
331
+ 'label-atlas': LabelAtlasAssetUserData;
332
+ 'render-texture': RenderTextureAssetUserData;
333
+ 'directory': DirectoryAssetUserData;
334
+ 'texture-cube': TextureCubeAssetUserData;
335
+ 'erp-texture-cube': TextureCubeAssetUserData;
336
+ 'image': ImageAssetUserData;
337
+ 'sprite-frame': SpriteFrameAssetUserData;
338
+ 'texture': Texture2DAssetUserData;
339
+ 'spine-data': SpineAssetUserData;
340
+ 'javascript': JavaScriptAssetUserData;
341
+ 'gltf-animation': GltfAnimationAssetUserData;
342
+ 'particle': ParticleAssetUserData;
343
+ 'json': JsonAssetUserData;
344
+ 'prefab': PrefabAssetUserData;
345
+ 'scene': PrefabAssetUserData;
346
+ 'effect': EffectAssetUserData;
347
+ 'audio-clip': AudioClipAssetUserData;
348
+ 'bitmap-font': BitmapFontAssetUserData;
349
+ 'gltf-skeleton': GltfSkeletonAssetUserData;
350
+ 'gltf-embeded-image': GltfEmbededImageAssetUserData;
351
+ 'gltf-mesh': IVirtualAssetUserData;
352
+ 'gltf-material': IVirtualAssetUserData;
353
+ 'gltf-scene': IVirtualAssetUserData;
354
+ 'gltf': GlTFUserData;
355
+ 'fbx': GlTFUserData;
356
+ 'sprite-atlas': SpriteAtlasAssetUserData;
357
+ 'rt-sprite-frame': RtSpriteFrameAssetUserData;
358
+ 'sign-image': ImageAssetUserData;
359
+ 'alpha-image': ImageAssetUserData;
360
+
361
+ // 无特定 userData 的资源类型(仅保留 unknown)
362
+ 'unknown': any;
363
+ }
364
+
365
+ /** 渲染纹理精灵帧的 userData */
366
+ export interface RtSpriteFrameAssetUserData {
367
+ /** 图片 UUID 或数据库 URI */
368
+ imageUuidOrDatabaseUri: string;
369
+ /** 宽度 */
370
+ width?: number;
371
+ /** 高度 */
372
+ height?: number;
373
+ }
374
+
375
+ /** 精灵图集资源的 userData */
376
+ export interface SpriteAtlasAssetUserData {
377
+ /** 图集纹理名称 */
378
+ atlasTextureName: string;
379
+ /** 纹理 UUID */
380
+ textureUuid: string | null;
381
+ /** 精灵帧列表 */
382
+ frames: SpriteFrameAssetUserData[];
383
+ /** 资源 UUID */
384
+ uuid: string;
385
+ /** 格式版本 */
386
+ format: number;
387
+ }
388
+
389
+ export interface SpriteFrameAssetUserData extends SpriteFrameBaseAssetUserData {
390
+ isUuid?: boolean;
391
+ imageUuidOrDatabaseUri: string;
392
+ }
393
+
394
+ export interface SpriteFrameBaseAssetUserData {
395
+ trimType?: string;
396
+ trimThreshold: number;
397
+ rotated: boolean;
398
+ offsetX: number;
399
+ offsetY: number;
400
+ trimX: number;
401
+ trimY: number;
402
+ width: number;
403
+ height: number;
404
+ rawWidth: number;
405
+ rawHeight: number;
406
+ borderTop: number;
407
+ borderBottom: number;
408
+ borderLeft: number;
409
+ borderRight: number;
410
+ packable?: boolean;
411
+ pixelsToUnit: number;
412
+ pivotX: number;
413
+ pivotY: number;
414
+ meshType: number;
415
+ vertices: SpriteFrameVertices;
416
+ }
417
+
418
+ export interface SpriteFrameVertices {
419
+ rawPosition: number[];
420
+ indexes: number[];
421
+ uv: number[];
422
+ nuv: number[];
423
+ triangles?: number[];
424
+ minPos: number[];
425
+ maxPos: number[];
426
+ }
427
+
428
+ export interface GlTFUserData {
429
+ assetFinder?: SerializedAssetFinder;
430
+
431
+ imageMetas: ImageMeta[];
432
+
433
+ // Normal import settings
434
+ // @default required
435
+ normals?: NormalImportSetting;
436
+
437
+ // Tangent import settings;
438
+ // @default required
439
+ tangents?: TangentImportSetting;
440
+
441
+ /**
442
+ * Controls how to import morph normals.
443
+ * @default Exclude.
444
+ */
445
+ morphNormals?: NormalImportSetting.exclude | NormalImportSetting.optional;
446
+
447
+ // Whether to extract material assets out of embedded (sub)assets,
448
+ // so that the assets become editable.
449
+ // @default false
450
+ dumpMaterials?: boolean;
451
+
452
+ // only for chat avatar
453
+ redirectMaterialMap?: Record<string, string>;
454
+
455
+ // The directory to dump the materials.
456
+ // Default to a direct sub-folder prefixed with 'Materials_' under current path.
457
+ materialDumpDir?: string;
458
+
459
+ /**
460
+ * Whether to use vertex colors(if valid) in material.
461
+ * @default false
462
+ */
463
+ useVertexColors?: boolean;
464
+
465
+ /**
466
+ * Whether to enable depth-write if the material specify the `BLEND` mode.
467
+ * See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#alpha-coverage
468
+ * @default false
469
+ */
470
+ depthWriteInAlphaModeBlend?: boolean;
471
+
472
+ // @default true
473
+ skipValidation?: boolean;
474
+
475
+ /**
476
+ * 整个数组由导入器创建。`name` 和 `duration` 也都由导入器写入修改,外部不允许修改。
477
+ * `splits` 是允许用户配置的。
478
+ */
479
+ animationImportSettings?: AnimationImportSetting[];
480
+
481
+ /**
482
+ * 是否将所有动画挂载到生成的预制体上。
483
+ * @default false
484
+ */
485
+ mountAllAnimationsOnPrefab?: boolean;
486
+
487
+ /**
488
+ * 使用旧的 FBX 导入器。(在非 FBX 导入器上是 `undefined`)
489
+ */
490
+ legacyFbxImporter?: boolean;
491
+
492
+ /**
493
+ * 禁用 Mesh 分割,默认勾选
494
+ */
495
+ disableMeshSplit?: boolean;
496
+
497
+ /**
498
+ * 允许数据访问。
499
+ */
500
+ allowMeshDataAccess?: boolean;
501
+
502
+ /**
503
+ * 是否添加填充顶点色
504
+ * @default false
505
+ */
506
+ addVertexColor?: boolean;
507
+
508
+ /**
509
+ * 若开启并且模型场景顶部仅有一个节点,那么以该节点作为根节点转换为 Prefab。
510
+ * 否则,以场景为根节点转换为 Prefab。见 cocos/cocos-engine#11858 。
511
+ */
512
+ promoteSingleRootNode?: boolean;
513
+ /*
514
+ * 若开启则自动生成 Lightmap UV,并将 UV 写入第二个通道(若第二个通道有 UV , 则该 UV 会被覆盖)
515
+ * 否则,使用默认 UV 。
516
+ */
517
+ generateLightmapUVNode?: boolean;
518
+
519
+ /**
520
+ * 关于 FBX 的配置。仅当 `legacyFbxImporter === false` 时有效。
521
+ */
522
+ fbx?: IFbxSetting;
523
+
524
+ /**
525
+ * 减面配置
526
+ */
527
+ meshOptimizer?: MeshOptimizerOption;
528
+
529
+ /**
530
+ * mesh 优化配置
531
+ */
532
+ meshOptimize?: MeshOptimizeOptions;
533
+
534
+ /**
535
+ * 是否开启 mesh 减面
536
+ */
537
+ meshSimplify?: MeshSimplifyOptions;
538
+
539
+ /**
540
+ * MeshCluster Options
541
+ */
542
+ meshCluster?: MeshClusterOptions;
543
+
544
+ /**
545
+ * Mesh compression options
546
+ */
547
+ meshCompress?: MeshCompressOptions;
548
+
549
+ lods?: {
550
+ // 是否开启 LODS
551
+ enable: boolean;
552
+ // fbx 是否自带 LOD
553
+ hasBuiltinLOD: boolean;
554
+ // fbx 各层级 lod 的配置
555
+ options: LODsOption[];
556
+ };
557
+ }
558
+
559
+ export interface LODsOption {
560
+ // 屏占比
561
+ screenRatio: number;
562
+ // 和 lod0 的减面比
563
+ faceCount: number;
564
+ }
565
+
566
+ export interface MeshCompressOptions {
567
+ enable: boolean;
568
+ encode?: boolean;
569
+ compress?: boolean;
570
+ quantize?: boolean;
571
+ }
572
+
573
+ export interface MeshClusterOptions {
574
+ enable: boolean;
575
+ coneCluster?: boolean;
576
+ }
577
+
578
+ export interface MeshSimplifyOptions {
579
+ enable: boolean;
580
+ targetRatio?: number;
581
+ autoErrorRate?: boolean;
582
+ errorRate?: number;
583
+ lockBoundary?: boolean;
584
+ }
585
+
586
+ export interface MeshOptimizeOptions {
587
+ enable: boolean;
588
+ vertexCache?: boolean;
589
+ vertexFetch?: boolean;
590
+ overdraw?: boolean;
591
+ }
592
+
593
+ export interface MeshOptimizerOption {
594
+ // 是否启用此功能
595
+ enable: boolean;
596
+ // 减面算法,默认 simplify
597
+ algorithm?: 'gltfpack' | 'simplify';
598
+ simplifyOptions?: SimplifyOptions;
599
+ // 已废弃,仅做简单记录
600
+ gltfpackOptions?: GltfpackOptions;
601
+ }
602
+
603
+ export type GltfpackOptions = Record<string, any>;
604
+
605
+ export interface SimplifyOptions {
606
+ // 压缩比例
607
+ targetRatio?: number;
608
+ // 防止破面
609
+ enableSmartLink?: boolean;
610
+ // 误差距离
611
+ agressiveness?: number;
612
+ // 计算迭代次数
613
+ maxIterationCount?: number;
614
+ }
615
+
616
+ export interface IFbxSetting {
617
+ /**
618
+ * https://github.com/cocos-creator/FBX-glTF-conv/pull/26
619
+ */
620
+ unitConversion?: 'geometry-level' | 'hierarchy-level' | 'disabled';
621
+
622
+ /**
623
+ * 动画烘焙速率。单位为 FPS。
624
+ * 一般来说有以下几种 FPS 选项。
625
+ * - NTSC video 30/60
626
+ * - PAL video 25
627
+ * - Film 24
628
+ * 见 https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2020/ENU/3DSMax-Reference/files/GUID-92B75FD6-C112-44D6-AB89-DB50D11AE0DE-htm.html 。
629
+ * 为了以后的拓展性,我们目前仅支持用户从这几种选项中选择。
630
+ * @default 24
631
+ */
632
+ animationBakeRate?: 0 | 24 | 25 | 30 | 60;
633
+
634
+ /**
635
+ * 在导出动画时,是否优先使用 FBX 内记录的时间范围。
636
+ * @default true
637
+ */
638
+ preferLocalTimeSpan?: boolean;
639
+
640
+ /**
641
+ * 是否为导入的材质匹配DCC的光照模型.
642
+ * 在导入时,若此字段为 `undefined` 时,该字段将被初始化为当前配置的"是否开启智能材质转换".
643
+ */
644
+ smartMaterialEnabled?: boolean;
645
+
646
+ /**
647
+ * 匹配 DCC 原始模型名称。
648
+ */
649
+ matchMeshNames?: boolean;
650
+ }
651
+
652
+ export interface AnimationImportSetting {
653
+ /**
654
+ * glTf 中原始动画资源的名称。
655
+ */
656
+ name: string;
657
+
658
+ /**
659
+ * 原始动画的长度,单位为秒。
660
+ */
661
+ duration: number;
662
+
663
+ /**
664
+ * 用户查看、切割原始动画时的 FPS 设定。
665
+ */
666
+ fps: number;
667
+
668
+ /**
669
+ * 对原始动画的划分,由用户配置。
670
+ * 若此资源存在,所有划分出的动画成为 glTf 资源下的独立动画并将被导出;
671
+ * 否则,直接导入原始动画资源。
672
+ */
673
+ splits: Array<{
674
+ /**
675
+ * 以前的 ID。如果存在,优先使用这个 ID 来创建子资源,以防止改名后 UUID 变化。
676
+ */
677
+ previousId?: string;
678
+
679
+ /**
680
+ * 划分出的动画的名称。
681
+ */
682
+ name: string;
683
+
684
+ /**
685
+ * 划分的起始时刻,单位为秒。
686
+ */
687
+ from: number;
688
+
689
+ /**
690
+ * 划分的终止时刻,单位为秒。
691
+ */
692
+ to: number;
693
+
694
+ /**
695
+ * 用户查看划分出的子动画时的 FPS 设定。
696
+ */
697
+ fps?: number;
698
+
699
+ /**
700
+ * 速度。
701
+ */
702
+ speed?: number;
703
+
704
+ /**
705
+ * 动画循环模式。
706
+ */
707
+ wrapMode?: number;
708
+
709
+ /**
710
+ * 额外的动画辅助曲线信息。
711
+ */
712
+ auxiliaryCurves?: Record<
713
+ string,
714
+ {
715
+ /**
716
+ * 序列化后的曲线。
717
+ */
718
+ curve: unknown;
719
+ }
720
+ >;
721
+
722
+ /**
723
+ * 加性动画导入设置。
724
+ */
725
+ additive?: {
726
+ /**
727
+ * 是否将动画导入为加性动画。
728
+ */
729
+ enabled: boolean;
730
+
731
+ /**
732
+ * 参考动画。
733
+ * 若设置,将参考该动画第 0 帧的姿势计算加性动画;
734
+ * 否则,则将参考第动画本身第 0 帧的姿势进行计算。
735
+ */
736
+ refClip?: string;
737
+ };
738
+ }>;
739
+ }
740
+
741
+ export enum TangentImportSetting {
742
+ /**
743
+ * 不在导出的网格中包含正切信息。
744
+ */
745
+ exclude = 0,
746
+ /**
747
+ * 如果模型文件中包含正切信息则导出正切,否则不导出正切。
748
+ */
749
+ optional = 1,
750
+ /**
751
+ * 如果模型文件中包含正切信息则导出正切,否则若纹理坐标存在则重新计算并导出正切。
752
+ */
753
+ require = 2,
754
+ /**
755
+ * 不管模型文件中是否包含正切信息,直接重新计算并导出正切。
756
+ */
757
+ recalculate = 3
758
+ }
759
+
760
+ export enum NormalImportSetting {
761
+ /**
762
+ * 如果模型文件中包含法线信息则导出法线,否则不导出法线。
763
+ */
764
+ optional = 0,
765
+ /**
766
+ * 不在导出的网格中包含法线信息。
767
+ */
768
+ exclude = 1,
769
+ /**
770
+ * 如果模型文件中包含法线信息则导出法线,否则重新计算并导出法线。
771
+ */
772
+ require = 2,
773
+ /**
774
+ * 不管模型文件中是否包含法线信息,直接重新计算并导出法线。
775
+ */
776
+ recalculate = 3
777
+ }
778
+
779
+ export interface ImageMeta {
780
+ /**
781
+ * 图片名字。
782
+ */
783
+ name?: string;
784
+
785
+ /**
786
+ * 模型文件中该图片的 URI,可能是以下形式:
787
+ * - Database URL,这种路径的图片存在项目目录中;
788
+ * - uuid URI,这种路径的图片已经作为子资源导入,路径代表子资源的 uuid。
789
+ * 如果未定义,表示此图片未指定源或指定的源无法解析。
790
+ */
791
+ uri?: string;
792
+
793
+ /**
794
+ * 用户设置的图片对象。
795
+ * 3.8.0 以前使用路径,3.8.0 之后使用 UUID。
796
+ */
797
+ remap?: string;
798
+ }
799
+
800
+ export interface SerializedAssetFinder {
801
+ meshes?: Array<string | null>;
802
+ animations?: Array<string | null>;
803
+ skeletons?: Array<string | null>;
804
+ textures?: Array<string | null>;
805
+ materials?: Array<string | null>;
806
+ scenes?: Array<string | null>;
807
+ }
808
+
809
+ /** glTF 虚拟子资源的通用 userData */
810
+ export interface IVirtualAssetUserData {
811
+ /** 在 glTF 文件中的索引 */
812
+ gltfIndex?: number;
813
+ /** mesh 资源的面数 */
814
+ triangleCount?: number;
815
+ /** mesh 所在 lod 层级 */
816
+ lodLevel?: number;
817
+ /** 根据 lod 配置自动生成 */
818
+ lodOptions?: {
819
+ /** 自动生成的 mesh 占原 mesh 的百分比 */
820
+ faceCount: number;
821
+ };
822
+ [key: string]: any;
823
+ }
824
+
825
+ /** glTF 嵌入图片子资源的 userData */
826
+ export interface GltfEmbededImageAssetUserData extends IVirtualAssetUserData {
827
+ /** 是否修复 Alpha 透明度瑕疵 */
828
+ fixAlphaTransparencyArtifacts?: boolean;
829
+ }
830
+
831
+ /** glTF Skeleton 子资源的 userData */
832
+ export interface GltfSkeletonAssetUserData extends IVirtualAssetUserData {
833
+ /** 骨骼数量 */
834
+ jointsLength?: number;
835
+ }
836
+
837
+ /** 位图字体资源的 userData */
838
+ export interface BitmapFontAssetUserData {
839
+ /** 字体配置 */
840
+ _fntConfig: any;
841
+ /** 字体大小 */
842
+ fontSize: number;
843
+ /** 纹理 UUID */
844
+ textureUuid: string;
845
+ }
846
+
847
+ /** 音频资源的 userData */
848
+ export interface AudioClipAssetUserData {
849
+ /** 下载模式:0-Web Audio, 1-DOM Audio */
850
+ downloadMode: number;
851
+ }
852
+
853
+ /** Effect 着色器资源的 userData */
854
+ export interface EffectAssetUserData {
855
+ /** 预编译组合 */
856
+ combinations?: any;
857
+ /** 编辑器相关数据 */
858
+ editor?: any;
859
+ }
860
+
861
+ /** 场景/预制体资源的 userData */
862
+ export interface PrefabAssetUserData {
863
+ /** 是否为持久节点 */
864
+ persistent?: boolean;
865
+ /** 同步节点名称 */
866
+ syncNodeName?: string;
867
+ }
868
+
869
+ /** JSON 资源的 userData */
870
+ export interface JsonAssetUserData {
871
+ /** 是否启用 JSON5 解析 */
872
+ json5?: boolean;
873
+ }
874
+
875
+ /** 粒子资源的 userData */
876
+ export interface ParticleAssetUserData {
877
+ totalParticles: number;
878
+ life: number;
879
+ lifeVar: number;
880
+ emissionRate: number;
881
+ duration: number;
882
+ srcBlendFactor: number;
883
+ dstBlendFactor: number;
884
+ startColor: any;
885
+ startColorVar: any;
886
+ endColor: any;
887
+ endColorVar: any;
888
+ startSize: number;
889
+ startSizeVar: number;
890
+ endSize: number;
891
+ endSizeVar: number;
892
+ positionType: number;
893
+ sourcePos: any;
894
+ posVar: any;
895
+ angle: number;
896
+ angleVar: number;
897
+ startSpin: number;
898
+ startSpinVar: number;
899
+ endSpin: number;
900
+ endSpinVar: number;
901
+ emitterMode: number;
902
+ gravity: any;
903
+ speed: number;
904
+ speedVar: number;
905
+ radialAccel: number;
906
+ radialAccelVar: number;
907
+ tangentialAccel: number;
908
+ tangentialAccelVar: number;
909
+ rotationIsDir: boolean;
910
+ startRadius: number;
911
+ startRadiusVar: number;
912
+ endRadius: number;
913
+ endRadiusVar: number;
914
+ rotatePerS: number;
915
+ rotatePerSVar: number;
916
+ spriteFrameUuid: string;
917
+ }
918
+
919
+ /** glTF 动画资源的 userData */
920
+ export interface GltfAnimationAssetUserData {
921
+ gltfIndex: number;
922
+ events: Array<{
923
+ frame: number;
924
+ func: string;
925
+ params: string[];
926
+ }>;
927
+ editorExtras?: unknown;
928
+ embeddedPlayers?: Array<{
929
+ editorExtras?: unknown;
930
+ begin: number;
931
+ end: number;
932
+ reconciledSpeed: boolean;
933
+ playable:
934
+ | {
935
+ type: 'animation-clip';
936
+ path: string;
937
+ clip: string;
938
+ }
939
+ | {
940
+ type: 'particle-system';
941
+ path: string;
942
+ };
943
+ }>;
944
+ auxiliaryCurves?: Record<string, { curve: any }>;
945
+ wrapMode: number;
946
+ speed?: number;
947
+ sample?: number;
948
+ span?: {
949
+ from: number;
950
+ to: number;
951
+ };
952
+ additive?: any;
953
+ }
954
+
955
+ /** JavaScript 资源的 userData */
956
+ export type JavaScriptAssetUserData = ScriptModuleUserData | PluginScriptUserData;
957
+
958
+ /** JavaScript 插件脚本的 userData */
959
+ export interface PluginScriptUserData {
960
+ isPlugin: true;
961
+ /** 界面没有开放给用户。默认开启 */
962
+ experimentalHideCommonJs?: boolean;
963
+ /** 界面没有开放给用户。默认开启 */
964
+ experimentalHideAmd?: boolean;
965
+ /** 仅当 executionScope 为 enclosed 时有效。指定了要模拟的全局变量 */
966
+ simulateGlobals?: string[];
967
+ /** 执行作用域 */
968
+ executionScope?: 'enclosed' | 'global';
969
+ /** 插件执行时机 */
970
+ loadPluginInEditor?: boolean;
971
+ loadPluginInWeb?: boolean;
972
+ loadPluginInMiniGame?: boolean;
973
+ loadPluginInNative?: boolean;
974
+ }
975
+
976
+ /** JavaScript 脚本模块的 userData */
977
+ export interface ScriptModuleUserData {
978
+ isPlugin: false;
979
+ }
980
+
981
+ /** Spine 资源的 userData */
982
+ export interface SpineAssetUserData {
983
+ /** 图集资源的 UUID */
984
+ atlasUuid: string;
985
+ }
986
+
987
+ export interface Texture2DAssetUserData extends TextureBaseAssetUserData {
988
+ isUuid?: boolean;
989
+ imageUuidOrDatabaseUri?: string;
990
+ }
991
+
992
+ export interface TextureBaseAssetUserData {
993
+ wrapModeS: WrapMode;
994
+ wrapModeT: WrapMode;
995
+ minfilter: Filter;
996
+ magfilter: Filter;
997
+ mipfilter: Filter;
998
+ anisotropy: number;
999
+ }
1000
+
1001
+ export type Filter = 'none' | 'nearest' | 'linear';
1002
+
1003
+ export type WrapMode = 'repeat' | 'clamp-to-edge' | 'mirrored-repeat';
1004
+
1005
+ /** 图片资源的 userData */
1006
+ export interface ImageAssetUserData {
1007
+ /** 图片类型 */
1008
+ type: ImageImportType;
1009
+ /** 垂直翻转 */
1010
+ flipVertical?: boolean;
1011
+ /** 消除透明伪影 */
1012
+ fixAlphaTransparencyArtifacts?: boolean;
1013
+ /** 是否为 RGBE */
1014
+ isRGBE?: boolean;
1015
+ /** 这个图片是不是拥有 alpha 通道 */
1016
+ hasAlpha?: boolean;
1017
+ /** 重定向的 uuid */
1018
+ redirect?: string;
1019
+ visible?: boolean;
1020
+ /** 是否翻转绿通道 */
1021
+ flipGreenChannel?: boolean;
1022
+
1023
+ /**
1024
+ * 部分资源导入后可能产生多张图像资源
1025
+ */
1026
+ sign?: string;
1027
+ alpha?: string;
1028
+ }
1029
+
1030
+ export type ImageImportType = 'raw' | 'texture' | 'normal map' | 'sprite-frame' | 'texture cube';
1031
+
1032
+ export interface TextureCubeAssetUserData extends TextureBaseAssetUserData {
1033
+ imageDatabaseUri?: string;
1034
+ isRGBE: boolean;
1035
+
1036
+ mipBakeMode: number;
1037
+ /**
1038
+ * `0` 意味着默认。见 https://github.com/cocos-creator/3d-tasks/issues/2253
1039
+ */
1040
+ faceSize?: number;
1041
+ // 符号资源 uuid
1042
+ sign?: string;
1043
+
1044
+ // 六个面的 UUID
1045
+ front?: string;
1046
+ back?: string;
1047
+ left?: string;
1048
+ right?: string;
1049
+ top?: string;
1050
+ bottom?: string;
1051
+ }
1052
+
1053
+ /** 文件夹资源的 userData */
1054
+ export interface DirectoryAssetUserData {
1055
+ /** 是否是资源包 */
1056
+ isBundle?: boolean;
1057
+ /** 资源包配置 ID */
1058
+ bundleConfigID?: string;
1059
+ /** 资源包名称 */
1060
+ bundleName?: string;
1061
+ /** 优先级 */
1062
+ priority?: number;
1063
+ }
1064
+
1065
+ /** 渲染纹理资源的 userData */
1066
+ export interface RenderTextureAssetUserData extends TextureBaseAssetUserData {
1067
+ width: number;
1068
+ height: number;
1069
+ }
1070
+
1071
+ /** 标签图集资源的 userData */
1072
+ export interface LabelAtlasAssetUserData {
1073
+ itemWidth: number;
1074
+ itemHeight: number;
1075
+ startChar: string;
1076
+ fontSize: number;
1077
+ spriteFrameUuid: string;
1078
+ _fntConfig: FntData;
1079
+ }
1080
+
1081
+ export interface FntData {
1082
+ commonHeight?: number;
1083
+ fontSize?: number;
1084
+ atlasName?: string;
1085
+ fontDefDictionary?: FontDefDictionary;
1086
+ kerningDict?: KerningDict;
1087
+ }
1088
+
1089
+ export interface KerningDict {
1090
+ [key: number]: number;
1091
+ }
1092
+
1093
+ export interface FontDefDictionary {
1094
+ [charId: number]: FontDef;
1095
+ }
1096
+
1097
+ export interface FontDef {
1098
+ rect: {
1099
+ x: number;
1100
+ y: number;
1101
+ width: number;
1102
+ height: number;
1103
+ };
1104
+ xOffset: number;
1105
+ yOffset: number;
1106
+ xAdvance: number;
1107
+ }
1108
+
1109
+ /** 自动图集资源的 userData */
1110
+ export interface AutoAtlasAssetUserData {
1111
+ compressed: boolean;
1112
+ dest: any;
1113
+ /** 打包图像的尺寸 */
1114
+ maxWidth: number;
1115
+ maxHeight: number;
1116
+ /** 图像的边距 */
1117
+ padding: number;
1118
+ allowRotation: boolean;
1119
+ forceSquared: boolean;
1120
+ powerOfTwo: boolean;
1121
+ algorithm: string;
1122
+ format: string;
1123
+ quality: number;
1124
+ contourBleed: boolean;
1125
+ paddingBleed: boolean;
1126
+ filterUnused: boolean;
1127
+ removeTextureInBundle: boolean;
1128
+ removeImageInBundle: boolean;
1129
+ removeSpriteAtlasInBundle: boolean;
1130
+ platformSettings: any;
1131
+ textureSetting: any;
1132
+ }
1133
+
1134
+ /// <reference types="node" />
1135
+
1136
+ /** 动画剪辑资源的 userData */
1137
+ export interface AnimationClipAssetUserData {
1138
+ /** 动画名称 */
1139
+ name: string;
1140
+ }
1141
+
1142
+ /** Asset handler types include built-in values and extension-registered importer names. */
1143
+ export type AssetHandlerType =
1144
+ | typeof ASSET_HANDLER_TYPES[number]
1145
+ | (string & {});
1146
+
1147
+ /** 所有资源处理器类型的常量数组(用于 Zod enum 和 TypeScript type) */
1148
+ export const ASSET_HANDLER_TYPES: readonly ["directory", "unknown", "text", "json", "spine-data", "dragonbones", "dragonbones-atlas", "terrain", "javascript", "typescript", "scene", "prefab", "sprite-frame", "tiled-map", "buffer", "image", "sign-image", "alpha-image", "texture", "texture-cube", "erp-texture-cube", "render-texture", "texture-cube-face", "rt-sprite-frame", "gltf", "gltf-mesh", "gltf-animation", "gltf-skeleton", "gltf-material", "gltf-scene", "gltf-embeded-image", "fbx", "material", "physics-material", "effect", "effect-header", "audio-clip", "animation-clip", "animation-graph", "animation-graph-variant", "animation-mask", "ttf-font", "bitmap-font", "particle", "sprite-atlas", "auto-atlas", "label-atlas", "render-pipeline", "render-stage", "render-flow", "instantiation-material", "instantiation-mesh", "instantiation-skeleton", "instantiation-animation", "video-clip", "*", "database"];
1149
+
1150
+ /** 支持创建的资源类型(从常量数组派生) */
1151
+ export type ISupportCreateType = typeof SUPPORT_CREATE_TYPES[number];
1152
+
1153
+ /** 支持创建的资源类型常量数组(用于 Zod enum 和 TypeScript type) */
1154
+ export const SUPPORT_CREATE_TYPES: readonly ["animation-clip", "typescript", "auto-atlas", "effect", "scene", "prefab", "material", "texture-cube", "terrain", "physics-material", "label-atlas", "render-texture", "directory", "effect-header"];
1155
+
1156
+ export interface IRedirectInfo {
1157
+ // 跳转资源的类型
1158
+ type: string;
1159
+ // 跳转资源的 uuid
1160
+ uuid: string;
1161
+ }
1162
+
1163
+ export type IAssetType =
1164
+ | ISupportCreateCCType
1165
+ | 'cc.Asset' // 基础资源类型(instantiation-asset)
1166
+ | 'cce.Database' // 数据库资源
1167
+ | 'cce.EffectHeader' // 着色器头文件
1168
+ | 'cc.VideoClip' // 视频剪辑
1169
+ | 'cc.TiledMapAsset' // 瓦片地图
1170
+ | 'cc.TTFFont' // TTF 字体
1171
+ | 'cc.Texture2D' // 2D 纹理
1172
+ | 'cc.SpriteFrame' // 精灵帧(sprite-frame、rt-sprite-frame)
1173
+ | 'cc.ImageAsset' // 图片资源(image、gltf/image、image/alpha、image/sign、texture-cube-face)
1174
+ | 'cc.TextAsset' // 文本资源
1175
+ | 'cc.JsonAsset' // JSON 资源
1176
+ | 'cc.AudioClip' // 音频剪辑
1177
+ | 'cc.BitmapFont' // 位图字体
1178
+ | 'cc.BufferAsset' // 缓冲区资源
1179
+ | 'cc.ParticleAsset' // 粒子资源
1180
+ | 'cc.RenderPipeline' // 渲染管线
1181
+ | 'cc.Skeleton' // 骨骼(gltf/skeleton、instantiation-asset/skeleton)
1182
+ | 'cc.Mesh' // 网格(gltf/mesh、instantiation-asset/mesh)
1183
+ | 'sp.SkeletonData' // Spine 骨骼数据
1184
+ | 'dragonBones.DragonBonesAsset' // DragonBones 资源
1185
+ | 'dragonBones.DragonBonesAtlasAsset' // DragonBones 图集资源
1186
+ | 'RenderStage' // 渲染阶段
1187
+ | 'RenderFlow';
1188
+
1189
+ export type ISupportCreateCCType =
1190
+ | 'cc.AnimationClip' // 动画剪辑
1191
+ | 'cc.Script' // 脚本(TypeScript/JavaScript)
1192
+ | 'cc.SpriteAtlas' // 精灵图集(自动图集)
1193
+ | 'cc.EffectAsset' // 着色器效果
1194
+ | 'cc.SceneAsset' // 场景
1195
+ | 'cc.Prefab' // 预制体
1196
+ | 'cc.Material' // 材质
1197
+ | 'cc.TextureCube' // 立方体贴图
1198
+ | 'cc.TerrainAsset' // 地形
1199
+ | 'cc.PhysicsMaterial' // 物理材质
1200
+ | 'cc.LabelAtlas' // 标签图集
1201
+ | 'cc.RenderTexture' // 渲染纹理
1202
+ | 'cc.animation.AnimationGraph' // 动画图
1203
+ | 'cc.AnimationMask' // 动画遮罩
1204
+ | 'cc.animation.AnimationGraphVariant';
1205
+
1206
+ export interface QueryAssetsOption {
1207
+ ccType?: string | string[], // 'cc.ImageAsset' 这类,多个用数组
1208
+ isBundle?: boolean, // 筛选 asset bundle 信息,搜索子包只能与 pattern 选项共存
1209
+ importer?: string | string[], // 导入名称,多个用数组
1210
+ pattern?: string, // 路径匹配,globs 格式
1211
+ extname?: string | string[], // 扩展名匹配,多个用数组
1212
+
1213
+ // 筛选一些符合 userData 配置的资源
1214
+ userData?: Record<string, boolean | string | number>;
1215
+
1216
+ /**
1217
+ * @deprecated use ccType instead
1218
+ */
1219
+ type?: string;
1220
+ }
1221
+ }
1222
+
1223
+
1224
+
1225
+
1226
+ export interface Thenable<T> extends Promise<T> { }
1227
+
1228
+ /**
1229
+ * 表示一个可被监听的事件。
1230
+ * @template T 事件回调参数类型
1231
+ */
1232
+ export interface Event<T> {
1233
+ (listener: (e: T) => void, thisArgs?: any): Disposable;
1234
+ }
1235
+
1236
+ /**
1237
+ * 表示一个可被释放的资源。
1238
+ */
1239
+ export interface Disposable {
1240
+ dispose(): void;
1241
+ }
1242
+
1243
+ // ==================== Engine API ====================
1244
+
1245
+ /**
1246
+ * 引擎配置 API 命名空间。
1247
+ */
1248
+ export namespace engine {
1249
+ /**
1250
+ * 获取引擎基本信息。
1251
+ * @returns 引擎信息;未加载时返回 `undefined`
1252
+ */
1253
+ export function getInfo(): Thenable<EngineInfo | undefined>;
1254
+
1255
+ /**
1256
+ * 获取引擎配置映射表。
1257
+ * @returns 引擎配置;未加载时返回 `undefined`
1258
+ */
1259
+ export function getConfig(): Thenable<EngineConfig | undefined>;
1260
+
1261
+ /**
1262
+ * 获取引擎模块渲染配置(已本地化)。
1263
+ * @returns 模块渲染配置;未加载时返回 `undefined`
1264
+ */
1265
+ export function getRenderConfig(): Thenable<ModuleRenderConfig | undefined>;
1266
+
1267
+ /** 引擎基本信息类型 */
1268
+ export type EngineInfo = _cli.EngineInfo & {
1269
+ /** 引擎来源类型:'official'(官方引擎)或 'custom'(自定义引擎路径) */
1270
+ type: 'official' | 'custom';
1271
+ };
1272
+ /** 引擎配置类型 */
1273
+ export type EngineConfig = _cli.IEngineConfig;
1274
+ /** 引擎模块渲染配置类型 */
1275
+ export type ModuleRenderConfig = _cli.ModuleRenderConfig;
1276
+ }
1277
+
1278
+ // ==================== Assets API ====================
1279
+
1280
+ /**
1281
+ * 资源管理 API 命名空间。
1282
+ */
1283
+ export namespace assets {
1284
+ /**
1285
+ * 根据查询条件批量获取资源信息。
1286
+ * 支持按资源类型、导入器、路径模式、扩展名等条件筛选。
1287
+ *
1288
+ * @param options - 可选的查询选项:
1289
+ * - `ccType` — 资源类型,如 `'cc.ImageAsset'`,可为单个或数组
1290
+ * - `isBundle` — 是否筛选 Asset Bundle
1291
+ * - `importer` — 导入器名称,可为单个或数组
1292
+ * - `pattern` — 路径匹配模式(支持 globs 格式)
1293
+ * - `extname` — 扩展名匹配,可为单个或数组
1294
+ * @param dataKeys - 可选,需要返回的 `IAssetInfo` 可选字段名列表。
1295
+ * 如 `['meta', 'subAssets', 'depends']`。不传则返回默认字段(`subAssets` 和 `displayName`)。
1296
+ * @returns 符合条件的资源信息列表
1297
+ */
1298
+ export function queryAssetInfos(options?: QueryAssetsOption, dataKeys?: AssetInfoDataKey[]): Thenable<IAssetInfo[]>;
1299
+
1300
+ /**
1301
+ * 当有新资源被添加到项目时触发。
1302
+ */
1303
+ export const onAssetAdd: Event<IAssetInfo>;
1304
+
1305
+ /**
1306
+ * 当项目中的资源被修改时触发。
1307
+ */
1308
+ export const onAssetChange: Event<IAssetInfo>;
1309
+
1310
+ /**
1311
+ * 当项目中的资源被删除时触发。
1312
+ */
1313
+ export const onAssetDelete: Event<IAssetInfo>;
1314
+
1315
+ /** 资源查询选项类型 */
1316
+ export type QueryAssetsOption = _cli.QueryAssetsOption;
1317
+ /** 资源信息类型 */
1318
+ export type IAssetInfo = _cli.IAssetInfo;
1319
+ /** 资源信息可选字段名类型 */
1320
+ export type AssetInfoDataKey = keyof _cli.IAssetInfo;
1321
+ }
1322
+
1323
+ // ==================== Configuration API ====================
1324
+
1325
+ /**
1326
+ * Namespace for Pink configuration APIs.
1327
+ * Pink 配置系统与 VSCode 原生配置完全隔离,仅操作通过 Pink 注册表注册的配置项。
1328
+ */
1329
+ export namespace configuration {
1330
+
1331
+ /** 配置作用域 */
1332
+ export type ConfigScope = 'cocos' | 'folder' | 'global';
1333
+
1334
+ /**
1335
+ * 获取配置项的值。
1336
+ * 仅返回通过 Pink 注册表注册的配置,VSCode 原生配置不可通过此 API 获取。
1337
+ * @param section 配置键名,如 'scene.gizmoSize'
1338
+ * @param scope 显式指定作用域,不指定时按 schema.scope 决定读取 cocos 或 folder,再 global > default
1339
+ */
1340
+ export function get<T>(section: string, scope?: ConfigScope): Thenable<T | undefined>;
1341
+
1342
+ /**
1343
+ * 更新配置项的值。
1344
+ * @param section 配置键名,如 'scene.gizmoSize'
1345
+ * @param value 新的配置值
1346
+ * @param scope 写入的作用域,默认 'folder'
1347
+ */
1348
+ export function update(section: string, value: unknown, scope?: ConfigScope): Thenable<void>;
1349
+
1350
+ /**
1351
+ * 配置变更事件。
1352
+ * 仅在 Pink 注册表内的配置变更时触发,VSCode 原生配置变更不会触发此事件。
1353
+ */
1354
+ export const onDidChangeConfiguration: Event<ConfigurationChangeEvent>;
1355
+ }
1356
+
1357
+ export interface ConfigurationChangeEvent {
1358
+ /** 发生变化的配置键 */
1359
+ readonly section: string;
1360
+ /** 变化发生的作用域 */
1361
+ readonly scope: configuration.ConfigScope;
1362
+ /** 变化后的值,undefined 表示已删除 */
1363
+ readonly value: unknown;
1364
+ affectsConfiguration(section: string): boolean;
1365
+ }
1366
+
1367
+ // ======================== Lifecycle API ========================
1368
+
1369
+ export namespace lifecycle {
1370
+
1371
+ export enum PinkState {
1372
+ /** Pink 未启动 */
1373
+ NotReady = 'notReady',
1374
+ /** Pink 正在初始化 */
1375
+ Initializing = 'initializing',
1376
+ /** Pink 已就绪,所有 API 可用 */
1377
+ Ready = 'ready',
1378
+ /** Pink 启动失败 */
1379
+ Failed = 'failed',
1380
+ }
1381
+
1382
+ export enum DisposeReason {
1383
+ /** 窗口关闭 */
1384
+ WindowClose = 'windowClose',
1385
+ /** 窗口内切换项目 */
1386
+ ProjectSwitch = 'projectSwitch',
1387
+ }
1388
+
1389
+ /** 模块状态变更事件 */
1390
+ export interface ModuleStateChangeEvent {
1391
+ /** 模块标识 */
1392
+ readonly module: string;
1393
+ /** 新状态 */
1394
+ readonly state: PinkState;
1395
+ }
1396
+
1397
+ /** 模块阶段性进度事件(信息性) */
1398
+ export interface ModuleProgressEvent {
1399
+ /** 模块标识:'base' | 'assets' | 'scripting' | 'scene' | ... */
1400
+ readonly module: string;
1401
+ /** 可读的进度描述 */
1402
+ readonly message: string;
1403
+ }
1404
+
1405
+ /** 项目即将被销毁/切换前触发 */
1406
+ export interface WillDisposeEvent {
1407
+ readonly projectPath: string;
1408
+ /** 触发原因 */
1409
+ readonly reason: DisposeReason;
1410
+ /** 当前项目是否还有其他窗口在使用(进程不会销毁) */
1411
+ readonly hasOtherWindows: boolean;
1412
+ /**
1413
+ * 阻止/延迟项目销毁。
1414
+ * - `true` — 取消切换
1415
+ * - `Promise<boolean>` — 等待用户决定(如"是否保存?"对话框)
1416
+ */
1417
+ veto(value: boolean | Promise<boolean>): void;
1418
+ }
1419
+
1420
+ /** 当前 Pink 整体状态 */
1421
+ export const state: PinkState;
1422
+
1423
+ /**
1424
+ * 查询指定模块的当前状态。
1425
+ * 仅参与生命周期上报的 Cocos 依赖模块有状态,
1426
+ * 未接入模块或未知模块返回 `undefined`。
1427
+ */
1428
+ export function getModuleState(module: string): PinkState | undefined;
1429
+
1430
+ /** Pink 整体状态变更事件 */
1431
+ export const onDidChangeState: Event<PinkState>;
1432
+
1433
+ /**
1434
+ * 模块状态变更事件。
1435
+ * 当 Cocos 依赖模块的状态发生变化时触发。
1436
+ */
1437
+ export const onDidChangeModuleState: Event<ModuleStateChangeEvent>;
1438
+
1439
+ /**
1440
+ * 模块阶段性进度事件。
1441
+ * 只有耗时模块才会上报(如 assets 数据库加载、scripting 编译)。
1442
+ * 这是信息性事件,不代表 API 可用性。
1443
+ *
1444
+ * @param module 可选的模块过滤。传入时仅接收该模块的进度事件;
1445
+ * 如果该模块不支持进度上报,则抛出错误。
1446
+ * 不传则接收所有模块的进度事件。
1447
+ * @throws 当 `module` 参数指定的模块不支持进度上报时抛出错误。
1448
+ */
1449
+ export function onModuleProgress(listener: (e: ModuleProgressEvent) => void): Disposable;
1450
+ export function onModuleProgress(module: string, listener: (e: ModuleProgressEvent) => void): Disposable;
1451
+
1452
+ /**
1453
+ * 当前窗口即将脱离当前 Pink 项目时触发(窗口关闭 / 切换项目)。
1454
+ * 此时旧项目的 pink.* API 仍可用,可执行保存/清理操作。
1455
+ */
1456
+ export const onWillDispose: Event<WillDisposeEvent>;
1457
+ }
1458
+
1459
+ // ======================== System API ========================
1460
+
1461
+ /**
1462
+ * 系统信息 API 命名空间。
1463
+ */
1464
+ export namespace system {
1465
+ /** PinK 版本号(如 `'0.0.1.29'`)。 */
1466
+ const pinkVersion: string;
1467
+ /** 运行平台。 */
1468
+ const platform: 'win32' | 'darwin' | 'linux';
1469
+ }
1470
+
1471
+ // ======================== Window API ========================
1472
+
1473
+ /**
1474
+ * 窗口管理 API 命名空间。
1475
+ */
1476
+ export namespace window {
1477
+
1478
+ /**
1479
+ * 紧凑窗口选项。
1480
+ */
1481
+ export interface CompactWindowOptions {
1482
+ /** 以紧凑模式显示窗口,隐藏标签栏等非必要 UI 元素。 */
1483
+ compact?: boolean;
1484
+ /** 辅助窗口的初始尺寸。 */
1485
+ bounds?: { width?: number; height?: number };
1486
+ /** 为 `true` 时面板不会获取焦点。 */
1487
+ preserveFocus?: boolean;
1488
+ /** 为 `true` 时窗口始终置于其他窗口(如编辑器主窗口)之上。 */
1489
+ alwaysOnTop?: boolean;
1490
+ }
1491
+
1492
+ /**
1493
+ * 在紧凑辅助窗口中创建一个 webview 面板。
1494
+ *
1495
+ * @param viewType webview 面板的类型标识。
1496
+ * @param title 面板标题。
1497
+ * @param options 紧凑窗口选项。
1498
+ * @param webviewOptions webview 设置。
1499
+ * @returns 一个标准的 vscode WebviewPanel,拥有完整的生命周期支持。
1500
+ */
1501
+ export function createWebviewPanel(
1502
+ viewType: string,
1503
+ title: string,
1504
+ options?: CompactWindowOptions,
1505
+ webviewOptions?: import('vscode').WebviewPanelOptions & import('vscode').WebviewOptions
1506
+ ): import('vscode').WebviewPanel;
1507
+ }
1508
+
1509
+ }