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,15 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/** One entry of a {@link ContextMenu}. */
|
|
2
3
|
export interface ContextMenuItem {
|
|
4
|
+
/** The entry's text. */
|
|
3
5
|
label: string;
|
|
6
|
+
/** Runs when the entry is picked; the menu closes first. */
|
|
4
7
|
onSelect: () => void;
|
|
8
|
+
/** Shows the entry in red, for a destructive action. */
|
|
5
9
|
danger?: boolean;
|
|
10
|
+
/** Shows the entry greyed out and unpickable. */
|
|
6
11
|
disabled?: boolean;
|
|
7
12
|
}
|
|
13
|
+
/** Props of {@link ContextMenu}. */
|
|
8
14
|
export interface ContextMenuProps {
|
|
9
|
-
/** Client
|
|
15
|
+
/** Client X of the right-click. */
|
|
10
16
|
x: number;
|
|
17
|
+
/** Client Y of the right-click. */
|
|
11
18
|
y: number;
|
|
19
|
+
/** The entries, top to bottom. */
|
|
12
20
|
items: ContextMenuItem[];
|
|
21
|
+
/** Closes the menu: the host stops rendering it. */
|
|
13
22
|
onClose: () => void;
|
|
14
23
|
}
|
|
15
24
|
/** Right-click menu at the pointer; closes on outside click, Escape, scroll or window blur. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
|
-
import { theme } from './theme';
|
|
4
|
+
import { theme } from './theme.js';
|
|
5
5
|
/** Right-click menu at the pointer; closes on outside click, Escape, scroll or window blur. */
|
|
6
6
|
export function ContextMenu(props) {
|
|
7
7
|
const { x, y, items, onClose } = props;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useState } from 'react';
|
|
3
|
-
import { mergePieces, sampleCurve, splitPieces } from '../core/values';
|
|
4
|
-
import { inputStyle, theme } from './theme';
|
|
3
|
+
import { mergePieces, sampleCurve, splitPieces } from '../core/values.js';
|
|
4
|
+
import { inputStyle, theme } from './theme.js';
|
|
5
5
|
const WIDTH = 218;
|
|
6
6
|
const HEIGHT = 84;
|
|
7
7
|
const PAD = 8;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ProjectStore } from '../core/projectStore';
|
|
3
|
-
import { type EffectEditorHostProps } from './EffectEditorHost';
|
|
2
|
+
import type { ProjectStore } from '../core/projectStore.js';
|
|
3
|
+
import { type EffectEditorHostProps } from './EffectEditorHost.js';
|
|
4
|
+
/** Props of {@link EditorWorkspace}: the editor's, plus where projects live. */
|
|
4
5
|
export interface EditorWorkspaceProps extends Omit<EffectEditorHostProps, 'project' | 'onExitProject' | 'effectJson'> {
|
|
5
6
|
/** Where projects are kept; defaults to the browser's IndexedDB. */
|
|
6
7
|
store?: ProjectStore;
|
|
@@ -13,9 +14,15 @@ export interface EditorWorkspaceProps extends Omit<EffectEditorHostProps, 'proje
|
|
|
13
14
|
export declare function EditorWorkspace(props: EditorWorkspaceProps): React.ReactElement;
|
|
14
15
|
/** Imperative entry point, like QuarksEffectEditor.Show, for the project-based workspace. */
|
|
15
16
|
export declare const QuarksEditorWorkspace: {
|
|
17
|
+
/**
|
|
18
|
+
* Mounts an {@link EditorWorkspace} into `hostElement`.
|
|
19
|
+
*
|
|
20
|
+
* @returns A handle whose `dispose()` unmounts it.
|
|
21
|
+
*/
|
|
16
22
|
Show(options: EditorWorkspaceProps & {
|
|
17
23
|
hostElement: HTMLElement;
|
|
18
24
|
}): {
|
|
25
|
+
/** Unmounts the workspace. */
|
|
19
26
|
dispose: () => void;
|
|
20
27
|
};
|
|
21
28
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { createRoot } from 'react-dom/client';
|
|
4
|
-
import { IndexedDbProjectStore } from '../core/indexedDbProjectStore';
|
|
5
|
-
import { EffectEditorHost } from './EffectEditorHost';
|
|
6
|
-
import { ProjectsPage } from './ProjectsPage';
|
|
7
|
-
import { theme } from './theme';
|
|
4
|
+
import { IndexedDbProjectStore } from '../core/indexedDbProjectStore.js';
|
|
5
|
+
import { EffectEditorHost } from './EffectEditorHost.js';
|
|
6
|
+
import { ProjectsPage } from './ProjectsPage.js';
|
|
7
|
+
import { theme } from './theme.js';
|
|
8
8
|
/** Projects page → editor for the chosen project, with assets and scene saved in `store`. */
|
|
9
9
|
export function EditorWorkspace(props) {
|
|
10
10
|
const { store: storeProp, projectId, onProjectChange, ...hostProps } = props;
|
|
@@ -12,10 +12,8 @@ export function EditorWorkspace(props) {
|
|
|
12
12
|
const [project, setProject] = useState(null);
|
|
13
13
|
const [resolving, setResolving] = useState(Boolean(projectId));
|
|
14
14
|
useEffect(() => {
|
|
15
|
-
if (!projectId)
|
|
16
|
-
setResolving(false);
|
|
15
|
+
if (!projectId)
|
|
17
16
|
return;
|
|
18
|
-
}
|
|
19
17
|
let cancelled = false;
|
|
20
18
|
void store.getProject(projectId).then((meta) => {
|
|
21
19
|
if (cancelled)
|
|
@@ -54,6 +52,11 @@ export function EditorWorkspace(props) {
|
|
|
54
52
|
}
|
|
55
53
|
/** Imperative entry point, like QuarksEffectEditor.Show, for the project-based workspace. */
|
|
56
54
|
export const QuarksEditorWorkspace = {
|
|
55
|
+
/**
|
|
56
|
+
* Mounts an {@link EditorWorkspace} into `hostElement`.
|
|
57
|
+
*
|
|
58
|
+
* @returns A handle whose `dispose()` unmounts it.
|
|
59
|
+
*/
|
|
57
60
|
Show(options) {
|
|
58
61
|
const { hostElement, ...props } = options;
|
|
59
62
|
const root = createRoot(hostElement);
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Texture } from '@babylonjs/core/Materials/Textures/texture.js';
|
|
2
|
+
import type { TransformNode } from '@babylonjs/core/Meshes/transformNode.js';
|
|
2
3
|
import type { ParticleSystem } from 'babylon.quarks';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
import { EffectBinding } from '../core/binding';
|
|
5
|
-
import type { GeometryData, GeometryOption, TextureOption } from './modules';
|
|
5
|
+
import { EffectBinding } from '../core/binding.js';
|
|
6
|
+
import type { GeometryData, GeometryOption, TextureOption } from './modules.js';
|
|
7
|
+
/** Props of {@link EffectEditor}. */
|
|
6
8
|
export interface EffectEditorProps {
|
|
9
|
+
/** The effect the modules edit. */
|
|
7
10
|
binding: EffectBinding;
|
|
8
11
|
/** Currently selected system, lifted up so the timeline panel and this module stack agree. */
|
|
9
12
|
selectedSystem: ParticleSystem;
|
|
13
|
+
/** The node the Object module edits the transform of. */
|
|
10
14
|
gizmoTargetNode: TransformNode;
|
|
15
|
+
/** The Object module's title for that node. */
|
|
11
16
|
gizmoTargetLabel: string;
|
|
12
17
|
/** Texture presets offered in the Renderer module (host supplies the loader). */
|
|
13
18
|
textureOptions?: TextureOption[];
|
|
14
19
|
/** Mesh presets offered for the Mesh render mode (host supplies the geometry buffers). */
|
|
15
20
|
geometryOptions?: GeometryOption[];
|
|
16
|
-
|
|
21
|
+
/** Host texture loader for picked URLs; a plain `Texture` is made without it. */
|
|
22
|
+
resolveTexture?: (url: string) => Texture | null | undefined;
|
|
17
23
|
/** Host loader for "Load from file…" in the Mesh render mode (e.g. a GLB importer). */
|
|
18
24
|
resolveGeometry?: (file: File) => Promise<GeometryData>;
|
|
19
25
|
}
|
|
@@ -22,4 +28,4 @@ export interface EffectEditorProps {
|
|
|
22
28
|
* Embed it anywhere React runs — the standalone examples page or a BabylonJS Editor plugin.
|
|
23
29
|
* Module order mirrors Unity's Particle System inspector.
|
|
24
30
|
*/
|
|
25
|
-
export declare const EffectEditor: React.
|
|
31
|
+
export declare const EffectEditor: React.MemoExoticComponent<(props: EffectEditorProps) => React.JSX.Element>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useEffect, useSyncExternalStore } from 'react';
|
|
3
|
-
import { EffectBinding } from '../core/binding';
|
|
4
|
-
import { CollisionModule, ColorBySpeedModule, EmitDirectionModule, ForceOverLifeModule, GravityModule, InheritVelocityModule, LimitSpeedOverLifeModule, NoiseModule, OrbitOverLifeModule, Rotation3DOverLifeModule, RotationBySpeedModule, RotationOverLifeModule, SequencesModule, SizeBySpeedModule, SpeedOverLifeModule, TextureSheetModule, TurbulenceModule, VelocityOverLifeModule, WidthOverTrailModule, } from './behaviorModules';
|
|
5
|
-
import { ColorOverLifeModule, EmissionModule, MainModule, RendererModule, ShapeModule, SizeOverLifeModule, } from './modules';
|
|
6
|
-
import { ObjectModule } from './ObjectModule';
|
|
7
|
-
import { SubEmittersModule } from './SubEmittersModule';
|
|
8
|
-
import { theme } from './theme';
|
|
3
|
+
import { EffectBinding } from '../core/binding.js';
|
|
4
|
+
import { AttractorModule, CollisionModule, ColorBySpeedModule, EmitDirectionModule, ForceOverLifeModule, GravityModule, InheritVelocityModule, LimitSpeedOverLifeModule, NoiseModule, OrbitOverLifeModule, Rotation3DOverLifeModule, RotationBySpeedModule, RotationOverLifeModule, SequencesModule, SizeBySpeedModule, SpeedOverLifeModule, TextureSheetModule, TurbulenceModule, VelocityOverLifeModule, WidthOverTrailModule, } from './behaviorModules.js';
|
|
5
|
+
import { ColorOverLifeModule, EmissionModule, MainModule, RendererModule, ShapeModule, SizeOverLifeModule, } from './modules.js';
|
|
6
|
+
import { ObjectModule } from './ObjectModule.js';
|
|
7
|
+
import { SubEmittersModule } from './SubEmittersModule.js';
|
|
8
|
+
import { theme } from './theme.js';
|
|
9
9
|
/**
|
|
10
10
|
* Shuriken-style effect editor: a stacked module inspector for the selected system.
|
|
11
11
|
* Embed it anywhere React runs — the standalone examples page or a BabylonJS Editor plugin.
|
|
@@ -31,5 +31,5 @@ export const EffectEditor = React.memo(function EffectEditor(props) {
|
|
|
31
31
|
useEffect(() => (binding === props.binding ? undefined : binding.subscribe(() => props.binding.markChanged())), [binding, props.binding]);
|
|
32
32
|
useSyncExternalStore((onStoreChange) => binding.subscribe(onStoreChange), () => binding.getRevision());
|
|
33
33
|
const gizmoTargetIsEmitter = allSystems.some((s) => s.emitter === props.gizmoTargetNode);
|
|
34
|
-
return (_jsxs("div", { style: { fontFamily: theme.font, color: theme.text }, children: [_jsx(ObjectModule, { node: props.gizmoTargetNode, label: props.gizmoTargetLabel, onBeforeChange: () => props.binding.onBeforeChange?.(), onChanged: () => props.binding.markChanged() }), !gizmoTargetIsEmitter && (_jsxs("div", { style: { fontSize: 11, color: theme.textDim, margin: '0 0 10px', lineHeight: 1.45 }, children: ["Modules below edit ", _jsx("strong", { children: activeSystem.emitter.name || 'particle system' }), ". Select its emitter in the timeline to move it with the gizmo."] })), _jsx(MainModule, { binding: binding }), _jsx(EmissionModule, { binding: binding }), _jsx(ShapeModule, { binding: binding }), _jsx(EmitDirectionModule, { binding: binding }), _jsx(VelocityOverLifeModule, { binding: binding }), _jsx(SpeedOverLifeModule, { binding: binding }), _jsx(LimitSpeedOverLifeModule, { binding: binding }), _jsx(InheritVelocityModule, { binding: binding }), _jsx(ForceOverLifeModule, { binding: binding }), _jsx(GravityModule, { binding: binding }), _jsx(OrbitOverLifeModule, { binding: binding }), _jsx(ColorOverLifeModule, { binding: binding }), _jsx(ColorBySpeedModule, { binding: binding }), _jsx(SizeOverLifeModule, { binding: binding }), _jsx(SizeBySpeedModule, { binding: binding }), _jsx(RotationOverLifeModule, { binding: binding }), _jsx(Rotation3DOverLifeModule, { binding: binding }), _jsx(RotationBySpeedModule, { binding: binding }), _jsx(NoiseModule, { binding: binding }), _jsx(TurbulenceModule, { binding: binding }), _jsx(CollisionModule, { binding: binding }), _jsx(WidthOverTrailModule, { binding: binding }), _jsx(SubEmittersModule, { binding: binding, rootBinding: props.binding }), _jsx(TextureSheetModule, { binding: binding }), _jsx(SequencesModule, { binding: binding, textureOptions: props.textureOptions }), _jsx(RendererModule, { binding: binding, textureOptions: props.textureOptions, geometryOptions: props.geometryOptions, resolveTexture: props.resolveTexture, resolveGeometry: props.resolveGeometry })] }));
|
|
34
|
+
return (_jsxs("div", { style: { fontFamily: theme.font, color: theme.text }, children: [_jsx(ObjectModule, { node: props.gizmoTargetNode, label: props.gizmoTargetLabel, onBeforeChange: () => props.binding.onBeforeChange?.(), onChanged: () => props.binding.markChanged() }), !gizmoTargetIsEmitter && (_jsxs("div", { style: { fontSize: 11, color: theme.textDim, margin: '0 0 10px', lineHeight: 1.45 }, children: ["Modules below edit ", _jsx("strong", { children: activeSystem.emitter.name || 'particle system' }), ". Select its emitter in the timeline to move it with the gizmo."] })), _jsx(MainModule, { binding: binding }), _jsx(EmissionModule, { binding: binding }), _jsx(ShapeModule, { binding: binding }), _jsx(EmitDirectionModule, { binding: binding }), _jsx(VelocityOverLifeModule, { binding: binding }), _jsx(SpeedOverLifeModule, { binding: binding }), _jsx(LimitSpeedOverLifeModule, { binding: binding }), _jsx(InheritVelocityModule, { binding: binding }), _jsx(ForceOverLifeModule, { binding: binding }), _jsx(GravityModule, { binding: binding }), _jsx(AttractorModule, { binding: binding }), _jsx(OrbitOverLifeModule, { binding: binding }), _jsx(ColorOverLifeModule, { binding: binding }), _jsx(ColorBySpeedModule, { binding: binding }), _jsx(SizeOverLifeModule, { binding: binding }), _jsx(SizeBySpeedModule, { binding: binding }), _jsx(RotationOverLifeModule, { binding: binding }), _jsx(Rotation3DOverLifeModule, { binding: binding }), _jsx(RotationBySpeedModule, { binding: binding }), _jsx(NoiseModule, { binding: binding }), _jsx(TurbulenceModule, { binding: binding }), _jsx(CollisionModule, { binding: binding }), _jsx(WidthOverTrailModule, { binding: binding }), _jsx(SubEmittersModule, { binding: binding, rootBinding: props.binding }), _jsx(TextureSheetModule, { binding: binding }), _jsx(SequencesModule, { binding: binding, textureOptions: props.textureOptions }), _jsx(RendererModule, { binding: binding, textureOptions: props.textureOptions, geometryOptions: props.geometryOptions, resolveTexture: props.resolveTexture, resolveGeometry: props.resolveGeometry })] }));
|
|
35
35
|
});
|
|
@@ -1,67 +1,71 @@
|
|
|
1
|
-
import '@babylonjs/core/
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { AbstractEngine } from '@babylonjs/core/Engines/abstractEngine.js';
|
|
2
|
+
import type { Texture } from '@babylonjs/core/Materials/Textures/texture.js';
|
|
3
|
+
import type { Scene } from '@babylonjs/core/scene.js';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export interface EffectEditorHostHandle {
|
|
10
|
-
binding: EffectBinding;
|
|
11
|
-
history: EffectHistory;
|
|
12
|
-
scene: Scene;
|
|
13
|
-
renderer: BatchedRenderer;
|
|
14
|
-
/** Replaces the scene with this effect (it is also added to Assets). */
|
|
15
|
-
importJson: (json: unknown) => void;
|
|
16
|
-
/** Imports effect files (and the texture/geometry files they reference) into Assets. */
|
|
17
|
-
importAssets: (files: FileList | File[]) => Promise<void>;
|
|
18
|
-
/** @deprecated Renamed to `importAssets`. */
|
|
19
|
-
importGallery: (files: FileList | File[]) => Promise<void>;
|
|
20
|
-
exportJson: () => string;
|
|
21
|
-
}
|
|
5
|
+
import { type EditorProject, type EffectEditorHostHandle } from '../core/editorSession.js';
|
|
6
|
+
import type { GeometryData, GeometryOption, TextureOption } from './modules.js';
|
|
7
|
+
export type { EditorProject, EffectEditorHostHandle } from '../core/editorSession.js';
|
|
8
|
+
/** Props of {@link EffectEditorHost}. */
|
|
22
9
|
export interface EffectEditorHostProps {
|
|
23
10
|
/** Quarks JSON export to open; a default effect is created when omitted. */
|
|
24
11
|
effectJson?: unknown;
|
|
25
12
|
/** When set, a Save button appears and receives the serialized effect. */
|
|
26
13
|
onSave?: (json: string) => void;
|
|
27
|
-
/** Called once the engine
|
|
14
|
+
/** Called once the engine, scene and binding are live, and again whenever the focused effect changes. */
|
|
28
15
|
onReady?: (handle: EffectEditorHostHandle) => void;
|
|
16
|
+
/** Inspector header shown while the focused effect has no name. */
|
|
29
17
|
title?: string;
|
|
18
|
+
/** Texture presets offered in the Renderer module; the first is the default effect's texture. */
|
|
30
19
|
textureOptions?: TextureOption[];
|
|
31
20
|
/** Mesh presets for the Mesh render mode (e.g. asset meshes from a host editor). */
|
|
32
21
|
geometryOptions?: GeometryOption[];
|
|
33
|
-
|
|
22
|
+
/** Host texture loader for texture URLs picked in the editor. */
|
|
23
|
+
resolveTexture?: (url: string, scene: Scene) => Texture | null | undefined;
|
|
34
24
|
/** Host loader for the Mesh "Load from file…" option (e.g. GLB via @babylonjs/loaders). */
|
|
35
25
|
resolveGeometry?: (file: File, scene: Scene) => Promise<GeometryData>;
|
|
36
26
|
/** Optional link rendered in the viewport's top-left corner (e.g. back to a host gallery page). */
|
|
37
27
|
backLink?: {
|
|
28
|
+
/** Where the link goes. */
|
|
38
29
|
href: string;
|
|
30
|
+
/** The link's text; a leading `←` is dropped, an arrow icon is drawn instead. */
|
|
39
31
|
label: string;
|
|
40
32
|
};
|
|
41
33
|
/**
|
|
42
34
|
* Project to edit: its assets load from and save to `store`, and the scene is saved with
|
|
43
35
|
* Save / Ctrl+S. Without it the editor works in memory only.
|
|
44
36
|
*/
|
|
45
|
-
project?:
|
|
46
|
-
store: ProjectStore;
|
|
47
|
-
id: string;
|
|
48
|
-
name: string;
|
|
49
|
-
};
|
|
37
|
+
project?: EditorProject;
|
|
50
38
|
/** Shows a "← Projects" button; called once unsaved scene changes are dealt with. */
|
|
51
39
|
onExitProject?: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* Builds the engine the editor draws with, on the canvas it is given, for example a
|
|
42
|
+
* `WebGPUEngine` after `await engine.initAsync()`. It may return a promise. It must build a new
|
|
43
|
+
* engine on every call: the editor disposes the engine when it unmounts, and React may mount
|
|
44
|
+
* it more than once (StrictMode). Defaults to a WebGL `Engine` with antialiasing.
|
|
45
|
+
*/
|
|
46
|
+
createEngine?: (canvas: HTMLCanvasElement) => AbstractEngine | Promise<AbstractEngine>;
|
|
52
47
|
}
|
|
53
48
|
/**
|
|
54
49
|
* Self-contained effect editor: live Babylon preview, a Scene list of the effects placed in it,
|
|
55
50
|
* an inspector, and a bottom dock with the timeline and the Assets browser. Assets are effect
|
|
56
51
|
* files; dragging one into the viewport instantiates an independent copy, as many times as needed.
|
|
57
|
-
* Designed for embedding — see QuarksEffectEditor.Show for the NME-style entry point.
|
|
52
|
+
* Designed for embedding — see {@link QuarksEffectEditor}.Show for the NME-style entry point.
|
|
53
|
+
*
|
|
54
|
+
* The scene, Assets, prefab mode and undo live in an {@link EditorSession}; this component is its
|
|
55
|
+
* React view.
|
|
58
56
|
*/
|
|
59
|
-
export declare function EffectEditorHost(props: EffectEditorHostProps): React.
|
|
57
|
+
export declare function EffectEditorHost(props: EffectEditorHostProps): React.ReactElement;
|
|
60
58
|
/** NME-style imperative entry point for hosts like BabylonJS Editor windows. */
|
|
61
59
|
export declare const QuarksEffectEditor: {
|
|
60
|
+
/**
|
|
61
|
+
* Mounts an {@link EffectEditorHost} into `hostElement`.
|
|
62
|
+
*
|
|
63
|
+
* @returns A handle whose `dispose()` unmounts the editor and frees its engine.
|
|
64
|
+
*/
|
|
62
65
|
Show(options: EffectEditorHostProps & {
|
|
63
66
|
hostElement: HTMLElement;
|
|
64
67
|
}): {
|
|
68
|
+
/** Unmounts the editor. */
|
|
65
69
|
dispose: () => void;
|
|
66
70
|
};
|
|
67
71
|
};
|