@cocos/cocos-cli-types 0.0.1-alpha.22.2 → 0.0.1-alpha.23.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/index.d.ts CHANGED
@@ -2,10 +2,15 @@
2
2
 
3
3
  import { __private } from 'cc';
4
4
  import { ChunkInfo } from '@cocos/creator-programming-quick-pack/lib/loader';
5
+ import type { Component } from 'cc';
5
6
  import { EventEmitter } from 'events';
7
+ import { default as i18n_2 } from 'i18next';
6
8
  import { NextFunction } from 'express';
9
+ import type { Node as Node_2 } from 'cc';
7
10
  import { Request as Request_2 } from 'express';
8
11
  import { Response as Response_2 } from 'express';
12
+ import type { Scene as Scene_2 } from 'cc';
13
+ import type { Vec3 as Vec3_2 } from 'cc';
9
14
 
10
15
  /** 动画剪辑资源的 userData */
11
16
  declare interface AnimationClipAssetUserData {
@@ -475,6 +480,11 @@ export declare namespace Configuration {
475
480
  */
476
481
  declare type ConfigurationScope = 'default' | 'project';
477
482
 
483
+ /**
484
+ * 创建类型
485
+ */
486
+ declare const CREATE_TYPES: readonly ['scene', 'prefab'];
487
+
478
488
  /**
479
489
  * Create Asset // 创建资源
480
490
  */
@@ -707,6 +717,73 @@ declare function getStatus_2(): {
707
717
  */
708
718
  declare function getUrl(): string | undefined;
709
719
 
720
+ /**
721
+ * 全局事件管理器
722
+ * 统一管理所有服务的事件监听,支持类型安全的事件订阅
723
+ */
724
+ export declare class GlobalEventManager {
725
+ /**
726
+ * 监听指定类型的事件(类型安全版本)
727
+ * @param event 事件名称
728
+ * @param listener 事件监听器
729
+ */
730
+ on<TEvents extends Record<string, any>>(event: keyof TEvents, listener: TEvents[keyof TEvents] extends void ? () => void : (payload: TEvents[keyof TEvents]) => void): void;
731
+ /**
732
+ * 监听指定类型的事件(通用版本)
733
+ * @param event 事件名称
734
+ * @param listener 事件监听器
735
+ */
736
+ on(event: string, listener: (...args: any[]) => void): void;
737
+ /**
738
+ * 监听指定类型的事件(一次性,类型安全版本)
739
+ * @param event 事件名称
740
+ * @param listener 事件监听器
741
+ */
742
+ once<TEvents extends Record<string, any>>(event: keyof TEvents, listener: TEvents[keyof TEvents] extends void ? () => void : (payload: TEvents[keyof TEvents]) => void): void;
743
+ /**
744
+ * 监听指定类型的事件(一次性,通用版本)
745
+ * @param event 事件名称
746
+ * @param listener 事件监听器
747
+ */
748
+ once(event: string, listener: (...args: any[]) => void): void;
749
+ /**
750
+ * 移除指定类型的事件监听器(类型安全版本)
751
+ * @param event 事件名称
752
+ * @param listener 事件监听器
753
+ */
754
+ off<TEvents extends Record<string, any>>(event: keyof TEvents, listener: TEvents[keyof TEvents] extends void ? () => void : (payload: TEvents[keyof TEvents]) => void): void;
755
+ /**
756
+ * 移除事件监听器(通用版本)
757
+ * @param event 事件名称
758
+ * @param listener 事件监听器
759
+ */
760
+ off(event: string, listener: (...args: any[]) => void): void;
761
+ /**
762
+ * 发射指定类型的事件(类型安全版本)
763
+ * @param event 事件名称
764
+ * @param args 事件参数
765
+ */
766
+ emit<TEvents extends Record<string, any>>(event: keyof TEvents, ...args: TEvents[keyof TEvents]): void;
767
+ /**
768
+ * 触发事件(通用版本)
769
+ * @param event 事件名称
770
+ * @param args 事件参数
771
+ */
772
+ emit(event: string, ...args: any[]): void;
773
+ /**
774
+ * 跨进程广播,传的参数需要能被序列化
775
+ * @param event 事件名称
776
+ * @param args 事件参数
777
+ */
778
+ broadcast<TEvents extends Record<string, any>>(event: keyof TEvents, ...args: TEvents[keyof TEvents]): void;
779
+ broadcast(event: string, ...args: any[]): void;
780
+ /**
781
+ * 清除事件监听器
782
+ * @param event 事件名称,如果不提供则清除所有
783
+ */
784
+ clear(event?: string): void;
785
+ }
786
+
710
787
  /** glTF 动画资源的 userData */
711
788
  declare interface GltfAnimationAssetUserData {
712
789
  gltfIndex: number;
@@ -888,6 +965,24 @@ declare interface GlTFUserData {
888
965
  };
889
966
  }
890
967
 
968
+ export declare namespace i18n {
969
+ export {
970
+ i18n_2 as default
971
+ };
972
+ }
973
+
974
+ /**
975
+ * 添加/创建组件的选项
976
+ */
977
+ declare interface IAddComponentOptions {
978
+ nodePathOrUuid: string;
979
+ component: string;
980
+ }
981
+
982
+ declare interface IApplyPrefabChangesParams {
983
+ nodePath: string;
984
+ }
985
+
891
986
  declare interface IAssetConfig {
892
987
  displayName?: string;
893
988
  description?: string;
@@ -957,6 +1052,22 @@ declare interface IAssetMeta<T extends ISupportCreateType | 'unknown' = 'unknown
957
1052
  name?: string;
958
1053
  }
959
1054
 
1055
+ /**
1056
+ * 场景相关处理接口
1057
+ */
1058
+ declare interface IAssetService extends IServiceEvents {
1059
+ /**
1060
+ * 资源发生变化时,进行处理
1061
+ * @param uuid
1062
+ */
1063
+ assetChanged(uuid: string): Promise<void>;
1064
+ /**
1065
+ * 资源删除时,进行处理
1066
+ * @param uuid
1067
+ */
1068
+ assetDeleted(uuid: string): Promise<void>;
1069
+ }
1070
+
960
1071
  declare type IAssetType =
961
1072
  | ISupportCreateCCType
962
1073
  | 'cc.Asset' // 基础资源类型(instantiation-asset)
@@ -1026,11 +1137,72 @@ declare interface IBaseConfiguration extends EventEmitterMethods {
1026
1137
  save(): Promise<boolean>;
1027
1138
  }
1028
1139
 
1140
+ declare interface IBaseCreateNodeParams {
1141
+ path: string;
1142
+ name?: string;
1143
+ workMode?: '2d' | '3d';
1144
+ position?: IVec3;
1145
+ keepWorldTransform?: boolean;
1146
+ canvasRequired?: boolean;
1147
+ }
1148
+
1149
+ /**
1150
+ * 基础标识
1151
+ */
1152
+ declare interface IBaseIdentifier {
1153
+ assetName: string;
1154
+ assetUuid: string;
1155
+ assetUrl: string;
1156
+ assetType: string;
1157
+ }
1158
+
1159
+ declare interface ICameraService {
1160
+ init(): void;
1161
+ initFromConfig(): Promise<void>;
1162
+ is2D: boolean;
1163
+ focus(nodes?: string[] | null, editorCameraInfo?: any, immediate?: boolean): void;
1164
+ defaultFocus(uuid: string): void;
1165
+ rotateCameraToDir(dir: Vec3_2, rotateByViewDist: boolean): void;
1166
+ changeProjection(): void;
1167
+ setGridVisible(value: boolean): void;
1168
+ isGridVisible(): boolean;
1169
+ setCameraProperty(options: any): void;
1170
+ resetCameraProperty(): void;
1171
+ getCameraFov(): number;
1172
+ zoomUp(): void;
1173
+ zoomDown(): void;
1174
+ zoomReset(): void;
1175
+ alignNodeToSceneView(nodes: string[]): void;
1176
+ alignSceneViewToNode(nodes: string[]): void;
1177
+ onUpdate(deltaTime: number): void;
1178
+ }
1179
+
1180
+ declare interface IChangeNodeOptions {
1181
+ source?: 'editor' | 'undo' | 'engine';
1182
+ type?: NodeEventType;
1183
+ propPath?: string;
1184
+ index?: number;
1185
+ record?: boolean;
1186
+ dumpImmediately?: boolean;
1187
+ }
1188
+
1029
1189
  declare interface IChunkContent {
1030
1190
  skeleton: null | string;
1031
1191
  clips: string[];
1032
1192
  }
1033
1193
 
1194
+ export declare interface ICLI {
1195
+ Scene: IServiceManager;
1196
+ SceneEvents: GlobalEventManager;
1197
+ }
1198
+
1199
+ /**
1200
+ * 关闭场景/预制体选项
1201
+ */
1202
+ declare interface ICloseOptions {
1203
+ urlOrUUID?: string;
1204
+ }
1205
+
1034
1206
  declare interface ICocosConfigurationNode {
1035
1207
  id: string;
1036
1208
  title: string;
@@ -1060,6 +1232,183 @@ declare interface ICollisionMatrix {
1060
1232
  [x: string]: number;
1061
1233
  }
1062
1234
 
1235
+ /**
1236
+ * CLI 使用的组件信息,属性值以扁平的 key-value 形式呈现
1237
+ */
1238
+ declare interface IComponent extends IComponentIdentifier {
1239
+ properties: {
1240
+ [key: string]: IPropertyValueType;
1241
+ };
1242
+ prefab: ICompPrefabInfo | null;
1243
+ }
1244
+
1245
+ /**
1246
+ * 编辑器使用的组件详细信息,属性值以 IProperty 编码形式呈现,
1247
+ * 包含 type、readonly、default 等元信息,用于编辑器 Inspector 面板渲染
1248
+ */
1249
+ declare interface IComponentForEditor extends IProperty {
1250
+ value: {
1251
+ enabled: IPropertyValueType;
1252
+ uuid: IPropertyValueType;
1253
+ name: IPropertyValueType;
1254
+ } & Record<string, IPropertyValueType>;
1255
+ mountedRoot?: string;
1256
+ }
1257
+
1258
+ /**
1259
+ * 组件标识信息,包含组件的基本标识字段
1260
+ */
1261
+ declare interface IComponentIdentifier {
1262
+ cid: string;
1263
+ path: string;
1264
+ uuid: string;
1265
+ name: string;
1266
+ type: string;
1267
+ enabled: boolean;
1268
+ }
1269
+
1270
+ /**
1271
+ * 组件服务接口,定义了所有组件相关的操作方法
1272
+ */
1273
+ declare interface IComponentService extends IServiceEvents {
1274
+ /**
1275
+ * 添加组件到指定节点,返回添加后的组件信息
1276
+ * @param params - 添加组件选项
1277
+ * @param params.nodePathOrUuid - 目标节点路径或 UUID
1278
+ * @param params.component - 组件类名,支持精确匹配('cc.Label')和模糊匹配('label')
1279
+ * @returns 添加成功后的组件信息
1280
+ *
1281
+ * @example
1282
+ * ```ts
1283
+ * // 通过节点路径 + 精确组件名
1284
+ * const comp = await addComponent({ nodePathOrUuid: 'Canvas/MyNode', component: 'cc.Label' });
1285
+ *
1286
+ * // 通过节点 UUID + 模糊组件名
1287
+ * const comp = await addComponent({ nodePathOrUuid: 'abc-123-uuid', component: 'label' });
1288
+ * ```
1289
+ */
1290
+ addComponent(params: IAddComponentOptions): Promise<IComponent>;
1291
+ /**
1292
+ * 删除指定组件
1293
+ * @param params - 删除组件选项
1294
+ * @param params.path - 组件路径,支持路径、UUID 或资源 URL
1295
+ * @returns 删除成功返回 true,失败返回 false
1296
+ */
1297
+ removeComponent(params: IRemoveComponentOptions): Promise<boolean>;
1298
+ /**
1299
+ * 设置组件属性
1300
+ * - CLI 调用时传入 ISetPropertyOptions,通过 componentPath 定位,属性为扁平键值对
1301
+ * - 编辑器调用时传入 ISetPropertyOptionsForEditor,通过节点 UUID + dump 路径定位,属性为 IProperty 格式
1302
+ *
1303
+ * @param params - 设置属性选项,根据调用方不同传入不同类型
1304
+ * @returns 设置成功返回 true,失败返回 false
1305
+ *
1306
+ * @example
1307
+ * ```ts
1308
+ * // CLI 方式:通过 componentPath 定位,直接传属性键值对
1309
+ * await setProperty({
1310
+ * componentPath: 'Canvas/cc.Label_1',
1311
+ * properties: { string: 'Hello', fontSize: 32 },
1312
+ * });
1313
+ *
1314
+ * // 编辑器方式:通过节点 UUID + dump 路径定位,传 IProperty 格式
1315
+ * await setProperty({
1316
+ * uuid: 'node-uuid',
1317
+ * path: '__comps__.0.string',
1318
+ * dump: { value: 'Hello', type: 'String' },
1319
+ * });
1320
+ * ```
1321
+ */
1322
+ setProperty(params: ISetPropertyOptions | ISetPropertyOptionsForEditor): Promise<boolean>;
1323
+ /**
1324
+ * 查询组件信息
1325
+ * - 传入 IQueryComponentOptions 时,返回 IComponent 或 IComponent
1326
+ * - 传入 string 时,返回 IComponentForEditor
1327
+ *
1328
+ * @param params - 查询选项或组件路径字符串
1329
+ * @returns 如果传入的是 IQueryComponentOptions 时返回 IComponent,如果传入是string时返回 IComponentForEditor,未找到返回 null
1330
+ *
1331
+ * @example
1332
+ * ```ts
1333
+ * CLI 模式:返回 IComponent(扁平属性)
1334
+ * const comp = await queryComponent({ path: 'Canvas/cc.Label_1' }) as IComponent;
1335
+ *
1336
+ * 编辑器模式:直接传 string,这里是uuid,因为与cli重复了,也支持 path 和 url
1337
+ * const comp = await queryComponent('uuid') as IComponentForEditor;
1338
+ * ```
1339
+ */
1340
+ queryComponent(params: IQueryComponentOptions | string): Promise<IComponent | IComponentForEditor | null>;
1341
+ /**
1342
+ * 获取所有已注册的组件类名,包含内置与自定义组件
1343
+ * @returns 组件类名数组,如 ['cc.Label', 'cc.Sprite', 'MyCustomComponent']
1344
+ */
1345
+ queryAllComponent(): Promise<string[]>;
1346
+ /**
1347
+ * 创建组件(编辑器使用),与 addComponent 不同的是仅返回是否成功
1348
+ * @param params - 添加组件选项
1349
+ * @param params.nodePathOrUuid - 目标节点路径或 UUID
1350
+ * @param params.component - 组件类名
1351
+ * @returns 创建成功返回 true,失败返回 false
1352
+ */
1353
+ createComponent(params: IAddComponentOptions): Promise<boolean>;
1354
+ /**
1355
+ * 复位组件,将组件所有属性恢复为默认值
1356
+ * @param params - 查询组件选项,用于定位要复位的组件
1357
+ * @param params.path - 组件路径,支持路径、UUID 或资源 URL
1358
+ * @returns 复位成功返回 true,失败返回 false
1359
+ */
1360
+ resetComponent(params: IQueryComponentOptions): Promise<boolean>;
1361
+ /**
1362
+ * 获取所有注册类名,支持按继承关系过滤
1363
+ * @param options - 过滤选项,不传则返回所有注册类
1364
+ * @param options.extends - 父类名称,只返回继承自该类的子类,支持字符串或字符串数组
1365
+ * @param options.excludeSelf - 是否排除父类自身,默认 false
1366
+ * @returns 类名对象数组,如 [{ name: 'cc.Label' }, { name: 'cc.Sprite' }]
1367
+ *
1368
+ * @example
1369
+ * ```ts
1370
+ * // 查询所有注册类
1371
+ * const all = await queryClasses();
1372
+ *
1373
+ * // 查询 cc.Component 的所有子类(含自身)
1374
+ * const comps = await queryClasses({ extends: 'cc.Component' });
1375
+ *
1376
+ * // 查询 cc.Component 的所有子类(排除自身)
1377
+ * const subComps = await queryClasses({ extends: 'cc.Component', excludeSelf: true });
1378
+ * ```
1379
+ */
1380
+ queryClasses(options?: IQueryClassesOptions): Promise<{
1381
+ name: string;
1382
+ }[]>;
1383
+ /**
1384
+ * 查询指定节点上所有组件暴露的可调用函数
1385
+ * @param uuid - 节点 UUID
1386
+ * @returns 节点上组件的函数信息,节点不存在时返回空对象
1387
+ */
1388
+ queryComponentFunctionOfNode(uuid: string): Promise<any>;
1389
+ /**
1390
+ * 执行组件上的指定方法
1391
+ * @param options - 执行选项
1392
+ * @param options.uuid - 组件实例的 UUID
1393
+ * @param options.name - 要执行的方法名,如 'onLoad'、'start'
1394
+ * @param options.args - 方法参数列表
1395
+ * @returns 执行成功返回 true,失败返回 false
1396
+ */
1397
+ executeComponentMethod(options: IExecuteComponentMethodOptions): Promise<boolean>;
1398
+ /**
1399
+ * 查询指定名称的组件是否已注册(是否存在对应脚本)
1400
+ * @param name - 组件类名,如 'cc.Label'
1401
+ * @returns 存在返回 true,不存在返回 false
1402
+ */
1403
+ queryComponentHasScript(name: string): Promise<boolean>;
1404
+ init(): void;
1405
+ unregisterCompMgrEvents(): void;
1406
+ }
1407
+
1408
+ declare interface ICompPrefabInfo {
1409
+ fileId: string;
1410
+ }
1411
+
1063
1412
  /**
1064
1413
  * 配置的格式
1065
1414
  */
@@ -1070,6 +1419,14 @@ declare interface IConfiguration {
1070
1419
  [key: string]: any;
1071
1420
  }
1072
1421
 
1422
+ declare interface ICreateByAssetParams extends IBaseCreateNodeParams {
1423
+ dbURL: string;
1424
+ }
1425
+
1426
+ declare interface ICreateByNodeTypeParams extends IBaseCreateNodeParams {
1427
+ nodeType: NodeType;
1428
+ }
1429
+
1073
1430
  declare interface ICreateMenuInfo {
1074
1431
  // 新建菜单名称,支持 i18n:xxx
1075
1432
  label: string;
@@ -1093,6 +1450,27 @@ declare interface ICreateMenuInfo {
1093
1450
  fileNameCheckConfigs?: FileNameCheckConfig[];
1094
1451
  }
1095
1452
 
1453
+ /**
1454
+ * 创建场景/预制体选项
1455
+ */
1456
+ declare interface ICreateOptions {
1457
+ type: ICreateType;
1458
+ baseName: string;
1459
+ targetDirectory: string;
1460
+ templateType?: TSceneTemplateType;
1461
+ }
1462
+
1463
+ declare interface ICreatePrefabFromNodeParams {
1464
+ /** 要转换为预制体的源节点路径 */
1465
+ nodePath: string;
1466
+ /** 预制体资源保存 URL */
1467
+ dbURL: string;
1468
+ /** 是否强制覆盖现有资源 */
1469
+ overwrite?: boolean;
1470
+ }
1471
+
1472
+ declare type ICreateType = typeof CREATE_TYPES[number];
1473
+
1096
1474
  declare type ICroppingConfig = {
1097
1475
  name: string;
1098
1476
  cache: Record<string, IDisplayModuleCache>,
@@ -1120,6 +1498,15 @@ declare type IDefaultConfig = {
1120
1498
 
1121
1499
  declare type IDefaultConfigKeys = 'defaultConfig' | 'default2d' | 'default3d' | 'defaultNative' | 'defaultSmallGames'
1122
1500
 
1501
+ declare interface IDeleteNodeParams {
1502
+ path: string;
1503
+ keepWorldTransform?: boolean;
1504
+ }
1505
+
1506
+ declare interface IDeleteNodeResult {
1507
+ path: string;
1508
+ }
1509
+
1123
1510
  /**
1124
1511
  * 构建使用的设计分辨率数据
1125
1512
  */
@@ -1143,6 +1530,50 @@ declare interface IDisplayModuleItem extends IFeatureItem {
1143
1530
  options?: Record<string, IDisplayModuleItem>;
1144
1531
  }
1145
1532
 
1533
+ declare interface IEditorService extends IServiceEvents {
1534
+ /**
1535
+ * 当前编辑器类型
1536
+ */
1537
+ getCurrentEditorType(): 'scene' | 'prefab' | 'unknown';
1538
+ /**
1539
+ * 打开资产
1540
+ * @param params
1541
+ */
1542
+ open(params: IOpenOptions): Promise<TEditorEntity>;
1543
+ /**
1544
+ * 关闭当前资产
1545
+ */
1546
+ close(params: ICloseOptions): Promise<boolean>;
1547
+ /**
1548
+ * 保存资产
1549
+ */
1550
+ save(params: ISaveOptions): Promise<IAssetInfo>;
1551
+ /**
1552
+ * 重载资产
1553
+ * @param params
1554
+ */
1555
+ reload(params: IReloadOptions): Promise<ReloadResult>;
1556
+ /**
1557
+ * 创建新资产
1558
+ * @param params
1559
+ */
1560
+ create(params: ICreateOptions): Promise<IBaseIdentifier>;
1561
+ /**
1562
+ * 是否有打开编辑器
1563
+ */
1564
+ hasOpen(): Promise<boolean>;
1565
+ /**
1566
+ * 获取当前打开的资产
1567
+ */
1568
+ queryCurrent(): Promise<TEditorEntity | null>;
1569
+ /**
1570
+ *
1571
+ */
1572
+ getRootNode(): TEditorInstance | null;
1573
+ lock(): Promise<void>;
1574
+ unlock(): void;
1575
+ }
1576
+
1146
1577
  declare interface IEngineConfig extends IEngineModuleConfig {
1147
1578
  physicsConfig: IPhysicsConfig;
1148
1579
  macroConfig?: Record<string, string | number | boolean>;
@@ -1192,6 +1623,26 @@ declare interface IEngineProjectConfig extends Exclude<IEngineConfig, 'includeMo
1192
1623
  globalConfigKey?: string;
1193
1624
  }
1194
1625
 
1626
+ declare interface IEngineService extends IServiceEvents {
1627
+ /**
1628
+ * 初始化引擎服务,目前是暂时引擎 mainLoop
1629
+ */
1630
+ init(): Promise<void>;
1631
+ /**
1632
+ * 让引擎执行一帧
1633
+ */
1634
+ repaintInEditMode(): Promise<void>;
1635
+ }
1636
+
1637
+ /**
1638
+ * 执行组件方法的选项
1639
+ */
1640
+ declare interface IExecuteComponentMethodOptions {
1641
+ uuid: string;
1642
+ name: string;
1643
+ args: any[];
1644
+ }
1645
+
1195
1646
  declare interface IFbxSetting {
1196
1647
  /**
1197
1648
  * https://github.com/cocos-creator/FBX-glTF-conv/pull/26
@@ -1279,6 +1730,32 @@ declare interface IGetPostConfig {
1279
1730
  handler: (req: Request_2, res: Response_2, next?: NextFunction) => Promise<void>;
1280
1731
  }
1281
1732
 
1733
+ declare interface IGetPrefabInfoParams {
1734
+ nodePath: string;
1735
+ }
1736
+
1737
+ declare interface IGizmoService {
1738
+ gizmoRootNode: any;
1739
+ foregroundNode: any;
1740
+ backgroundNode: any;
1741
+ transformToolData: any;
1742
+ transformToolName: string;
1743
+ isViewMode: boolean;
1744
+ init(): void;
1745
+ initFromConfig(): Promise<void>;
1746
+ saveConfig(): Promise<void>;
1747
+ changeTool(name: string): void;
1748
+ setCoordinate(coord: 'local' | 'global'): void;
1749
+ setPivot(pivot: 'pivot' | 'center'): void;
1750
+ lockGizmoTool(locked: boolean): void;
1751
+ setIconVisible(visible: boolean): void;
1752
+ showAllGizmoOfNode(node: any, recursive?: boolean): void;
1753
+ removeAllGizmoOfNode(node: any, recursive?: boolean): void;
1754
+ clearAllGizmos(): void;
1755
+ callAllGizmoFuncOfNode(node: any, funcName: string, ...params: any[]): boolean;
1756
+ onUpdate(deltaTime: number): void;
1757
+ }
1758
+
1282
1759
  declare interface IInitEngineInfo {
1283
1760
  importBase: string;
1284
1761
  nativeBase: string;
@@ -1286,6 +1763,10 @@ declare interface IInitEngineInfo {
1286
1763
  serverURL?: string;
1287
1764
  }
1288
1765
 
1766
+ declare interface IIsPrefabInstanceParams {
1767
+ nodePath: string;
1768
+ }
1769
+
1289
1770
  /** 图片资源的 userData */
1290
1771
  declare interface ImageAssetUserData {
1291
1772
  /** 图片类型 */
@@ -1362,6 +1843,16 @@ declare type IModuleItem = IFeatureItem | IFeatureGroup;
1362
1843
 
1363
1844
  declare type IModules = Record<string, IModuleItem>;
1364
1845
 
1846
+ declare interface IMountedChildrenInfo {
1847
+ targetInfo: ITargetInfo | null;
1848
+ nodes: INodeIdentifier[];
1849
+ }
1850
+
1851
+ declare interface IMountedComponentsInfo {
1852
+ targetInfo: ITargetInfo | null;
1853
+ components: IComponentIdentifier[];
1854
+ }
1855
+
1365
1856
  /**
1366
1857
  * Import Asset // 导入资源
1367
1858
  */
@@ -1394,6 +1885,103 @@ declare function initEngine(enginePath: string, projectPath: string, serverURL?:
1394
1885
 
1395
1886
  declare function initProgrammingFacet(): Promise<ProgrammingFacet>;
1396
1887
 
1888
+ declare interface INode extends INodeIdentifier {
1889
+ properties: INodeProperties;
1890
+ components?: IComponent[] | IComponentIdentifier[];
1891
+ children?: INode[];
1892
+ prefab: IPrefabInfo | null;
1893
+ }
1894
+
1895
+ declare interface INodeIdentifier {
1896
+ nodeId: string;
1897
+ path: string;
1898
+ name: string;
1899
+ }
1900
+
1901
+ declare interface INodeProperties {
1902
+ position: IVec3;
1903
+ rotation: IQuat;
1904
+ eulerAngles: IVec3;
1905
+ scale: IVec3;
1906
+ mobility: MobilityMode;
1907
+ layer: number;
1908
+ active: boolean;
1909
+ }
1910
+
1911
+ /**
1912
+ * 节点的相关处理接口
1913
+ */
1914
+ declare interface INodeService extends IServiceEvents {
1915
+ /**
1916
+ * 创建节点
1917
+ * @param params
1918
+ */
1919
+ createNodeByType(params: ICreateByNodeTypeParams): Promise<INode | null>;
1920
+ /**
1921
+ * 创建节点
1922
+ * @param params
1923
+ */
1924
+ createNodeByAsset(params: ICreateByAssetParams): Promise<INode | null>;
1925
+ /**
1926
+ * 删除节点
1927
+ * @param params
1928
+ */
1929
+ deleteNode(params: IDeleteNodeParams): Promise<IDeleteNodeResult | null>;
1930
+ /**
1931
+ * 更新节点
1932
+ * @param params
1933
+ */
1934
+ updateNode(params: IUpdateNodeParams): Promise<IUpdateNodeResult>;
1935
+ /**
1936
+ * 查询节点
1937
+ */
1938
+ queryNode(params: IQueryNodeParams): Promise<INode | null>;
1939
+ /**
1940
+ * 查询节点树(层级管理器格式)
1941
+ */
1942
+ queryNodeTree(params: IQueryNodeTreeParams): Promise<INodeTreeItem | null>;
1943
+ }
1944
+
1945
+ declare interface INodeTreeComponent {
1946
+ isCustom: boolean;
1947
+ type: string;
1948
+ value: string;
1949
+ extends: string[];
1950
+ }
1951
+
1952
+ declare interface INodeTreeItem {
1953
+ name: string;
1954
+ active: boolean;
1955
+ locked: boolean;
1956
+ type: string;
1957
+ uuid: string;
1958
+ children: INodeTreeItem[];
1959
+ prefab: IPrefabStateInfo;
1960
+ parent: string;
1961
+ path: string;
1962
+ isScene: boolean;
1963
+ readonly: boolean;
1964
+ components: INodeTreeComponent[];
1965
+ }
1966
+
1967
+ /**
1968
+ * 打开场景/预制体选项
1969
+ */
1970
+ declare interface IOpenOptions {
1971
+ urlOrUUID: string;
1972
+ simpleNode?: boolean;
1973
+ }
1974
+
1975
+ declare interface IOperationService {
1976
+ addListener(type: OperationEvent, listener: Function, priority?: number): void;
1977
+ removeListener(type: OperationEvent, listener: Function): void;
1978
+ dispatch(type: OperationEvent, ...args: any[]): void;
1979
+ emitMouseEvent(type: string, event: ISceneMouseEvent, dpr?: number): void;
1980
+ requestPointerLock(): void;
1981
+ exitPointerLock(): void;
1982
+ changePointer(type: string): void;
1983
+ }
1984
+
1397
1985
  declare interface IPhysicsConfig {
1398
1986
  gravity: IVec3Like; // (0,-10, 0)
1399
1987
  allowSleep: boolean; // true
@@ -1424,6 +2012,76 @@ declare interface IPluginScriptInfo extends PluginScriptInfo {
1424
2012
  url: string;
1425
2013
  }
1426
2014
 
2015
+ declare interface IPrefab {
2016
+ name: string;
2017
+ uuid: string;
2018
+ data: INodeIdentifier;
2019
+ optimizationPolicy: OptimizationPolicy;
2020
+ persistent: boolean;
2021
+ }
2022
+
2023
+ declare interface IPrefabInfo {
2024
+ /** 关联的预制体资源信息 */
2025
+ asset?: IPrefab;
2026
+ root?: INodeIdentifier;
2027
+ instance?: IPrefabInstance;
2028
+ fileId: string;
2029
+ targetOverrides: ITargetOverrideInfo[];
2030
+ nestedPrefabInstanceRoots: INodeIdentifier[];
2031
+ }
2032
+
2033
+ declare interface IPrefabInstance {
2034
+ fileId: string;
2035
+ prefabRootNode?: INodeIdentifier;
2036
+ mountedChildren: IMountedChildrenInfo[];
2037
+ mountedComponents: IMountedComponentsInfo[];
2038
+ propertyOverrides: IPropertyOverrideInfo[];
2039
+ removedComponents: ITargetInfo[];
2040
+ }
2041
+
2042
+ declare interface IPrefabService extends IServiceEvents {
2043
+ /**
2044
+ * 将节点转换为预制体资源
2045
+ */
2046
+ createPrefabFromNode(params: ICreatePrefabFromNodeParams): Promise<INode>;
2047
+ /**
2048
+ * 将节点的修改应用回预制体资源
2049
+ */
2050
+ applyPrefabChanges(params: IApplyPrefabChangesParams): Promise<boolean>;
2051
+ /**
2052
+ * 重置节点到预制体原始状态
2053
+ */
2054
+ revertToPrefab(params: IRevertToPrefabParams): Promise<boolean>;
2055
+ /**
2056
+ * 解耦预制体实例,使其成为普通节点
2057
+ */
2058
+ unpackPrefabInstance(params: IUnpackPrefabInstanceParams): Promise<INode>;
2059
+ /**
2060
+ * 检查节点是否为预制体实例
2061
+ */
2062
+ isPrefabInstance(params: IIsPrefabInstanceParams): Promise<boolean>;
2063
+ /**
2064
+ * 获取节点的预制体信息
2065
+ */
2066
+ getPrefabInfo(params: IGetPrefabInfoParams): Promise<IPrefabInfo | null>;
2067
+ /**
2068
+ * 移除 prefab info
2069
+ * @param node
2070
+ * @param removeNested
2071
+ */
2072
+ removePrefabInfoFromNode(node: Node_2, removeNested?: boolean): void;
2073
+ }
2074
+
2075
+ declare interface IPrefabStateInfo {
2076
+ state: PrefabState;
2077
+ isUnwrappable: boolean;
2078
+ isRevertable: boolean;
2079
+ isApplicable: boolean;
2080
+ isAddedChild: boolean;
2081
+ isNested: boolean;
2082
+ assetUuid: string;
2083
+ }
2084
+
1427
2085
  declare interface IProject {
1428
2086
  /**
1429
2087
  * Gets the project directory path
@@ -1497,6 +2155,116 @@ declare interface IProject {
1497
2155
  updateInfo<T>(keyOrValue: string | ProjectInfo, value?: T): Promise<boolean>;
1498
2156
  }
1499
2157
 
2158
+ /**
2159
+ * 组件的 dump 数据,以 IProperty 格式编码组件信息
2160
+ * 与 IComponent 不同,所有属性(包括 uuid, name, enabled)都通过 encodeObject 编码为 IProperty
2161
+ */
2162
+ declare interface IProperty {
2163
+ value: { [key: string]: IPropertyValueType } | IPropertyValueType;
2164
+ default?: any; // 默认值
2165
+
2166
+ // 多选节点之后,这里存储多个数据,用于自行判断多选后的显示效果,无需更新该数据
2167
+ values?: ({ [key: string]: IPropertyValueType } | IPropertyValueType)[];
2168
+
2169
+ lock?: { [key in keyof Vec4]?: IPropertyLock };
2170
+
2171
+ cid?: string;
2172
+ type?: string;
2173
+ ui?: { name: string; data?: any }; // 是否用指定的 UI 组件,name 是组件的名称
2174
+ readonly?: boolean;
2175
+ visible?: boolean;
2176
+ name?: string;
2177
+
2178
+ elementTypeData?: IProperty; // 数组里的数据的默认值 dump
2179
+
2180
+ path?: string; // 数据的搜索路径,这个是由使用方填充的
2181
+
2182
+ isArray?: boolean;
2183
+ invalid?: boolean;
2184
+ extends?: string[]; // 继承链
2185
+ displayName?: string; // 显示到界面上的名字
2186
+ displayOrder?: number; // 显示排序
2187
+ help?: string; // 帮助文档的 url 地址
2188
+ group?: IPropertyGroupOptions; // tab
2189
+ tooltip?: string; // 提示文本
2190
+ editor?: any; // 组件上定义的编辑器数据
2191
+ animatable?: boolean; // 是否可以在动画中编辑
2192
+ radioGroup?: boolean; // 是否渲染为 RadioGroup
2193
+
2194
+ // Enum
2195
+ enumList?: any[]; // enum 类型的 list 选项数组
2196
+
2197
+ bitmaskList?: any[];
2198
+
2199
+ // Number
2200
+ min?: number; // 数值类型的最小值
2201
+ max?: number; // 数值类型的最大值
2202
+ step?: number; // 数值类型的步进值
2203
+ slide?: boolean; // 数组是否显示为滑块
2204
+ unit?: string; // 显示的单位
2205
+ radian?: boolean; // 标识是否为角度
2206
+
2207
+ // Label
2208
+ multiline?: boolean; // 字符串是否允许换行
2209
+ // nullable?: boolean; 属性是否允许为空
2210
+
2211
+ optionalTypes?: string[]; // 对属性是 object 且是可变类型的数据的支持,比如 render-pipeline
2212
+
2213
+ userData?: { [key: string]: any }; // 用户透传的数据
2214
+ }
2215
+
2216
+ declare interface IPropertyGroupOptions {
2217
+ id: string // 默认 'default'
2218
+ name: string,
2219
+ displayOrder: number, // 默认 Infinity, 排在最后面
2220
+ style: string // 默认为 'tab'
2221
+ }
2222
+
2223
+ declare type IPropertyLock = {
2224
+ default: number;
2225
+ message: string
2226
+ };
2227
+
2228
+ declare interface IPropertyOverrideInfo {
2229
+ targetInfo: ITargetInfo | null;
2230
+ propertyPath: string[];
2231
+ value?: any;
2232
+ }
2233
+
2234
+ declare type IPropertyValueType = IProperty | IProperty[] | null | undefined | number | boolean | string | Vec4 | Vec3 | Vec2 | Mat4 | any | Array<unknown>
2235
+
2236
+ declare interface IQuat {
2237
+ x: number;
2238
+ y: number;
2239
+ z: number;
2240
+ w: number;
2241
+ }
2242
+
2243
+ /**
2244
+ * 查询注册类的过滤选项
2245
+ */
2246
+ declare interface IQueryClassesOptions {
2247
+ extends?: string | string[];
2248
+ excludeSelf?: boolean;
2249
+ }
2250
+
2251
+ /**
2252
+ * 查询组件的选项
2253
+ */
2254
+ declare interface IQueryComponentOptions {
2255
+ path: string;
2256
+ }
2257
+
2258
+ declare interface IQueryNodeParams {
2259
+ path: string;
2260
+ queryChildren: boolean;
2261
+ queryComponent: boolean;
2262
+ }
2263
+
2264
+ declare interface IQueryNodeTreeParams {
2265
+ path?: string;
2266
+ }
2267
+
1500
2268
  declare interface IRedirectInfo {
1501
2269
  // 跳转资源的类型
1502
2270
  type: string;
@@ -1504,6 +2272,167 @@ declare interface IRedirectInfo {
1504
2272
  uuid: string;
1505
2273
  }
1506
2274
 
2275
+ /**
2276
+ * 软刷新场景/预制体选项
2277
+ */
2278
+ declare interface IReloadOptions {
2279
+ urlOrUUID?: string;
2280
+ }
2281
+
2282
+ /**
2283
+ * 删除组件的选项
2284
+ */
2285
+ declare interface IRemoveComponentOptions {
2286
+ path: string;
2287
+ }
2288
+
2289
+ declare interface IRevertToPrefabParams {
2290
+ nodePath: string;
2291
+ }
2292
+
2293
+ /**
2294
+ * 保持场景/预制体选项
2295
+ */
2296
+ declare interface ISaveOptions {
2297
+ urlOrUUID?: string;
2298
+ }
2299
+
2300
+ /**
2301
+ * 场景信息
2302
+ */
2303
+ declare interface IScene extends IBaseIdentifier {
2304
+ name: string;
2305
+ prefab: IPrefabInfo | null;
2306
+ children: INode[];
2307
+ components: IComponentIdentifier[];
2308
+ }
2309
+
2310
+ declare interface ISceneMouseEvent {
2311
+ x: number;
2312
+ y: number;
2313
+ clientX: number;
2314
+ clientY: number;
2315
+ deltaX: number;
2316
+ deltaY: number;
2317
+ wheelDeltaX: number;
2318
+ wheelDeltaY: number;
2319
+ moveDeltaX: number;
2320
+ moveDeltaY: number;
2321
+ leftButton: boolean;
2322
+ middleButton: boolean;
2323
+ rightButton: boolean;
2324
+ button: number;
2325
+ buttons: number;
2326
+ ctrlKey: boolean;
2327
+ shiftKey: boolean;
2328
+ altKey: boolean;
2329
+ metaKey: boolean;
2330
+ hitPoint?: any;
2331
+ type?: string;
2332
+ handleName?: string;
2333
+ }
2334
+
2335
+ declare interface ISceneViewService {
2336
+ init(): void;
2337
+ initFromConfig(): Promise<void>;
2338
+ saveConfig(): Promise<void>;
2339
+ setSceneLightOn(enable: boolean): void;
2340
+ querySceneLightOn(): boolean;
2341
+ onSceneOpened(scene: any): void;
2342
+ onSceneClosed(): void;
2343
+ onComponentAdded(comp: Component): void;
2344
+ onComponentRemoved(comp: Component): void;
2345
+ }
2346
+
2347
+ declare interface IScriptService extends IServiceEvents {
2348
+ investigatePackerDriver(): Promise<void>;
2349
+ loadScript(): Promise<void>;
2350
+ removeScript(): Promise<void>;
2351
+ scriptChange(): Promise<void>;
2352
+ queryScriptCid(uuid: string): Promise<string | null>;
2353
+ queryScriptName(uuid: string): Promise<string | null>;
2354
+ isCustomComponent(classConstructor: Function): boolean;
2355
+ suspend(condition: Promise<any>): void;
2356
+ }
2357
+
2358
+ declare interface ISelectionService {
2359
+ select(uuid: string): void;
2360
+ unselect(uuid: string): void;
2361
+ clear(): void;
2362
+ query(): string[];
2363
+ isSelect(uuid: string): boolean;
2364
+ reset(): void;
2365
+ }
2366
+
2367
+ declare interface IServiceEvents {
2368
+ onEditorOpened?(): void;
2369
+ onEditorReload?(): void;
2370
+ onEditorClosed?(): void;
2371
+ onEditorSaved?(): void;
2372
+ onNodeBeforeChanged?(node: Node_2): void;
2373
+ onBeforeRemoveNode?(node: Node_2): void;
2374
+ onBeforeAddNode?(node: Node_2): void;
2375
+ onNodeChanged?(node: Node_2, opts: IChangeNodeOptions): void;
2376
+ onBeforeNodeAdded?(node: Node_2): void;
2377
+ onAddNode?(node: Node_2): void;
2378
+ onRemoveNode?(node: Node_2): void;
2379
+ onNodeAdded?(node: Node_2): void;
2380
+ onNodeRemoved?(node: Node_2): void;
2381
+ onAddComponent?(comp: Component): void;
2382
+ onRemoveComponent?(comp: Component): void;
2383
+ onSetPropertyComponent?(comp: Component): void;
2384
+ onComponentAdded?(comp: Component): void;
2385
+ onComponentRemoved?(comp: Component): void;
2386
+ onBeforeRemoveComponent?(comp: Component): void;
2387
+ onComponentBeforeChanged?(node: Node_2): void;
2388
+ onBeforeComponentAdded?(name: string, node: Node_2): void;
2389
+ onComponentChanged?(name: string, opts: IChangeNodeOptions): void;
2390
+ onAssetDeleted?(uuid: string): void;
2391
+ onAssetChanged?(uuid: string): void;
2392
+ onAssetRefreshed?(uuid: string): void;
2393
+ onScriptExecutionFinished?(): void;
2394
+ onSelectionSelect?(uuid: string, uuids: string[]): void;
2395
+ onSelectionUnselect?(uuid: string, uuids: string[]): void;
2396
+ onSelectionClear?(): void;
2397
+ }
2398
+
2399
+ export declare interface IServiceManager {
2400
+ Editor: IEditorService;
2401
+ Node: INodeService;
2402
+ Component: IComponentService;
2403
+ Script: IScriptService;
2404
+ Asset: IAssetService;
2405
+ Engine: IEngineService;
2406
+ Prefab: IPrefabService;
2407
+ Selection: ISelectionService;
2408
+ Operation: IOperationService;
2409
+ Undo: IUndoService;
2410
+ Camera: ICameraService;
2411
+ Gizmo: IGizmoService;
2412
+ SceneView: ISceneViewService;
2413
+ }
2414
+
2415
+ /**
2416
+ * CLI 设置组件属性的选项
2417
+ */
2418
+ declare interface ISetPropertyOptions {
2419
+ componentPath: string;
2420
+ properties: {
2421
+ [key: string]: null | undefined | number | boolean | string | object | Array<unknown>;
2422
+ };
2423
+ record?: boolean;
2424
+ }
2425
+
2426
+ /**
2427
+ * 编辑器设置组件属性的选项
2428
+ */
2429
+ declare interface ISetPropertyOptionsForEditor {
2430
+ uuid: string;
2431
+ path: string;
2432
+ dump: IProperty;
2433
+ record?: boolean;
2434
+ }
2435
+
1507
2436
  declare interface ISocketConfig {
1508
2437
  connection: (socket: any) => void;
1509
2438
  disconnect: (socket: any) => void;
@@ -1560,6 +2489,18 @@ declare type ISupportCreateCCType =
1560
2489
  /** 支持创建的资源类型(从常量数组派生) */
1561
2490
  declare type ISupportCreateType = typeof SUPPORT_CREATE_TYPES[number];
1562
2491
 
2492
+ declare interface ITargetInfo {
2493
+ localID: string[];
2494
+ }
2495
+
2496
+ declare interface ITargetOverrideInfo {
2497
+ source: IComponentIdentifier | INodeIdentifier | null;
2498
+ sourceInfo: ITargetInfo | null;
2499
+ propertyPath: string[];
2500
+ target: INodeIdentifier | null;
2501
+ targetInfo: ITargetInfo | null;
2502
+ }
2503
+
1563
2504
  declare interface IUerDataConfigItem {
1564
2505
  key?: string; // 唯一标识符
1565
2506
  // 配置显示的名字,如果需要翻译,则传入 i18n:${key}
@@ -1582,6 +2523,40 @@ declare interface IUerDataConfigItem {
1582
2523
  };
1583
2524
  }
1584
2525
 
2526
+ declare interface IUndoService {
2527
+ beginRecording(uuids: string[], options?: any): string;
2528
+ endRecording(commandId: string): void;
2529
+ cancelRecording(commandId: string): void;
2530
+ undo(): Promise<void>;
2531
+ redo(): Promise<void>;
2532
+ snapshot(): void;
2533
+ reset(): void;
2534
+ isDirty(): boolean;
2535
+ }
2536
+
2537
+ declare interface IUnpackPrefabInstanceParams {
2538
+ /** 要解耦的预制体实例节点 */
2539
+ nodePath: string;
2540
+ /** 递归解耦所有子预制体 */
2541
+ recursive?: boolean;
2542
+ }
2543
+
2544
+ declare interface IUpdateNodeParams {
2545
+ path: string;
2546
+ name?: string;
2547
+ properties?: Partial<INodeProperties>;
2548
+ }
2549
+
2550
+ declare interface IUpdateNodeResult {
2551
+ path: string;
2552
+ }
2553
+
2554
+ declare interface IVec3 {
2555
+ x: number;
2556
+ y: number;
2557
+ z: number;
2558
+ }
2559
+
1585
2560
  declare interface IVec3Like {
1586
2561
  x: number;
1587
2562
  y: number;
@@ -1649,6 +2624,28 @@ declare type MacroItem = {
1649
2624
 
1650
2625
  declare type MakeRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
1651
2626
 
2627
+ declare interface Mat4 {
2628
+ m00: number;
2629
+ m01: number;
2630
+ m02: number;
2631
+ m03: number;
2632
+
2633
+ m04: number;
2634
+ m05: number;
2635
+ m06: number;
2636
+ m07: number;
2637
+
2638
+ m08: number;
2639
+ m09: number;
2640
+ m10: number;
2641
+ m11: number;
2642
+
2643
+ m12: number;
2644
+ m13: number;
2645
+ m14: number;
2646
+ m15: number;
2647
+ }
2648
+
1652
2649
  export declare namespace Mcp {
1653
2650
  export {
1654
2651
  register,
@@ -1703,6 +2700,24 @@ declare interface Migration {
1703
2700
  migrate(moduleCache: Record<string, boolean>): Record<string, boolean>;
1704
2701
  }
1705
2702
 
2703
+ declare enum MobilityMode {
2704
+ /**
2705
+ * @en Static node
2706
+ * @zh 静态节点
2707
+ */
2708
+ Static = 0,
2709
+ /**
2710
+ * @en Stationary node
2711
+ * @zh 固定节点
2712
+ */
2713
+ Stationary = 1,
2714
+ /**
2715
+ * @en Movable node
2716
+ * @zh 可移动节点
2717
+ */
2718
+ Movable = 2
2719
+ }
2720
+
1706
2721
  declare interface ModuleRenderConfig {
1707
2722
  $schema?: string;
1708
2723
 
@@ -1729,6 +2744,66 @@ declare interface ModuleRenderConfig {
1729
2744
  */
1730
2745
  declare function moveAsset(source: string, target: string, options?: AssetOperationOption): Promise<any>;
1731
2746
 
2747
+ declare enum NodeEventType {
2748
+ TRANSFORM_CHANGED = 'transform-changed',// 节点改变位置、旋转或缩放事件
2749
+ SIZE_CHANGED = 'size-changed',// 当节点尺寸改变时触发的事件
2750
+ ANCHOR_CHANGED = 'anchor-changed',// 当节点锚点改变时触发的事件
2751
+ CHILD_ADDED = 'child-added',// 节点子类添加
2752
+ CHILD_REMOVED = 'child-removed',// 节点子类移除
2753
+ PARENT_CHANGED = 'parent-changed',// 父节点改变时触发的事件
2754
+ CHILD_CHANGED = 'child-changed',// 子节点改变时触发的事件
2755
+ COMPONENT_CHANGED = 'component-changed',// 组件数据发生改变时
2756
+ ACTIVE_IN_HIERARCHY_CHANGE = 'active-in-hierarchy-changed',// 节点在hierarchy是否激活
2757
+ NOTIFY_NODE_CHANGED = 'notify-node-changed',
2758
+ PREFAB_INFO_CHANGED = 'prefab-info-changed',// prefab数据改变
2759
+ LIGHT_PROBE_CHANGED = 'light-probe-changed',// 光照探针数据改变
2760
+ SET_PROPERTY = 'set-property',// 设置节点上的属性
2761
+ MOVE_ARRAY_ELEMENT = 'move-array-element',// 调整一个数组类型的数据内某个 item 的位置
2762
+ REMOVE_ARRAY_ELEMENT = 'remove-array-element',// 删除一个数组元素
2763
+ CREATE_COMPONENT = 'create-component',// 创建一个组件
2764
+ RESET_COMPONENT = 'reset-component'
2765
+ }
2766
+
2767
+ declare enum NodeType {
2768
+ EMPTY = 'Empty',// 空节点
2769
+ TERRAIN = 'Terrain',// 地形节点
2770
+ CAMERA = 'Camera',// 摄像机节点(需要用过 TWorkMode 来区分 2D 和 3D)
2771
+ SPRITE = 'Sprite',// 精灵节点(需要用过 TWorkMode 来区分 2D 和 3D)
2772
+ SPRITE_SPLASH = 'SpriteSplash',// 单色
2773
+ GRAPHICS = 'Graphics',// 图形节点
2774
+ LABEL = 'Label',// 文本节点
2775
+ MASK = 'Mask',// 遮罩节点
2776
+ PARTICLE = 'Particle',// 粒子节点(需要用过 TWorkMode 来区分 2D 和 3D)
2777
+ TILED_MAP = 'TiledMap',// 瓦片地图节点
2778
+ CAPSULE = 'Capsule',// 胶囊体节点
2779
+ CONE = 'Cone',// 圆锥体节点
2780
+ CUBE = 'Cube',// 立方体节点
2781
+ CYLINDER = 'Cylinder',// 圆柱体节点
2782
+ PLANE = 'Plane',// 平面节点
2783
+ QUAD = 'Quad',// 四边形节点
2784
+ SPHERE = 'Sphere',// 球体节点
2785
+ TORUS = 'Torus',// 圆环体节点
2786
+ BUTTON = 'Button',// 按钮节点
2787
+ CANVAS = 'Canvas',// 画布节点(需要用过 TWorkMode 来区分 2D 和 3D)
2788
+ EDIT_BOX = 'EditBox',// 输入框节点
2789
+ LAYOUT = 'Layout',// 布局节点
2790
+ PAGE_VIEW = 'PageView',// 页面视图节点
2791
+ PROGRESS_BAR = 'ProgressBar',// 进度条节点
2792
+ RICH_TEXT = 'RichText',// 富文本节点
2793
+ SCROLL_VIEW = 'ScrollView',// 滚动视图节点
2794
+ SLIDER = 'Slider',// 滑动条节点
2795
+ TOGGLE = 'Toggle',// 切换节点
2796
+ TOGGLE_GROUP = 'ToggleGroup',// 切换组节点
2797
+ VIDEO_PLAYER = 'VideoPlayer',// 视频播放器节点
2798
+ WEB_VIEW = 'WebView',// 网页视图节点
2799
+ WIDGET = 'Widget',// 小部件节点
2800
+ DIRECTIONAL_LIGHT = 'Light-Directional',// 平行光
2801
+ SPHERE_LIGHT = 'Light-Sphere',// 球面光
2802
+ SPOT_LIGHT = 'Light-Spot',// 聚光灯
2803
+ PROBE_LIGHT = 'Light-Probe-Group',// 光照探针
2804
+ REFLECTION_LIGHT = 'Light-Reflection-Probe'
2805
+ }
2806
+
1732
2807
  declare enum NormalImportSetting {
1733
2808
  /**
1734
2809
  * 如果模型文件中包含法线信息则导出法线,否则不导出法线。
@@ -1850,6 +2925,14 @@ declare function onReady(listener: () => void): () => void;
1850
2925
 
1851
2926
  declare function open_2(projectPath: string): Promise<void>;
1852
2927
 
2928
+ declare type OperationEvent = SceneDragEvent | SceneKeyboardEvent | SceneMouseEvent | 'resize';
2929
+
2930
+ declare enum OptimizationPolicy {
2931
+ AUTO = 0,
2932
+ SINGLE_INSTANCE = 1,
2933
+ MULTI_INSTANCE = 2
2934
+ }
2935
+
1853
2936
  /** 粒子资源的 userData */
1854
2937
  declare interface ParticleAssetUserData {
1855
2938
  totalParticles: number;
@@ -1928,6 +3011,13 @@ declare interface PrefabAssetUserData {
1928
3011
  syncNodeName?: string;
1929
3012
  }
1930
3013
 
3014
+ declare enum PrefabState {
3015
+ NotAPrefab = 0,// Normal node, not a Prefab
3016
+ PrefabChild = 1,// Child node of a Prefab, without PrefabInstance
3017
+ PrefabInstance = 2,// Root node of a Prefab that contains a PrefabInstance
3018
+ PrefabLostAsset = 3
3019
+ }
3020
+
1931
3021
  declare class ProgrammingFacet {
1932
3022
  private _packerDriverUpdateCount;
1933
3023
  private _asyncIteration;
@@ -2223,6 +3313,18 @@ declare function reimportAsset(pathOrUrlOrUUID: string): Promise<IAssetInfo>;
2223
3313
 
2224
3314
  declare function reload(): Promise<void>;
2225
3315
 
3316
+ /**
3317
+ * 重载结果
3318
+ */
3319
+ declare enum ReloadResult {
3320
+ SUCCESS = 0,
3321
+ FAILED = 1,
3322
+ QUEUED = 2,
3323
+ NO_EDITOR = 3,
3324
+ ASSET_NOT_FOUND = 4,
3325
+ EDITOR_NOT_FOUND = 5
3326
+ }
3327
+
2226
3328
  declare function remove(key: string, scope?: ConfigurationScope): Promise<boolean>;
2227
3329
 
2228
3330
  /**
@@ -2260,6 +3362,17 @@ export declare namespace Scene {
2260
3362
  };
2261
3363
  }
2262
3364
 
3365
+ /**
3366
+ * 场景模板类型
3367
+ */
3368
+ declare const SCENE_TEMPLATE_TYPE: readonly ['2d', '3d', 'quality'];
3369
+
3370
+ declare type SceneDragEvent = 'onDragLeave' | 'onDragOver' | 'onDrop';
3371
+
3372
+ declare type SceneKeyboardEvent = 'keydown' | 'keyup';
3373
+
3374
+ declare type SceneMouseEvent = 'dblclick' | 'mousedown' | 'mousemove' | 'mouseup' | 'mousewheel';
3375
+
2263
3376
  export declare namespace Scripting {
2264
3377
  export {
2265
3378
  init_7 as init,
@@ -2445,6 +3558,10 @@ declare enum TangentImportSetting {
2445
3558
  recalculate = 3
2446
3559
  }
2447
3560
 
3561
+ declare type TEditorEntity = IScene | INode;
3562
+
3563
+ declare type TEditorInstance = Scene_2 | Node_2;
3564
+
2448
3565
  declare interface Texture2DAssetUserData extends TextureBaseAssetUserData {
2449
3566
  isUuid?: boolean;
2450
3567
  imageUuidOrDatabaseUri?: string;
@@ -2487,6 +3604,8 @@ declare interface ThumbnailInfo {
2487
3604
 
2488
3605
  declare type ThumbnailSize = 'large' | 'small' | 'middle' | 'origin';
2489
3606
 
3607
+ declare type TSceneTemplateType = typeof SCENE_TEMPLATE_TYPE[number];
3608
+
2490
3609
  /**
2491
3610
  * Clean up MCP state.
2492
3611
  * Note: does NOT stop the Express server — use the Server module for that.
@@ -2503,6 +3622,24 @@ declare function updateAssetUserData(urlOrUuidOrPath: string, path: string, valu
2503
3622
  */
2504
3623
  declare function updateDefaultUserData(handler: string, path: string, value: any): Promise<void>;
2505
3624
 
3625
+ declare interface Vec2 {
3626
+ x: number;
3627
+ y: number;
3628
+ }
3629
+
3630
+ declare interface Vec3 {
3631
+ x: number;
3632
+ y: number;
3633
+ z: number;
3634
+ }
3635
+
3636
+ declare interface Vec4 {
3637
+ x: number;
3638
+ y: number;
3639
+ z: number;
3640
+ w: number;
3641
+ }
3642
+
2506
3643
  declare type WrapMode = 'repeat' | 'clamp-to-edge' | 'mirrored-repeat';
2507
3644
 
2508
3645
  export { };