@playcanvas/inspector 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -26
- package/package.json +12 -6
- package/src/asset-view.js +24 -17
- package/src/camera-view.js +5 -3
- package/src/context-menu.js +231 -0
- package/src/copy-json.js +692 -0
- package/src/describe.js +51 -2
- package/src/frame-graph-view.js +1 -0
- package/src/hierarchy-view.js +29 -3
- package/src/inspector.js +406 -59
- package/src/list-view.js +118 -12
- package/src/material-view.js +7 -6
- package/src/memory-view.js +224 -66
- package/src/mesh-view.js +6 -5
- package/src/model.js +24 -2
- package/src/node-model.js +78 -9
- package/src/property-view.js +159 -5
- package/src/render-target-view.js +3 -3
- package/src/script-view.js +21 -12
- package/src/styles.js +196 -2
- package/src/texture-view.js +4 -4
- package/src/transform-tool.js +185 -0
- package/types/asset-usage.d.ts +2 -0
- package/types/asset-view.d.ts +17 -10
- package/types/camera-view.d.ts +12 -6
- package/types/context-menu.d.ts +90 -0
- package/types/copy-json.d.ts +69 -0
- package/types/describe.d.ts +3 -2
- package/types/entity-inspector-script.d.ts +2 -2
- package/types/frame-graph-view.d.ts +6 -2
- package/types/hierarchy-view.d.ts +25 -11
- package/types/input/fly-controller.d.ts +4 -4
- package/types/input/input.d.ts +2 -2
- package/types/input/orbit-controller.d.ts +6 -6
- package/types/input/pose.d.ts +9 -7
- package/types/inspector.d.ts +144 -22
- package/types/instance-survey.d.ts +3 -1
- package/types/list-view.d.ts +44 -3
- package/types/material-view.d.ts +13 -6
- package/types/memory-view.d.ts +37 -30
- package/types/mesh-view.d.ts +12 -5
- package/types/model.d.ts +21 -3
- package/types/node-model.d.ts +30 -6
- package/types/physics-debug.d.ts +9 -5
- package/types/physics-view.d.ts +8 -6
- package/types/picker/picker.d.ts +15 -6
- package/types/picker/render-pass-picker.d.ts +16 -10
- package/types/property-view.d.ts +41 -0
- package/types/render-target-view.d.ts +10 -7
- package/types/renderers/texture-renderer-shaders.d.ts +1 -1
- package/types/renderers/texture-renderer.d.ts +11 -5
- package/types/renderers/wire-renderer.d.ts +14 -5
- package/types/script-view.d.ts +10 -4
- package/types/shader-view.d.ts +10 -6
- package/types/texture-view.d.ts +8 -5
- package/types/transform-tool.d.ts +92 -0
- package/types/viewport-tools.d.ts +25 -18
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How far a copy follows the links of what it copies.
|
|
3
|
+
*/
|
|
4
|
+
export type CopyOptions = object;
|
|
5
|
+
export type CopyResult = object;
|
|
6
|
+
/**
|
|
7
|
+
* Copies a group of a list, under its title. See {@link JsonCopy#group}.
|
|
8
|
+
*
|
|
9
|
+
* @param {ListRow[]} rows - The rows of the list.
|
|
10
|
+
* @param {string} key - The key of the group's header.
|
|
11
|
+
* @param {CopyOptions} options - How far to follow links from each entry.
|
|
12
|
+
* @returns {CopyResult} The copy, empty when the group is gone.
|
|
13
|
+
*/
|
|
14
|
+
export function copyGroup(rows: ListRow[], key: string, options: CopyOptions): CopyResult;
|
|
15
|
+
/**
|
|
16
|
+
* Copies a list, such as everything a tab lists, under its name. See {@link JsonCopy#listRows}.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} title - The name of the list.
|
|
19
|
+
* @param {ListRow[]} rows - Its rows, all of them, whatever its filter shows.
|
|
20
|
+
* @param {CopyOptions} options - How far to follow links from each entry.
|
|
21
|
+
* @returns {CopyResult} The copy.
|
|
22
|
+
*/
|
|
23
|
+
export function copyList(title: string, rows: ListRow[], options: CopyOptions): CopyResult;
|
|
24
|
+
/**
|
|
25
|
+
* Copies the figures of a row of a list that selects nothing, such as the size of a pool.
|
|
26
|
+
*
|
|
27
|
+
* @param {ListRow} row - The row.
|
|
28
|
+
* @returns {CopyResult} The copy.
|
|
29
|
+
*/
|
|
30
|
+
export function copyListRow(row: ListRow): CopyResult;
|
|
31
|
+
/**
|
|
32
|
+
* Copies a row. A row standing for an object copies the object, counting the links followed from
|
|
33
|
+
* it; a list copies its entries the same way, each as if it was copied on its own. Anything else
|
|
34
|
+
* is copied under its label.
|
|
35
|
+
*
|
|
36
|
+
* @param {PropertyRow} row - The row.
|
|
37
|
+
* @param {CopyOptions} options - How far to follow links.
|
|
38
|
+
* @returns {CopyResult} The copy.
|
|
39
|
+
*/
|
|
40
|
+
export function copyRow(row: PropertyRow, options: CopyOptions): CopyResult;
|
|
41
|
+
/**
|
|
42
|
+
* Copies a section of the subject, under its title.
|
|
43
|
+
*
|
|
44
|
+
* @param {PropertySection} section - The section.
|
|
45
|
+
* @param {CopyOptions} options - How far to follow links.
|
|
46
|
+
* @returns {CopyResult} The copy.
|
|
47
|
+
*/
|
|
48
|
+
export function copySection(section: PropertySection, options: CopyOptions): CopyResult;
|
|
49
|
+
/**
|
|
50
|
+
* Copies the subject of the panel, which is where the links followed are counted from.
|
|
51
|
+
*
|
|
52
|
+
* @param {object} subject - The subject.
|
|
53
|
+
* @param {PropertySection[]} sections - What the panel shows for it.
|
|
54
|
+
* @param {CopyOptions} options - How far to follow links.
|
|
55
|
+
* @returns {CopyResult} The copy.
|
|
56
|
+
*/
|
|
57
|
+
export function copySubject(subject: object, sections: PropertySection[], options: CopyOptions): CopyResult;
|
|
58
|
+
/**
|
|
59
|
+
* Prints a copy as indented JSON, the way `JSON.stringify` does, except that a list of plain
|
|
60
|
+
* values stays on one line, so a vector reads as `[0, 1, 0]` rather than taking five lines.
|
|
61
|
+
*
|
|
62
|
+
* @param {*} json - The copy.
|
|
63
|
+
* @param {string} [indent] - The indentation of the line the value starts on.
|
|
64
|
+
* @returns {string} The text.
|
|
65
|
+
*/
|
|
66
|
+
export function stringifyCopy(json: any, indent?: string): string;
|
|
67
|
+
import type { ListRow } from './list-view.js';
|
|
68
|
+
import type { PropertyRow } from './model.js';
|
|
69
|
+
import type { PropertySection } from './model.js';
|
package/types/describe.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ export type Described = object;
|
|
|
5
5
|
/**
|
|
6
6
|
* Lists the public properties of an object: accessors with a getter found on its prototype chain
|
|
7
7
|
* (most derived class first, in declaration order), followed by its own enumerable data fields.
|
|
8
|
-
* Names starting with an underscore, methods
|
|
8
|
+
* Names starting with an underscore, methods, getters of deprecated or removed engine APIs and
|
|
9
|
+
* anything in `skip` are left out.
|
|
9
10
|
*
|
|
10
11
|
* @param {object} obj - The object to reflect on.
|
|
11
12
|
* @param {object[]} stopPrototypes - Prototypes at which to stop walking the chain. These and
|
|
@@ -21,7 +22,7 @@ export function collectProperties(obj: object, stopPrototypes: object[], skip?:
|
|
|
21
22
|
*
|
|
22
23
|
* @param {*} value - The value to describe.
|
|
23
24
|
* @param {number} [depth] - The nesting depth. Nested values are kept to a short type name.
|
|
24
|
-
* @returns {Described} The description
|
|
25
|
+
* @returns {Described} The description, carrying the value as `raw`.
|
|
25
26
|
*/
|
|
26
27
|
export function describeValue(value: any, depth?: number): Described;
|
|
27
28
|
/**
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
* cannot switch itself off. Everything else is the {@link Inspector} API, reachable through
|
|
19
19
|
* {@link EntityInspector#inspector}.
|
|
20
20
|
*/
|
|
21
|
-
export class EntityInspector {
|
|
22
|
-
static scriptName: string;
|
|
21
|
+
export class EntityInspector extends Script {
|
|
23
22
|
/**
|
|
24
23
|
* Whether the panel is shown. Toggled by {@link toggleKey}.
|
|
25
24
|
*
|
|
@@ -84,4 +83,5 @@ export class EntityInspector {
|
|
|
84
83
|
get inspector(): Inspector | null;
|
|
85
84
|
initialize(): void;
|
|
86
85
|
}
|
|
86
|
+
import { Script } from 'playcanvas';
|
|
87
87
|
import { Inspector } from './inspector.js';
|
|
@@ -140,7 +140,7 @@ export function buildStepModel(selection: LayerStepSelection, ctx: PassModelCont
|
|
|
140
140
|
* @param {AppBase} app - The app.
|
|
141
141
|
* @returns {FrameSnapshot} The snapshot.
|
|
142
142
|
*/
|
|
143
|
-
export function captureFrameGraph(app:
|
|
143
|
+
export function captureFrameGraph(app: AppBase): FrameSnapshot;
|
|
144
144
|
/**
|
|
145
145
|
* Turns a snapshot into list rows: one per pass, plus one per layer step of a forward pass and one
|
|
146
146
|
* naming the light of a shadow pass. Render target cells link to the target, camera and light
|
|
@@ -150,6 +150,10 @@ export function captureFrameGraph(app: FramePass): FrameSnapshot;
|
|
|
150
150
|
* @param {GraphicsDevice} device - The device.
|
|
151
151
|
* @returns {ListRow[]} The rows.
|
|
152
152
|
*/
|
|
153
|
-
export function passRows(frame: FrameSnapshot, device:
|
|
153
|
+
export function passRows(frame: FrameSnapshot, device: GraphicsDevice): ListRow[];
|
|
154
|
+
import { RenderPassForward } from 'playcanvas';
|
|
155
|
+
import { FramePass } from 'playcanvas';
|
|
154
156
|
import type { PropertySection } from './model.js';
|
|
157
|
+
import type { AppBase } from 'playcanvas';
|
|
158
|
+
import type { GraphicsDevice } from 'playcanvas';
|
|
155
159
|
import type { ListRow } from './list-view.js';
|
|
@@ -16,7 +16,7 @@ export class HierarchyView {
|
|
|
16
16
|
* @param {HTMLElement} container - The element to render into.
|
|
17
17
|
* @param {(node: GraphNode|null) => void} onSelect - The selection callback.
|
|
18
18
|
*/
|
|
19
|
-
constructor(container: HTMLElement, onSelect: (node:
|
|
19
|
+
constructor(container: HTMLElement, onSelect: (node: GraphNode | null) => void);
|
|
20
20
|
/**
|
|
21
21
|
* The element the tree is rendered into.
|
|
22
22
|
*
|
|
@@ -28,31 +28,38 @@ export class HierarchyView {
|
|
|
28
28
|
*
|
|
29
29
|
* @type {(node: GraphNode|null) => void}
|
|
30
30
|
*/
|
|
31
|
-
onSelect: (node:
|
|
31
|
+
onSelect: (node: GraphNode | null) => void;
|
|
32
32
|
/**
|
|
33
33
|
* Called after a node's enabled flag was flipped from its checkbox.
|
|
34
34
|
*
|
|
35
35
|
* @type {((node: GraphNode) => void)|undefined}
|
|
36
36
|
*/
|
|
37
|
-
onToggle: ((node:
|
|
37
|
+
onToggle: ((node: GraphNode) => void) | undefined;
|
|
38
38
|
/**
|
|
39
39
|
* Decides which nodes get no enabled checkbox. Defaults to none.
|
|
40
40
|
*
|
|
41
41
|
* @type {(node: GraphNode) => boolean}
|
|
42
42
|
*/
|
|
43
|
-
isLocked: (node:
|
|
43
|
+
isLocked: (node: GraphNode) => boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Decides which nodes are left out of the tree, with everything below them, such as the
|
|
46
|
+
* entity of a gizmo the panel adds to the hierarchy. Defaults to none.
|
|
47
|
+
*
|
|
48
|
+
* @type {(node: GraphNode) => boolean}
|
|
49
|
+
*/
|
|
50
|
+
isHidden: (node: GraphNode) => boolean;
|
|
44
51
|
/**
|
|
45
52
|
* The root of the rendered hierarchy.
|
|
46
53
|
*
|
|
47
54
|
* @type {GraphNode|null}
|
|
48
55
|
*/
|
|
49
|
-
root:
|
|
56
|
+
root: GraphNode | null;
|
|
50
57
|
/**
|
|
51
58
|
* The selected node.
|
|
52
59
|
*
|
|
53
60
|
* @type {GraphNode|null}
|
|
54
61
|
*/
|
|
55
|
-
selected:
|
|
62
|
+
selected: GraphNode | null;
|
|
56
63
|
/**
|
|
57
64
|
* Case-insensitive filter text. Nodes that match, and their ancestors, stay visible.
|
|
58
65
|
*
|
|
@@ -104,7 +111,7 @@ export class HierarchyView {
|
|
|
104
111
|
*
|
|
105
112
|
* @param {GraphNode|null} root - The new root.
|
|
106
113
|
*/
|
|
107
|
-
setRoot(root:
|
|
114
|
+
setRoot(root: GraphNode | null): void;
|
|
108
115
|
/**
|
|
109
116
|
* Counts the nodes of a subtree, recording for each node how many are below it, and totals
|
|
110
117
|
* the nodes and entities of the hierarchy on the way.
|
|
@@ -118,19 +125,25 @@ export class HierarchyView {
|
|
|
118
125
|
* Synchronizes the rendered tree with the hierarchy.
|
|
119
126
|
*/
|
|
120
127
|
refresh(): void;
|
|
128
|
+
/**
|
|
129
|
+
* @param {Node} element - An element, such as the target of a context menu event.
|
|
130
|
+
* @returns {GraphNode|null} The node whose row it is in, or null when it is in none. The rows
|
|
131
|
+
* of a node's children are nested under its element, so only the row itself is matched.
|
|
132
|
+
*/
|
|
133
|
+
nodeAt(element: Node): GraphNode | null;
|
|
121
134
|
/**
|
|
122
135
|
* Selects a node, expanding its ancestors and scrolling it into view.
|
|
123
136
|
*
|
|
124
137
|
* @param {GraphNode|null} node - The node, or null to clear the selection.
|
|
125
138
|
*/
|
|
126
|
-
select(node:
|
|
139
|
+
select(node: GraphNode | null): void;
|
|
127
140
|
/**
|
|
128
141
|
* Toggles the expansion of a node.
|
|
129
142
|
*
|
|
130
143
|
* @param {GraphNode} node - The node.
|
|
131
144
|
* @param {boolean} [recursive] - Apply the new state to the whole subtree.
|
|
132
145
|
*/
|
|
133
|
-
toggle(node:
|
|
146
|
+
toggle(node: GraphNode, recursive?: boolean): void;
|
|
134
147
|
/**
|
|
135
148
|
* Renders a node and, when expanded or filtering, its subtree.
|
|
136
149
|
*
|
|
@@ -162,11 +175,12 @@ export class HierarchyView {
|
|
|
162
175
|
* @param {FilterBy} by - What to collect: 'component' or 'script'.
|
|
163
176
|
* @returns {string[]} The values, empty when filtering by name.
|
|
164
177
|
*/
|
|
165
|
-
export function filterSuggestions(root:
|
|
178
|
+
export function filterSuggestions(root: GraphNode | null, by: FilterBy): string[];
|
|
166
179
|
/**
|
|
167
180
|
* @param {GraphNode} node - A node.
|
|
168
181
|
* @param {string} text - The lower-cased filter text.
|
|
169
182
|
* @param {FilterBy} by - What the text matches.
|
|
170
183
|
* @returns {boolean} Whether the node matches.
|
|
171
184
|
*/
|
|
172
|
-
export function matchesFilter(node:
|
|
185
|
+
export function matchesFilter(node: GraphNode, text: string, by: FilterBy): boolean;
|
|
186
|
+
import type { GraphNode } from 'playcanvas';
|
|
@@ -23,10 +23,10 @@ export class FlyController extends InputController {
|
|
|
23
23
|
* full damping. Default is 0.98.
|
|
24
24
|
*/
|
|
25
25
|
moveDamping: number;
|
|
26
|
-
set pitchRange(value:
|
|
27
|
-
get pitchRange():
|
|
28
|
-
set yawRange(value:
|
|
29
|
-
get yawRange():
|
|
26
|
+
set pitchRange(value: import("playcanvas").Vec2);
|
|
27
|
+
get pitchRange(): import("playcanvas").Vec2;
|
|
28
|
+
set yawRange(value: import("playcanvas").Vec2);
|
|
29
|
+
get yawRange(): import("playcanvas").Vec2;
|
|
30
30
|
/**
|
|
31
31
|
* @param {InputFrame<{ move: number[], rotate: number[] }>} frame - The input frame.
|
|
32
32
|
* @param {number} dt - The delta time.
|
package/types/input/input.d.ts
CHANGED
|
@@ -113,14 +113,14 @@ export class InputSource<T extends Record<string, number[]>> extends InputFrame<
|
|
|
113
113
|
* @param {HandleEventCallback} callback - The callback function to execute when the event is
|
|
114
114
|
* triggered.
|
|
115
115
|
*/
|
|
116
|
-
on(event: string, callback:
|
|
116
|
+
on(event: string, callback: HandleEventCallback): void;
|
|
117
117
|
/**
|
|
118
118
|
* Removes an event listener for the specified event.
|
|
119
119
|
*
|
|
120
120
|
* @param {string} event - The event name to stop listening for.
|
|
121
121
|
* @param {HandleEventCallback} callback - The callback function to remove.
|
|
122
122
|
*/
|
|
123
|
-
off(event: string, callback:
|
|
123
|
+
off(event: string, callback: HandleEventCallback): void;
|
|
124
124
|
/**
|
|
125
125
|
* Fires an event with the given name and arguments.
|
|
126
126
|
*
|
|
@@ -42,12 +42,12 @@ export class OrbitController extends InputController {
|
|
|
42
42
|
* The zoom damping. A higher value means more damping. A value of 0 means no damping.
|
|
43
43
|
*/
|
|
44
44
|
zoomDamping: number;
|
|
45
|
-
set pitchRange(range:
|
|
46
|
-
get pitchRange():
|
|
47
|
-
set yawRange(range:
|
|
48
|
-
get yawRange():
|
|
49
|
-
set zoomRange(range:
|
|
50
|
-
get zoomRange():
|
|
45
|
+
set pitchRange(range: import("playcanvas").Vec2);
|
|
46
|
+
get pitchRange(): import("playcanvas").Vec2;
|
|
47
|
+
set yawRange(range: import("playcanvas").Vec2);
|
|
48
|
+
get yawRange(): import("playcanvas").Vec2;
|
|
49
|
+
set zoomRange(range: import("playcanvas").Vec2);
|
|
50
|
+
get zoomRange(): import("playcanvas").Vec2;
|
|
51
51
|
/**
|
|
52
52
|
* @param {InputFrame<{ move: number[], rotate: number[] }>} frame - The input frame.
|
|
53
53
|
* @param {number} dt - The delta time.
|
package/types/input/pose.d.ts
CHANGED
|
@@ -19,11 +19,11 @@ export class Pose {
|
|
|
19
19
|
/**
|
|
20
20
|
* The position of the pose.
|
|
21
21
|
*/
|
|
22
|
-
position:
|
|
22
|
+
position: Vec3;
|
|
23
23
|
/**
|
|
24
24
|
* The angles of the pose in degrees calculated from the forward vector.
|
|
25
25
|
*/
|
|
26
|
-
angles:
|
|
26
|
+
angles: Vec3;
|
|
27
27
|
/**
|
|
28
28
|
* The focus distance from the position to the pose.
|
|
29
29
|
*/
|
|
@@ -32,27 +32,27 @@ export class Pose {
|
|
|
32
32
|
* The allowed range of pitch angles in degrees, stored as (min, max). Applied when the pose
|
|
33
33
|
* is rotated via {@link rotate}.
|
|
34
34
|
*/
|
|
35
|
-
pitchRange:
|
|
35
|
+
pitchRange: Vec2;
|
|
36
36
|
/**
|
|
37
37
|
* The allowed range of yaw angles in degrees, stored as (min, max). Applied when the pose is
|
|
38
38
|
* rotated via {@link rotate}.
|
|
39
39
|
*/
|
|
40
|
-
yawRange:
|
|
40
|
+
yawRange: Vec2;
|
|
41
41
|
/**
|
|
42
42
|
* The allowed range of positions along the x axis, stored as (min, max). Applied when the
|
|
43
43
|
* pose is translated via {@link move}.
|
|
44
44
|
*/
|
|
45
|
-
xRange:
|
|
45
|
+
xRange: Vec2;
|
|
46
46
|
/**
|
|
47
47
|
* The allowed range of positions along the y axis, stored as (min, max). Applied when the
|
|
48
48
|
* pose is translated via {@link move}.
|
|
49
49
|
*/
|
|
50
|
-
yRange:
|
|
50
|
+
yRange: Vec2;
|
|
51
51
|
/**
|
|
52
52
|
* The allowed range of positions along the z axis, stored as (min, max). Applied when the
|
|
53
53
|
* pose is translated via {@link move}.
|
|
54
54
|
*/
|
|
55
|
-
zRange:
|
|
55
|
+
zRange: Vec2;
|
|
56
56
|
/**
|
|
57
57
|
* Copies the position and rotation from another pose.
|
|
58
58
|
*
|
|
@@ -124,3 +124,5 @@ export class Pose {
|
|
|
124
124
|
*/
|
|
125
125
|
getFocus(out?: Vec3): Vec3;
|
|
126
126
|
}
|
|
127
|
+
import { Vec3 } from 'playcanvas';
|
|
128
|
+
import { Vec2 } from 'playcanvas';
|
package/types/inspector.d.ts
CHANGED
|
@@ -102,7 +102,7 @@ export type InspectorPhysicsDrawOptions = {
|
|
|
102
102
|
range?: number;
|
|
103
103
|
};
|
|
104
104
|
/**
|
|
105
|
-
* An in-page inspector for a running application. It docks a panel over the canvas with
|
|
105
|
+
* An in-page inspector for a running application. It docks a panel over the canvas with twelve
|
|
106
106
|
* tabs above a live property view of whatever is selected:
|
|
107
107
|
*
|
|
108
108
|
* - Hierarchy: the entity tree. The property view shows the node's transform, every component it
|
|
@@ -111,9 +111,12 @@ export type InspectorPhysicsDrawOptions = {
|
|
|
111
111
|
* - Cameras: every camera in render order, with its target, viewport, layers and render mode. The
|
|
112
112
|
* render mode of a camera can be switched to a debug view of the material inputs, the whole scene
|
|
113
113
|
* drawn in wireframe, and any camera flown.
|
|
114
|
+
* - Assets: every asset in the registry with its file, load state and the components using it.
|
|
115
|
+
* Asset references on a component link here, and a texture names the asset it came from.
|
|
114
116
|
* - Frame graph: the render passes of the last frame in execution order, as the render pass trace
|
|
115
117
|
* prints them, with the layer steps of forward passes, the light of shadow passes and optional
|
|
116
|
-
* GPU timings. Render target cells link to the next tab.
|
|
118
|
+
* GPU timings. Render target cells link to the next tab. With the debug engine, the debug frame
|
|
119
|
+
* draws a forward pass only up to a chosen draw, stepped one draw at a time with the arrow keys.
|
|
117
120
|
* - Render targets: every render target on the device including the backbuffer, with its
|
|
118
121
|
* attachments and the passes that rendered into it this frame, linking back to the frame graph.
|
|
119
122
|
* The selected target's attachment can be previewed live in a corner of the viewport.
|
|
@@ -128,20 +131,21 @@ export type InspectorPhysicsDrawOptions = {
|
|
|
128
131
|
* - Scripts: every script class the script registry holds or an entity uses, with the entities using
|
|
129
132
|
* it, its declared attributes and its source as the browser keeps it. The script sections of an
|
|
130
133
|
* entity link here.
|
|
131
|
-
* - Memory: video memory by kind of resource,
|
|
132
|
-
* after the mesh, material or asset
|
|
134
|
+
* - Memory: video memory by kind of resource, each kind a group headed by its count and size that
|
|
135
|
+
* opens to list its buffers largest first, named after the mesh, material or asset each was found
|
|
136
|
+
* to belong to. Buffer values elsewhere link here.
|
|
133
137
|
* - Shaders: every shader on the device with its language, state and vertex attributes. The
|
|
134
138
|
* compiled variants listed on a material link here.
|
|
135
|
-
* - Assets: every asset in the registry with its file, load state and the components using it.
|
|
136
|
-
* Asset references on a component link here, and a texture names the asset it came from.
|
|
137
139
|
* - Physics: the rigid bodies and joints of the scene, with the physics world drawn over the scene
|
|
138
140
|
* through the engine's debug drawer when Ammo is loaded.
|
|
139
141
|
*
|
|
140
142
|
* The app can be paused and stepped a frame at a time, and the panel can be popped out into its own
|
|
141
|
-
* window to leave the canvas unobscured.
|
|
143
|
+
* window to leave the canvas unobscured. In the view, an entity can be picked to select it, and the
|
|
144
|
+
* camera flown, or orbited around the selected entity, without moving the app's own camera.
|
|
142
145
|
*
|
|
143
|
-
* The
|
|
144
|
-
* enabled flag
|
|
146
|
+
* The inspector is read-only, apart from the checkbox on each hierarchy row, which flips the node's
|
|
147
|
+
* enabled flag, pausing and stepping the app, and view-only overrides: render modes, wireframe and
|
|
148
|
+
* a flown or orbited camera, which it removes when it closes.
|
|
145
149
|
*
|
|
146
150
|
* ```javascript
|
|
147
151
|
* const inspector = new Inspector(app, { dock: 'left' });
|
|
@@ -192,7 +196,7 @@ export class Inspector {
|
|
|
192
196
|
* @example
|
|
193
197
|
* const inspector = new Inspector(app, { dock: 'left', width: 480 });
|
|
194
198
|
*/
|
|
195
|
-
constructor(app:
|
|
199
|
+
constructor(app: AppBase, options?: InspectorOptions);
|
|
196
200
|
/**
|
|
197
201
|
* Called with the new visibility whenever the panel is shown or hidden, whether through
|
|
198
202
|
* {@link visible}, the toggle key or the panel's own close button. Set from the
|
|
@@ -375,6 +379,34 @@ export class Inspector {
|
|
|
375
379
|
* @private
|
|
376
380
|
*/
|
|
377
381
|
private _bodyList;
|
|
382
|
+
/**
|
|
383
|
+
* The gizmo that moves, rotates or scales the selected entity, while one of its buttons is on.
|
|
384
|
+
*
|
|
385
|
+
* @type {TransformTool|null}
|
|
386
|
+
* @private
|
|
387
|
+
*/
|
|
388
|
+
private _transformTool;
|
|
389
|
+
/**
|
|
390
|
+
* The buttons of the gizmos, by what each does.
|
|
391
|
+
*
|
|
392
|
+
* @type {Record<TransformMode, HTMLButtonElement>}
|
|
393
|
+
* @private
|
|
394
|
+
*/
|
|
395
|
+
private _transformBtns;
|
|
396
|
+
/**
|
|
397
|
+
* The menu opened with a right click, which copies what it was opened on.
|
|
398
|
+
*
|
|
399
|
+
* @type {ContextMenu|null}
|
|
400
|
+
* @private
|
|
401
|
+
*/
|
|
402
|
+
private _menu;
|
|
403
|
+
/**
|
|
404
|
+
* How many links the menu's deep copy follows.
|
|
405
|
+
*
|
|
406
|
+
* @type {number}
|
|
407
|
+
* @private
|
|
408
|
+
*/
|
|
409
|
+
private _copyDepth;
|
|
378
410
|
/**
|
|
379
411
|
* Draws the selected render target's texture over the canvas, straight from the GPU.
|
|
380
412
|
*
|
|
@@ -604,16 +636,6 @@ export class Inspector {
|
|
|
604
636
|
* @private
|
|
605
637
|
*/
|
|
606
638
|
private _instancePages;
|
|
607
|
-
/**
|
|
608
|
-
* @type {HTMLSelectElement}
|
|
609
|
-
* @private
|
|
610
|
-
*/
|
|
611
|
-
private _bufferKind;
|
|
612
|
-
/**
|
|
613
|
-
* @type {HTMLElement}
|
|
614
|
-
* @private
|
|
615
|
-
*/
|
|
616
|
-
private _memoryNote;
|
|
617
639
|
/**
|
|
618
640
|
* Model builder for the property view when a buffer is selected.
|
|
619
641
|
*
|
|
@@ -1122,6 +1144,81 @@ export class Inspector {
|
|
|
1122
1144
|
* @private
|
|
1123
1145
|
*/
|
|
1124
1146
|
private _applyFilter;
|
|
1147
|
+
/**
|
|
1148
|
+
* @returns {Record<string, ListView>} The list of each tab, all but the hierarchy, by tab.
|
|
1149
|
+
* @private
|
|
1150
|
+
*/
|
|
1151
|
+
private _tabLists;
|
|
1152
|
+
/**
|
|
1153
|
+
* @returns {ListView[]} The lists of the tabs, all but the hierarchy.
|
|
1154
|
+
* @private
|
|
1155
|
+
*/
|
|
1156
|
+
private _lists;
|
|
1157
|
+
/**
|
|
1158
|
+
* Opens the copy menu on what was right-clicked. Text fields keep the browser's own menu, to
|
|
1159
|
+
* paste into them.
|
|
1160
|
+
*
|
|
1161
|
+
* @param {MouseEvent} e - The event.
|
|
1162
|
+
* @private
|
|
1163
|
+
*/
|
|
1164
|
+
private _onContextMenu;
|
|
1165
|
+
/**
|
|
1166
|
+
* What a right click copies: a row or section of the property view, or anywhere else in it
|
|
1167
|
+
* the subject. A row of a list or of the hierarchy is selected first, the way a click selects
|
|
1168
|
+
* it, and the subject it shows is copied; the header of a group copies the group, and a row
|
|
1169
|
+
* that selects nothing its figures. A tab is opened first, the way a click opens it, and
|
|
1170
|
+
* everything it lists is copied.
|
|
1171
|
+
*
|
|
1172
|
+
* @param {Node} target - What was right-clicked.
|
|
1173
|
+
* @returns {CopyTarget|null} What to copy, or null for a part of the panel nothing is copied
|
|
1174
|
+
* from, such as the toolbar.
|
|
1175
|
+
* @private
|
|
1176
|
+
*/
|
|
1177
|
+
private _copyTargetAt;
|
|
1178
|
+
/**
|
|
1179
|
+
* @param {string} tab - A tab.
|
|
1180
|
+
* @returns {CopyTarget|null} A copy of everything the tab lists: the hierarchy from its root,
|
|
1181
|
+
* or every row of the tab's list, whatever its filter shows.
|
|
1182
|
+
* @private
|
|
1183
|
+
*/
|
|
1184
|
+
private _tabCopyTarget;
|
|
1185
|
+
/**
|
|
1186
|
+
* @param {CopyTarget} copy - What the menu copies.
|
|
1187
|
+
* @returns {MenuItem[]} The entries of the menu: on its own, a
|
|
1188
|
+
* number of links deep, and every link there is.
|
|
1189
|
+
* @private
|
|
1190
|
+
*/
|
|
1191
|
+
private _copyItems;
|
|
1192
|
+
/**
|
|
1193
|
+
* @param {number} depth - How many links the deep copy follows.
|
|
1194
|
+
* @private
|
|
1195
|
+
*/
|
|
1196
|
+
private _setCopyDepth;
|
|
1197
|
+
/**
|
|
1198
|
+
* Copies to the clipboard as JSON, and notes how much was copied.
|
|
1199
|
+
*
|
|
1200
|
+
* @param {CopyTarget} copy - What to copy.
|
|
1201
|
+
* @param {number} depth - How many links to follow, see {@link CopyOptions#depth}.
|
|
1202
|
+
* @private
|
|
1203
|
+
*/
|
|
1204
|
+
private _copy;
|
|
1205
|
+
/**
|
|
1206
|
+
* @returns {Set<object>} The app's own objects, which a copy never follows, as through them it
|
|
1207
|
+
* would reach everything else.
|
|
1208
|
+
* @private
|
|
1209
|
+
*/
|
|
1210
|
+
private _opaqueObjects;
|
|
1211
|
+
/**
|
|
1212
|
+
* The model a copy follows a link into: what the tab the link opens on shows, see
|
|
1213
|
+
* {@link Inspector#_selectAny}, without the lists of what uses the object.
|
|
1214
|
+
*
|
|
1215
|
+
* @param {object} obj - An object reached through a link.
|
|
1216
|
+
* @param {PassModelContext & { app: AppBase, backlinks: boolean }} ctx - What the model
|
|
1217
|
+
* builders need besides their subject.
|
|
1218
|
+
* @returns {PropertySection[]|PropertyRow[]|null} The model, or null for an object no tab shows.
|
|
1219
|
+
* @private
|
|
1220
|
+
*/
|
|
1221
|
+
private _copyModel;
|
|
1125
1222
|
/**
|
|
1126
1223
|
* Reveals a linked object in the tab that lists it: nodes in the hierarchy, passes in the frame
|
|
1127
1224
|
* graph, render targets in their list.
|
|
@@ -1218,11 +1315,13 @@ export class Inspector {
|
|
|
1218
1315
|
/** @private */
|
|
1219
1316
|
private _stopFly;
|
|
1220
1317
|
/**
|
|
1221
|
-
* Orbit
|
|
1318
|
+
* Pick, Fly and Orbit take the view from the app, which a gizmo needs to be used in, so their
|
|
1319
|
+
* buttons are off while one is on. Orbit also needs a node to orbit around, so its button is off
|
|
1320
|
+
* until one is selected.
|
|
1222
1321
|
*
|
|
1223
1322
|
* @private
|
|
1224
1323
|
*/
|
|
1225
|
-
private
|
|
1324
|
+
private _applyViewToolState;
|
|
1226
1325
|
/**
|
|
1227
1326
|
* Takes the pointer on the canvas for a mode, and Esc to end it.
|
|
1228
1327
|
*
|
|
@@ -1278,6 +1377,27 @@ export class Inspector {
|
|
|
1278
1377
|
* @private
|
|
1279
1378
|
*/
|
|
1280
1379
|
private _updateModeStatus;
|
|
1380
|
+
/**
|
|
1381
|
+
* Turns a gizmo on, in place of the one that is on, or turns it off. The gizmo is drawn and
|
|
1382
|
+
* used in the view of the first camera drawing to the screen, which Pick, Fly and Orbit would
|
|
1383
|
+
* take from the app, so they stop and stay off while it is on.
|
|
1384
|
+
*
|
|
1385
|
+
* @param {TransformMode|null} mode - What the gizmo does, or null to turn it off.
|
|
1386
|
+
* @private
|
|
1387
|
+
*/
|
|
1388
|
+
private _setTransformMode;
|
|
1389
|
+
/**
|
|
1390
|
+
* @param {KeyboardEvent} e - A key pressed while a gizmo is on.
|
|
1391
|
+
* @private
|
|
1392
|
+
*/
|
|
1393
|
+
private _onTransformKey;
|
|
1394
|
+
/**
|
|
1395
|
+
* Hands the pointer to the gizmo first, and keeps from everything else what it keeps.
|
|
1396
|
+
*
|
|
1397
|
+
* @param {Event} e - A pointer event anywhere in the window.
|
|
1398
|
+
* @private
|
|
1399
|
+
*/
|
|
1400
|
+
private _onTransformPointer;
|
|
1281
1401
|
/**
|
|
1282
1402
|
* Outlines a node in the viewport for the current frame.
|
|
1283
1403
|
*
|
|
@@ -1302,3 +1422,5 @@ export class Inspector {
|
|
|
1302
1422
|
*/
|
|
1303
1423
|
private _highlightSize;
|
|
1304
1424
|
}
|
|
1425
|
+
import { GraphNode } from 'playcanvas';
|
|
1426
|
+
import type { AppBase } from 'playcanvas';
|
|
@@ -32,4 +32,6 @@ export type FoundInstance = {
|
|
|
32
32
|
* @param {AppBase} app - The app.
|
|
33
33
|
* @returns {FoundInstance[]} The mesh instances, in the order found.
|
|
34
34
|
*/
|
|
35
|
-
export function collectMeshInstances(app:
|
|
35
|
+
export function collectMeshInstances(app: AppBase): FoundInstance[];
|
|
36
|
+
import { MeshInstance } from 'playcanvas';
|
|
37
|
+
import type { AppBase } from 'playcanvas';
|
package/types/list-view.d.ts
CHANGED
|
@@ -7,9 +7,10 @@ export type ListRow = object;
|
|
|
7
7
|
export type ListGuides = object;
|
|
8
8
|
export type ListEntry = object;
|
|
9
9
|
/**
|
|
10
|
-
* A flat, selectable list of rows with cells
|
|
11
|
-
*
|
|
12
|
-
* touches the text
|
|
10
|
+
* A flat, selectable list of rows with cells, optionally in groups under headers that open and
|
|
11
|
+
* close them. Rows are keyed and reconciled in place, so a list rebuilt from scratch a couple of
|
|
12
|
+
* times a second keeps its selection, open groups and scroll position and only touches the text
|
|
13
|
+
* that changed.
|
|
13
14
|
*
|
|
14
15
|
* @ignore
|
|
15
16
|
*/
|
|
@@ -80,18 +81,37 @@ export class ListView {
|
|
|
80
81
|
* @private
|
|
81
82
|
*/
|
|
82
83
|
private _entries;
|
|
84
|
+
/**
|
|
85
|
+
* Whether each header the user opened or closed is open, by row key.
|
|
86
|
+
*
|
|
87
|
+
* @type {Map<string, boolean>}
|
|
88
|
+
* @private
|
|
89
|
+
*/
|
|
90
|
+
private _open;
|
|
83
91
|
/**
|
|
84
92
|
* The number of rows before filtering.
|
|
85
93
|
*
|
|
86
94
|
* @type {number}
|
|
87
95
|
*/
|
|
88
96
|
get rowCount(): number;
|
|
97
|
+
/**
|
|
98
|
+
* The rows, all of them, whatever the filter shows and whichever groups are open.
|
|
99
|
+
*
|
|
100
|
+
* @type {ListRow[]}
|
|
101
|
+
*/
|
|
102
|
+
get rows(): ListRow[];
|
|
89
103
|
/**
|
|
90
104
|
* The item of the selected row, or null when nothing is selected or the row is gone.
|
|
91
105
|
*
|
|
92
106
|
* @type {*}
|
|
93
107
|
*/
|
|
94
108
|
get selected(): any;
|
|
109
|
+
/**
|
|
110
|
+
* The selected row, or null when nothing is selected or the row is gone.
|
|
111
|
+
*
|
|
112
|
+
* @type {ListRow|null}
|
|
113
|
+
*/
|
|
114
|
+
get selectedRow(): ListRow | null;
|
|
95
115
|
/**
|
|
96
116
|
* Replaces the rows and re-renders.
|
|
97
117
|
*
|
|
@@ -111,10 +131,31 @@ export class ListView {
|
|
|
111
131
|
* @returns {boolean} Whether a row was found.
|
|
112
132
|
*/
|
|
113
133
|
selectItem(item: any): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* @param {Node} node - An element, such as the target of a context menu event.
|
|
136
|
+
* @returns {ListRow|null} The row it is in, a header included, or null when it is in none.
|
|
137
|
+
*/
|
|
138
|
+
rowAt(node: Node): ListRow | null;
|
|
139
|
+
/**
|
|
140
|
+
* @param {ListRow} row - A header row.
|
|
141
|
+
* @returns {boolean} Whether its group is open.
|
|
142
|
+
* @private
|
|
143
|
+
*/
|
|
144
|
+
private _isOpen;
|
|
114
145
|
/**
|
|
115
146
|
* Synchronizes the DOM with the rows.
|
|
116
147
|
*/
|
|
117
148
|
render(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Decides which rows are shown. Without a filter, the rows of a closed group are hidden. With
|
|
151
|
+
* one, every matching row is shown whether its group is open or not, and a header is shown when
|
|
152
|
+
* any row of its group matches.
|
|
153
|
+
*
|
|
154
|
+
* @param {string} filter - The lower-cased filter, or an empty string for none.
|
|
155
|
+
* @returns {boolean[]} Whether each row is shown.
|
|
156
|
+
* @private
|
|
157
|
+
*/
|
|
158
|
+
private _shownRows;
|
|
118
159
|
/**
|
|
119
160
|
* @param {ListEntry} entry - The row entry.
|
|
120
161
|
* @param {ListCell[]} cells - The cells to show.
|