@cocos/cocos-cli-types 0.0.1-alpha.22.1 → 0.0.1-alpha.22.2
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/assets.d.ts +13 -1
- package/builder.d.ts +1 -0
- package/configuration.d.ts +2 -0
- package/engine.d.ts +9 -0
- package/index.d.ts +28 -226
- package/package.json +1 -1
- package/service.d.ts +965 -38
package/service.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import { Camera } from 'cc';
|
|
1
2
|
import { default as cc_2 } from 'cc';
|
|
3
|
+
import { Color } from 'cc';
|
|
2
4
|
import { Component } from 'cc';
|
|
5
|
+
import { EventEmitter } from 'events';
|
|
3
6
|
import { GeometryRenderer as GeometryRenderer_2 } from 'cc';
|
|
7
|
+
import { gfx } from 'cc';
|
|
8
|
+
import { ISizeLike } from 'cc';
|
|
9
|
+
import { IVec3Like } from 'cc';
|
|
10
|
+
import { MeshRenderer } from 'cc';
|
|
4
11
|
import { Node as Node_2 } from 'cc';
|
|
12
|
+
import { Quat } from 'cc';
|
|
13
|
+
import { Rect } from 'cc';
|
|
5
14
|
import { Scene } from 'cc';
|
|
6
15
|
import { TransformBit } from 'cc';
|
|
7
16
|
import { Vec3 as Vec3_2 } from 'cc';
|
|
@@ -240,6 +249,292 @@ declare interface BitmapFontAssetUserData {
|
|
|
240
249
|
textureUuid: string;
|
|
241
250
|
}
|
|
242
251
|
|
|
252
|
+
declare class CameraController2D extends CameraControllerBase {
|
|
253
|
+
private _size;
|
|
254
|
+
private _modeFSM;
|
|
255
|
+
private _idleMode;
|
|
256
|
+
private _panMode;
|
|
257
|
+
private _lineColor;
|
|
258
|
+
private _grid;
|
|
259
|
+
private _contentRect;
|
|
260
|
+
private _scale2D;
|
|
261
|
+
protected _wheelSpeed: number;
|
|
262
|
+
protected _near: number;
|
|
263
|
+
protected _far: number;
|
|
264
|
+
private _spaceKeyHeld;
|
|
265
|
+
private _posAnim;
|
|
266
|
+
isMoving(): boolean;
|
|
267
|
+
get lineColor(): Color;
|
|
268
|
+
set lineColor(value: Color);
|
|
269
|
+
get grid(): Grid;
|
|
270
|
+
get contentRect(): Rect;
|
|
271
|
+
get scale2D(): number;
|
|
272
|
+
/**
|
|
273
|
+
* 同步 scale2D 到 Gizmo(如果可用)
|
|
274
|
+
*/
|
|
275
|
+
private setScale2D;
|
|
276
|
+
showGrid(visible: boolean): void;
|
|
277
|
+
init(camera: Camera): void;
|
|
278
|
+
private _initMode;
|
|
279
|
+
private _initGrid;
|
|
280
|
+
set active(value: boolean);
|
|
281
|
+
private _adjustToCenter;
|
|
282
|
+
private _fitSizeCalc;
|
|
283
|
+
private _getSizeScale;
|
|
284
|
+
adjustCamera(immediate?: boolean): void;
|
|
285
|
+
private _updateOrthoHeight;
|
|
286
|
+
private _updateGridData;
|
|
287
|
+
updateGrid(): void;
|
|
288
|
+
private initOriginAxis;
|
|
289
|
+
updateOriginAxisByConfig(config: {
|
|
290
|
+
x?: boolean;
|
|
291
|
+
y?: boolean;
|
|
292
|
+
}, update?: boolean): void;
|
|
293
|
+
updateOriginAxis(): void;
|
|
294
|
+
focus(nodeUuids: string[], editorCameraInfo?: EditorCameraInfo, immediate?: boolean): void;
|
|
295
|
+
smoothScale(delta: number, curScale: number): number;
|
|
296
|
+
scale(delta: number, offsetX?: number, offsetY?: number): void;
|
|
297
|
+
fitSize(rect: Rect): void;
|
|
298
|
+
onMouseDown(event: ISceneMouseEvent): void;
|
|
299
|
+
onMouseMove(event: ISceneMouseEvent): void;
|
|
300
|
+
onMouseUp(event: ISceneMouseEvent): void;
|
|
301
|
+
onMouseWheel(event: ISceneMouseEvent): void;
|
|
302
|
+
onMouseDBlDown(event: ISceneMouseEvent): void;
|
|
303
|
+
onKeyDown(event: ISceneKeyboardEvent): void;
|
|
304
|
+
onKeyUp(event: ISceneKeyboardEvent): void;
|
|
305
|
+
onUpdate(deltaTime: number): void;
|
|
306
|
+
onResize(size?: ISizeLike): void;
|
|
307
|
+
refresh(): void;
|
|
308
|
+
zoomTo(scaleValue: number): void;
|
|
309
|
+
zoomUp(): void;
|
|
310
|
+
zoomDown(): void;
|
|
311
|
+
zoomReset(): void;
|
|
312
|
+
onDesignResolutionChange(): void;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
declare class CameraController3D extends CameraControllerBase {
|
|
316
|
+
protected _wheelSpeed: number;
|
|
317
|
+
protected _near: number;
|
|
318
|
+
protected _far: number;
|
|
319
|
+
private _orthoScale;
|
|
320
|
+
private _minScalar;
|
|
321
|
+
homePos: Vec3_2;
|
|
322
|
+
homeRot: Quat;
|
|
323
|
+
sceneViewCenter: Vec3_2;
|
|
324
|
+
viewDist: number;
|
|
325
|
+
forward: Vec3_2;
|
|
326
|
+
private _curRot;
|
|
327
|
+
private _curEye;
|
|
328
|
+
private _lineColor;
|
|
329
|
+
private v3a;
|
|
330
|
+
private v3b;
|
|
331
|
+
private q1;
|
|
332
|
+
lastMouseWheelDeltaY: number;
|
|
333
|
+
maxMouseWheelDeltaY: number;
|
|
334
|
+
private _modeFSM;
|
|
335
|
+
private _idleMode;
|
|
336
|
+
private _orbitMode;
|
|
337
|
+
private _panMode;
|
|
338
|
+
private _wanderMode;
|
|
339
|
+
view?: number;
|
|
340
|
+
private hTicks;
|
|
341
|
+
private vTicks;
|
|
342
|
+
shiftKey?: boolean;
|
|
343
|
+
altKey?: boolean;
|
|
344
|
+
mousePressing: boolean;
|
|
345
|
+
lastFocusNodeUUID: string[];
|
|
346
|
+
private _posAnim;
|
|
347
|
+
private _rotAnim;
|
|
348
|
+
private _distAnim;
|
|
349
|
+
constructor();
|
|
350
|
+
init(camera: Camera): void;
|
|
351
|
+
showGrid(visible: boolean): void;
|
|
352
|
+
private initOriginAxis;
|
|
353
|
+
updateOriginAxisByConfig(config: {
|
|
354
|
+
x?: boolean;
|
|
355
|
+
y?: boolean;
|
|
356
|
+
z?: boolean;
|
|
357
|
+
}, update?: boolean): void;
|
|
358
|
+
getOriginAxisData(): {
|
|
359
|
+
minH: number;
|
|
360
|
+
maxH: number;
|
|
361
|
+
minV: number;
|
|
362
|
+
maxV: number;
|
|
363
|
+
yDist: number;
|
|
364
|
+
};
|
|
365
|
+
updateOriginAxisHorizontal(): void;
|
|
366
|
+
updateOriginAxisVertical(): void;
|
|
367
|
+
updateOriginAxis(): void;
|
|
368
|
+
private _initMode;
|
|
369
|
+
private _initLinearTick;
|
|
370
|
+
set active(value: boolean);
|
|
371
|
+
get wanderSpeed(): number;
|
|
372
|
+
set wanderSpeed(value: number);
|
|
373
|
+
get enableAcceleration(): boolean;
|
|
374
|
+
set enableAcceleration(value: boolean);
|
|
375
|
+
changeMode(command: string): Promise<void>;
|
|
376
|
+
reset(): void;
|
|
377
|
+
updateViewCenterByDist(viewDist: number): void;
|
|
378
|
+
scale(delta: number): void;
|
|
379
|
+
smoothScale(delta: number): void;
|
|
380
|
+
focusByNode(nodes: Node_2[], notChangeDist?: boolean, immediate?: boolean): void;
|
|
381
|
+
focus(nodeUuids: string[], editorCameraInfo?: EditorCameraInfo, immediate?: boolean): void;
|
|
382
|
+
focusByXY(hitPoint: Vec3_2, immediate?: boolean): void;
|
|
383
|
+
alignNodeToSceneView(nodeUuids: string[]): void;
|
|
384
|
+
alignCameraOrthoHeightToNode(cameras: Camera[]): void;
|
|
385
|
+
alignSceneViewToNode(nodeUuids: string[]): void;
|
|
386
|
+
isMoving(): boolean;
|
|
387
|
+
onMouseDBlDown(event: ISceneMouseEvent): void;
|
|
388
|
+
onMouseDown(event: ISceneMouseEvent): void;
|
|
389
|
+
onMouseMove(event: ISceneMouseEvent): void;
|
|
390
|
+
onMouseUp(event: ISceneMouseEvent): void;
|
|
391
|
+
onMouseWheel(event: ISceneMouseEvent): void;
|
|
392
|
+
onKeyDown(event: ISceneKeyboardEvent): void;
|
|
393
|
+
onKeyUp(event: ISceneKeyboardEvent): void;
|
|
394
|
+
onUpdate(deltaTime: number): void;
|
|
395
|
+
onResize(size: ISizeLike): void;
|
|
396
|
+
private _updateGridData;
|
|
397
|
+
updateGrid(): void;
|
|
398
|
+
refresh(): void;
|
|
399
|
+
rotateCameraToDir(dir: Vec3_2, rotateByViewDist: boolean): void;
|
|
400
|
+
getDepthSize(): number;
|
|
401
|
+
calcCameraPosInOrtho(): Vec3_2;
|
|
402
|
+
isOrtho(): boolean;
|
|
403
|
+
setOrthoHeight(newOrthoHeight: number): void;
|
|
404
|
+
changeProjection(): void;
|
|
405
|
+
zoomUp(): void;
|
|
406
|
+
zoomDown(): void;
|
|
407
|
+
zoomReset(): void;
|
|
408
|
+
onDesignResolutionChange(): void;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
declare abstract class CameraControllerBase extends EventEmitter {
|
|
412
|
+
protected _camera: Camera;
|
|
413
|
+
protected camera_move_mode: CameraMoveMode;
|
|
414
|
+
protected _gridMeshComp: MeshRenderer;
|
|
415
|
+
protected _originAxisHorizontalMeshComp: MeshRenderer;
|
|
416
|
+
protected _originAxisVerticalMeshComp: MeshRenderer;
|
|
417
|
+
node: Node_2;
|
|
418
|
+
protected _isGridVisible: boolean;
|
|
419
|
+
protected originAxisX_Visible: boolean;
|
|
420
|
+
protected originAxisY_Visible: boolean;
|
|
421
|
+
protected originAxisZ_Visible: boolean;
|
|
422
|
+
protected readonly originAxisX_Color: Color;
|
|
423
|
+
protected readonly originAxisY_Color: Color;
|
|
424
|
+
protected readonly originAxisZ_Color: Color;
|
|
425
|
+
protected _near: number;
|
|
426
|
+
protected _far: number;
|
|
427
|
+
protected _wheelSpeed: number;
|
|
428
|
+
protected _wheelBaseScale: number;
|
|
429
|
+
get near(): number;
|
|
430
|
+
set near(value: number);
|
|
431
|
+
get far(): number;
|
|
432
|
+
set far(value: number);
|
|
433
|
+
get wheelSpeed(): number;
|
|
434
|
+
set wheelSpeed(value: number);
|
|
435
|
+
init(camera: Camera): void;
|
|
436
|
+
focus(nodes: string[], editorCameraInfo?: EditorCameraInfo, immediate?: boolean): void;
|
|
437
|
+
alignNodeToSceneView(nodes: string[]): void;
|
|
438
|
+
alignSceneViewToNode(nodes: string[]): void;
|
|
439
|
+
abstract isMoving(): boolean;
|
|
440
|
+
onMouseDBlDown(event: any): void;
|
|
441
|
+
onMouseDown(event: any): void;
|
|
442
|
+
onMouseMove(event: any): void;
|
|
443
|
+
onMouseUp(event: any): void;
|
|
444
|
+
onMouseWheel(event: any): void;
|
|
445
|
+
onKeyDown(event: any): void;
|
|
446
|
+
onKeyUp(event: any): void;
|
|
447
|
+
onResize(size: ISizeLike): void;
|
|
448
|
+
onUpdate(deltaTime: number): void;
|
|
449
|
+
onDesignResolutionChange(): void;
|
|
450
|
+
refresh(): void;
|
|
451
|
+
updateGrid(): void;
|
|
452
|
+
showGrid(visible: boolean): void;
|
|
453
|
+
set isGridVisible(value: boolean);
|
|
454
|
+
get isGridVisible(): boolean;
|
|
455
|
+
set active(_value: boolean);
|
|
456
|
+
rotateCameraToDir(dir: Vec3_2, rotateByViewDist: boolean): void;
|
|
457
|
+
changeProjection(): void;
|
|
458
|
+
zoomUp(): void;
|
|
459
|
+
zoomDown(): void;
|
|
460
|
+
zoomReset(): void;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
declare enum CameraMoveMode {
|
|
464
|
+
IDLE = 0,
|
|
465
|
+
ORBIT = 1,
|
|
466
|
+
PAN = 2,
|
|
467
|
+
ZOOM = 3,
|
|
468
|
+
WANDER = 4
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* 相机服务,管理编辑器相机的 2D/3D 控制器切换、输入事件绑定和相机属性
|
|
473
|
+
*/
|
|
474
|
+
export declare class CameraService extends BaseService<ICameraEvents> implements ICameraService {
|
|
475
|
+
private _controller2D;
|
|
476
|
+
private _controller3D;
|
|
477
|
+
private _controller;
|
|
478
|
+
private _camera;
|
|
479
|
+
private _controllerFirstChange;
|
|
480
|
+
private _currentUuid;
|
|
481
|
+
private _cameraInfos;
|
|
482
|
+
get controller2D(): CameraController2D;
|
|
483
|
+
get controller3D(): CameraController3D;
|
|
484
|
+
get controller(): CameraControllerBase;
|
|
485
|
+
get camera(): EditorCameraComponent;
|
|
486
|
+
set is2D(value: boolean);
|
|
487
|
+
get is2D(): boolean;
|
|
488
|
+
init(): void;
|
|
489
|
+
/**
|
|
490
|
+
* 场景就绪时调用,创建编辑器相机并初始化控制器
|
|
491
|
+
*/
|
|
492
|
+
onEditorOpened(): void;
|
|
493
|
+
initFromConfig(): Promise<void>;
|
|
494
|
+
private bindOperation;
|
|
495
|
+
focus(nodes?: string[] | null, editorCameraInfo?: any, immediate?: boolean): void;
|
|
496
|
+
defaultFocus(uuid: string): void;
|
|
497
|
+
rotateCameraToDir(dir: Vec3_2, rotateByViewDist: boolean): void;
|
|
498
|
+
changeProjection(): void;
|
|
499
|
+
setGridVisible(value: boolean): void;
|
|
500
|
+
isGridVisible(): boolean;
|
|
501
|
+
setCameraProperty(options: any): void;
|
|
502
|
+
resetCameraProperty(): void;
|
|
503
|
+
getCameraFov(): number;
|
|
504
|
+
zoomUp(): void;
|
|
505
|
+
zoomDown(): void;
|
|
506
|
+
zoomReset(): void;
|
|
507
|
+
alignNodeToSceneView(nodes: string[]): void;
|
|
508
|
+
alignSceneViewToNode(nodes: string[]): void;
|
|
509
|
+
onUpdate(deltaTime: number): void;
|
|
510
|
+
private onMouseDBlDown;
|
|
511
|
+
private onMouseDown;
|
|
512
|
+
private onMouseMove;
|
|
513
|
+
private onMouseUp;
|
|
514
|
+
private onMouseWheel;
|
|
515
|
+
private onKeyDown;
|
|
516
|
+
private onKeyUp;
|
|
517
|
+
onResize(size: any): void;
|
|
518
|
+
refresh(): void;
|
|
519
|
+
getCamera(): EditorCameraComponent;
|
|
520
|
+
/**
|
|
521
|
+
* 与原始编辑器 ScenePreview.detachSceneCameras 一致:
|
|
522
|
+
* 将所有非编辑器的场景相机从渲染管线中移除,并设置 tempWindow
|
|
523
|
+
* 使后续新建的相机默认渲染到离屏窗口,不干扰编辑器相机。
|
|
524
|
+
*/
|
|
525
|
+
private _detachSceneCameras;
|
|
526
|
+
/**
|
|
527
|
+
* 新增的 Camera 组件也需要 detach,与原始编辑器 ScenePreview.onComponentAdded 一致
|
|
528
|
+
*/
|
|
529
|
+
detachNewSceneCamera(comp: any): void;
|
|
530
|
+
private _focusOnSceneContent;
|
|
531
|
+
/**
|
|
532
|
+
* 场景保存时调用,可通过 RPC 持久化相机配置
|
|
533
|
+
*/
|
|
534
|
+
onEditorSaved(): void;
|
|
535
|
+
onComponentAdded(comp: any): void;
|
|
536
|
+
}
|
|
537
|
+
|
|
243
538
|
/**
|
|
244
539
|
* 子进程节点处理器
|
|
245
540
|
* 在子进程中处理所有节点相关操作
|
|
@@ -269,21 +564,28 @@ export declare class ComponentService extends BaseService<IComponentEvents> impl
|
|
|
269
564
|
checkComponentsCollision(node: Node_2): Promise<void>;
|
|
270
565
|
checkDynamicBodyShape(ndoe: Node_2): void;
|
|
271
566
|
/**
|
|
272
|
-
* 通过 path
|
|
567
|
+
* 通过 path 查找组件实例,支持路径、UUID 或 URL
|
|
273
568
|
*/
|
|
274
569
|
private findComponent;
|
|
275
570
|
removeComponent(params: IRemoveComponentOptions): Promise<boolean>;
|
|
276
|
-
|
|
277
|
-
|
|
571
|
+
queryComponentImpl(params: IQueryComponentOptions, isEditor?: boolean): Promise<IComponent | IComponentForEditor | null>;
|
|
572
|
+
queryComponent(params: IQueryComponentOptions | string): Promise<IComponent | IComponentForEditor | null>;
|
|
573
|
+
setPropertyForCli(options: ISetPropertyOptions): Promise<boolean>;
|
|
574
|
+
setProperty(options: ISetPropertyOptions | ISetPropertyOptionsForEditor): Promise<boolean>;
|
|
278
575
|
/**
|
|
279
576
|
* 查询一个节点的实例
|
|
280
577
|
* @param {*} uuid
|
|
281
578
|
* @return {cc.Node}
|
|
282
579
|
*/
|
|
283
580
|
query(uuid: string | undefined): Node_2 | null;
|
|
284
|
-
|
|
581
|
+
setPropertyForEditor(options: ISetPropertyOptionsForEditor): Promise<boolean>;
|
|
285
582
|
private setPropertyImp;
|
|
286
583
|
queryAllComponent(): Promise<string[]>;
|
|
584
|
+
queryComponentHasScript(name: string): Promise<boolean>;
|
|
585
|
+
queryClasses(options?: IQueryClassesOptions): Promise<{
|
|
586
|
+
name: string;
|
|
587
|
+
}[]>;
|
|
588
|
+
queryComponentFunctionOfNode(uuid: string): Promise<any>;
|
|
287
589
|
init(): void;
|
|
288
590
|
private readonly CompMgrEventHandlers;
|
|
289
591
|
private compMgrEventHandlers;
|
|
@@ -329,6 +631,44 @@ declare interface DirectoryAssetUserData {
|
|
|
329
631
|
priority?: number;
|
|
330
632
|
}
|
|
331
633
|
|
|
634
|
+
declare class EditorCameraComponent extends Camera {
|
|
635
|
+
private _uiEditorGizmoCamera;
|
|
636
|
+
set projection(val: number);
|
|
637
|
+
get projection(): number;
|
|
638
|
+
set fov(val: number);
|
|
639
|
+
get fov(): number;
|
|
640
|
+
set orthoHeight(val: number);
|
|
641
|
+
get orthoHeight(): number;
|
|
642
|
+
set near(val: number);
|
|
643
|
+
get near(): number;
|
|
644
|
+
set far(val: number);
|
|
645
|
+
get far(): number;
|
|
646
|
+
set clearColor(val: Color);
|
|
647
|
+
get clearColor(): Color;
|
|
648
|
+
set clearDepth(val: number);
|
|
649
|
+
get clearDepth(): number;
|
|
650
|
+
set clearStencil(val: number);
|
|
651
|
+
get clearStencil(): number;
|
|
652
|
+
set clearFlags(val: gfx.ClearFlags);
|
|
653
|
+
get clearFlags(): gfx.ClearFlags;
|
|
654
|
+
set rect(val: Rect);
|
|
655
|
+
get rect(): Rect;
|
|
656
|
+
set screenScale(val: number);
|
|
657
|
+
get screenScale(): number;
|
|
658
|
+
onLoad(): void;
|
|
659
|
+
onEnable(): void;
|
|
660
|
+
onDisable(): void;
|
|
661
|
+
onDestroy(): void;
|
|
662
|
+
_createCamera(): void;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
declare interface EditorCameraInfo {
|
|
666
|
+
position?: Vec3_2;
|
|
667
|
+
rotation?: Quat;
|
|
668
|
+
viewCenter?: Vec3_2;
|
|
669
|
+
viewDist?: number;
|
|
670
|
+
}
|
|
671
|
+
|
|
332
672
|
/**
|
|
333
673
|
* EditorAsset - 统一的编辑器管理入口
|
|
334
674
|
* 作为调度器,根据资源类型动态创建和管理编辑器实例
|
|
@@ -458,6 +798,122 @@ declare class GeometryRenderer {
|
|
|
458
798
|
*/
|
|
459
799
|
export declare function getServiceAll(): any[];
|
|
460
800
|
|
|
801
|
+
export declare class GizmoService extends BaseService<IGizmoEvents> implements IGizmoService {
|
|
802
|
+
gizmoRootNode: Node_2;
|
|
803
|
+
foregroundNode: Node_2;
|
|
804
|
+
backgroundNode: Node_2;
|
|
805
|
+
transformToolData: TransformToolData;
|
|
806
|
+
private _gizmoOperation;
|
|
807
|
+
private _iconVisible;
|
|
808
|
+
private _selection;
|
|
809
|
+
private _componentPool;
|
|
810
|
+
private _iconPool;
|
|
811
|
+
private _persistentPool;
|
|
812
|
+
get transformToolName(): string;
|
|
813
|
+
get isViewMode(): boolean;
|
|
814
|
+
init(): void;
|
|
815
|
+
initFromConfig(): Promise<void>;
|
|
816
|
+
saveConfig(): Promise<void>;
|
|
817
|
+
changeTool(name: string): void;
|
|
818
|
+
setCoordinate(coord: 'local' | 'global'): void;
|
|
819
|
+
setPivot(pivot: 'pivot' | 'center'): void;
|
|
820
|
+
lockGizmoTool(locked: boolean): void;
|
|
821
|
+
setIconVisible(visible: boolean): void;
|
|
822
|
+
private _getPool;
|
|
823
|
+
private _createGizmo;
|
|
824
|
+
private _showGizmo;
|
|
825
|
+
private _hideGizmo;
|
|
826
|
+
private _removeGizmo;
|
|
827
|
+
showAllGizmoOfNode(node: Node_2, recursive?: boolean): void;
|
|
828
|
+
removeAllGizmoOfNode(node: Node_2, recursive?: boolean): void;
|
|
829
|
+
clearAllGizmos(): void;
|
|
830
|
+
callAllGizmoFuncOfNode(node: Node_2, funcName: string, ...params: any[]): boolean;
|
|
831
|
+
onSelectionSelect(uuid: string): void;
|
|
832
|
+
onSelectionUnselect(uuid: string): void;
|
|
833
|
+
onSelectionClear(): void;
|
|
834
|
+
private _onNodeSelectionChanged;
|
|
835
|
+
onEditorOpened(): void;
|
|
836
|
+
onSceneOpened(): void;
|
|
837
|
+
onSceneClosed(): void;
|
|
838
|
+
onNodeChanged(node: Node_2): void;
|
|
839
|
+
onComponentAdded(comp: Component): void;
|
|
840
|
+
onComponentRemoved(comp: Component): void;
|
|
841
|
+
onNodeAdded(node: Node_2): void;
|
|
842
|
+
onNodeRemoved(node: Node_2): void;
|
|
843
|
+
private _showIconGizmosForScene;
|
|
844
|
+
private _walkSceneForIcons;
|
|
845
|
+
onUpdate(deltaTime: number): void;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
export declare const globalEventEmitter: EventEmitter<[never]>;
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* 全局事件管理器
|
|
852
|
+
* 统一管理所有服务的事件监听,支持类型安全的事件订阅
|
|
853
|
+
*/
|
|
854
|
+
declare class GlobalEventManager {
|
|
855
|
+
/**
|
|
856
|
+
* 监听指定类型的事件(类型安全版本)
|
|
857
|
+
* @param event 事件名称
|
|
858
|
+
* @param listener 事件监听器
|
|
859
|
+
*/
|
|
860
|
+
on<TEvents extends Record<string, any>>(event: keyof TEvents, listener: TEvents[keyof TEvents] extends void ? () => void : (payload: TEvents[keyof TEvents]) => void): void;
|
|
861
|
+
/**
|
|
862
|
+
* 监听指定类型的事件(通用版本)
|
|
863
|
+
* @param event 事件名称
|
|
864
|
+
* @param listener 事件监听器
|
|
865
|
+
*/
|
|
866
|
+
on(event: string, listener: (...args: any[]) => void): void;
|
|
867
|
+
/**
|
|
868
|
+
* 监听指定类型的事件(一次性,类型安全版本)
|
|
869
|
+
* @param event 事件名称
|
|
870
|
+
* @param listener 事件监听器
|
|
871
|
+
*/
|
|
872
|
+
once<TEvents extends Record<string, any>>(event: keyof TEvents, listener: TEvents[keyof TEvents] extends void ? () => void : (payload: TEvents[keyof TEvents]) => void): void;
|
|
873
|
+
/**
|
|
874
|
+
* 监听指定类型的事件(一次性,通用版本)
|
|
875
|
+
* @param event 事件名称
|
|
876
|
+
* @param listener 事件监听器
|
|
877
|
+
*/
|
|
878
|
+
once(event: string, listener: (...args: any[]) => void): void;
|
|
879
|
+
/**
|
|
880
|
+
* 移除指定类型的事件监听器(类型安全版本)
|
|
881
|
+
* @param event 事件名称
|
|
882
|
+
* @param listener 事件监听器
|
|
883
|
+
*/
|
|
884
|
+
off<TEvents extends Record<string, any>>(event: keyof TEvents, listener: TEvents[keyof TEvents] extends void ? () => void : (payload: TEvents[keyof TEvents]) => void): void;
|
|
885
|
+
/**
|
|
886
|
+
* 移除事件监听器(通用版本)
|
|
887
|
+
* @param event 事件名称
|
|
888
|
+
* @param listener 事件监听器
|
|
889
|
+
*/
|
|
890
|
+
off(event: string, listener: (...args: any[]) => void): void;
|
|
891
|
+
/**
|
|
892
|
+
* 发射指定类型的事件(类型安全版本)
|
|
893
|
+
* @param event 事件名称
|
|
894
|
+
* @param args 事件参数
|
|
895
|
+
*/
|
|
896
|
+
emit<TEvents extends Record<string, any>>(event: keyof TEvents, ...args: TEvents[keyof TEvents]): void;
|
|
897
|
+
/**
|
|
898
|
+
* 触发事件(通用版本)
|
|
899
|
+
* @param event 事件名称
|
|
900
|
+
* @param args 事件参数
|
|
901
|
+
*/
|
|
902
|
+
emit(event: string, ...args: any[]): void;
|
|
903
|
+
/**
|
|
904
|
+
* 跨进程广播,传的参数需要能被序列化
|
|
905
|
+
* @param event 事件名称
|
|
906
|
+
* @param args 事件参数
|
|
907
|
+
*/
|
|
908
|
+
broadcast<TEvents extends Record<string, any>>(event: keyof TEvents, ...args: TEvents[keyof TEvents]): void;
|
|
909
|
+
broadcast(event: string, ...args: any[]): void;
|
|
910
|
+
/**
|
|
911
|
+
* 清除事件监听器
|
|
912
|
+
* @param event 事件名称,如果不提供则清除所有
|
|
913
|
+
*/
|
|
914
|
+
clear(event?: string): void;
|
|
915
|
+
}
|
|
916
|
+
|
|
461
917
|
/** glTF 动画资源的 userData */
|
|
462
918
|
declare interface GltfAnimationAssetUserData {
|
|
463
919
|
gltfIndex: number;
|
|
@@ -639,8 +1095,54 @@ declare interface GlTFUserData {
|
|
|
639
1095
|
};
|
|
640
1096
|
}
|
|
641
1097
|
|
|
1098
|
+
declare class Grid {
|
|
1099
|
+
private _canvasWidth;
|
|
1100
|
+
private _canvasHeight;
|
|
1101
|
+
hTicks: LinearTicks | null;
|
|
1102
|
+
xAxisScale: number;
|
|
1103
|
+
xAxisOffset: number;
|
|
1104
|
+
xAnchor: number;
|
|
1105
|
+
vTicks: LinearTicks | null;
|
|
1106
|
+
yAxisScale: number;
|
|
1107
|
+
yAxisOffset: number;
|
|
1108
|
+
yAnchor: number;
|
|
1109
|
+
private _xAnchorOffset;
|
|
1110
|
+
private _yAnchorOffset;
|
|
1111
|
+
pixelToValueH: Function | null;
|
|
1112
|
+
valueToPixelH: Function | null;
|
|
1113
|
+
pixelToValueV: Function | null;
|
|
1114
|
+
valueToPixelV: Function | null;
|
|
1115
|
+
xDirection: number;
|
|
1116
|
+
yDirection: number;
|
|
1117
|
+
xMinRange: number | null;
|
|
1118
|
+
xMaxRange: number | null;
|
|
1119
|
+
yMinRange: number | null;
|
|
1120
|
+
yMaxRange: number | null;
|
|
1121
|
+
constructor(canvasWidth: number, canvasHeight: number);
|
|
1122
|
+
get canvasWidth(): number;
|
|
1123
|
+
get canvasHeight(): number;
|
|
1124
|
+
setAnchor(x: number, y: number): void;
|
|
1125
|
+
setScaleH(lods: number[], minScale: number, maxScale: number): void;
|
|
1126
|
+
setMappingH(minValue: number, maxValue: number, pixelRange: number): void;
|
|
1127
|
+
setScaleV(lods: number[], minScale: number, maxScale: number): void;
|
|
1128
|
+
setMappingV(minValue: number, maxValue: number, pixelRange: number): void;
|
|
1129
|
+
pan(deltaPixelX: number, deltaPixelY: number): void;
|
|
1130
|
+
panX(deltaPixelX: number): void;
|
|
1131
|
+
panY(deltaPixelY: number): void;
|
|
1132
|
+
xAxisScaleAt(pixelX: number, scale: number): void;
|
|
1133
|
+
yAxisScaleAt(pixelY: number, scale: number): void;
|
|
1134
|
+
xAxisSync(x: number, scaleX: number): void;
|
|
1135
|
+
yAxisSync(y: number, scaleY: number): void;
|
|
1136
|
+
resize(w: number, h: number): void;
|
|
1137
|
+
get left(): any;
|
|
1138
|
+
get right(): any;
|
|
1139
|
+
get top(): any;
|
|
1140
|
+
get bottom(): any;
|
|
1141
|
+
updateRange(): void;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
642
1144
|
/**
|
|
643
|
-
*
|
|
1145
|
+
* 添加/创建组件的选项
|
|
644
1146
|
*/
|
|
645
1147
|
declare interface IAddComponentOptions {
|
|
646
1148
|
nodePathOrUuid: string;
|
|
@@ -693,6 +1195,7 @@ declare interface IAssetInfo {
|
|
|
693
1195
|
mtime?: number; // 资源文件的 mtime
|
|
694
1196
|
depends?: string[]; // 依赖的资源 uuid 信息
|
|
695
1197
|
dependeds?: string[]; // 被依赖的资源 uuid 信息
|
|
1198
|
+
temp?: string; // 资源临时文件目录
|
|
696
1199
|
}
|
|
697
1200
|
|
|
698
1201
|
declare interface IAssetMeta<T extends ISupportCreateType | 'unknown' = 'unknown'> {
|
|
@@ -771,6 +1274,33 @@ declare interface IBaseIdentifier {
|
|
|
771
1274
|
assetType: string;
|
|
772
1275
|
}
|
|
773
1276
|
|
|
1277
|
+
declare interface ICameraEvents {
|
|
1278
|
+
'camera:mode-change': [mode: number];
|
|
1279
|
+
'camera:fov-changed': [fov: number];
|
|
1280
|
+
'camera:projection-changed': [projection: number];
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
declare interface ICameraService {
|
|
1284
|
+
init(): void;
|
|
1285
|
+
initFromConfig(): Promise<void>;
|
|
1286
|
+
is2D: boolean;
|
|
1287
|
+
focus(nodes?: string[] | null, editorCameraInfo?: any, immediate?: boolean): void;
|
|
1288
|
+
defaultFocus(uuid: string): void;
|
|
1289
|
+
rotateCameraToDir(dir: Vec3_2, rotateByViewDist: boolean): void;
|
|
1290
|
+
changeProjection(): void;
|
|
1291
|
+
setGridVisible(value: boolean): void;
|
|
1292
|
+
isGridVisible(): boolean;
|
|
1293
|
+
setCameraProperty(options: any): void;
|
|
1294
|
+
resetCameraProperty(): void;
|
|
1295
|
+
getCameraFov(): number;
|
|
1296
|
+
zoomUp(): void;
|
|
1297
|
+
zoomDown(): void;
|
|
1298
|
+
zoomReset(): void;
|
|
1299
|
+
alignNodeToSceneView(nodes: string[]): void;
|
|
1300
|
+
alignSceneViewToNode(nodes: string[]): void;
|
|
1301
|
+
onUpdate(deltaTime: number): void;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
774
1304
|
declare interface IChangeNodeOptions {
|
|
775
1305
|
source?: 'editor' | 'undo' | 'engine';
|
|
776
1306
|
type?: NodeEventType;
|
|
@@ -788,7 +1318,7 @@ declare interface ICloseOptions {
|
|
|
788
1318
|
}
|
|
789
1319
|
|
|
790
1320
|
/**
|
|
791
|
-
*
|
|
1321
|
+
* CLI 使用的组件信息,属性值以扁平的 key-value 形式呈现
|
|
792
1322
|
*/
|
|
793
1323
|
declare interface IComponent extends IComponentIdentifier {
|
|
794
1324
|
properties: {
|
|
@@ -798,7 +1328,7 @@ declare interface IComponent extends IComponentIdentifier {
|
|
|
798
1328
|
}
|
|
799
1329
|
|
|
800
1330
|
/**
|
|
801
|
-
*
|
|
1331
|
+
* 组件相关事件类型
|
|
802
1332
|
*/
|
|
803
1333
|
declare interface IComponentEvents extends INodeEvents {
|
|
804
1334
|
'component:add': [Component];
|
|
@@ -810,7 +1340,11 @@ declare interface IComponentEvents extends INodeEvents {
|
|
|
810
1340
|
'component:before-add-component': [string, Node_2];
|
|
811
1341
|
}
|
|
812
1342
|
|
|
813
|
-
|
|
1343
|
+
/**
|
|
1344
|
+
* 编辑器使用的组件详细信息,属性值以 IProperty 编码形式呈现,
|
|
1345
|
+
* 包含 type、readonly、default 等元信息,用于编辑器 Inspector 面板渲染
|
|
1346
|
+
*/
|
|
1347
|
+
declare interface IComponentForEditor extends IProperty {
|
|
814
1348
|
value: {
|
|
815
1349
|
enabled: IPropertyValueType;
|
|
816
1350
|
uuid: IPropertyValueType;
|
|
@@ -820,7 +1354,7 @@ declare interface IComponentForPinK extends IProperty {
|
|
|
820
1354
|
}
|
|
821
1355
|
|
|
822
1356
|
/**
|
|
823
|
-
*
|
|
1357
|
+
* 组件标识信息,包含组件的基本标识字段
|
|
824
1358
|
*/
|
|
825
1359
|
declare interface IComponentIdentifier {
|
|
826
1360
|
cid: string;
|
|
@@ -832,50 +1366,139 @@ declare interface IComponentIdentifier {
|
|
|
832
1366
|
}
|
|
833
1367
|
|
|
834
1368
|
/**
|
|
835
|
-
*
|
|
1369
|
+
* 组件服务接口,定义了所有组件相关的操作方法
|
|
836
1370
|
*/
|
|
837
1371
|
declare interface IComponentService extends IServiceEvents {
|
|
838
1372
|
/**
|
|
839
|
-
*
|
|
840
|
-
* @param params
|
|
1373
|
+
* 添加组件到指定节点,返回添加后的组件信息
|
|
1374
|
+
* @param params - 添加组件选项
|
|
1375
|
+
* @param params.nodePathOrUuid - 目标节点路径或 UUID
|
|
1376
|
+
* @param params.component - 组件类名,支持精确匹配('cc.Label')和模糊匹配('label')
|
|
1377
|
+
* @returns 添加成功后的组件信息
|
|
1378
|
+
*
|
|
1379
|
+
* @example
|
|
1380
|
+
* ```ts
|
|
1381
|
+
* // 通过节点路径 + 精确组件名
|
|
1382
|
+
* const comp = await addComponent({ nodePathOrUuid: 'Canvas/MyNode', component: 'cc.Label' });
|
|
1383
|
+
*
|
|
1384
|
+
* // 通过节点 UUID + 模糊组件名
|
|
1385
|
+
* const comp = await addComponent({ nodePathOrUuid: 'abc-123-uuid', component: 'label' });
|
|
1386
|
+
* ```
|
|
841
1387
|
*/
|
|
842
1388
|
addComponent(params: IAddComponentOptions): Promise<IComponent>;
|
|
843
1389
|
/**
|
|
844
|
-
*
|
|
845
|
-
* @param params
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* 删除组件
|
|
850
|
-
* @param params
|
|
1390
|
+
* 删除指定组件
|
|
1391
|
+
* @param params - 删除组件选项
|
|
1392
|
+
* @param params.path - 组件路径,支持路径、UUID 或资源 URL
|
|
1393
|
+
* @returns 删除成功返回 true,失败返回 false
|
|
851
1394
|
*/
|
|
852
1395
|
removeComponent(params: IRemoveComponentOptions): Promise<boolean>;
|
|
853
1396
|
/**
|
|
854
1397
|
* 设置组件属性
|
|
855
|
-
*
|
|
1398
|
+
* - CLI 调用时传入 ISetPropertyOptions,通过 componentPath 定位,属性为扁平键值对
|
|
1399
|
+
* - 编辑器调用时传入 ISetPropertyOptionsForEditor,通过节点 UUID + dump 路径定位,属性为 IProperty 格式
|
|
1400
|
+
*
|
|
1401
|
+
* @param params - 设置属性选项,根据调用方不同传入不同类型
|
|
1402
|
+
* @returns 设置成功返回 true,失败返回 false
|
|
1403
|
+
*
|
|
1404
|
+
* @example
|
|
1405
|
+
* ```ts
|
|
1406
|
+
* // CLI 方式:通过 componentPath 定位,直接传属性键值对
|
|
1407
|
+
* await setProperty({
|
|
1408
|
+
* componentPath: 'Canvas/cc.Label_1',
|
|
1409
|
+
* properties: { string: 'Hello', fontSize: 32 },
|
|
1410
|
+
* });
|
|
1411
|
+
*
|
|
1412
|
+
* // 编辑器方式:通过节点 UUID + dump 路径定位,传 IProperty 格式
|
|
1413
|
+
* await setProperty({
|
|
1414
|
+
* uuid: 'node-uuid',
|
|
1415
|
+
* path: '__comps__.0.string',
|
|
1416
|
+
* dump: { value: 'Hello', type: 'String' },
|
|
1417
|
+
* });
|
|
1418
|
+
* ```
|
|
1419
|
+
*/
|
|
1420
|
+
setProperty(params: ISetPropertyOptions | ISetPropertyOptionsForEditor): Promise<boolean>;
|
|
1421
|
+
/**
|
|
1422
|
+
* 查询组件信息
|
|
1423
|
+
* - 传入 IQueryComponentOptions 时,返回 IComponent 或 IComponent
|
|
1424
|
+
* - 传入 string 时,返回 IComponentForEditor
|
|
1425
|
+
*
|
|
1426
|
+
* @param params - 查询选项或组件路径字符串
|
|
1427
|
+
* @returns 如果传入的是 IQueryComponentOptions 时返回 IComponent,如果传入是string时返回 IComponentForEditor,未找到返回 null
|
|
1428
|
+
*
|
|
1429
|
+
* @example
|
|
1430
|
+
* ```ts
|
|
1431
|
+
* CLI 模式:返回 IComponent(扁平属性)
|
|
1432
|
+
* const comp = await queryComponent({ path: 'Canvas/cc.Label_1' }) as IComponent;
|
|
1433
|
+
*
|
|
1434
|
+
* 编辑器模式:直接传 string,这里是uuid,因为与cli重复了,也支持 path 和 url
|
|
1435
|
+
* const comp = await queryComponent('uuid') as IComponentForEditor;
|
|
1436
|
+
* ```
|
|
856
1437
|
*/
|
|
857
|
-
|
|
1438
|
+
queryComponent(params: IQueryComponentOptions | string): Promise<IComponent | IComponentForEditor | null>;
|
|
858
1439
|
/**
|
|
859
|
-
*
|
|
860
|
-
* @
|
|
1440
|
+
* 获取所有已注册的组件类名,包含内置与自定义组件
|
|
1441
|
+
* @returns 组件类名数组,如 ['cc.Label', 'cc.Sprite', 'MyCustomComponent']
|
|
861
1442
|
*/
|
|
862
|
-
|
|
1443
|
+
queryAllComponent(): Promise<string[]>;
|
|
863
1444
|
/**
|
|
864
|
-
*
|
|
1445
|
+
* 创建组件(编辑器使用),与 addComponent 不同的是仅返回是否成功
|
|
1446
|
+
* @param params - 添加组件选项
|
|
1447
|
+
* @param params.nodePathOrUuid - 目标节点路径或 UUID
|
|
1448
|
+
* @param params.component - 组件类名
|
|
1449
|
+
* @returns 创建成功返回 true,失败返回 false
|
|
865
1450
|
*/
|
|
866
|
-
|
|
1451
|
+
createComponent(params: IAddComponentOptions): Promise<boolean>;
|
|
867
1452
|
/**
|
|
868
|
-
*
|
|
1453
|
+
* 复位组件,将组件所有属性恢复为默认值
|
|
1454
|
+
* @param params - 查询组件选项,用于定位要复位的组件
|
|
1455
|
+
* @param params.path - 组件路径,支持路径、UUID 或资源 URL
|
|
1456
|
+
* @returns 复位成功返回 true,失败返回 false
|
|
869
1457
|
*/
|
|
870
|
-
|
|
1458
|
+
resetComponent(params: IQueryComponentOptions): Promise<boolean>;
|
|
1459
|
+
/**
|
|
1460
|
+
* 获取所有注册类名,支持按继承关系过滤
|
|
1461
|
+
* @param options - 过滤选项,不传则返回所有注册类
|
|
1462
|
+
* @param options.extends - 父类名称,只返回继承自该类的子类,支持字符串或字符串数组
|
|
1463
|
+
* @param options.excludeSelf - 是否排除父类自身,默认 false
|
|
1464
|
+
* @returns 类名对象数组,如 [{ name: 'cc.Label' }, { name: 'cc.Sprite' }]
|
|
1465
|
+
*
|
|
1466
|
+
* @example
|
|
1467
|
+
* ```ts
|
|
1468
|
+
* // 查询所有注册类
|
|
1469
|
+
* const all = await queryClasses();
|
|
1470
|
+
*
|
|
1471
|
+
* // 查询 cc.Component 的所有子类(含自身)
|
|
1472
|
+
* const comps = await queryClasses({ extends: 'cc.Component' });
|
|
1473
|
+
*
|
|
1474
|
+
* // 查询 cc.Component 的所有子类(排除自身)
|
|
1475
|
+
* const subComps = await queryClasses({ extends: 'cc.Component', excludeSelf: true });
|
|
1476
|
+
* ```
|
|
1477
|
+
*/
|
|
1478
|
+
queryClasses(options?: IQueryClassesOptions): Promise<{
|
|
1479
|
+
name: string;
|
|
1480
|
+
}[]>;
|
|
871
1481
|
/**
|
|
872
|
-
*
|
|
1482
|
+
* 查询指定节点上所有组件暴露的可调用函数
|
|
1483
|
+
* @param uuid - 节点 UUID
|
|
1484
|
+
* @returns 节点上组件的函数信息,节点不存在时返回空对象
|
|
873
1485
|
*/
|
|
874
|
-
|
|
1486
|
+
queryComponentFunctionOfNode(uuid: string): Promise<any>;
|
|
875
1487
|
/**
|
|
876
|
-
*
|
|
1488
|
+
* 执行组件上的指定方法
|
|
1489
|
+
* @param options - 执行选项
|
|
1490
|
+
* @param options.uuid - 组件实例的 UUID
|
|
1491
|
+
* @param options.name - 要执行的方法名,如 'onLoad'、'start'
|
|
1492
|
+
* @param options.args - 方法参数列表
|
|
1493
|
+
* @returns 执行成功返回 true,失败返回 false
|
|
877
1494
|
*/
|
|
878
1495
|
executeComponentMethod(options: IExecuteComponentMethodOptions): Promise<boolean>;
|
|
1496
|
+
/**
|
|
1497
|
+
* 查询指定名称的组件是否已注册(是否存在对应脚本)
|
|
1498
|
+
* @param name - 组件类名,如 'cc.Label'
|
|
1499
|
+
* @returns 存在返回 true,不存在返回 false
|
|
1500
|
+
*/
|
|
1501
|
+
queryComponentHasScript(name: string): Promise<boolean>;
|
|
879
1502
|
init(): void;
|
|
880
1503
|
unregisterCompMgrEvents(): void;
|
|
881
1504
|
}
|
|
@@ -993,7 +1616,7 @@ declare interface IEngineService extends IServiceEvents {
|
|
|
993
1616
|
}
|
|
994
1617
|
|
|
995
1618
|
/**
|
|
996
|
-
*
|
|
1619
|
+
* 执行组件方法的选项
|
|
997
1620
|
*/
|
|
998
1621
|
declare interface IExecuteComponentMethodOptions {
|
|
999
1622
|
uuid: string;
|
|
@@ -1041,6 +1664,34 @@ declare interface IGetPrefabInfoParams {
|
|
|
1041
1664
|
nodePath: string;
|
|
1042
1665
|
}
|
|
1043
1666
|
|
|
1667
|
+
declare interface IGizmoEvents {
|
|
1668
|
+
'gizmo:tool-changed': [name: string];
|
|
1669
|
+
'gizmo:control-begin': [];
|
|
1670
|
+
'gizmo:control-end': [];
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
declare interface IGizmoService {
|
|
1674
|
+
gizmoRootNode: any;
|
|
1675
|
+
foregroundNode: any;
|
|
1676
|
+
backgroundNode: any;
|
|
1677
|
+
transformToolData: any;
|
|
1678
|
+
transformToolName: string;
|
|
1679
|
+
isViewMode: boolean;
|
|
1680
|
+
init(): void;
|
|
1681
|
+
initFromConfig(): Promise<void>;
|
|
1682
|
+
saveConfig(): Promise<void>;
|
|
1683
|
+
changeTool(name: string): void;
|
|
1684
|
+
setCoordinate(coord: 'local' | 'global'): void;
|
|
1685
|
+
setPivot(pivot: 'pivot' | 'center'): void;
|
|
1686
|
+
lockGizmoTool(locked: boolean): void;
|
|
1687
|
+
setIconVisible(visible: boolean): void;
|
|
1688
|
+
showAllGizmoOfNode(node: any, recursive?: boolean): void;
|
|
1689
|
+
removeAllGizmoOfNode(node: any, recursive?: boolean): void;
|
|
1690
|
+
clearAllGizmos(): void;
|
|
1691
|
+
callAllGizmoFuncOfNode(node: any, funcName: string, ...params: any[]): boolean;
|
|
1692
|
+
onUpdate(deltaTime: number): void;
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1044
1695
|
declare interface IIsPrefabInstanceParams {
|
|
1045
1696
|
nodePath: string;
|
|
1046
1697
|
}
|
|
@@ -1186,6 +1837,7 @@ declare interface INodeTreeItem {
|
|
|
1186
1837
|
active: boolean;
|
|
1187
1838
|
locked: boolean;
|
|
1188
1839
|
type: string;
|
|
1840
|
+
uuid: string;
|
|
1189
1841
|
children: INodeTreeItem[];
|
|
1190
1842
|
prefab: IPrefabStateInfo;
|
|
1191
1843
|
parent: string;
|
|
@@ -1203,6 +1855,21 @@ declare interface IOpenOptions {
|
|
|
1203
1855
|
simpleNode?: boolean;
|
|
1204
1856
|
}
|
|
1205
1857
|
|
|
1858
|
+
export declare interface IOperationEvents {
|
|
1859
|
+
'pointer-lock': [locked: boolean];
|
|
1860
|
+
'pointer-change': [type: string];
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
declare interface IOperationService {
|
|
1864
|
+
addListener(type: OperationEvent, listener: Function, priority?: number): void;
|
|
1865
|
+
removeListener(type: OperationEvent, listener: Function): void;
|
|
1866
|
+
dispatch(type: OperationEvent, ...args: any[]): void;
|
|
1867
|
+
emitMouseEvent(type: string, event: ISceneMouseEvent, dpr?: number): void;
|
|
1868
|
+
requestPointerLock(): void;
|
|
1869
|
+
exitPointerLock(): void;
|
|
1870
|
+
changePointer(type: string): void;
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1206
1873
|
export declare interface IOptionBase {
|
|
1207
1874
|
modeName?: string;
|
|
1208
1875
|
}
|
|
@@ -1369,11 +2036,18 @@ declare interface IQuat {
|
|
|
1369
2036
|
}
|
|
1370
2037
|
|
|
1371
2038
|
/**
|
|
1372
|
-
*
|
|
2039
|
+
* 查询注册类的过滤选项
|
|
2040
|
+
*/
|
|
2041
|
+
declare interface IQueryClassesOptions {
|
|
2042
|
+
extends?: string | string[];
|
|
2043
|
+
excludeSelf?: boolean;
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
/**
|
|
2047
|
+
* 查询组件的选项
|
|
1373
2048
|
*/
|
|
1374
2049
|
declare interface IQueryComponentOptions {
|
|
1375
|
-
|
|
1376
|
-
isFull?: boolean;
|
|
2050
|
+
path: string;
|
|
1377
2051
|
}
|
|
1378
2052
|
|
|
1379
2053
|
declare interface IQueryNodeParams {
|
|
@@ -1401,10 +2075,10 @@ declare interface IReloadOptions {
|
|
|
1401
2075
|
}
|
|
1402
2076
|
|
|
1403
2077
|
/**
|
|
1404
|
-
*
|
|
2078
|
+
* 删除组件的选项
|
|
1405
2079
|
*/
|
|
1406
2080
|
declare interface IRemoveComponentOptions {
|
|
1407
|
-
|
|
2081
|
+
path: string;
|
|
1408
2082
|
}
|
|
1409
2083
|
|
|
1410
2084
|
declare interface IRevertToPrefabParams {
|
|
@@ -1435,6 +2109,59 @@ export declare interface ISceneEvents {
|
|
|
1435
2109
|
onComponentRemoved?(comp: Component, opts?: IOptionBase): void;
|
|
1436
2110
|
}
|
|
1437
2111
|
|
|
2112
|
+
declare interface ISceneKeyboardEvent {
|
|
2113
|
+
key: string;
|
|
2114
|
+
keyCode: number;
|
|
2115
|
+
code: string;
|
|
2116
|
+
repeat: boolean;
|
|
2117
|
+
ctrlKey: boolean;
|
|
2118
|
+
shiftKey: boolean;
|
|
2119
|
+
altKey: boolean;
|
|
2120
|
+
metaKey: boolean;
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
declare interface ISceneMouseEvent {
|
|
2124
|
+
x: number;
|
|
2125
|
+
y: number;
|
|
2126
|
+
clientX: number;
|
|
2127
|
+
clientY: number;
|
|
2128
|
+
deltaX: number;
|
|
2129
|
+
deltaY: number;
|
|
2130
|
+
wheelDeltaX: number;
|
|
2131
|
+
wheelDeltaY: number;
|
|
2132
|
+
moveDeltaX: number;
|
|
2133
|
+
moveDeltaY: number;
|
|
2134
|
+
leftButton: boolean;
|
|
2135
|
+
middleButton: boolean;
|
|
2136
|
+
rightButton: boolean;
|
|
2137
|
+
button: number;
|
|
2138
|
+
buttons: number;
|
|
2139
|
+
ctrlKey: boolean;
|
|
2140
|
+
shiftKey: boolean;
|
|
2141
|
+
altKey: boolean;
|
|
2142
|
+
metaKey: boolean;
|
|
2143
|
+
hitPoint?: any;
|
|
2144
|
+
type?: string;
|
|
2145
|
+
handleName?: string;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
declare interface ISceneViewEvents {
|
|
2149
|
+
'scene-view:light-changed': [isOn: boolean];
|
|
2150
|
+
'scene-view:visibility-changed': [visible: boolean];
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
declare interface ISceneViewService {
|
|
2154
|
+
init(): void;
|
|
2155
|
+
initFromConfig(): Promise<void>;
|
|
2156
|
+
saveConfig(): Promise<void>;
|
|
2157
|
+
setSceneLightOn(enable: boolean): void;
|
|
2158
|
+
querySceneLightOn(): boolean;
|
|
2159
|
+
onSceneOpened(scene: any): void;
|
|
2160
|
+
onSceneClosed(): void;
|
|
2161
|
+
onComponentAdded(comp: Component): void;
|
|
2162
|
+
onComponentRemoved(comp: Component): void;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
1438
2165
|
declare interface IScriptEvents {
|
|
1439
2166
|
/**
|
|
1440
2167
|
* 当脚本刷新并执行完成时触发
|
|
@@ -1453,6 +2180,21 @@ declare interface IScriptService extends IServiceEvents {
|
|
|
1453
2180
|
suspend(condition: Promise<any>): void;
|
|
1454
2181
|
}
|
|
1455
2182
|
|
|
2183
|
+
declare interface ISelectionEvents {
|
|
2184
|
+
'selection:select': [uuid: string, uuids: string[]];
|
|
2185
|
+
'selection:unselect': [uuid: string, uuids: string[]];
|
|
2186
|
+
'selection:clear': [];
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
declare interface ISelectionService {
|
|
2190
|
+
select(uuid: string): void;
|
|
2191
|
+
unselect(uuid: string): void;
|
|
2192
|
+
clear(): void;
|
|
2193
|
+
query(): string[];
|
|
2194
|
+
isSelect(uuid: string): boolean;
|
|
2195
|
+
reset(): void;
|
|
2196
|
+
}
|
|
2197
|
+
|
|
1456
2198
|
declare interface IServiceEvents {
|
|
1457
2199
|
onEditorOpened?(): void;
|
|
1458
2200
|
onEditorReload?(): void;
|
|
@@ -1480,6 +2222,9 @@ declare interface IServiceEvents {
|
|
|
1480
2222
|
onAssetChanged?(uuid: string): void;
|
|
1481
2223
|
onAssetRefreshed?(uuid: string): void;
|
|
1482
2224
|
onScriptExecutionFinished?(): void;
|
|
2225
|
+
onSelectionSelect?(uuid: string, uuids: string[]): void;
|
|
2226
|
+
onSelectionUnselect?(uuid: string, uuids: string[]): void;
|
|
2227
|
+
onSelectionClear?(): void;
|
|
1483
2228
|
}
|
|
1484
2229
|
|
|
1485
2230
|
declare interface IServiceManager {
|
|
@@ -1490,10 +2235,16 @@ declare interface IServiceManager {
|
|
|
1490
2235
|
Asset: IAssetService;
|
|
1491
2236
|
Engine: IEngineService;
|
|
1492
2237
|
Prefab: IPrefabService;
|
|
2238
|
+
Selection: ISelectionService;
|
|
2239
|
+
Operation: IOperationService;
|
|
2240
|
+
Undo: IUndoService;
|
|
2241
|
+
Camera: ICameraService;
|
|
2242
|
+
Gizmo: IGizmoService;
|
|
2243
|
+
SceneView: ISceneViewService;
|
|
1493
2244
|
}
|
|
1494
2245
|
|
|
1495
2246
|
/**
|
|
1496
|
-
*
|
|
2247
|
+
* CLI 设置组件属性的选项
|
|
1497
2248
|
*/
|
|
1498
2249
|
declare interface ISetPropertyOptions {
|
|
1499
2250
|
componentPath: string;
|
|
@@ -1503,6 +2254,25 @@ declare interface ISetPropertyOptions {
|
|
|
1503
2254
|
record?: boolean;
|
|
1504
2255
|
}
|
|
1505
2256
|
|
|
2257
|
+
/**
|
|
2258
|
+
* 编辑器设置组件属性的选项
|
|
2259
|
+
*/
|
|
2260
|
+
declare interface ISetPropertyOptionsForEditor {
|
|
2261
|
+
uuid: string;
|
|
2262
|
+
path: string;
|
|
2263
|
+
dump: IProperty;
|
|
2264
|
+
record?: boolean;
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
declare interface ISnapConfigData {
|
|
2268
|
+
position: IVec3Like;
|
|
2269
|
+
rotation: number;
|
|
2270
|
+
scale: number;
|
|
2271
|
+
isPositionSnapEnabled: boolean;
|
|
2272
|
+
isRotationSnapEnabled: boolean;
|
|
2273
|
+
isScaleSnapEnabled: boolean;
|
|
2274
|
+
}
|
|
2275
|
+
|
|
1506
2276
|
declare type ISupportCreateCCType =
|
|
1507
2277
|
| 'cc.AnimationClip' // 动画剪辑
|
|
1508
2278
|
| 'cc.Script' // 脚本(TypeScript/JavaScript)
|
|
@@ -1535,6 +2305,21 @@ declare interface ITargetOverrideInfo {
|
|
|
1535
2305
|
targetInfo: ITargetInfo | null;
|
|
1536
2306
|
}
|
|
1537
2307
|
|
|
2308
|
+
declare interface IUndoEvents {
|
|
2309
|
+
'undo:changed': [];
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
declare interface IUndoService {
|
|
2313
|
+
beginRecording(uuids: string[], options?: any): string;
|
|
2314
|
+
endRecording(commandId: string): void;
|
|
2315
|
+
cancelRecording(commandId: string): void;
|
|
2316
|
+
undo(): Promise<void>;
|
|
2317
|
+
redo(): Promise<void>;
|
|
2318
|
+
snapshot(): void;
|
|
2319
|
+
reset(): void;
|
|
2320
|
+
isDirty(): boolean;
|
|
2321
|
+
}
|
|
2322
|
+
|
|
1538
2323
|
declare interface IUnpackPrefabInstanceParams {
|
|
1539
2324
|
/** 要解耦的预制体实例节点 */
|
|
1540
2325
|
nodePath: string;
|
|
@@ -1597,6 +2382,28 @@ declare interface LabelAtlasAssetUserData {
|
|
|
1597
2382
|
_fntConfig: FntData;
|
|
1598
2383
|
}
|
|
1599
2384
|
|
|
2385
|
+
declare class LinearTicks {
|
|
2386
|
+
ticks: number[];
|
|
2387
|
+
tickLods: number[];
|
|
2388
|
+
tickRatios: number[];
|
|
2389
|
+
minScale: number;
|
|
2390
|
+
maxScale: number;
|
|
2391
|
+
minValueScale: number;
|
|
2392
|
+
maxValueScale: number;
|
|
2393
|
+
minValue: number;
|
|
2394
|
+
maxValue: number;
|
|
2395
|
+
pixelRange: number;
|
|
2396
|
+
minSpacing: number;
|
|
2397
|
+
maxSpacing: number;
|
|
2398
|
+
minTickLevel: number;
|
|
2399
|
+
maxTickLevel: number;
|
|
2400
|
+
initTicks(lods: number[], min: number, max: number): this;
|
|
2401
|
+
spacing(min: number, max: number): this;
|
|
2402
|
+
range(minValue: number, maxValue: number, range: number): this;
|
|
2403
|
+
ticksAtLevel(level: number, excludeHigherLevel: boolean): number[];
|
|
2404
|
+
levelForStep(step: number): number;
|
|
2405
|
+
}
|
|
2406
|
+
|
|
1600
2407
|
declare interface LODsOption {
|
|
1601
2408
|
// 屏占比
|
|
1602
2409
|
screenRatio: number;
|
|
@@ -1841,6 +2648,19 @@ declare enum NormalImportSetting {
|
|
|
1841
2648
|
recalculate = 3
|
|
1842
2649
|
}
|
|
1843
2650
|
|
|
2651
|
+
declare type OperationEvent = SceneDragEvent | SceneKeyboardEvent | SceneMouseEvent | 'resize';
|
|
2652
|
+
|
|
2653
|
+
export declare class OperationService extends BaseService<IOperationEvents> {
|
|
2654
|
+
private _manager;
|
|
2655
|
+
addListener(type: OperationEvent, listener: Function, priority?: number): void;
|
|
2656
|
+
removeListener(type: OperationEvent, listener: Function): void;
|
|
2657
|
+
dispatch(type: OperationEvent, ...args: any[]): void;
|
|
2658
|
+
emitMouseEvent(type: string, event: ISceneMouseEvent, dpr?: number): void;
|
|
2659
|
+
requestPointerLock(): void;
|
|
2660
|
+
exitPointerLock(): void;
|
|
2661
|
+
changePointer(type: string): void;
|
|
2662
|
+
}
|
|
2663
|
+
|
|
1844
2664
|
declare enum OptimizationPolicy {
|
|
1845
2665
|
AUTO = 0,
|
|
1846
2666
|
SINGLE_INSTANCE = 1,
|
|
@@ -2076,6 +2896,10 @@ declare interface RtSpriteFrameAssetUserData {
|
|
|
2076
2896
|
*/
|
|
2077
2897
|
declare const SCENE_TEMPLATE_TYPE: readonly ['2d', '3d', 'quality'];
|
|
2078
2898
|
|
|
2899
|
+
declare type SceneDragEvent = 'onDragLeave' | 'onDragOver' | 'onDrop';
|
|
2900
|
+
|
|
2901
|
+
declare type SceneKeyboardEvent = 'keydown' | 'keyup';
|
|
2902
|
+
|
|
2079
2903
|
declare enum SceneModeType {
|
|
2080
2904
|
General = 'general',
|
|
2081
2905
|
Prefab = 'prefab',
|
|
@@ -2084,6 +2908,26 @@ declare enum SceneModeType {
|
|
|
2084
2908
|
Unset = ''
|
|
2085
2909
|
}
|
|
2086
2910
|
|
|
2911
|
+
declare type SceneMouseEvent = 'dblclick' | 'mousedown' | 'mousemove' | 'mouseup' | 'mousewheel';
|
|
2912
|
+
|
|
2913
|
+
export declare class SceneViewService extends BaseService<ISceneViewEvents> implements ISceneViewService {
|
|
2914
|
+
private _sceneViewLight;
|
|
2915
|
+
private _lightNode;
|
|
2916
|
+
private _isVisible;
|
|
2917
|
+
init(): void;
|
|
2918
|
+
initFromConfig(): Promise<void>;
|
|
2919
|
+
saveConfig(): Promise<void>;
|
|
2920
|
+
setSceneLightOn(enable: boolean): void;
|
|
2921
|
+
querySceneLightOn(): boolean;
|
|
2922
|
+
onSceneOpened(scene: any): void;
|
|
2923
|
+
onSceneClosed(): void;
|
|
2924
|
+
onComponentAdded(comp: Component): void;
|
|
2925
|
+
onComponentRemoved(comp: Component): void;
|
|
2926
|
+
get isVisible(): boolean;
|
|
2927
|
+
set isVisible(value: boolean);
|
|
2928
|
+
private _onIsSceneLightOn;
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2087
2931
|
/** JavaScript 脚本模块的 userData */
|
|
2088
2932
|
declare interface ScriptModuleUserData {
|
|
2089
2933
|
isPlugin: false;
|
|
@@ -2151,6 +2995,18 @@ export declare class ScriptService extends BaseService<IScriptEvents> implements
|
|
|
2151
2995
|
private _handleImportException;
|
|
2152
2996
|
}
|
|
2153
2997
|
|
|
2998
|
+
export declare class SelectionService extends BaseService<ISelectionEvents> implements ISelectionService {
|
|
2999
|
+
private _uuids;
|
|
3000
|
+
select(uuid: string): void;
|
|
3001
|
+
unselect(uuid: string): void;
|
|
3002
|
+
clear(): void;
|
|
3003
|
+
query(): string[];
|
|
3004
|
+
isSelect(uuid: string): boolean;
|
|
3005
|
+
reset(): void;
|
|
3006
|
+
private _callFocusInEditor;
|
|
3007
|
+
private _callLostFocusInEditor;
|
|
3008
|
+
}
|
|
3009
|
+
|
|
2154
3010
|
declare interface SerializedAssetFinder {
|
|
2155
3011
|
meshes?: Array<string | null>;
|
|
2156
3012
|
animations?: Array<string | null>;
|
|
@@ -2165,6 +3021,8 @@ declare interface SerializedAssetFinder {
|
|
|
2165
3021
|
*/
|
|
2166
3022
|
export declare const Service: IServiceManager;
|
|
2167
3023
|
|
|
3024
|
+
export declare const ServiceEvents: GlobalEventManager;
|
|
3025
|
+
|
|
2168
3026
|
/**
|
|
2169
3027
|
* 范例
|
|
2170
3028
|
* @register('Scene')
|
|
@@ -2199,6 +3057,29 @@ declare interface SimplifyOptions {
|
|
|
2199
3057
|
maxIterationCount?: number;
|
|
2200
3058
|
}
|
|
2201
3059
|
|
|
3060
|
+
declare class SnapConfigs extends EventEmitter {
|
|
3061
|
+
private _position;
|
|
3062
|
+
private _rotation;
|
|
3063
|
+
private _scale;
|
|
3064
|
+
private _isPositionSnapEnabled;
|
|
3065
|
+
private _isRotationSnapEnabled;
|
|
3066
|
+
private _isScaleSnapEnabled;
|
|
3067
|
+
get position(): IVec3Like;
|
|
3068
|
+
set position(value: IVec3Like);
|
|
3069
|
+
get rotation(): number;
|
|
3070
|
+
set rotation(value: number);
|
|
3071
|
+
get scale(): number;
|
|
3072
|
+
set scale(value: number);
|
|
3073
|
+
get isPositionSnapEnabled(): boolean;
|
|
3074
|
+
set isPositionSnapEnabled(value: boolean);
|
|
3075
|
+
get isRotationSnapEnabled(): boolean;
|
|
3076
|
+
set isRotationSnapEnabled(value: boolean);
|
|
3077
|
+
get isScaleSnapEnabled(): boolean;
|
|
3078
|
+
set isScaleSnapEnabled(value: boolean);
|
|
3079
|
+
getPureDataObject(): ISnapConfigData;
|
|
3080
|
+
initFromData(data: ISnapConfigData): void;
|
|
3081
|
+
}
|
|
3082
|
+
|
|
2202
3083
|
/** Spine 资源的 userData */
|
|
2203
3084
|
declare interface SpineAssetUserData {
|
|
2204
3085
|
/** 图集资源的 UUID */
|
|
@@ -2319,8 +3200,54 @@ declare interface TextureCubeAssetUserData extends TextureBaseAssetUserData {
|
|
|
2319
3200
|
bottom?: string;
|
|
2320
3201
|
}
|
|
2321
3202
|
|
|
3203
|
+
declare class TransformToolData extends EventEmitter {
|
|
3204
|
+
private _toolName;
|
|
3205
|
+
private _viewMode;
|
|
3206
|
+
private _coordinate;
|
|
3207
|
+
private _pivot;
|
|
3208
|
+
private _isLocked;
|
|
3209
|
+
private _is2D;
|
|
3210
|
+
private _scale2D;
|
|
3211
|
+
snapConfigs: SnapConfigs;
|
|
3212
|
+
get toolName(): TransformToolDataToolNameType;
|
|
3213
|
+
set toolName(value: TransformToolDataToolNameType);
|
|
3214
|
+
get viewMode(): TransformToolDataViewMode;
|
|
3215
|
+
set viewMode(value: TransformToolDataViewMode);
|
|
3216
|
+
get coordinate(): TransformToolDataCoordinateType;
|
|
3217
|
+
set coordinate(value: TransformToolDataCoordinateType);
|
|
3218
|
+
get pivot(): TransformToolDataPivotType;
|
|
3219
|
+
set pivot(value: TransformToolDataPivotType);
|
|
3220
|
+
get isLocked(): boolean;
|
|
3221
|
+
set isLocked(value: boolean);
|
|
3222
|
+
get is2D(): boolean;
|
|
3223
|
+
set is2D(value: boolean);
|
|
3224
|
+
get scale2D(): number;
|
|
3225
|
+
set scale2D(value: number);
|
|
3226
|
+
set cameraOrthoHeight(value: number);
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
declare type TransformToolDataCoordinateType = 'local' | 'global';
|
|
3230
|
+
|
|
3231
|
+
declare type TransformToolDataPivotType = 'pivot' | 'center';
|
|
3232
|
+
|
|
3233
|
+
declare type TransformToolDataToolNameType = 'view' | 'position' | 'rotation' | 'scale' | 'rect';
|
|
3234
|
+
|
|
3235
|
+
declare type TransformToolDataViewMode = 'view' | 'select';
|
|
3236
|
+
|
|
2322
3237
|
declare type TSceneTemplateType = typeof SCENE_TEMPLATE_TYPE[number];
|
|
2323
3238
|
|
|
3239
|
+
export declare class UndoService extends BaseService<IUndoEvents> implements IUndoService {
|
|
3240
|
+
private _undoMgr;
|
|
3241
|
+
beginRecording(uuids: string[], options?: any): string;
|
|
3242
|
+
endRecording(commandId: string): void;
|
|
3243
|
+
cancelRecording(commandId: string): void;
|
|
3244
|
+
undo(): Promise<void>;
|
|
3245
|
+
redo(): Promise<void>;
|
|
3246
|
+
snapshot(): void;
|
|
3247
|
+
reset(): void;
|
|
3248
|
+
isDirty(): boolean;
|
|
3249
|
+
}
|
|
3250
|
+
|
|
2324
3251
|
declare interface Vec2 {
|
|
2325
3252
|
x: number;
|
|
2326
3253
|
y: number;
|