@cocos/cocos-cli-types 0.0.1-alpha.21.2 → 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 +15 -10
- package/engine.d.ts +9 -0
- package/index.d.ts +42 -11
- package/package.json +1 -1
- package/service.d.ts +1158 -26
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,18 +249,343 @@ 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
|
* 在子进程中处理所有节点相关操作
|
|
246
541
|
*/
|
|
247
542
|
export declare class ComponentService extends BaseService<IComponentEvents> implements IComponentService {
|
|
543
|
+
modeName: SceneModeType;
|
|
544
|
+
protected _sceneEventListener: ISceneEvents[];
|
|
545
|
+
protected _recycleComponent: Record<string, Component>;
|
|
546
|
+
constructor();
|
|
547
|
+
/**
|
|
548
|
+
* 查询当前正在编辑的模式名字
|
|
549
|
+
*/
|
|
550
|
+
queryMode(): SceneModeType;
|
|
551
|
+
onAddComponent(comp: Component, opts?: IOptionBase): void;
|
|
552
|
+
onRemoveComponent(comp: Component, opts?: IOptionBase): void;
|
|
553
|
+
onComponentAdded(comp: Component, opts?: IOptionBase): void;
|
|
554
|
+
onComponentRemoved(comp: Component, opts?: IOptionBase): void;
|
|
555
|
+
dispatchEvents(eventName: keyof ISceneEvents, ...args: any[any]): void;
|
|
248
556
|
private addComponentImpl;
|
|
249
557
|
addComponent(params: IAddComponentOptions): Promise<IComponent>;
|
|
558
|
+
/**
|
|
559
|
+
* 创建组件
|
|
560
|
+
* @param params
|
|
561
|
+
*/
|
|
562
|
+
private requireComponentList;
|
|
563
|
+
createComponent(params: IAddComponentOptions): Promise<boolean>;
|
|
564
|
+
checkComponentsCollision(node: Node_2): Promise<void>;
|
|
565
|
+
checkDynamicBodyShape(ndoe: Node_2): void;
|
|
566
|
+
/**
|
|
567
|
+
* 通过 path 查找组件实例,支持路径、UUID 或 URL
|
|
568
|
+
*/
|
|
569
|
+
private findComponent;
|
|
250
570
|
removeComponent(params: IRemoveComponentOptions): Promise<boolean>;
|
|
251
|
-
|
|
252
|
-
|
|
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>;
|
|
575
|
+
/**
|
|
576
|
+
* 查询一个节点的实例
|
|
577
|
+
* @param {*} uuid
|
|
578
|
+
* @return {cc.Node}
|
|
579
|
+
*/
|
|
580
|
+
query(uuid: string | undefined): Node_2 | null;
|
|
581
|
+
setPropertyForEditor(options: ISetPropertyOptionsForEditor): Promise<boolean>;
|
|
253
582
|
private setPropertyImp;
|
|
254
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>;
|
|
255
589
|
init(): void;
|
|
256
590
|
private readonly CompMgrEventHandlers;
|
|
257
591
|
private compMgrEventHandlers;
|
|
@@ -272,6 +606,12 @@ export declare class ComponentService extends BaseService<IComponentEvents> impl
|
|
|
272
606
|
* @param {cc.Component} component
|
|
273
607
|
*/
|
|
274
608
|
remove(uuid: string, component: Component): void;
|
|
609
|
+
/**
|
|
610
|
+
* 重置组件
|
|
611
|
+
* @param uuid component 的 uuid
|
|
612
|
+
*/
|
|
613
|
+
resetComponent(params: IQueryComponentOptions): Promise<boolean>;
|
|
614
|
+
executeComponentMethod(options: IExecuteComponentMethodOptions): Promise<boolean>;
|
|
275
615
|
}
|
|
276
616
|
|
|
277
617
|
/**
|
|
@@ -291,6 +631,44 @@ declare interface DirectoryAssetUserData {
|
|
|
291
631
|
priority?: number;
|
|
292
632
|
}
|
|
293
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
|
+
|
|
294
672
|
/**
|
|
295
673
|
* EditorAsset - 统一的编辑器管理入口
|
|
296
674
|
* 作为调度器,根据资源类型动态创建和管理编辑器实例
|
|
@@ -420,6 +798,122 @@ declare class GeometryRenderer {
|
|
|
420
798
|
*/
|
|
421
799
|
export declare function getServiceAll(): any[];
|
|
422
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
|
+
|
|
423
917
|
/** glTF 动画资源的 userData */
|
|
424
918
|
declare interface GltfAnimationAssetUserData {
|
|
425
919
|
gltfIndex: number;
|
|
@@ -601,11 +1095,57 @@ declare interface GlTFUserData {
|
|
|
601
1095
|
};
|
|
602
1096
|
}
|
|
603
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
|
+
|
|
604
1144
|
/**
|
|
605
|
-
*
|
|
1145
|
+
* 添加/创建组件的选项
|
|
606
1146
|
*/
|
|
607
1147
|
declare interface IAddComponentOptions {
|
|
608
|
-
|
|
1148
|
+
nodePathOrUuid: string;
|
|
609
1149
|
component: string;
|
|
610
1150
|
}
|
|
611
1151
|
|
|
@@ -655,6 +1195,7 @@ declare interface IAssetInfo {
|
|
|
655
1195
|
mtime?: number; // 资源文件的 mtime
|
|
656
1196
|
depends?: string[]; // 依赖的资源 uuid 信息
|
|
657
1197
|
dependeds?: string[]; // 被依赖的资源 uuid 信息
|
|
1198
|
+
temp?: string; // 资源临时文件目录
|
|
658
1199
|
}
|
|
659
1200
|
|
|
660
1201
|
declare interface IAssetMeta<T extends ISupportCreateType | 'unknown' = 'unknown'> {
|
|
@@ -733,6 +1274,33 @@ declare interface IBaseIdentifier {
|
|
|
733
1274
|
assetType: string;
|
|
734
1275
|
}
|
|
735
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
|
+
|
|
736
1304
|
declare interface IChangeNodeOptions {
|
|
737
1305
|
source?: 'editor' | 'undo' | 'engine';
|
|
738
1306
|
type?: NodeEventType;
|
|
@@ -750,7 +1318,7 @@ declare interface ICloseOptions {
|
|
|
750
1318
|
}
|
|
751
1319
|
|
|
752
1320
|
/**
|
|
753
|
-
*
|
|
1321
|
+
* CLI 使用的组件信息,属性值以扁平的 key-value 形式呈现
|
|
754
1322
|
*/
|
|
755
1323
|
declare interface IComponent extends IComponentIdentifier {
|
|
756
1324
|
properties: {
|
|
@@ -760,19 +1328,33 @@ declare interface IComponent extends IComponentIdentifier {
|
|
|
760
1328
|
}
|
|
761
1329
|
|
|
762
1330
|
/**
|
|
763
|
-
*
|
|
1331
|
+
* 组件相关事件类型
|
|
764
1332
|
*/
|
|
765
|
-
declare interface IComponentEvents {
|
|
1333
|
+
declare interface IComponentEvents extends INodeEvents {
|
|
766
1334
|
'component:add': [Component];
|
|
767
1335
|
'component:before-remove': [Component];
|
|
768
1336
|
'component:remove': [Component];
|
|
769
1337
|
'component:set-property': [Component, IChangeNodeOptions];
|
|
770
1338
|
'component:added': [Component];
|
|
771
1339
|
'component:removed': [Component];
|
|
1340
|
+
'component:before-add-component': [string, Node_2];
|
|
772
1341
|
}
|
|
773
1342
|
|
|
774
1343
|
/**
|
|
775
|
-
*
|
|
1344
|
+
* 编辑器使用的组件详细信息,属性值以 IProperty 编码形式呈现,
|
|
1345
|
+
* 包含 type、readonly、default 等元信息,用于编辑器 Inspector 面板渲染
|
|
1346
|
+
*/
|
|
1347
|
+
declare interface IComponentForEditor extends IProperty {
|
|
1348
|
+
value: {
|
|
1349
|
+
enabled: IPropertyValueType;
|
|
1350
|
+
uuid: IPropertyValueType;
|
|
1351
|
+
name: IPropertyValueType;
|
|
1352
|
+
} & Record<string, IPropertyValueType>;
|
|
1353
|
+
mountedRoot?: string;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
/**
|
|
1357
|
+
* 组件标识信息,包含组件的基本标识字段
|
|
776
1358
|
*/
|
|
777
1359
|
declare interface IComponentIdentifier {
|
|
778
1360
|
cid: string;
|
|
@@ -784,32 +1366,139 @@ declare interface IComponentIdentifier {
|
|
|
784
1366
|
}
|
|
785
1367
|
|
|
786
1368
|
/**
|
|
787
|
-
*
|
|
1369
|
+
* 组件服务接口,定义了所有组件相关的操作方法
|
|
788
1370
|
*/
|
|
789
1371
|
declare interface IComponentService extends IServiceEvents {
|
|
790
1372
|
/**
|
|
791
|
-
*
|
|
792
|
-
* @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
|
+
* ```
|
|
793
1387
|
*/
|
|
794
1388
|
addComponent(params: IAddComponentOptions): Promise<IComponent>;
|
|
795
1389
|
/**
|
|
796
|
-
*
|
|
797
|
-
* @param params
|
|
1390
|
+
* 删除指定组件
|
|
1391
|
+
* @param params - 删除组件选项
|
|
1392
|
+
* @param params.path - 组件路径,支持路径、UUID 或资源 URL
|
|
1393
|
+
* @returns 删除成功返回 true,失败返回 false
|
|
798
1394
|
*/
|
|
799
1395
|
removeComponent(params: IRemoveComponentOptions): Promise<boolean>;
|
|
800
1396
|
/**
|
|
801
1397
|
* 设置组件属性
|
|
802
|
-
*
|
|
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
|
+
* ```
|
|
803
1437
|
*/
|
|
804
|
-
|
|
1438
|
+
queryComponent(params: IQueryComponentOptions | string): Promise<IComponent | IComponentForEditor | null>;
|
|
805
1439
|
/**
|
|
806
|
-
*
|
|
1440
|
+
* 获取所有已注册的组件类名,包含内置与自定义组件
|
|
1441
|
+
* @returns 组件类名数组,如 ['cc.Label', 'cc.Sprite', 'MyCustomComponent']
|
|
807
1442
|
*/
|
|
808
|
-
|
|
1443
|
+
queryAllComponent(): Promise<string[]>;
|
|
809
1444
|
/**
|
|
810
|
-
*
|
|
1445
|
+
* 创建组件(编辑器使用),与 addComponent 不同的是仅返回是否成功
|
|
1446
|
+
* @param params - 添加组件选项
|
|
1447
|
+
* @param params.nodePathOrUuid - 目标节点路径或 UUID
|
|
1448
|
+
* @param params.component - 组件类名
|
|
1449
|
+
* @returns 创建成功返回 true,失败返回 false
|
|
811
1450
|
*/
|
|
812
|
-
|
|
1451
|
+
createComponent(params: IAddComponentOptions): Promise<boolean>;
|
|
1452
|
+
/**
|
|
1453
|
+
* 复位组件,将组件所有属性恢复为默认值
|
|
1454
|
+
* @param params - 查询组件选项,用于定位要复位的组件
|
|
1455
|
+
* @param params.path - 组件路径,支持路径、UUID 或资源 URL
|
|
1456
|
+
* @returns 复位成功返回 true,失败返回 false
|
|
1457
|
+
*/
|
|
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
|
+
}[]>;
|
|
1481
|
+
/**
|
|
1482
|
+
* 查询指定节点上所有组件暴露的可调用函数
|
|
1483
|
+
* @param uuid - 节点 UUID
|
|
1484
|
+
* @returns 节点上组件的函数信息,节点不存在时返回空对象
|
|
1485
|
+
*/
|
|
1486
|
+
queryComponentFunctionOfNode(uuid: string): Promise<any>;
|
|
1487
|
+
/**
|
|
1488
|
+
* 执行组件上的指定方法
|
|
1489
|
+
* @param options - 执行选项
|
|
1490
|
+
* @param options.uuid - 组件实例的 UUID
|
|
1491
|
+
* @param options.name - 要执行的方法名,如 'onLoad'、'start'
|
|
1492
|
+
* @param options.args - 方法参数列表
|
|
1493
|
+
* @returns 执行成功返回 true,失败返回 false
|
|
1494
|
+
*/
|
|
1495
|
+
executeComponentMethod(options: IExecuteComponentMethodOptions): Promise<boolean>;
|
|
1496
|
+
/**
|
|
1497
|
+
* 查询指定名称的组件是否已注册(是否存在对应脚本)
|
|
1498
|
+
* @param name - 组件类名,如 'cc.Label'
|
|
1499
|
+
* @returns 存在返回 true,不存在返回 false
|
|
1500
|
+
*/
|
|
1501
|
+
queryComponentHasScript(name: string): Promise<boolean>;
|
|
813
1502
|
init(): void;
|
|
814
1503
|
unregisterCompMgrEvents(): void;
|
|
815
1504
|
}
|
|
@@ -926,6 +1615,15 @@ declare interface IEngineService extends IServiceEvents {
|
|
|
926
1615
|
repaintInEditMode(): Promise<void>;
|
|
927
1616
|
}
|
|
928
1617
|
|
|
1618
|
+
/**
|
|
1619
|
+
* 执行组件方法的选项
|
|
1620
|
+
*/
|
|
1621
|
+
declare interface IExecuteComponentMethodOptions {
|
|
1622
|
+
uuid: string;
|
|
1623
|
+
name: string;
|
|
1624
|
+
args: any[];
|
|
1625
|
+
}
|
|
1626
|
+
|
|
929
1627
|
declare interface IFbxSetting {
|
|
930
1628
|
/**
|
|
931
1629
|
* https://github.com/cocos-creator/FBX-glTF-conv/pull/26
|
|
@@ -966,6 +1664,34 @@ declare interface IGetPrefabInfoParams {
|
|
|
966
1664
|
nodePath: string;
|
|
967
1665
|
}
|
|
968
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
|
+
|
|
969
1695
|
declare interface IIsPrefabInstanceParams {
|
|
970
1696
|
nodePath: string;
|
|
971
1697
|
}
|
|
@@ -1093,6 +1819,32 @@ declare interface INodeService extends IServiceEvents {
|
|
|
1093
1819
|
* 查询节点
|
|
1094
1820
|
*/
|
|
1095
1821
|
queryNode(params: IQueryNodeParams): Promise<INode | null>;
|
|
1822
|
+
/**
|
|
1823
|
+
* 查询节点树(层级管理器格式)
|
|
1824
|
+
*/
|
|
1825
|
+
queryNodeTree(params: IQueryNodeTreeParams): Promise<INodeTreeItem | null>;
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
declare interface INodeTreeComponent {
|
|
1829
|
+
isCustom: boolean;
|
|
1830
|
+
type: string;
|
|
1831
|
+
value: string;
|
|
1832
|
+
extends: string[];
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
declare interface INodeTreeItem {
|
|
1836
|
+
name: string;
|
|
1837
|
+
active: boolean;
|
|
1838
|
+
locked: boolean;
|
|
1839
|
+
type: string;
|
|
1840
|
+
uuid: string;
|
|
1841
|
+
children: INodeTreeItem[];
|
|
1842
|
+
prefab: IPrefabStateInfo;
|
|
1843
|
+
parent: string;
|
|
1844
|
+
path: string;
|
|
1845
|
+
isScene: boolean;
|
|
1846
|
+
readonly: boolean;
|
|
1847
|
+
components: INodeTreeComponent[];
|
|
1096
1848
|
}
|
|
1097
1849
|
|
|
1098
1850
|
/**
|
|
@@ -1103,6 +1855,25 @@ declare interface IOpenOptions {
|
|
|
1103
1855
|
simpleNode?: boolean;
|
|
1104
1856
|
}
|
|
1105
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
|
+
|
|
1873
|
+
export declare interface IOptionBase {
|
|
1874
|
+
modeName?: string;
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1106
1877
|
declare interface IPrefab {
|
|
1107
1878
|
name: string;
|
|
1108
1879
|
uuid: string;
|
|
@@ -1169,16 +1940,86 @@ declare interface IPrefabService extends IServiceEvents {
|
|
|
1169
1940
|
removePrefabInfoFromNode(node: Node_2, removeNested?: boolean): void;
|
|
1170
1941
|
}
|
|
1171
1942
|
|
|
1943
|
+
declare interface IPrefabStateInfo {
|
|
1944
|
+
state: PrefabState;
|
|
1945
|
+
isUnwrappable: boolean;
|
|
1946
|
+
isRevertable: boolean;
|
|
1947
|
+
isApplicable: boolean;
|
|
1948
|
+
isAddedChild: boolean;
|
|
1949
|
+
isNested: boolean;
|
|
1950
|
+
assetUuid: string;
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
/**
|
|
1954
|
+
* 组件的 dump 数据,以 IProperty 格式编码组件信息
|
|
1955
|
+
* 与 IComponent 不同,所有属性(包括 uuid, name, enabled)都通过 encodeObject 编码为 IProperty
|
|
1956
|
+
*/
|
|
1172
1957
|
declare interface IProperty {
|
|
1173
1958
|
value: { [key: string]: IPropertyValueType } | IPropertyValueType;
|
|
1959
|
+
default?: any; // 默认值
|
|
1960
|
+
|
|
1961
|
+
// 多选节点之后,这里存储多个数据,用于自行判断多选后的显示效果,无需更新该数据
|
|
1962
|
+
values?: ({ [key: string]: IPropertyValueType } | IPropertyValueType)[];
|
|
1963
|
+
|
|
1964
|
+
lock?: { [key in keyof Vec4]?: IPropertyLock };
|
|
1965
|
+
|
|
1966
|
+
cid?: string;
|
|
1174
1967
|
type?: string;
|
|
1968
|
+
ui?: { name: string; data?: any }; // 是否用指定的 UI 组件,name 是组件的名称
|
|
1175
1969
|
readonly?: boolean;
|
|
1970
|
+
visible?: boolean;
|
|
1176
1971
|
name?: string;
|
|
1972
|
+
|
|
1973
|
+
elementTypeData?: IProperty; // 数组里的数据的默认值 dump
|
|
1974
|
+
|
|
1177
1975
|
path?: string; // 数据的搜索路径,这个是由使用方填充的
|
|
1976
|
+
|
|
1178
1977
|
isArray?: boolean;
|
|
1978
|
+
invalid?: boolean;
|
|
1979
|
+
extends?: string[]; // 继承链
|
|
1980
|
+
displayName?: string; // 显示到界面上的名字
|
|
1981
|
+
displayOrder?: number; // 显示排序
|
|
1982
|
+
help?: string; // 帮助文档的 url 地址
|
|
1983
|
+
group?: IPropertyGroupOptions; // tab
|
|
1984
|
+
tooltip?: string; // 提示文本
|
|
1985
|
+
editor?: any; // 组件上定义的编辑器数据
|
|
1986
|
+
animatable?: boolean; // 是否可以在动画中编辑
|
|
1987
|
+
radioGroup?: boolean; // 是否渲染为 RadioGroup
|
|
1988
|
+
|
|
1989
|
+
// Enum
|
|
1990
|
+
enumList?: any[]; // enum 类型的 list 选项数组
|
|
1991
|
+
|
|
1992
|
+
bitmaskList?: any[];
|
|
1993
|
+
|
|
1994
|
+
// Number
|
|
1995
|
+
min?: number; // 数值类型的最小值
|
|
1996
|
+
max?: number; // 数值类型的最大值
|
|
1997
|
+
step?: number; // 数值类型的步进值
|
|
1998
|
+
slide?: boolean; // 数组是否显示为滑块
|
|
1999
|
+
unit?: string; // 显示的单位
|
|
2000
|
+
radian?: boolean; // 标识是否为角度
|
|
2001
|
+
|
|
2002
|
+
// Label
|
|
2003
|
+
multiline?: boolean; // 字符串是否允许换行
|
|
2004
|
+
// nullable?: boolean; 属性是否允许为空
|
|
2005
|
+
|
|
2006
|
+
optionalTypes?: string[]; // 对属性是 object 且是可变类型的数据的支持,比如 render-pipeline
|
|
2007
|
+
|
|
1179
2008
|
userData?: { [key: string]: any }; // 用户透传的数据
|
|
1180
2009
|
}
|
|
1181
2010
|
|
|
2011
|
+
declare interface IPropertyGroupOptions {
|
|
2012
|
+
id: string // 默认 'default'
|
|
2013
|
+
name: string,
|
|
2014
|
+
displayOrder: number, // 默认 Infinity, 排在最后面
|
|
2015
|
+
style: string // 默认为 'tab'
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
declare type IPropertyLock = {
|
|
2019
|
+
default: number;
|
|
2020
|
+
message: string
|
|
2021
|
+
};
|
|
2022
|
+
|
|
1182
2023
|
declare interface IPropertyOverrideInfo {
|
|
1183
2024
|
targetInfo: ITargetInfo | null;
|
|
1184
2025
|
propertyPath: string[];
|
|
@@ -1195,7 +2036,15 @@ declare interface IQuat {
|
|
|
1195
2036
|
}
|
|
1196
2037
|
|
|
1197
2038
|
/**
|
|
1198
|
-
*
|
|
2039
|
+
* 查询注册类的过滤选项
|
|
2040
|
+
*/
|
|
2041
|
+
declare interface IQueryClassesOptions {
|
|
2042
|
+
extends?: string | string[];
|
|
2043
|
+
excludeSelf?: boolean;
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
/**
|
|
2047
|
+
* 查询组件的选项
|
|
1199
2048
|
*/
|
|
1200
2049
|
declare interface IQueryComponentOptions {
|
|
1201
2050
|
path: string;
|
|
@@ -1207,6 +2056,10 @@ declare interface IQueryNodeParams {
|
|
|
1207
2056
|
queryComponent: boolean;
|
|
1208
2057
|
}
|
|
1209
2058
|
|
|
2059
|
+
declare interface IQueryNodeTreeParams {
|
|
2060
|
+
path?: string;
|
|
2061
|
+
}
|
|
2062
|
+
|
|
1210
2063
|
declare interface IRedirectInfo {
|
|
1211
2064
|
// 跳转资源的类型
|
|
1212
2065
|
type: string;
|
|
@@ -1222,7 +2075,7 @@ declare interface IReloadOptions {
|
|
|
1222
2075
|
}
|
|
1223
2076
|
|
|
1224
2077
|
/**
|
|
1225
|
-
*
|
|
2078
|
+
* 删除组件的选项
|
|
1226
2079
|
*/
|
|
1227
2080
|
declare interface IRemoveComponentOptions {
|
|
1228
2081
|
path: string;
|
|
@@ -1249,6 +2102,66 @@ declare interface IScene extends IBaseIdentifier {
|
|
|
1249
2102
|
components: IComponentIdentifier[];
|
|
1250
2103
|
}
|
|
1251
2104
|
|
|
2105
|
+
export declare interface ISceneEvents {
|
|
2106
|
+
onAddComponent?(comp: Component): void;
|
|
2107
|
+
onRemoveComponent?(comp: Component): void;
|
|
2108
|
+
onComponentAdded?(comp: Component, opts?: IOptionBase): void;
|
|
2109
|
+
onComponentRemoved?(comp: Component, opts?: IOptionBase): void;
|
|
2110
|
+
}
|
|
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
|
+
|
|
1252
2165
|
declare interface IScriptEvents {
|
|
1253
2166
|
/**
|
|
1254
2167
|
* 当脚本刷新并执行完成时触发
|
|
@@ -1263,10 +2176,25 @@ declare interface IScriptService extends IServiceEvents {
|
|
|
1263
2176
|
scriptChange(): Promise<void>;
|
|
1264
2177
|
queryScriptCid(uuid: string): Promise<string | null>;
|
|
1265
2178
|
queryScriptName(uuid: string): Promise<string | null>;
|
|
1266
|
-
isCustomComponent(classConstructor: Function):
|
|
2179
|
+
isCustomComponent(classConstructor: Function): boolean;
|
|
1267
2180
|
suspend(condition: Promise<any>): void;
|
|
1268
2181
|
}
|
|
1269
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
|
+
|
|
1270
2198
|
declare interface IServiceEvents {
|
|
1271
2199
|
onEditorOpened?(): void;
|
|
1272
2200
|
onEditorReload?(): void;
|
|
@@ -1287,10 +2215,16 @@ declare interface IServiceEvents {
|
|
|
1287
2215
|
onComponentAdded?(comp: Component): void;
|
|
1288
2216
|
onComponentRemoved?(comp: Component): void;
|
|
1289
2217
|
onBeforeRemoveComponent?(comp: Component): void;
|
|
2218
|
+
onComponentBeforeChanged?(node: Node_2): void;
|
|
2219
|
+
onBeforeComponentAdded?(name: string, node: Node_2): void;
|
|
2220
|
+
onComponentChanged?(name: string, opts: IChangeNodeOptions): void;
|
|
1290
2221
|
onAssetDeleted?(uuid: string): void;
|
|
1291
2222
|
onAssetChanged?(uuid: string): void;
|
|
1292
2223
|
onAssetRefreshed?(uuid: string): void;
|
|
1293
2224
|
onScriptExecutionFinished?(): void;
|
|
2225
|
+
onSelectionSelect?(uuid: string, uuids: string[]): void;
|
|
2226
|
+
onSelectionUnselect?(uuid: string, uuids: string[]): void;
|
|
2227
|
+
onSelectionClear?(): void;
|
|
1294
2228
|
}
|
|
1295
2229
|
|
|
1296
2230
|
declare interface IServiceManager {
|
|
@@ -1301,10 +2235,16 @@ declare interface IServiceManager {
|
|
|
1301
2235
|
Asset: IAssetService;
|
|
1302
2236
|
Engine: IEngineService;
|
|
1303
2237
|
Prefab: IPrefabService;
|
|
2238
|
+
Selection: ISelectionService;
|
|
2239
|
+
Operation: IOperationService;
|
|
2240
|
+
Undo: IUndoService;
|
|
2241
|
+
Camera: ICameraService;
|
|
2242
|
+
Gizmo: IGizmoService;
|
|
2243
|
+
SceneView: ISceneViewService;
|
|
1304
2244
|
}
|
|
1305
2245
|
|
|
1306
2246
|
/**
|
|
1307
|
-
*
|
|
2247
|
+
* CLI 设置组件属性的选项
|
|
1308
2248
|
*/
|
|
1309
2249
|
declare interface ISetPropertyOptions {
|
|
1310
2250
|
componentPath: string;
|
|
@@ -1314,6 +2254,25 @@ declare interface ISetPropertyOptions {
|
|
|
1314
2254
|
record?: boolean;
|
|
1315
2255
|
}
|
|
1316
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
|
+
|
|
1317
2276
|
declare type ISupportCreateCCType =
|
|
1318
2277
|
| 'cc.AnimationClip' // 动画剪辑
|
|
1319
2278
|
| 'cc.Script' // 脚本(TypeScript/JavaScript)
|
|
@@ -1346,6 +2305,21 @@ declare interface ITargetOverrideInfo {
|
|
|
1346
2305
|
targetInfo: ITargetInfo | null;
|
|
1347
2306
|
}
|
|
1348
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
|
+
|
|
1349
2323
|
declare interface IUnpackPrefabInstanceParams {
|
|
1350
2324
|
/** 要解耦的预制体实例节点 */
|
|
1351
2325
|
nodePath: string;
|
|
@@ -1408,6 +2382,28 @@ declare interface LabelAtlasAssetUserData {
|
|
|
1408
2382
|
_fntConfig: FntData;
|
|
1409
2383
|
}
|
|
1410
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
|
+
|
|
1411
2407
|
declare interface LODsOption {
|
|
1412
2408
|
// 屏占比
|
|
1413
2409
|
screenRatio: number;
|
|
@@ -1532,6 +2528,7 @@ export declare class NodeService extends BaseService<INodeEvents> implements INo
|
|
|
1532
2528
|
private _walkNode;
|
|
1533
2529
|
updateNode(params: IUpdateNodeParams): Promise<IUpdateNodeResult>;
|
|
1534
2530
|
queryNode(params: IQueryNodeParams): Promise<INode | null>;
|
|
2531
|
+
queryNodeTree(params: IQueryNodeTreeParams): Promise<INodeTreeItem | null>;
|
|
1535
2532
|
/**
|
|
1536
2533
|
* 确保节点有 UITransform 组件
|
|
1537
2534
|
* 目前只需保障在创建空节点的时候检查任意上级是否为 canvas
|
|
@@ -1651,10 +2648,23 @@ declare enum NormalImportSetting {
|
|
|
1651
2648
|
recalculate = 3
|
|
1652
2649
|
}
|
|
1653
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
|
+
|
|
1654
2664
|
declare enum OptimizationPolicy {
|
|
1655
2665
|
AUTO = 0,
|
|
1656
|
-
SINGLE_INSTANCE =
|
|
1657
|
-
MULTI_INSTANCE =
|
|
2666
|
+
SINGLE_INSTANCE = 1,
|
|
2667
|
+
MULTI_INSTANCE = 2
|
|
1658
2668
|
}
|
|
1659
2669
|
|
|
1660
2670
|
/** 粒子资源的 userData */
|
|
@@ -1843,6 +2853,13 @@ export declare class PrefabService extends BaseService<IPrefabEvents> implements
|
|
|
1843
2853
|
findPathWithRule(root: Node_2, rule: Function): string[];
|
|
1844
2854
|
}
|
|
1845
2855
|
|
|
2856
|
+
declare enum PrefabState {
|
|
2857
|
+
NotAPrefab = 0,// Normal node, not a Prefab
|
|
2858
|
+
PrefabChild = 1,// Child node of a Prefab, without PrefabInstance
|
|
2859
|
+
PrefabInstance = 2,// Root node of a Prefab that contains a PrefabInstance
|
|
2860
|
+
PrefabLostAsset = 3
|
|
2861
|
+
}
|
|
2862
|
+
|
|
1846
2863
|
/** 类装饰器:注册 Service 类,自动收集所有公有方法 */
|
|
1847
2864
|
export declare function register(name?: string): ClassDecorator;
|
|
1848
2865
|
|
|
@@ -1879,6 +2896,38 @@ declare interface RtSpriteFrameAssetUserData {
|
|
|
1879
2896
|
*/
|
|
1880
2897
|
declare const SCENE_TEMPLATE_TYPE: readonly ['2d', '3d', 'quality'];
|
|
1881
2898
|
|
|
2899
|
+
declare type SceneDragEvent = 'onDragLeave' | 'onDragOver' | 'onDrop';
|
|
2900
|
+
|
|
2901
|
+
declare type SceneKeyboardEvent = 'keydown' | 'keyup';
|
|
2902
|
+
|
|
2903
|
+
declare enum SceneModeType {
|
|
2904
|
+
General = 'general',
|
|
2905
|
+
Prefab = 'prefab',
|
|
2906
|
+
Animation = 'animation',
|
|
2907
|
+
Preview = 'preview',
|
|
2908
|
+
Unset = ''
|
|
2909
|
+
}
|
|
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
|
+
|
|
1882
2931
|
/** JavaScript 脚本模块的 userData */
|
|
1883
2932
|
declare interface ScriptModuleUserData {
|
|
1884
2933
|
isPlugin: false;
|
|
@@ -1916,7 +2965,7 @@ export declare class ScriptService extends BaseService<IScriptEvents> implements
|
|
|
1916
2965
|
* 是否是自定义脚本(不是引擎定义的组件)
|
|
1917
2966
|
* @param classConstructor
|
|
1918
2967
|
*/
|
|
1919
|
-
isCustomComponent(classConstructor: Function):
|
|
2968
|
+
isCustomComponent(classConstructor: Function): boolean;
|
|
1920
2969
|
_loadScripts(): Promise<void>;
|
|
1921
2970
|
/**
|
|
1922
2971
|
* 加载脚本时触发
|
|
@@ -1946,6 +2995,18 @@ export declare class ScriptService extends BaseService<IScriptEvents> implements
|
|
|
1946
2995
|
private _handleImportException;
|
|
1947
2996
|
}
|
|
1948
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
|
+
|
|
1949
3010
|
declare interface SerializedAssetFinder {
|
|
1950
3011
|
meshes?: Array<string | null>;
|
|
1951
3012
|
animations?: Array<string | null>;
|
|
@@ -1960,6 +3021,8 @@ declare interface SerializedAssetFinder {
|
|
|
1960
3021
|
*/
|
|
1961
3022
|
export declare const Service: IServiceManager;
|
|
1962
3023
|
|
|
3024
|
+
export declare const ServiceEvents: GlobalEventManager;
|
|
3025
|
+
|
|
1963
3026
|
/**
|
|
1964
3027
|
* 范例
|
|
1965
3028
|
* @register('Scene')
|
|
@@ -1994,6 +3057,29 @@ declare interface SimplifyOptions {
|
|
|
1994
3057
|
maxIterationCount?: number;
|
|
1995
3058
|
}
|
|
1996
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
|
+
|
|
1997
3083
|
/** Spine 资源的 userData */
|
|
1998
3084
|
declare interface SpineAssetUserData {
|
|
1999
3085
|
/** 图集资源的 UUID */
|
|
@@ -2114,8 +3200,54 @@ declare interface TextureCubeAssetUserData extends TextureBaseAssetUserData {
|
|
|
2114
3200
|
bottom?: string;
|
|
2115
3201
|
}
|
|
2116
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
|
+
|
|
2117
3237
|
declare type TSceneTemplateType = typeof SCENE_TEMPLATE_TYPE[number];
|
|
2118
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
|
+
|
|
2119
3251
|
declare interface Vec2 {
|
|
2120
3252
|
x: number;
|
|
2121
3253
|
y: number;
|