babylon.quarks-editor 0.27.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 +71 -0
- package/README.md +31 -4
- package/dist/core/assetTree.d.ts +5 -0
- package/dist/core/assets.d.ts +7 -0
- package/dist/core/assets.js +11 -7
- package/dist/core/binding.d.ts +9 -0
- package/dist/core/binding.js +8 -0
- 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 +3 -2
- package/dist/core/defaultEffect.js +1 -1
- package/dist/core/editorSession.d.ts +229 -0
- package/dist/core/editorSession.js +983 -0
- package/dist/core/effectTree.d.ts +5 -0
- package/dist/core/galleryPlayback.js +2 -1
- package/dist/core/history.d.ts +6 -0
- package/dist/core/history.js +4 -0
- package/dist/core/indexedDbProjectStore.d.ts +13 -0
- package/dist/core/indexedDbProjectStore.js +13 -0
- package/dist/core/material.d.ts +12 -2
- 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 +3 -0
- package/dist/core/scrub.d.ts +1 -1
- package/dist/core/scrub.js +2 -2
- package/dist/core/shapes.d.ts +24 -0
- package/dist/core/shapes.js +5 -0
- package/dist/core/systems.d.ts +2 -0
- package/dist/core/systems.js +3 -1
- package/dist/core/timeline.d.ts +23 -3
- package/dist/core/values.d.ts +21 -4
- package/dist/core/values.js +5 -0
- package/dist/index.d.ts +5 -1
- package/dist/react/AssetsPanel.d.ts +7 -0
- package/dist/react/ChoiceDialog.d.ts +7 -0
- package/dist/react/ContextMenu.d.ts +10 -1
- package/dist/react/EditorWorkspace.d.ts +7 -0
- package/dist/react/EditorWorkspace.js +6 -3
- package/dist/react/EffectEditor.d.ts +8 -2
- package/dist/react/EffectEditorHost.d.ts +32 -28
- package/dist/react/EffectEditorHost.js +241 -1665
- package/dist/react/EffectTreeView.d.ts +3 -0
- package/dist/react/MessageDialog.d.ts +5 -0
- package/dist/react/ModuleSection.d.ts +10 -0
- package/dist/react/ModuleSection.js +4 -1
- package/dist/react/ProjectsPage.d.ts +6 -0
- package/dist/react/ProjectsPage.js +27 -11
- package/dist/react/PromptDialog.d.ts +7 -0
- package/dist/react/ScenePanel.d.ts +7 -0
- package/dist/react/ScenePanel.js +7 -5
- package/dist/react/TextureSelect.d.ts +5 -5
- package/dist/react/TimelinePanel.d.ts +13 -0
- package/dist/react/TimelinePanel.js +10 -6
- package/dist/react/TimelineTrackRow.d.ts +10 -0
- package/dist/react/TransportBar.d.ts +9 -0
- package/dist/react/ValueField.d.ts +32 -5
- package/dist/react/ValueField.js +20 -9
- package/dist/react/behaviorModules.d.ts +16 -5
- package/dist/react/behaviorModules.js +16 -1
- package/dist/react/fields.d.ts +8 -0
- package/dist/react/fields.js +3 -0
- 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 +3 -1
- package/dist/react/modules.d.ts +17 -6
- package/dist/react/modules.js +38 -20
- 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 +17 -11
- package/src/core/assetTree.ts +14 -1
- package/src/core/assets.ts +25 -10
- package/src/core/binding.ts +9 -0
- package/src/core/collision.ts +4 -0
- package/src/core/colors.ts +21 -1
- package/src/core/defaultEffect.ts +4 -3
- package/src/core/editorSession.ts +1299 -0
- package/src/core/effectTree.ts +5 -0
- package/src/core/galleryPlayback.ts +2 -1
- package/src/core/history.ts +6 -0
- package/src/core/indexedDbProjectStore.ts +13 -0
- package/src/core/loadEffect.ts +1 -1
- package/src/core/material.ts +14 -4
- package/src/core/playback.ts +6 -0
- package/src/core/projectStore.ts +26 -0
- package/src/core/sceneEntries.ts +3 -0
- package/src/core/scrub.ts +2 -2
- package/src/core/shapes.ts +28 -1
- package/src/core/systems.ts +9 -2
- package/src/core/timeline.ts +40 -15
- package/src/core/values.ts +20 -4
- package/src/index.ts +5 -1
- package/src/react/AssetsPanel.tsx +7 -0
- package/src/react/ChoiceDialog.tsx +7 -0
- package/src/react/ContextMenu.tsx +10 -1
- package/src/react/EditorWorkspace.tsx +11 -5
- package/src/react/EffectEditor.tsx +7 -1
- package/src/react/EffectEditorHost.tsx +406 -2340
- package/src/react/EffectTreeView.tsx +3 -0
- package/src/react/MessageDialog.tsx +5 -0
- package/src/react/ModuleSection.tsx +11 -0
- package/src/react/ProjectsPage.tsx +38 -11
- package/src/react/PromptDialog.tsx +7 -0
- package/src/react/ScenePanel.tsx +14 -5
- package/src/react/TextureSelect.tsx +6 -6
- package/src/react/TimelinePanel.tsx +23 -6
- package/src/react/TimelineTrackRow.tsx +10 -0
- package/src/react/TransportBar.tsx +9 -0
- package/src/react/ValueField.tsx +58 -14
- package/src/react/behaviorModules.tsx +34 -32
- package/src/react/fields.tsx +12 -1
- 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 +3 -1
- package/src/react/modules.tsx +70 -44
- package/src/react/theme.ts +15 -0
- package/src/session.ts +17 -0
package/src/react/modules.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
ParticleErosionOptions,
|
|
11
11
|
ParticleSystem,
|
|
12
12
|
ParticleUVDistortionOptions,
|
|
13
|
+
RenderFace,
|
|
13
14
|
ScalingMode,
|
|
14
15
|
SortMode,
|
|
15
16
|
TrailSettings,
|
|
@@ -36,7 +37,6 @@ import {
|
|
|
36
37
|
normalizeTextureUV,
|
|
37
38
|
} from 'babylon.quarks';
|
|
38
39
|
import React, {useMemo} from 'react';
|
|
39
|
-
import {EffectBinding} from '../core/binding.js';
|
|
40
40
|
import {
|
|
41
41
|
DEFAULT_GRADIENT_STOPS,
|
|
42
42
|
GradientStop,
|
|
@@ -60,7 +60,7 @@ import {buildCurve, buildScalar, readPieces, readScalar} from '../core/values.js
|
|
|
60
60
|
import {CurveEditor} from './CurveEditor.js';
|
|
61
61
|
import {GradientEditor} from './GradientEditor.js';
|
|
62
62
|
import {InspectorInfoIcon} from './InspectorInfoIcon.js';
|
|
63
|
-
import {ModuleSection} from './ModuleSection.js';
|
|
63
|
+
import {ModuleSection, type ModuleProps} from './ModuleSection.js';
|
|
64
64
|
import {TextureSelect} from './TextureSelect.js';
|
|
65
65
|
import {TextureUVField} from './TextureUVField.js';
|
|
66
66
|
import {ValueField} from './ValueField.js';
|
|
@@ -68,10 +68,6 @@ import {CheckboxField, NumberField, Row, SelectField} from './fields.js';
|
|
|
68
68
|
import {iconStyle} from './icons.js';
|
|
69
69
|
import {theme} from './theme.js';
|
|
70
70
|
|
|
71
|
-
interface ModuleProps {
|
|
72
|
-
binding: EffectBinding;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
71
|
const MESH_QUAD_POSITIONS = new Float32Array([-0.5, -0.5, 0, 0.5, -0.5, 0, 0.5, 0.5, 0, -0.5, 0.5, 0]);
|
|
76
72
|
const MESH_QUAD_INDICES = new Uint32Array([0, 1, 2, 0, 2, 3]);
|
|
77
73
|
const MESH_QUAD_UVS = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);
|
|
@@ -194,18 +190,20 @@ function ColorInput(props: {value: Vector4; onChange: (next: Vector4) => void})
|
|
|
194
190
|
);
|
|
195
191
|
}
|
|
196
192
|
|
|
193
|
+
/** The Main module (Unity's main module): duration, looping, start delay, life, speed, size, rotation and colour. */
|
|
197
194
|
export function MainModule({binding}: ModuleProps) {
|
|
198
195
|
const system = binding.system;
|
|
199
196
|
const startColor = system.startColor;
|
|
200
197
|
const colorMode =
|
|
201
198
|
startColor instanceof RandomColor ? 'random' : startColor instanceof ColorRange ? 'range' : 'constant';
|
|
202
|
-
const
|
|
203
|
-
const colorA =
|
|
204
|
-
?
|
|
199
|
+
const twoColor = startColor instanceof RandomColor || startColor instanceof ColorRange ? startColor : null;
|
|
200
|
+
const colorA = twoColor
|
|
201
|
+
? twoColor.a
|
|
205
202
|
: startColor instanceof ConstantColor
|
|
206
203
|
? startColor.color
|
|
207
204
|
: new Vector4(1, 1, 1, 1);
|
|
208
|
-
const colorB =
|
|
205
|
+
const colorB = twoColor ? twoColor.b : new Vector4(1, 0.5, 0.2, 1);
|
|
206
|
+
const twoColors = twoColor !== null;
|
|
209
207
|
/** The two-colour generator of the current mode. */
|
|
210
208
|
const makeTwoColors = (a: Vector4, b: Vector4) =>
|
|
211
209
|
colorMode === 'range' ? new ColorRange(a, b) : new RandomColor(a, b);
|
|
@@ -219,17 +217,17 @@ export function MainModule({binding}: ModuleProps) {
|
|
|
219
217
|
? 'euler'
|
|
220
218
|
: isAxisAngle
|
|
221
219
|
? 'axisAngle'
|
|
222
|
-
: readScalar(rotation
|
|
220
|
+
: readScalar(rotation).mode === 'random'
|
|
223
221
|
? 'random'
|
|
224
222
|
: 'angle';
|
|
225
223
|
const rotationState = readScalar(
|
|
226
|
-
rotation instanceof RandomQuatGenerator || isEuler || isAxisAngle ? undefined :
|
|
224
|
+
rotation instanceof RandomQuatGenerator || isEuler || isAxisAngle ? undefined : rotation
|
|
227
225
|
);
|
|
228
226
|
const axisAngle = isAxisAngle ? (rotation as AxisAngleGenerator) : undefined;
|
|
229
227
|
const eulerAngles = {
|
|
230
|
-
x: isEuler ? readScalar((rotation as EulerGenerator).angleX
|
|
231
|
-
y: isEuler ? readScalar((rotation as EulerGenerator).angleY
|
|
232
|
-
z: isEuler ? readScalar((rotation as EulerGenerator).angleZ
|
|
228
|
+
x: isEuler ? readScalar((rotation as EulerGenerator).angleX).value : 0,
|
|
229
|
+
y: isEuler ? readScalar((rotation as EulerGenerator).angleY).value : 0,
|
|
230
|
+
z: isEuler ? readScalar((rotation as EulerGenerator).angleZ).value : 0,
|
|
233
231
|
};
|
|
234
232
|
const setEulerAxis = (axis: 'x' | 'y' | 'z', v: number) =>
|
|
235
233
|
binding.apply((s) => {
|
|
@@ -240,8 +238,7 @@ export function MainModule({binding}: ModuleProps) {
|
|
|
240
238
|
axis === 'z' ? new ConstantValue(v) : cur.angleZ
|
|
241
239
|
);
|
|
242
240
|
});
|
|
243
|
-
const
|
|
244
|
-
const size3D = startSize.type === 'vec3function';
|
|
241
|
+
const startSize3D = system.startSize instanceof Vector3Function ? system.startSize : null;
|
|
245
242
|
const colorGenMode =
|
|
246
243
|
startColor instanceof RandomColorBetweenGradient
|
|
247
244
|
? 'gradient2'
|
|
@@ -349,50 +346,50 @@ export function MainModule({binding}: ModuleProps) {
|
|
|
349
346
|
/>
|
|
350
347
|
<Row label="Start size">
|
|
351
348
|
<SelectField
|
|
352
|
-
value={
|
|
349
|
+
value={startSize3D ? '3d' : 'uniform'}
|
|
353
350
|
options={[
|
|
354
351
|
{value: 'uniform', label: 'Uniform'},
|
|
355
352
|
{value: '3d', label: '3D (per axis)'},
|
|
356
353
|
]}
|
|
357
354
|
onChange={(mode) =>
|
|
358
355
|
binding.apply((s) => {
|
|
359
|
-
const cur = s.startSize
|
|
360
|
-
if (mode === '3d') {
|
|
356
|
+
const cur = s.startSize;
|
|
357
|
+
if (mode === '3d' && cur.type !== 'vec3function') {
|
|
361
358
|
// Seed all three axes from the current uniform generator.
|
|
362
359
|
s.startSize = new Vector3Function(cur.clone(), cur.clone(), cur.clone());
|
|
363
|
-
} else {
|
|
360
|
+
} else if (mode !== '3d' && cur instanceof Vector3Function) {
|
|
364
361
|
// Collapse back to the X-axis generator.
|
|
365
|
-
s.startSize =
|
|
362
|
+
s.startSize = cur.x;
|
|
366
363
|
}
|
|
367
364
|
})
|
|
368
365
|
}
|
|
369
366
|
/>
|
|
370
367
|
</Row>
|
|
371
|
-
{!
|
|
368
|
+
{!startSize3D && (
|
|
372
369
|
<ValueField
|
|
373
370
|
label=""
|
|
374
|
-
generator={system.startSize
|
|
371
|
+
generator={system.startSize}
|
|
375
372
|
min={0}
|
|
376
373
|
curveMax={5}
|
|
377
374
|
onChange={(g) => binding.apply((s) => (s.startSize = g))}
|
|
378
375
|
/>
|
|
379
376
|
)}
|
|
380
|
-
{
|
|
377
|
+
{startSize3D && (
|
|
381
378
|
<>
|
|
382
379
|
{(['x', 'y', 'z'] as const).map((axis) => (
|
|
383
380
|
<ValueField
|
|
384
381
|
key={axis}
|
|
385
382
|
label={axis.toUpperCase()}
|
|
386
|
-
generator={
|
|
383
|
+
generator={startSize3D[axis]}
|
|
387
384
|
min={0}
|
|
388
385
|
curveMax={5}
|
|
389
386
|
onChange={(g) =>
|
|
390
387
|
binding.apply((s) => {
|
|
391
388
|
const cur = s.startSize as Vector3Function;
|
|
392
389
|
s.startSize = new Vector3Function(
|
|
393
|
-
axis === 'x' ?
|
|
394
|
-
axis === 'y' ?
|
|
395
|
-
axis === 'z' ?
|
|
390
|
+
axis === 'x' ? g : cur.x,
|
|
391
|
+
axis === 'y' ? g : cur.y,
|
|
392
|
+
axis === 'z' ? g : cur.z
|
|
396
393
|
);
|
|
397
394
|
})
|
|
398
395
|
}
|
|
@@ -585,6 +582,7 @@ export function MainModule({binding}: ModuleProps) {
|
|
|
585
582
|
);
|
|
586
583
|
}
|
|
587
584
|
|
|
585
|
+
/** The Emission module (Unity's Emission): rate over time and distance, and bursts. */
|
|
588
586
|
export function EmissionModule({binding}: ModuleProps) {
|
|
589
587
|
const system = binding.system;
|
|
590
588
|
const bursts = system.emissionBursts ?? [];
|
|
@@ -634,7 +632,7 @@ export function EmissionModule({binding}: ModuleProps) {
|
|
|
634
632
|
</Row>
|
|
635
633
|
<Row label="Count">
|
|
636
634
|
<NumberField
|
|
637
|
-
value={readScalar(burst.count
|
|
635
|
+
value={readScalar(burst.count).value}
|
|
638
636
|
min={0}
|
|
639
637
|
step={1}
|
|
640
638
|
onChange={(count) =>
|
|
@@ -707,6 +705,7 @@ export function EmissionModule({binding}: ModuleProps) {
|
|
|
707
705
|
// first texture" bug: a control that looks live but does nothing.
|
|
708
706
|
const SHAPES_WITHOUT_MODE_SPREAD = new Set<ShapeType>(['point', 'grid', 'box', 'mesh_surface']);
|
|
709
707
|
|
|
708
|
+
/** The Shape module (Unity's Shape): the emitter shape and its settings. */
|
|
710
709
|
export function ShapeModule({binding}: ModuleProps) {
|
|
711
710
|
const system = binding.system;
|
|
712
711
|
const type = getShapeType(system.emitterShape);
|
|
@@ -806,12 +805,11 @@ export function ShapeModule({binding}: ModuleProps) {
|
|
|
806
805
|
);
|
|
807
806
|
}
|
|
808
807
|
|
|
808
|
+
/** The Size over Lifetime module (Unity's Size over Lifetime): size by a curve over the particle's life. */
|
|
809
809
|
export function SizeOverLifeModule({binding}: ModuleProps) {
|
|
810
810
|
const system = binding.system;
|
|
811
811
|
const behavior = findBehavior<SizeOverLife>(system.behaviors, 'SizeOverLife');
|
|
812
|
-
const curve = behavior
|
|
813
|
-
? readScalar(behavior.size as never).curve
|
|
814
|
-
: ([0.2, 1, 1, 0.4] as [number, number, number, number]);
|
|
812
|
+
const curve = behavior ? readScalar(behavior.size).curve : ([0.2, 1, 1, 0.4] as [number, number, number, number]);
|
|
815
813
|
return (
|
|
816
814
|
<ModuleSection
|
|
817
815
|
title="Size over Lifetime"
|
|
@@ -820,21 +818,19 @@ export function SizeOverLifeModule({binding}: ModuleProps) {
|
|
|
820
818
|
binding.apply((s) => {
|
|
821
819
|
removeBehavior(s, 'SizeOverLife');
|
|
822
820
|
if (enabled) {
|
|
823
|
-
s.addBehavior(
|
|
824
|
-
new SizeOverLife(buildScalar({mode: 'curve', value: 1, min: 0, max: 1, curve}) as never)
|
|
825
|
-
);
|
|
821
|
+
s.addBehavior(new SizeOverLife(buildScalar({mode: 'curve', value: 1, min: 0, max: 1, curve})));
|
|
826
822
|
}
|
|
827
823
|
})
|
|
828
824
|
}
|
|
829
825
|
>
|
|
830
826
|
<div style={{marginTop: 6}}>
|
|
831
827
|
<CurveEditor
|
|
832
|
-
pieces={behavior ? readPieces(behavior.size
|
|
828
|
+
pieces={behavior ? readPieces(behavior.size) : [{start: 0, p: curve}]}
|
|
833
829
|
maxValue={2}
|
|
834
830
|
onChange={(pieces) =>
|
|
835
831
|
binding.apply((s) => {
|
|
836
832
|
removeBehavior(s, 'SizeOverLife');
|
|
837
|
-
s.addBehavior(new SizeOverLife(buildCurve(pieces)
|
|
833
|
+
s.addBehavior(new SizeOverLife(buildCurve(pieces)));
|
|
838
834
|
})
|
|
839
835
|
}
|
|
840
836
|
/>
|
|
@@ -843,6 +839,7 @@ export function SizeOverLifeModule({binding}: ModuleProps) {
|
|
|
843
839
|
);
|
|
844
840
|
}
|
|
845
841
|
|
|
842
|
+
/** The Color over Lifetime module (Unity's Color over Lifetime): a gradient over the particle's life. */
|
|
846
843
|
export function ColorOverLifeModule({binding}: ModuleProps) {
|
|
847
844
|
const system = binding.system;
|
|
848
845
|
const behavior = findBehavior<ColorOverLife>(system.behaviors, 'ColorOverLife');
|
|
@@ -873,8 +870,11 @@ export function ColorOverLifeModule({binding}: ModuleProps) {
|
|
|
873
870
|
);
|
|
874
871
|
}
|
|
875
872
|
|
|
873
|
+
/** A texture preset the host offers in the Renderer module's texture menus. */
|
|
876
874
|
export interface TextureOption {
|
|
875
|
+
/** Its label in the menu. */
|
|
877
876
|
label: string;
|
|
877
|
+
/** The URL the host's texture loader receives. */
|
|
878
878
|
url: string;
|
|
879
879
|
}
|
|
880
880
|
|
|
@@ -884,12 +884,17 @@ export interface TextureOption {
|
|
|
884
884
|
* them into the system's instancing geometry.
|
|
885
885
|
*/
|
|
886
886
|
export interface GeometryOption {
|
|
887
|
+
/** Its label in the menu. */
|
|
887
888
|
label: string;
|
|
889
|
+
/** Vertex positions, three values per vertex. */
|
|
888
890
|
positions: Float32Array | number[];
|
|
891
|
+
/** Triangle indices; without them the vertices are drawn in sequence. */
|
|
889
892
|
indices?: Uint32Array | number[];
|
|
893
|
+
/** The first UV set, two values per vertex; without it the mesh samples UV (0, 0). */
|
|
890
894
|
uvs?: Float32Array | number[];
|
|
891
895
|
/** A second UV set (glTF `TEXCOORD_1`), what textures on UV channel 1 read on the mesh. */
|
|
892
896
|
uvs2?: Float32Array | number[];
|
|
897
|
+
/** Vertex normals, three values per vertex; without them lighting uses +Z. */
|
|
893
898
|
normals?: Float32Array | number[];
|
|
894
899
|
}
|
|
895
900
|
|
|
@@ -982,6 +987,7 @@ function MeshPreview({
|
|
|
982
987
|
);
|
|
983
988
|
}
|
|
984
989
|
|
|
990
|
+
/** The Renderer module (Unity's Renderer): render mode, material, textures, sorting and mesh settings. */
|
|
985
991
|
export function RendererModule({
|
|
986
992
|
binding,
|
|
987
993
|
textureOptions,
|
|
@@ -991,7 +997,7 @@ export function RendererModule({
|
|
|
991
997
|
}: ModuleProps & {
|
|
992
998
|
textureOptions?: TextureOption[];
|
|
993
999
|
geometryOptions?: GeometryOption[];
|
|
994
|
-
resolveTexture?: (url: string) =>
|
|
1000
|
+
resolveTexture?: (url: string) => Texture | null | undefined;
|
|
995
1001
|
resolveGeometry?: (file: File) => Promise<GeometryData>;
|
|
996
1002
|
}) {
|
|
997
1003
|
const system = binding.system;
|
|
@@ -1431,13 +1437,20 @@ export function RendererModule({
|
|
|
1431
1437
|
const hostGeometry = geometryOptions ?? [];
|
|
1432
1438
|
const applyGeometry = (g: GeometryData) =>
|
|
1433
1439
|
binding.apply((s) => {
|
|
1440
|
+
// The previous mesh's sets go first, so the positions setter gives
|
|
1441
|
+
// this mesh the library's own fallback UVs and normals; then every set
|
|
1442
|
+
// this mesh has. An unindexed mesh draws its vertices in sequence.
|
|
1434
1443
|
const settings = s.getRendererSettings();
|
|
1435
|
-
|
|
1444
|
+
settings.instancingUVs = undefined;
|
|
1445
|
+
settings.instancingUVs2 = undefined;
|
|
1446
|
+
settings.instancingNormals = undefined;
|
|
1436
1447
|
s.instancingGeometry = new Float32Array(g.positions);
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1448
|
+
s.instancingIndices = g.indices
|
|
1449
|
+
? new Uint32Array(g.indices)
|
|
1450
|
+
: Uint32Array.from({length: g.positions.length / 3}, (_, i) => i);
|
|
1451
|
+
if (g.uvs) s.instancingUVs = new Float32Array(g.uvs);
|
|
1452
|
+
if (g.uvs2) s.instancingUVs2 = new Float32Array(g.uvs2);
|
|
1453
|
+
if (g.normals) settings.instancingNormals = new Float32Array(g.normals);
|
|
1441
1454
|
});
|
|
1442
1455
|
return (
|
|
1443
1456
|
<Row label="Geometry">
|
|
@@ -1658,6 +1671,19 @@ export function RendererModule({
|
|
|
1658
1671
|
</Row>
|
|
1659
1672
|
</>
|
|
1660
1673
|
)}
|
|
1674
|
+
{isMesh && (
|
|
1675
|
+
<Row label="Render face">
|
|
1676
|
+
<SelectField
|
|
1677
|
+
value={system.renderFace}
|
|
1678
|
+
options={[
|
|
1679
|
+
{value: 'both', label: 'Both'},
|
|
1680
|
+
{value: 'front', label: 'Front'},
|
|
1681
|
+
{value: 'back', label: 'Back'},
|
|
1682
|
+
]}
|
|
1683
|
+
onChange={(face) => binding.apply((s) => (s.renderFace = face as RenderFace))}
|
|
1684
|
+
/>
|
|
1685
|
+
</Row>
|
|
1686
|
+
)}
|
|
1661
1687
|
<Row label="Sort mode">
|
|
1662
1688
|
<SelectField
|
|
1663
1689
|
value={system.sortMode}
|
package/src/react/theme.ts
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import type {CSSProperties} from 'react';
|
|
2
2
|
|
|
3
|
+
/** The editor's colours and font, for hosts that style their own panels to match. */
|
|
3
4
|
export const theme = {
|
|
5
|
+
/** Background of the side panels and docks. */
|
|
4
6
|
panelBg: 'linear-gradient(180deg, rgba(12, 18, 38, 0.92), rgba(6, 10, 22, 0.94))',
|
|
7
|
+
/** Background of an inspector module or a framed list. */
|
|
5
8
|
sectionBg: 'rgba(10, 16, 34, 0.6)',
|
|
9
|
+
/** Borders and separators. */
|
|
6
10
|
border: '#2a365f',
|
|
11
|
+
/** The border of a selected or switched-on control. */
|
|
7
12
|
borderActive: '#4f6fbe',
|
|
13
|
+
/** Body text. */
|
|
8
14
|
text: '#eef3ff',
|
|
15
|
+
/** Labels and secondary text. */
|
|
9
16
|
textDim: '#b7c6ea',
|
|
17
|
+
/** Highlights, such as a Save button with something to save. */
|
|
10
18
|
accent: '#9eb9ff',
|
|
19
|
+
/** Background of inputs. */
|
|
11
20
|
inputBg: 'rgba(7, 11, 22, 0.82)',
|
|
21
|
+
/** The line of curve editors. */
|
|
12
22
|
curveStroke: '#78a5ff',
|
|
23
|
+
/** The editor's font stack. */
|
|
13
24
|
font: 'Inter, Segoe UI, Roboto, sans-serif',
|
|
14
25
|
};
|
|
15
26
|
|
|
27
|
+
/** Style of a text or number input. */
|
|
16
28
|
export const inputStyle: CSSProperties = {
|
|
17
29
|
background: theme.inputBg,
|
|
18
30
|
border: `1px solid ${theme.border}`,
|
|
@@ -26,6 +38,7 @@ export const inputStyle: CSSProperties = {
|
|
|
26
38
|
fontFamily: theme.font,
|
|
27
39
|
};
|
|
28
40
|
|
|
41
|
+
/** Style of an inspector row: a label column, then the controls. */
|
|
29
42
|
export const rowStyle: CSSProperties = {
|
|
30
43
|
display: 'grid',
|
|
31
44
|
gridTemplateColumns: '110px 1fr',
|
|
@@ -34,6 +47,7 @@ export const rowStyle: CSSProperties = {
|
|
|
34
47
|
marginTop: 6,
|
|
35
48
|
};
|
|
36
49
|
|
|
50
|
+
/** Style of an inspector row's label. */
|
|
37
51
|
export const labelStyle: CSSProperties = {
|
|
38
52
|
color: theme.textDim,
|
|
39
53
|
fontSize: 12,
|
|
@@ -42,6 +56,7 @@ export const labelStyle: CSSProperties = {
|
|
|
42
56
|
textOverflow: 'ellipsis',
|
|
43
57
|
};
|
|
44
58
|
|
|
59
|
+
/** Style of a button. */
|
|
45
60
|
export const buttonStyle: CSSProperties = {
|
|
46
61
|
border: `1px solid #4563ad`,
|
|
47
62
|
background: 'rgba(28, 48, 98, 0.55)',
|
package/src/session.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The editor's headless session: scene, camera, gizmos, history, scene entries, assets, prefab
|
|
3
|
+
* mode and project save/load, without React. It builds the whole viewport (grid, gizmos, markers),
|
|
4
|
+
* so it has its own entry point and the UI-free `babylon.quarks-editor` entry stays light.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export {createEditorSession} from './core/editorSession.js';
|
|
9
|
+
export type {
|
|
10
|
+
EditorFrameStats,
|
|
11
|
+
EditorProject,
|
|
12
|
+
EditorSession,
|
|
13
|
+
EditorSessionOptions,
|
|
14
|
+
EditorSessionView,
|
|
15
|
+
EffectEditorHostHandle,
|
|
16
|
+
PrefabInfo,
|
|
17
|
+
} from './core/editorSession.js';
|