babylon.quarks-editor 0.26.0 → 0.28.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/CHANGELOG.md +134 -0
- package/README.md +69 -9
- package/dist/core/assetDragSession.d.ts +1 -1
- package/dist/core/assetTree.d.ts +6 -1
- package/dist/core/assets.d.ts +7 -0
- package/dist/core/assets.js +11 -7
- package/dist/core/binding.d.ts +11 -2
- package/dist/core/binding.js +9 -1
- package/dist/core/collision.d.ts +4 -0
- package/dist/core/collision.js +4 -0
- package/dist/core/colors.d.ts +16 -0
- package/dist/core/colors.js +8 -0
- package/dist/core/defaultEffect.d.ts +5 -4
- package/dist/core/defaultEffect.js +4 -4
- package/dist/core/editorScene.d.ts +1 -1
- package/dist/core/editorSession.d.ts +229 -0
- package/dist/core/editorSession.js +983 -0
- package/dist/core/effectTree.d.ts +6 -1
- package/dist/core/effectTree.js +13 -88
- package/dist/core/emitterShapeWireframe.d.ts +2 -2
- package/dist/core/emitterShapeWireframe.js +45 -13
- package/dist/core/galleryDropMarker.d.ts +2 -2
- package/dist/core/galleryDropMarker.js +6 -6
- package/dist/core/galleryLayout.d.ts +3 -3
- package/dist/core/galleryLayout.js +1 -1
- package/dist/core/galleryPlayback.d.ts +1 -1
- package/dist/core/galleryPlayback.js +2 -1
- package/dist/core/galleryScene.d.ts +4 -4
- package/dist/core/galleryScene.js +3 -3
- package/dist/core/gallerySelectionMarker.d.ts +4 -4
- package/dist/core/gallerySelectionMarker.js +5 -5
- package/dist/core/groups.d.ts +1 -1
- package/dist/core/groups.js +1 -1
- package/dist/core/history.d.ts +7 -1
- package/dist/core/history.js +4 -0
- package/dist/core/indexedDbProjectStore.d.ts +14 -1
- package/dist/core/indexedDbProjectStore.js +13 -0
- package/dist/core/lineShaders.d.ts +2 -2
- package/dist/core/lineShaders.js +2 -2
- package/dist/core/loadEffect.d.ts +2 -2
- package/dist/core/loadEffect.js +1 -1
- package/dist/core/material.d.ts +12 -2
- package/dist/core/pickAssetFiles.js +1 -1
- package/dist/core/playback.d.ts +6 -0
- package/dist/core/projectStore.d.ts +26 -0
- package/dist/core/projectStore.js +1 -0
- package/dist/core/sceneEntries.d.ts +7 -4
- package/dist/core/sceneEntries.js +2 -2
- package/dist/core/scrub.d.ts +2 -2
- package/dist/core/scrub.js +2 -2
- package/dist/core/shapes.d.ts +25 -1
- package/dist/core/shapes.js +5 -0
- package/dist/core/systems.d.ts +4 -2
- package/dist/core/systems.js +3 -1
- package/dist/core/textureExport.d.ts +1 -1
- package/dist/core/timeline.d.ts +25 -5
- package/dist/core/transport.d.ts +3 -3
- package/dist/core/transport.js +2 -2
- package/dist/core/values.d.ts +21 -4
- package/dist/core/values.js +5 -0
- package/dist/core/viewportPicker.d.ts +4 -4
- package/dist/core/viewportPicker.js +8 -7
- package/dist/index.d.ts +25 -21
- package/dist/index.js +12 -12
- package/dist/react/AssetsPanel.d.ts +9 -2
- package/dist/react/AssetsPanel.js +6 -6
- package/dist/react/ChoiceDialog.d.ts +7 -0
- package/dist/react/ChoiceDialog.js +1 -1
- package/dist/react/ContextMenu.d.ts +10 -1
- package/dist/react/ContextMenu.js +1 -1
- package/dist/react/CurveEditor.d.ts +1 -1
- package/dist/react/CurveEditor.js +2 -2
- package/dist/react/EditorWorkspace.d.ts +9 -2
- package/dist/react/EditorWorkspace.js +10 -7
- package/dist/react/EffectEditor.d.ts +11 -5
- package/dist/react/EffectEditor.js +7 -7
- package/dist/react/EffectEditorHost.d.ts +33 -29
- package/dist/react/EffectEditorHost.js +247 -1674
- package/dist/react/EffectTreeView.d.ts +4 -1
- package/dist/react/EffectTreeView.js +3 -3
- package/dist/react/GradientEditor.d.ts +1 -1
- package/dist/react/GradientEditor.js +3 -3
- package/dist/react/InspectorInfoIcon.js +3 -3
- package/dist/react/InspectorLabel.js +3 -3
- package/dist/react/MessageDialog.d.ts +5 -0
- package/dist/react/MessageDialog.js +1 -1
- package/dist/react/ModuleSection.d.ts +10 -0
- package/dist/react/ModuleSection.js +8 -5
- package/dist/react/ObjectModule.d.ts +1 -1
- package/dist/react/ObjectModule.js +4 -4
- package/dist/react/ProjectsPage.d.ts +7 -1
- package/dist/react/ProjectsPage.js +33 -17
- package/dist/react/PromptDialog.d.ts +7 -0
- package/dist/react/PromptDialog.js +1 -1
- package/dist/react/ScenePanel.d.ts +9 -2
- package/dist/react/ScenePanel.js +12 -10
- package/dist/react/SubEmittersModule.d.ts +1 -1
- package/dist/react/SubEmittersModule.js +5 -5
- package/dist/react/TextureSelect.d.ts +24 -0
- package/dist/react/TextureSelect.js +74 -0
- package/dist/react/TextureUVField.d.ts +14 -0
- package/dist/react/TextureUVField.js +23 -0
- package/dist/react/TimelinePanel.d.ts +20 -7
- package/dist/react/TimelinePanel.js +21 -15
- package/dist/react/TimelineTrackRow.d.ts +13 -3
- package/dist/react/TimelineTrackRow.js +6 -6
- package/dist/react/TransportBar.d.ts +13 -4
- package/dist/react/TransportBar.js +3 -3
- package/dist/react/ValueField.d.ts +32 -5
- package/dist/react/ValueField.js +22 -11
- package/dist/react/behaviorModules.d.ts +19 -6
- package/dist/react/behaviorModules.js +68 -17
- package/dist/react/fields.d.ts +9 -0
- package/dist/react/fields.js +6 -3
- package/dist/react/host/BottomDocks.d.ts +36 -0
- package/dist/react/host/BottomDocks.js +63 -0
- package/dist/react/host/HostDialogs.d.ts +50 -0
- package/dist/react/host/HostDialogs.js +113 -0
- package/dist/react/host/InspectorSidebar.d.ts +32 -0
- package/dist/react/host/InspectorSidebar.js +59 -0
- package/dist/react/host/SceneSidebar.d.ts +53 -0
- package/dist/react/host/SceneSidebar.js +62 -0
- package/dist/react/host/ViewportPane.d.ts +56 -0
- package/dist/react/host/ViewportPane.js +91 -0
- package/dist/react/host/hostHooks.d.ts +44 -0
- package/dist/react/host/hostHooks.js +164 -0
- package/dist/react/host/hostStyles.d.ts +21 -0
- package/dist/react/host/hostStyles.js +57 -0
- package/dist/react/index.d.ts +42 -38
- package/dist/react/index.js +25 -23
- package/dist/react/inspectorHints.js +31 -0
- package/dist/react/modules.d.ts +19 -6
- package/dist/react/modules.js +134 -117
- package/dist/react/theme.d.ts +15 -0
- package/dist/react/theme.js +15 -0
- package/dist/session.d.ts +9 -0
- package/dist/session.js +8 -0
- package/package.json +18 -11
- package/src/core/assetDragSession.ts +1 -1
- package/src/core/assetTree.ts +15 -2
- package/src/core/assets.ts +25 -10
- package/src/core/binding.ts +12 -3
- package/src/core/collision.ts +4 -0
- package/src/core/colors.ts +21 -1
- package/src/core/defaultEffect.ts +8 -7
- package/src/core/editorScene.ts +1 -1
- package/src/core/editorSession.ts +1299 -0
- package/src/core/effectTree.ts +18 -101
- package/src/core/emitterShapeWireframe.ts +48 -16
- package/src/core/galleryDropMarker.ts +8 -8
- package/src/core/galleryLayout.ts +4 -4
- package/src/core/galleryPlayback.ts +3 -2
- package/src/core/galleryScene.ts +5 -5
- package/src/core/gallerySelectionMarker.ts +7 -7
- package/src/core/groups.ts +1 -1
- package/src/core/history.ts +7 -1
- package/src/core/indexedDbProjectStore.ts +14 -1
- package/src/core/lineShaders.ts +2 -2
- package/src/core/loadEffect.ts +4 -4
- package/src/core/material.ts +14 -4
- package/src/core/pickAssetFiles.ts +2 -2
- package/src/core/playback.ts +6 -0
- package/src/core/projectStore.ts +26 -0
- package/src/core/sceneEntries.ts +8 -5
- package/src/core/scrub.ts +3 -3
- package/src/core/shapes.ts +29 -2
- package/src/core/systems.ts +11 -4
- package/src/core/textureExport.ts +1 -1
- package/src/core/timeline.ts +43 -18
- package/src/core/transport.ts +4 -4
- package/src/core/values.ts +20 -4
- package/src/core/viewportPicker.ts +12 -11
- package/src/index.ts +25 -21
- package/src/react/AssetsPanel.tsx +13 -6
- package/src/react/ChoiceDialog.tsx +8 -1
- package/src/react/ContextMenu.tsx +11 -2
- package/src/react/CurveEditor.tsx +2 -2
- package/src/react/EditorWorkspace.tsx +16 -10
- package/src/react/EffectEditor.tsx +17 -9
- package/src/react/EffectEditorHost.tsx +415 -2354
- package/src/react/EffectTreeView.tsx +7 -4
- package/src/react/GradientEditor.tsx +3 -3
- package/src/react/InspectorInfoIcon.tsx +3 -3
- package/src/react/InspectorLabel.tsx +3 -3
- package/src/react/MessageDialog.tsx +6 -1
- package/src/react/ModuleSection.tsx +15 -4
- package/src/react/ObjectModule.tsx +5 -5
- package/src/react/ProjectsPage.tsx +44 -17
- package/src/react/PromptDialog.tsx +8 -1
- package/src/react/ScenePanel.tsx +21 -12
- package/src/react/SubEmittersModule.tsx +6 -6
- package/src/react/TextureSelect.tsx +118 -0
- package/src/react/TextureUVField.tsx +62 -0
- package/src/react/TimelinePanel.tsx +40 -21
- package/src/react/TimelineTrackRow.tsx +19 -9
- package/src/react/TransportBar.tsx +16 -7
- package/src/react/ValueField.tsx +60 -16
- package/src/react/behaviorModules.tsx +240 -55
- package/src/react/fields.tsx +22 -4
- package/src/react/host/BottomDocks.tsx +178 -0
- package/src/react/host/HostDialogs.tsx +228 -0
- package/src/react/host/InspectorSidebar.tsx +147 -0
- package/src/react/host/SceneSidebar.tsx +227 -0
- package/src/react/host/ViewportPane.tsx +300 -0
- package/src/react/host/hostHooks.ts +198 -0
- package/src/react/host/hostStyles.ts +65 -0
- package/src/react/index.ts +43 -38
- package/src/react/inspectorHints.ts +40 -0
- package/src/react/modules.tsx +440 -170
- package/src/react/theme.ts +15 -0
- package/src/session.ts +17 -0
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/** One editor project: a library of effect assets plus the scene built from them. */
|
|
2
2
|
export interface ProjectMeta {
|
|
3
|
+
/** The project's key in its store. */
|
|
3
4
|
id: string;
|
|
5
|
+
/** The project's display name. */
|
|
4
6
|
name: string;
|
|
7
|
+
/** When the project was created, in milliseconds since the epoch. */
|
|
5
8
|
createdAt: number;
|
|
9
|
+
/** When the project last changed, in milliseconds since the epoch. */
|
|
6
10
|
updatedAt: number;
|
|
11
|
+
/** How many effect assets the project holds. */
|
|
7
12
|
assetCount: number;
|
|
8
13
|
/** Approximate bytes the project takes in storage (JSON + texture files). */
|
|
9
14
|
sizeBytes: number;
|
|
@@ -12,23 +17,32 @@ export interface ProjectMeta {
|
|
|
12
17
|
export interface StoredAsset {
|
|
13
18
|
/** Relative path inside the project (`Fire/Explosion.json`) — the asset's key. */
|
|
14
19
|
path: string;
|
|
20
|
+
/** The asset's display name, its file name without `.json`. */
|
|
15
21
|
name: string;
|
|
22
|
+
/** The effect, as quarks JSON with its textures inlined. */
|
|
16
23
|
json: unknown;
|
|
24
|
+
/** Files the effect referenced that were not imported with it. */
|
|
17
25
|
missingFiles: string[];
|
|
18
26
|
}
|
|
19
27
|
/** One effect instance in a saved scene. */
|
|
20
28
|
export interface StoredSceneEntry {
|
|
29
|
+
/** The instance's name in the Scene list. */
|
|
21
30
|
name: string;
|
|
22
31
|
/** Path of the asset it was made from, if any. */
|
|
23
32
|
assetPath: string | null;
|
|
24
33
|
/** The instance's own (possibly edited) effect, root transform included. */
|
|
25
34
|
json: unknown;
|
|
35
|
+
/** Whether the instance was shown. */
|
|
26
36
|
visible: boolean;
|
|
27
37
|
}
|
|
38
|
+
/** A project's saved scene: the effects placed in it, in Scene list order. */
|
|
28
39
|
export interface StoredScene {
|
|
40
|
+
/** The scene's effect instances. */
|
|
29
41
|
entries: StoredSceneEntry[];
|
|
42
|
+
/** When it was saved, in milliseconds since the epoch. */
|
|
30
43
|
savedAt: number;
|
|
31
44
|
}
|
|
45
|
+
/** How much storage projects use, as far as the browser tells. */
|
|
32
46
|
export interface StorageEstimate {
|
|
33
47
|
/** Bytes the whole site uses (all projects), when the browser reports it. */
|
|
34
48
|
usage: number | null;
|
|
@@ -42,20 +56,32 @@ export interface StorageEstimate {
|
|
|
42
56
|
* everything in the browser, and an embedding host can supply its own (e.g. on disk).
|
|
43
57
|
*/
|
|
44
58
|
export interface ProjectStore {
|
|
59
|
+
/** Every project, most recently changed first. */
|
|
45
60
|
listProjects(): Promise<ProjectMeta[]>;
|
|
61
|
+
/** One project, or null when there is none with that id. */
|
|
46
62
|
getProject(id: string): Promise<ProjectMeta | null>;
|
|
63
|
+
/** Creates an empty project. */
|
|
47
64
|
createProject(name: string): Promise<ProjectMeta>;
|
|
65
|
+
/** Renames a project. */
|
|
48
66
|
renameProject(id: string, name: string): Promise<void>;
|
|
67
|
+
/** Copies a project, its assets and its scene, under a new name. */
|
|
49
68
|
duplicateProject(id: string, name: string): Promise<ProjectMeta>;
|
|
69
|
+
/** Deletes a project, its assets and its scene. */
|
|
50
70
|
deleteProject(id: string): Promise<void>;
|
|
71
|
+
/** A project's assets. */
|
|
51
72
|
loadAssets(projectId: string): Promise<StoredAsset[]>;
|
|
52
73
|
/** Adds or replaces assets by path. */
|
|
53
74
|
putAssets(projectId: string, assets: StoredAsset[]): Promise<void>;
|
|
75
|
+
/** Deletes assets by path; paths it does not have are ignored. */
|
|
54
76
|
deleteAssets(projectId: string, paths: string[]): Promise<void>;
|
|
77
|
+
/** A project's saved scene, or null when it was never saved. */
|
|
55
78
|
loadScene(projectId: string): Promise<StoredScene | null>;
|
|
79
|
+
/** Replaces a project's saved scene. */
|
|
56
80
|
saveScene(projectId: string, scene: StoredScene): Promise<void>;
|
|
81
|
+
/** How much storage projects use. */
|
|
57
82
|
estimate(): Promise<StorageEstimate>;
|
|
58
83
|
/** Asks the browser to keep the data even under storage pressure; resolves to the result. */
|
|
59
84
|
requestPersistence(): Promise<boolean>;
|
|
60
85
|
}
|
|
86
|
+
/** A byte count for people: `512 B`, `1.5 KB`, `20 MB`; `—` when unknown. */
|
|
61
87
|
export declare function formatBytes(bytes: number | null | undefined): string;
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import type { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
2
|
-
import type { Scene } from '@babylonjs/core/scene';
|
|
1
|
+
import type { TransformNode } from '@babylonjs/core/Meshes/transformNode.js';
|
|
2
|
+
import type { Scene } from '@babylonjs/core/scene.js';
|
|
3
3
|
import type { BatchedRenderer, ParticleSystem } from 'babylon.quarks';
|
|
4
|
-
import type { EffectAsset } from './assets';
|
|
5
|
-
import { EffectBinding } from './binding';
|
|
4
|
+
import type { EffectAsset } from './assets.js';
|
|
5
|
+
import { EffectBinding } from './binding.js';
|
|
6
6
|
/**
|
|
7
7
|
* One effect instance placed in the scene. Every instance is live (its systems are registered
|
|
8
8
|
* with the renderer) and independent: dropping the same asset three times gives three entries
|
|
9
9
|
* that are edited separately.
|
|
10
10
|
*/
|
|
11
11
|
export interface SceneEntry {
|
|
12
|
+
/** The instance's name in the Scene list, unique in the scene. */
|
|
12
13
|
name: string;
|
|
13
14
|
/** Path of the asset it came from, or a synthetic `_created/…` path for new effects. */
|
|
14
15
|
path: string;
|
|
15
16
|
/** Asset this instance was made from, if any. */
|
|
16
17
|
assetId: number | null;
|
|
18
|
+
/** The instance's root node. */
|
|
17
19
|
root: TransformNode;
|
|
20
|
+
/** Every particle system of the instance. */
|
|
18
21
|
systems: ParticleSystem[];
|
|
19
22
|
}
|
|
20
23
|
/** `name`, or `name (2)`, `name (3)`… when an entry already uses it. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QuarksUtil } from 'babylon.quarks';
|
|
2
|
-
import { EffectBinding } from './binding';
|
|
3
|
-
import { disposeLoadedEffect, parseEffectFromJson } from './loadEffect';
|
|
2
|
+
import { EffectBinding } from './binding.js';
|
|
3
|
+
import { disposeLoadedEffect, parseEffectFromJson } from './loadEffect.js';
|
|
4
4
|
/** `name`, or `name (2)`, `name (3)`… when an entry already uses it. */
|
|
5
5
|
export function uniqueEntryName(name, existing) {
|
|
6
6
|
const taken = new Set(existing.map((entry) => entry.name));
|
package/dist/core/scrub.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BatchedRenderer } from 'babylon.quarks';
|
|
2
|
-
import type { EffectBinding } from './binding';
|
|
3
|
-
/** Unpauses every system in the focused effect. */
|
|
2
|
+
import type { EffectBinding } from './binding.js';
|
|
3
|
+
/** Unpauses every system in the focused effect; one that has finished stays finished. */
|
|
4
4
|
export declare function playFocus(binding: EffectBinding): void;
|
|
5
5
|
/** Freezes the focused effect at its current simulation state. */
|
|
6
6
|
export declare function pauseFocus(binding: EffectBinding): void;
|
package/dist/core/scrub.js
CHANGED
|
@@ -2,10 +2,10 @@ const WIDE_STEP_THRESHOLD = 8;
|
|
|
2
2
|
function bindingSystems(binding) {
|
|
3
3
|
return [binding.system, ...binding.subSystems];
|
|
4
4
|
}
|
|
5
|
-
/** Unpauses every system in the focused effect. */
|
|
5
|
+
/** Unpauses every system in the focused effect; one that has finished stays finished. */
|
|
6
6
|
export function playFocus(binding) {
|
|
7
7
|
for (const system of bindingSystems(binding)) {
|
|
8
|
-
system.
|
|
8
|
+
system.resume();
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
/** Freezes the focused effect at its current simulation state. */
|
package/dist/core/shapes.d.ts
CHANGED
|
@@ -1,22 +1,41 @@
|
|
|
1
|
-
import type { Mesh } from '@babylonjs/core/Meshes/mesh';
|
|
1
|
+
import type { Mesh } from '@babylonjs/core/Meshes/mesh.js';
|
|
2
2
|
import type { EmitterShape } from 'babylon.quarks';
|
|
3
3
|
import { BoxEmitFrom, EmitterMode } from 'babylon.quarks';
|
|
4
|
+
/** The emitter shapes the Shape module offers, by the `type` they serialise with. */
|
|
4
5
|
export type ShapeType = 'point' | 'sphere' | 'hemisphere' | 'cone' | 'circle' | 'donut' | 'rectangle' | 'grid' | 'box' | 'edge' | 'mesh_surface';
|
|
6
|
+
/** The Shape module's shape list, in menu order, with the label each shows. */
|
|
5
7
|
export declare const SHAPE_TYPES: Array<{
|
|
8
|
+
/** The shape's type. */
|
|
6
9
|
value: ShapeType;
|
|
10
|
+
/** Its label in the menu. */
|
|
7
11
|
label: string;
|
|
8
12
|
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Every shape's settings in one flat record, so switching shapes keeps what the shapes share
|
|
15
|
+
* (a cone's radius becomes the sphere's). Each shape reads the fields it has.
|
|
16
|
+
*/
|
|
9
17
|
export interface ShapeParams {
|
|
18
|
+
/** Radius of a sphere, hemisphere, cone, circle or donut. */
|
|
10
19
|
radius: number;
|
|
20
|
+
/** The part of the circle emitted from, in radians (2π: all of it). */
|
|
11
21
|
arc: number;
|
|
22
|
+
/** 0 emits from the surface only, 1 from the whole volume. */
|
|
12
23
|
thickness: number;
|
|
24
|
+
/** A cone's half angle, in radians. */
|
|
13
25
|
angle: number;
|
|
26
|
+
/** The radius of a donut's tube. */
|
|
14
27
|
donutRadius: number;
|
|
28
|
+
/** Width of a rectangle, grid or box (X). */
|
|
15
29
|
width: number;
|
|
30
|
+
/** Height of a rectangle, grid or box (Y). */
|
|
16
31
|
height: number;
|
|
32
|
+
/** How points around the arc are picked: at random, in a loop, back and forth or in bursts. */
|
|
17
33
|
mode: EmitterMode;
|
|
34
|
+
/** Snaps the arc position to steps of this fraction; 0 for none. */
|
|
18
35
|
spread: number;
|
|
36
|
+
/** A grid's column count. */
|
|
19
37
|
column: number;
|
|
38
|
+
/** A grid's row count. */
|
|
20
39
|
row: number;
|
|
21
40
|
/** Box depth (Z). */
|
|
22
41
|
depth: number;
|
|
@@ -24,14 +43,19 @@ export interface ShapeParams {
|
|
|
24
43
|
emitFrom: BoxEmitFrom;
|
|
25
44
|
/** How fast an edge emitter's loop / ping-pong point travels, in lengths per second. */
|
|
26
45
|
speed: number;
|
|
46
|
+
/** The mesh a mesh surface emitter emits from. */
|
|
27
47
|
mesh?: Mesh;
|
|
28
48
|
}
|
|
49
|
+
/** The settings a new shape starts from. */
|
|
29
50
|
export declare const DEFAULT_SHAPE_PARAMS: ShapeParams;
|
|
51
|
+
/** The type of a shape, as the Shape module lists it. */
|
|
30
52
|
export declare function getShapeType(shape: EmitterShape): ShapeType;
|
|
53
|
+
/** A shape's settings, the fields it does not have taken from {@link DEFAULT_SHAPE_PARAMS}. */
|
|
31
54
|
export declare function readShapeParams(shape: EmitterShape): ShapeParams;
|
|
32
55
|
/** Which parameters are relevant per shape type (drives the UI). `mesh_surface`'s mesh
|
|
33
56
|
* reference isn't a NumberField, so it's handled separately by the Shape module. */
|
|
34
57
|
export declare const SHAPE_PARAM_KEYS: {
|
|
35
58
|
[K in ShapeType]: Array<keyof ShapeParams>;
|
|
36
59
|
};
|
|
60
|
+
/** A new shape of `type`, built from the fields of `params` it has. */
|
|
37
61
|
export declare function createShape(type: ShapeType, params: ShapeParams): EmitterShape;
|
package/dist/core/shapes.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BoxEmitFrom, BoxEmitter, CircleEmitter, ConeEmitter, ConstantValue, DonutEmitter, EdgeEmitter, EmitterMode, GridEmitter, HemisphereEmitter, MeshSurfaceEmitter, PointEmitter, RectangleEmitter, SphereEmitter, } from 'babylon.quarks';
|
|
2
|
+
/** The Shape module's shape list, in menu order, with the label each shows. */
|
|
2
3
|
export const SHAPE_TYPES = [
|
|
3
4
|
{ value: 'cone', label: 'Cone' },
|
|
4
5
|
{ value: 'sphere', label: 'Sphere' },
|
|
@@ -12,6 +13,7 @@ export const SHAPE_TYPES = [
|
|
|
12
13
|
{ value: 'mesh_surface', label: 'Mesh surface' },
|
|
13
14
|
{ value: 'point', label: 'Point' },
|
|
14
15
|
];
|
|
16
|
+
/** The settings a new shape starts from. */
|
|
15
17
|
export const DEFAULT_SHAPE_PARAMS = {
|
|
16
18
|
radius: 0.3,
|
|
17
19
|
arc: Math.PI * 2,
|
|
@@ -29,10 +31,12 @@ export const DEFAULT_SHAPE_PARAMS = {
|
|
|
29
31
|
speed: 1,
|
|
30
32
|
mesh: undefined,
|
|
31
33
|
};
|
|
34
|
+
/** The type of a shape, as the Shape module lists it. */
|
|
32
35
|
export function getShapeType(shape) {
|
|
33
36
|
const type = shape.type ?? 'point';
|
|
34
37
|
return (SHAPE_TYPES.some((s) => s.value === type) ? type : 'point');
|
|
35
38
|
}
|
|
39
|
+
/** A shape's settings, the fields it does not have taken from {@link DEFAULT_SHAPE_PARAMS}. */
|
|
36
40
|
export function readShapeParams(shape) {
|
|
37
41
|
const anyShape = shape;
|
|
38
42
|
const num = (key, fallback) => typeof anyShape[key] === 'number' ? anyShape[key] : fallback;
|
|
@@ -69,6 +73,7 @@ export const SHAPE_PARAM_KEYS = {
|
|
|
69
73
|
edge: ['radius', 'speed'],
|
|
70
74
|
mesh_surface: [],
|
|
71
75
|
};
|
|
76
|
+
/** A new shape of `type`, built from the fields of `params` it has. */
|
|
72
77
|
export function createShape(type, params) {
|
|
73
78
|
switch (type) {
|
|
74
79
|
case 'point':
|
package/dist/core/systems.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
1
|
+
import type { TransformNode } from '@babylonjs/core/Meshes/transformNode.js';
|
|
2
2
|
import { ParticleSystem } from 'babylon.quarks';
|
|
3
|
-
import type { EffectBinding } from './binding';
|
|
3
|
+
import type { EffectBinding } from './binding.js';
|
|
4
|
+
/** How {@link createChildSystem} builds a new system. */
|
|
4
5
|
export interface ChildSystemOptions {
|
|
6
|
+
/** The new emitter's name. */
|
|
5
7
|
name?: string;
|
|
6
8
|
/** One-shot burst (sub-emitter target) instead of a looping stream. */
|
|
7
9
|
oneShot?: boolean;
|
package/dist/core/systems.js
CHANGED
|
@@ -43,7 +43,9 @@ export function unlinkSubEmitterReferences(systems, removed) {
|
|
|
43
43
|
const behaviors = system.behaviors;
|
|
44
44
|
for (let i = behaviors.length - 1; i >= 0; i--) {
|
|
45
45
|
const behavior = behaviors[i];
|
|
46
|
-
if (behavior.type === 'EmitSubParticleSystem' &&
|
|
46
|
+
if (behavior.type === 'EmitSubParticleSystem' &&
|
|
47
|
+
behavior.subParticleSystem &&
|
|
48
|
+
removedEmitters.has(behavior.subParticleSystem)) {
|
|
47
49
|
behaviors.splice(i, 1);
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Texture } from '@babylonjs/core/Materials/Textures/texture';
|
|
1
|
+
import type { Texture } from '@babylonjs/core/Materials/Textures/texture.js';
|
|
2
2
|
/**
|
|
3
3
|
* Ensures a texture's `.url` can be reloaded in a different Scene/Engine, baking its live
|
|
4
4
|
* GPU pixels into a real base64 PNG data URI when it currently only carries Babylon's
|
package/dist/core/timeline.d.ts
CHANGED
|
@@ -1,24 +1,44 @@
|
|
|
1
|
-
import type { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
1
|
+
import type { TransformNode } from '@babylonjs/core/Meshes/transformNode.js';
|
|
2
2
|
import type { FunctionValueGenerator, ParticleSystem, ValueGenerator } from 'babylon.quarks';
|
|
3
|
-
import type { EffectBinding } from './binding';
|
|
4
|
-
|
|
3
|
+
import type { EffectBinding } from './binding.js';
|
|
4
|
+
/** A timeline row for a group node: a heading over the tracks of the systems under it. */
|
|
5
|
+
export interface TimelineGroupRow {
|
|
6
|
+
/** Tells group rows from track rows. */
|
|
5
7
|
kind: 'group';
|
|
8
|
+
/** The group's node. */
|
|
6
9
|
node: TransformNode;
|
|
10
|
+
/** The group's name. */
|
|
7
11
|
name: string;
|
|
12
|
+
/** How deep the group sits in the effect tree; the root's children are 0. */
|
|
8
13
|
depth: number;
|
|
9
|
-
}
|
|
14
|
+
}
|
|
15
|
+
/** A timeline row for one particle system: a bar from its start delay over its duration. */
|
|
16
|
+
export interface TimelineSystemRow {
|
|
17
|
+
/** Tells group rows from track rows. */
|
|
10
18
|
kind: 'track';
|
|
19
|
+
/** The system's emitter node. */
|
|
11
20
|
node: TransformNode;
|
|
21
|
+
/** The system. */
|
|
12
22
|
system: ParticleSystem;
|
|
23
|
+
/** The emitter's name. */
|
|
13
24
|
name: string;
|
|
25
|
+
/** How deep the emitter sits in the effect tree. */
|
|
14
26
|
depth: number;
|
|
27
|
+
/** True for the effect's main system. */
|
|
15
28
|
isRoot: boolean;
|
|
29
|
+
/** False for the one system an effect cannot lose. */
|
|
16
30
|
removable: boolean;
|
|
31
|
+
/** Where the bar starts: the start delay, its lower end when random, in seconds. */
|
|
17
32
|
startOffset: number;
|
|
33
|
+
/** True when the start delay is a curve and the bar's start is only indicative. */
|
|
18
34
|
startOffsetVariable: boolean;
|
|
35
|
+
/** The bar's length, the system's duration in seconds. */
|
|
19
36
|
duration: number;
|
|
37
|
+
/** True when the system loops; its bar runs to the end of the ruler. */
|
|
20
38
|
looping: boolean;
|
|
21
|
-
}
|
|
39
|
+
}
|
|
40
|
+
/** One row of the focused effect's timeline. */
|
|
41
|
+
export type TimelineRow = TimelineGroupRow | TimelineSystemRow;
|
|
22
42
|
/**
|
|
23
43
|
* Reads a representative start-delay value for display without invoking the generator's
|
|
24
44
|
* stateful `genValue` (IntervalValue caches its sampled slot on first call and returns NaN
|
package/dist/core/transport.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Scene } from '@babylonjs/core/scene';
|
|
1
|
+
import type { Scene } from '@babylonjs/core/scene.js';
|
|
2
2
|
import type { BatchedRenderer } from 'babylon.quarks';
|
|
3
|
-
import type { EffectBinding } from './binding';
|
|
4
|
-
import { type PlaybackState } from './playback';
|
|
3
|
+
import type { EffectBinding } from './binding.js';
|
|
4
|
+
import { type PlaybackState } from './playback.js';
|
|
5
5
|
/**
|
|
6
6
|
* Stage Play/Pause shared by the viewport transport bar and the timeline. Pressing Play on a
|
|
7
7
|
* one-shot focus that already parked at its end replays it from the start.
|
package/dist/core/transport.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { clearFocusFinished, isFocusFinished, setFocusElapsed } from './playback';
|
|
2
|
-
import { playFocus, scrubFocusTo } from './scrub';
|
|
1
|
+
import { clearFocusFinished, isFocusFinished, setFocusElapsed } from './playback.js';
|
|
2
|
+
import { playFocus, scrubFocusTo } from './scrub.js';
|
|
3
3
|
/**
|
|
4
4
|
* Stage Play/Pause shared by the viewport transport bar and the timeline. Pressing Play on a
|
|
5
5
|
* one-shot focus that already parked at its end replays it from the start.
|
package/dist/core/values.d.ts
CHANGED
|
@@ -1,27 +1,44 @@
|
|
|
1
|
-
import type { FunctionValueGenerator, ValueGenerator } from 'babylon.quarks';
|
|
1
|
+
import type { FunctionValueGenerator, RotationGenerator, ValueGenerator, Vector3Generator } from 'babylon.quarks';
|
|
2
2
|
import { PiecewiseBezier } from 'babylon.quarks';
|
|
3
|
+
/** A generator of one number: a constant or random value, or a curve over the particle's life. */
|
|
3
4
|
export type ScalarGenerator = ValueGenerator | FunctionValueGenerator;
|
|
5
|
+
/** Any generator a value field can be pointed at; ones that are not scalar read as the default. */
|
|
6
|
+
export type AnyGenerator = ScalarGenerator | Vector3Generator | RotationGenerator;
|
|
7
|
+
/** How a value field produces its number: Unity's Constant, Random Between Two Constants or Curve. */
|
|
4
8
|
export type ScalarMode = 'constant' | 'random' | 'curve';
|
|
5
9
|
/** Editable snapshot of a scalar value generator. */
|
|
6
10
|
export interface ScalarValueState {
|
|
11
|
+
/** Which of the fields below is the value. */
|
|
7
12
|
mode: ScalarMode;
|
|
8
13
|
/** Constant value (mode: constant). */
|
|
9
14
|
value: number;
|
|
10
|
-
/**
|
|
15
|
+
/** Lower end of the random range (mode: random). */
|
|
11
16
|
min: number;
|
|
17
|
+
/** Upper end of the random range (mode: random). */
|
|
12
18
|
max: number;
|
|
13
19
|
/** Cubic bezier control values over normalized lifetime (mode: curve). */
|
|
14
20
|
curve: [number, number, number, number];
|
|
15
21
|
}
|
|
16
|
-
|
|
22
|
+
/**
|
|
23
|
+
* What a value field shows for `generator`: its constant, its range or its first curve segment.
|
|
24
|
+
* Anything else, including a missing generator, reads as the constant 1.
|
|
25
|
+
*/
|
|
26
|
+
export declare function readScalar(generator: AnyGenerator | undefined): ScalarValueState;
|
|
27
|
+
/** The generator a value field's state describes; a curve state builds a one-segment curve. */
|
|
28
|
+
export declare function buildScalar(state: ScalarValueState & {
|
|
29
|
+
mode: 'curve';
|
|
30
|
+
}): PiecewiseBezier;
|
|
17
31
|
export declare function buildScalar(state: ScalarValueState): ScalarGenerator;
|
|
18
32
|
/** One segment of a piecewise bezier curve: start x (0..1) + four control values. */
|
|
19
33
|
export interface CurvePiece {
|
|
34
|
+
/** Where the segment starts, 0..1 over the particle's life. */
|
|
20
35
|
start: number;
|
|
36
|
+
/** The segment's four bezier control values. */
|
|
21
37
|
p: [number, number, number, number];
|
|
22
38
|
}
|
|
23
39
|
/** Reads pieces from a PiecewiseBezier (or synthesizes one segment for other generators). */
|
|
24
|
-
export declare function readPieces(generator:
|
|
40
|
+
export declare function readPieces(generator: AnyGenerator | undefined): CurvePiece[];
|
|
41
|
+
/** A piecewise bezier from segments, sorted by their start. */
|
|
25
42
|
export declare function buildCurve(pieces: CurvePiece[]): PiecewiseBezier;
|
|
26
43
|
/** Splits the piece containing x into two exact halves using Bezier.split. */
|
|
27
44
|
export declare function splitPieces(pieces: CurvePiece[], x: number): CurvePiece[];
|
package/dist/core/values.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Bezier, ConstantValue, IntervalValue, PiecewiseBezier } from 'babylon.quarks';
|
|
2
|
+
/**
|
|
3
|
+
* What a value field shows for `generator`: its constant, its range or its first curve segment.
|
|
4
|
+
* Anything else, including a missing generator, reads as the constant 1.
|
|
5
|
+
*/
|
|
2
6
|
export function readScalar(generator) {
|
|
3
7
|
const state = { mode: 'constant', value: 1, min: 0.5, max: 1.5, curve: [0, 1, 1, 0] };
|
|
4
8
|
if (generator instanceof ConstantValue) {
|
|
@@ -44,6 +48,7 @@ export function readPieces(generator) {
|
|
|
44
48
|
const fallback = readScalar(generator);
|
|
45
49
|
return [{ start: 0, p: fallback.curve }];
|
|
46
50
|
}
|
|
51
|
+
/** A piecewise bezier from segments, sorted by their start. */
|
|
47
52
|
export function buildCurve(pieces) {
|
|
48
53
|
const sorted = [...pieces].sort((a, b) => a.start - b.start);
|
|
49
54
|
return new PiecewiseBezier(sorted.map((piece) => [new Bezier(...piece.p), piece.start]));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import '@babylonjs/core/Culling/ray';
|
|
2
|
-
import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
3
|
-
import type { Scene } from '@babylonjs/core/scene';
|
|
4
|
-
import type { SceneEntry } from './sceneEntries';
|
|
1
|
+
import '@babylonjs/core/Culling/ray.js';
|
|
2
|
+
import { TransformNode } from '@babylonjs/core/Meshes/transformNode.js';
|
|
3
|
+
import type { Scene } from '@babylonjs/core/scene.js';
|
|
4
|
+
import type { SceneEntry } from './sceneEntries.js';
|
|
5
5
|
/**
|
|
6
6
|
* Viewport pick/hover for visible scene effect roots only (not child emitters).
|
|
7
7
|
* Hover uses the same ground ring as focus selection, in yellow.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import '@babylonjs/core/Culling/ray';
|
|
2
|
-
import { MeshBuilder } from '@babylonjs/core/Meshes/meshBuilder';
|
|
3
|
-
import { EDITOR_SCENE_NODE_METADATA } from './editorScene';
|
|
4
|
-
import { GROUND_RING_RADIUS, GalleryHoverMarker } from './gallerySelectionMarker';
|
|
1
|
+
import '@babylonjs/core/Culling/ray.js';
|
|
2
|
+
import { MeshBuilder } from '@babylonjs/core/Meshes/meshBuilder.js';
|
|
3
|
+
import { EDITOR_SCENE_NODE_METADATA } from './editorScene.js';
|
|
4
|
+
import { GROUND_RING_RADIUS, GalleryHoverMarker } from './gallerySelectionMarker.js';
|
|
5
5
|
/** Invisible pick proxy size — matches the ground ring footprint. */
|
|
6
6
|
const PICK_DIAMETER = GROUND_RING_RADIUS * 2;
|
|
7
7
|
/**
|
|
@@ -34,9 +34,10 @@ export class GalleryViewportPicker {
|
|
|
34
34
|
else if (soloRoot && !soloRoot.isDisposed()) {
|
|
35
35
|
this.createHandle(soloRoot);
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
if (this.hoveredRoot?.isDisposed()) {
|
|
38
|
+
this.hoveredRoot = null;
|
|
39
|
+
this.hoverMarker.hide();
|
|
40
|
+
}
|
|
40
41
|
}
|
|
41
42
|
/** Yellow focus-style ring under the hovered effect root. */
|
|
42
43
|
setHover(effectRoot) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export
|
|
6
|
-
export {
|
|
7
|
-
export type {
|
|
8
|
-
export {
|
|
9
|
-
export type {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export
|
|
13
|
-
export {
|
|
14
|
-
export type {
|
|
15
|
-
export {
|
|
16
|
-
export type {
|
|
17
|
-
export {
|
|
18
|
-
export
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export type {
|
|
1
|
+
export type { AssetLoadProgress, EffectAsset } from './core/assets.js';
|
|
2
|
+
export type { AssetDragPayload } from './core/assetTree.js';
|
|
3
|
+
export { EffectBinding } from './core/binding.js';
|
|
4
|
+
export type { EditorListener } from './core/binding.js';
|
|
5
|
+
export { GroundPlaneResolver, ensureGroundResolver } from './core/collision.js';
|
|
6
|
+
export { DEFAULT_GRADIENT_STOPS, buildColorOverLife, buildGradient, findBehavior, hexToRgb, rgbToHex, rgbaToVector4, stopToCss, stopsToCssGradient, } from './core/colors.js';
|
|
7
|
+
export type { GradientStop } from './core/colors.js';
|
|
8
|
+
export { buildEffectTree, collectSystems, serializeEffectForest, serializeEffectTree } from './core/effectTree.js';
|
|
9
|
+
export type { EffectTreeNode } from './core/effectTree.js';
|
|
10
|
+
export { EffectHistory } from './core/history.js';
|
|
11
|
+
export type { HistoryStacks } from './core/history.js';
|
|
12
|
+
export { IndexedDbProjectStore } from './core/indexedDbProjectStore.js';
|
|
13
|
+
export { applyRendererMaterial, getMaterialLabel } from './core/material.js';
|
|
14
|
+
export type { RendererMaterialPatch } from './core/material.js';
|
|
15
|
+
export { formatBytes } from './core/projectStore.js';
|
|
16
|
+
export type { ProjectMeta, ProjectStore, StorageEstimate, StoredAsset, StoredScene, StoredSceneEntry, } from './core/projectStore.js';
|
|
17
|
+
export type { SceneEntry } from './core/sceneEntries.js';
|
|
18
|
+
export { DEFAULT_SHAPE_PARAMS, SHAPE_PARAM_KEYS, SHAPE_TYPES, createShape, getShapeType, readShapeParams, } from './core/shapes.js';
|
|
19
|
+
export type { ShapeParams, ShapeType } from './core/shapes.js';
|
|
20
|
+
export { createChildSystem } from './core/systems.js';
|
|
21
|
+
export type { ChildSystemOptions } from './core/systems.js';
|
|
22
|
+
export { ensurePortableTextureUrl } from './core/textureExport.js';
|
|
23
|
+
export type { TimelineGroupRow, TimelineRow, TimelineSystemRow } from './core/timeline.js';
|
|
24
|
+
export { buildCurve, buildScalar, mergePieces, readPieces, readScalar, sampleCurve, splitPieces } from './core/values.js';
|
|
25
|
+
export type { AnyGenerator, CurvePiece, ScalarGenerator, ScalarMode, ScalarValueState } from './core/values.js';
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { EffectBinding } from './core/binding';
|
|
2
|
-
export { GroundPlaneResolver, ensureGroundResolver } from './core/collision';
|
|
3
|
-
export { DEFAULT_GRADIENT_STOPS, buildColorOverLife, buildGradient, findBehavior, hexToRgb, rgbToHex, rgbaToVector4, stopToCss, stopsToCssGradient, } from './core/colors';
|
|
4
|
-
export { buildEffectTree, collectSystems, serializeEffectForest, serializeEffectTree } from './core/effectTree';
|
|
5
|
-
export { EffectHistory } from './core/history';
|
|
6
|
-
export { IndexedDbProjectStore } from './core/indexedDbProjectStore';
|
|
7
|
-
export { applyRendererMaterial, getMaterialLabel } from './core/material';
|
|
8
|
-
export { formatBytes } from './core/projectStore';
|
|
9
|
-
export { DEFAULT_SHAPE_PARAMS, SHAPE_PARAM_KEYS, SHAPE_TYPES, createShape, getShapeType, readShapeParams, } from './core/shapes';
|
|
10
|
-
export { createChildSystem } from './core/systems';
|
|
11
|
-
export { ensurePortableTextureUrl } from './core/textureExport';
|
|
12
|
-
export { buildCurve, buildScalar, mergePieces, readPieces, readScalar, sampleCurve, splitPieces } from './core/values';
|
|
1
|
+
export { EffectBinding } from './core/binding.js';
|
|
2
|
+
export { GroundPlaneResolver, ensureGroundResolver } from './core/collision.js';
|
|
3
|
+
export { DEFAULT_GRADIENT_STOPS, buildColorOverLife, buildGradient, findBehavior, hexToRgb, rgbToHex, rgbaToVector4, stopToCss, stopsToCssGradient, } from './core/colors.js';
|
|
4
|
+
export { buildEffectTree, collectSystems, serializeEffectForest, serializeEffectTree } from './core/effectTree.js';
|
|
5
|
+
export { EffectHistory } from './core/history.js';
|
|
6
|
+
export { IndexedDbProjectStore } from './core/indexedDbProjectStore.js';
|
|
7
|
+
export { applyRendererMaterial, getMaterialLabel } from './core/material.js';
|
|
8
|
+
export { formatBytes } from './core/projectStore.js';
|
|
9
|
+
export { DEFAULT_SHAPE_PARAMS, SHAPE_PARAM_KEYS, SHAPE_TYPES, createShape, getShapeType, readShapeParams, } from './core/shapes.js';
|
|
10
|
+
export { createChildSystem } from './core/systems.js';
|
|
11
|
+
export { ensurePortableTextureUrl } from './core/textureExport.js';
|
|
12
|
+
export { buildCurve, buildScalar, mergePieces, readPieces, readScalar, sampleCurve, splitPieces } from './core/values.js';
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type AssetDragPayload } from '../core/assetTree';
|
|
3
|
-
import { type AssetLoadProgress, type EffectAsset } from '../core/assets';
|
|
2
|
+
import { type AssetDragPayload } from '../core/assetTree.js';
|
|
3
|
+
import { type AssetLoadProgress, type EffectAsset } from '../core/assets.js';
|
|
4
|
+
/** Props of {@link AssetsPanel}. */
|
|
4
5
|
export interface AssetsPanelProps {
|
|
6
|
+
/** The assets, shown as a folder tree by their paths. */
|
|
5
7
|
assets: EffectAsset[];
|
|
6
8
|
/** Scene instance count per asset id. */
|
|
7
9
|
instanceCounts: ReadonlyMap<number, number>;
|
|
10
|
+
/** Import progress while importing; the import buttons are disabled meanwhile. */
|
|
8
11
|
loading: AssetLoadProgress | null;
|
|
12
|
+
/** The hidden folder input, clicked by hosts whose browser has no directory picker. */
|
|
9
13
|
folderInputRef: React.RefObject<HTMLInputElement | null>;
|
|
14
|
+
/** Imports picked files. */
|
|
10
15
|
onImportFiles: (files: FileList | File[]) => void;
|
|
16
|
+
/** Opens a folder to import. */
|
|
11
17
|
onImportFolder: () => void;
|
|
12
18
|
/** Adds a new instance of each asset in the payload to the scene. */
|
|
13
19
|
onAddToScene: (payload: AssetDragPayload) => void;
|
|
20
|
+
/** Deletes the assets in the payload. */
|
|
14
21
|
onDelete: (payload: AssetDragPayload) => void;
|
|
15
22
|
/** Opens the asset on its own to edit it (double-click). Without it, double-click adds to the scene. */
|
|
16
23
|
onOpenPrefab?: (asset: EffectAsset) => void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ChevronDownIcon, ChevronRightIcon, ExclamationTriangleIcon, FolderIcon, FolderOpenIcon, SparklesIcon, } from '@heroicons/react/24/solid';
|
|
3
3
|
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import { setAssetDragSession } from '../core/assetDragSession';
|
|
5
|
-
import { buildAssetTree, collectFolderAssets, folderChildren, searchAssets, writeAssetDrag, } from '../core/assetTree';
|
|
6
|
-
import { assetIconUrl } from '../core/assets';
|
|
7
|
-
import { ContextMenu } from './ContextMenu';
|
|
8
|
-
import { iconStyle } from './icons';
|
|
9
|
-
import { buttonStyle, hiddenFileInputStyle, inputStyle, theme } from './theme';
|
|
4
|
+
import { setAssetDragSession } from '../core/assetDragSession.js';
|
|
5
|
+
import { buildAssetTree, collectFolderAssets, folderChildren, searchAssets, writeAssetDrag, } from '../core/assetTree.js';
|
|
6
|
+
import { assetIconUrl } from '../core/assets.js';
|
|
7
|
+
import { ContextMenu } from './ContextMenu.js';
|
|
8
|
+
import { iconStyle } from './icons.js';
|
|
9
|
+
import { buttonStyle, hiddenFileInputStyle, inputStyle, theme } from './theme.js';
|
|
10
10
|
const TREE_WIDTH = 200;
|
|
11
11
|
const TILE_WIDTH = 92;
|
|
12
12
|
function beginAssetDrag(e, payload) {
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/** One button of a {@link ChoiceDialog}. */
|
|
2
3
|
export interface ChoiceDialogAction {
|
|
4
|
+
/** The button's text. */
|
|
3
5
|
label: string;
|
|
6
|
+
/** Runs when the button is pressed. */
|
|
4
7
|
onSelect: () => void;
|
|
5
8
|
/** Accent button — also what Enter picks. */
|
|
6
9
|
primary?: boolean;
|
|
10
|
+
/** Shows the button in red, for a destructive choice. */
|
|
7
11
|
danger?: boolean;
|
|
8
12
|
}
|
|
13
|
+
/** Props of {@link ChoiceDialog}. */
|
|
9
14
|
export interface ChoiceDialogProps {
|
|
15
|
+
/** The question. */
|
|
10
16
|
title: string;
|
|
17
|
+
/** What the choice means. */
|
|
11
18
|
message: React.ReactNode;
|
|
12
19
|
/** Shown left to right; put the cancel action first. */
|
|
13
20
|
actions: ChoiceDialogAction[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import { buttonStyle, theme } from './theme';
|
|
3
|
+
import { buttonStyle, theme } from './theme.js';
|
|
4
4
|
/** Confirmation modal with several outcomes (e.g. Save / Don't save / Cancel). */
|
|
5
5
|
export function ChoiceDialog(props) {
|
|
6
6
|
const { title, message, actions, onCancel } = props;
|