babylon.quarks-editor 0.31.0 → 0.33.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 CHANGED
@@ -5,6 +5,41 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
5
  and the editor keeps its own 0.x version line; each release names the babylon.quarks line it
6
6
  needs in its peer dependency.
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ## [0.33.0] — 2026-11-10
11
+
12
+ Released with babylon.quarks 1.0.0. No editor behaviour changes.
13
+
14
+ ### Changed
15
+
16
+ - The peer dependency on babylon.quarks is `~1.0.0`. It no longer matches the release candidate
17
+ (`~1.0.0-rc.2` was 0.32.0), so a project that depends on the editor with `^0.32.0` does not take
18
+ this release on its next install.
19
+
20
+ ## [0.32.0] — 2026-11-08
21
+
22
+ Released with babylon.quarks 1.0.0-rc.2, on npm's `next` tag with it; its peer dependency is
23
+ `~1.0.0-rc.2`, for the API the candidate adds (mesh vertex colours).
24
+
25
+ ### Added
26
+
27
+ - **Mesh vertex colours** in the Mesh render mode's geometry: a host's `geometryOptions` and
28
+ `resolveGeometry` can give `colors`, `r, g, b, a` per vertex and linear, which the particle colour
29
+ is multiplied by (`ParticleSystem.instancingColors`). Picking another geometry clears them. The
30
+ example editor's glTF import reads `COLOR_0`.
31
+
32
+ ### Fixed
33
+
34
+ - An effect whose root is a group around one emitter, as the Unity exporter writes them, drew
35
+ nothing: the editor makes the emitter the root and disposes the group, and the group held the
36
+ effect's textures, which went with it. The emitter now takes the hold first
37
+ (`QuarksUtil.shareResources`).
38
+ - A field row without a label spans the whole inspector width: the min and max of _Random between
39
+ two_, a constant's value, the colour swatch of Start color and the angles of Start rotation. It
40
+ sat in the 110 px label column, which left each number box about 26 px wide and the min and max
41
+ unreadable. `Row` with an empty label now lays its children across the row in one block.
42
+
8
43
  ## [0.31.0] — 2026-10-26
9
44
 
10
45
  Released with babylon.quarks 1.0.0-rc.1, on npm's `next` tag with it. The editor stays on 0.x
package/README.md CHANGED
@@ -10,13 +10,9 @@ Shuriken-style effect editor for [babylon.quarks](https://www.npmjs.com/package/
10
10
  npm install babylon.quarks-editor babylon.quarks @babylonjs/core @babylonjs/materials react react-dom @heroicons/react @tanstack/react-virtual
11
11
  ```
12
12
 
13
- Until babylon.quarks 1.0.0 is out, editor 0.31 and the 1.0 release candidate are on the `next` tag:
14
- install `babylon.quarks-editor@next babylon.quarks@next` in place of the first two.
15
-
16
- The editor is an ES module package (`import`, not `require`). It stays on 0.x while babylon.quarks
17
- reaches 1.0, and each editor release names the babylon.quarks line it works with: editor 0.31.x
18
- needs babylon.quarks 1.0 (from 1.0.0-rc.1, installed with `@next` until 1.0.0 is out), and editor
19
- 0.30.x needs babylon.quarks 0.30.x.
13
+ The editor is an ES module package (`import`, not `require`). It stays on 0.x, and each editor
14
+ release names the babylon.quarks line it works with: editor 0.33 needs babylon.quarks 1.0
15
+ (`~1.0.0`), and editor 0.30.x needs babylon.quarks 0.30.x.
20
16
 
21
17
  ## Usage
22
18
 
@@ -79,10 +75,11 @@ an opinion on your CDN, asset pipeline, or loader (`@babylonjs/loaders`, your ow
79
75
  `system.texture`. Return `null` or `undefined` to leave the texture unset.
80
76
  - `resolveGeometry(file) => Promise<GeometryData>` — turns a picked file (from "Load from file…"
81
77
  in the Mesh render mode's geometry dropdown) into vertex buffers: `{positions, indices?, uvs?,
82
- uvs2?, normals?}` (typed arrays or plain number arrays; `uvs2` is the second UV set textures on
83
- UV channel 1 read).
78
+ uvs2?, normals?, colors?}` (typed arrays or plain number arrays; `uvs2` is the second UV set textures on
79
+ UV channel 1 read, `colors` the vertex colours, `r, g, b, a` per vertex and linear, the particle
80
+ colour is multiplied by).
84
81
  - `textureOptions?: {label, url}[]` / `geometryOptions?: {label, positions, indices?, uvs?,
85
- uvs2?, normals?}[]` — preset lists shown alongside "Custom URL…" / "Load from file…". The texture
82
+ uvs2?, normals?, colors?}[]` — preset lists shown alongside "Custom URL…" / "Load from file…". The texture
86
83
  presets also serve the gradient map's ramp, the erosion mask and the distortion noise.
87
84
 
88
85
  **Signature differs by entry point** — a common source of "works in the demo, throws in my
@@ -11,11 +11,13 @@ function groupChildren(node) {
11
11
  }
12
12
  /** Reparents `only` onto `parent`, transferring the outgoing node's name if `only` doesn't
13
13
  * already have a meaningful one of its own, then disposes the now-empty wrapper. World
14
- * transform is preserved via `setParent`. */
14
+ * transform is preserved via `setParent`. The loaded root holds the effect's textures and
15
+ * materials, so `only` takes a hold first: a wrapper root goes, and with it that hold. */
15
16
  function collapseInto(wrapper, only, parent) {
16
17
  if (!hasMeaningfulName(only) && hasMeaningfulName(wrapper)) {
17
18
  only.name = wrapper.name;
18
19
  }
20
+ QuarksUtil.shareResources(wrapper, only);
19
21
  only.setParent(parent);
20
22
  wrapper.dispose(true, false);
21
23
  }
@@ -8,13 +8,14 @@ export function applyRendererMaterial(system, patch) {
8
8
  system.blending = patch.blendMode;
9
9
  }
10
10
  if (patch.transparent !== undefined) {
11
- settings.materialTransparent = patch.transparent;
11
+ // The setter, so a depth write not chosen follows the surface.
12
+ system.transparent = patch.transparent;
12
13
  }
13
14
  if (patch.depthTest !== undefined) {
14
15
  settings.materialDepthTest = patch.depthTest;
15
16
  }
16
17
  if (patch.depthWrite !== undefined) {
17
- settings.materialDepthWrite = patch.depthWrite;
18
+ system.depthWrite = patch.depthWrite;
18
19
  }
19
20
  if (patch.alphaTest !== undefined) {
20
21
  settings.materialAlphaTest = patch.alphaTest;
@@ -1,5 +1,8 @@
1
1
  import React from 'react';
2
- /** An inspector row: a label, with an optional hint, and its controls. */
2
+ /**
3
+ * An inspector row: a label, with an optional hint, and its controls. With an empty label the
4
+ * controls span the whole row, continuing the row above; the hint is then not shown.
5
+ */
3
6
  export declare function Row(props: {
4
7
  label: string;
5
8
  hint?: string;
@@ -1,10 +1,13 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useEffect, useState } from 'react';
3
3
  import { InspectorLabel } from './InspectorLabel.js';
4
4
  import { inputStyle, rowStyle } from './theme.js';
5
- /** An inspector row: a label, with an optional hint, and its controls. */
5
+ /**
6
+ * An inspector row: a label, with an optional hint, and its controls. With an empty label the
7
+ * controls span the whole row, continuing the row above; the hint is then not shown.
8
+ */
6
9
  export function Row(props) {
7
- return (_jsxs("div", { style: rowStyle, children: [_jsx(InspectorLabel, { label: props.label, hint: props.hint, hintKey: props.hintKey }), props.children] }));
10
+ return (_jsx("div", { style: rowStyle, children: props.label ? (_jsxs(_Fragment, { children: [_jsx(InspectorLabel, { label: props.label, hint: props.hint, hintKey: props.hintKey }), props.children] })) : (_jsx("div", { style: { gridColumn: '1 / -1', minWidth: 0 }, children: props.children })) }));
8
11
  }
9
12
  /** Number input that keeps focus-friendly local text state and commits parsed values. */
10
13
  export function NumberField(props) {
@@ -36,6 +36,11 @@ export interface GeometryOption {
36
36
  uvs2?: Float32Array | number[];
37
37
  /** Vertex normals, three values per vertex; without them lighting uses +Z. */
38
38
  normals?: Float32Array | number[];
39
+ /**
40
+ * Vertex colours, `r, g, b, a` per vertex, linear (glTF `COLOR_0`), which the particle colour
41
+ * is multiplied by; see `ParticleSystem.instancingColors`.
42
+ */
43
+ colors?: Float32Array | number[];
39
44
  }
40
45
  /** Vertex buffers a host loader (e.g. a GLB importer) returns for the Mesh render mode. */
41
46
  export type GeometryData = Omit<GeometryOption, 'label'>;
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { Texture } from '@babylonjs/core/Materials/Textures/texture.js';
3
3
  import { Mesh } from '@babylonjs/core/Meshes/mesh.js';
4
4
  import { PlusIcon, XMarkIcon } from '@heroicons/react/24/solid';
5
- import { AxisAngleGenerator, BoxEmitFrom, ColorOverLife, ColorRange, ConeEmitFrom, ConstantColor, ConstantValue, EulerGenerator, Gradient, GridSampling, IntervalValue, RandomColor, RandomColorBetweenGradient, RandomQuatGenerator, RenderMode, SizeOverLife, Vector3Function, normalizeTextureUV, } from 'babylon.quarks';
5
+ import { AxisAngleGenerator, BoxEmitFrom, ColorOverLife, ColorRange, ConeEmitFrom, ConstantColor, ConstantValue, EulerGenerator, Gradient, GridSampling, IntervalValue, RandomColor, RandomColorBetweenGradient, RandomQuatGenerator, RenderMode, STRETCHED_LENGTH_FACTOR, SizeOverLife, Vector3Function, normalizeTextureUV, } from 'babylon.quarks';
6
6
  import React, { useMemo } from 'react';
7
7
  import { DEFAULT_GRADIENT_STOPS, buildGradient, findBehavior, hexToRgb, readGradientStops, rgbToHex, } from '../core/colors.js';
8
8
  import { applyRendererMaterial, getMaterialLabel } from '../core/material.js';
@@ -466,7 +466,8 @@ export function RendererModule({ binding, textureOptions, geometryOptions, resol
466
466
  }) }) }), system.rendererEmitterSettings.sideAxis && (_jsx(Row, { label: "Side axis", children: _jsx(AxisField, { value: system.rendererEmitterSettings.sideAxis, onChange: (axis) => binding.apply((s) => {
467
467
  // The axis's length scales the width: keep it a unit vector.
468
468
  s.rendererEmitterSettings.sideAxis = unitOrZero(axis);
469
- }) }) }))] })), system.renderMode === RenderMode.StretchedBillBoard && (_jsxs(_Fragment, { children: [_jsx(Row, { label: "Speed factor", children: _jsx(NumberField, { value: system.rendererEmitterSettings.speedFactor ?? 0, step: 0.1, onChange: (v) => binding.apply((s) => (s.rendererEmitterSettings.speedFactor = v)) }) }), _jsx(Row, { label: "Length factor", children: _jsx(NumberField, { value: system.rendererEmitterSettings.lengthFactor ?? 2, step: 0.1, onChange: (v) => binding.apply((s) => (s.rendererEmitterSettings.lengthFactor = v)) }) })] })), _jsx(SubHeader, { title: "Material", hint: "Shader and blending settings applied to the particle sprite or mesh." }), materialLabel ? (_jsx(Row, { label: "Source", children: _jsx("div", { style: { fontSize: 12, color: theme.textDim, lineHeight: 1.45 }, children: materialLabel }) })) : null, _jsx(Row, { label: "Blend mode", children: _jsx(SelectField, { value: system.blending, options: [
469
+ }) }) }))] })), system.renderMode === RenderMode.StretchedBillBoard && (_jsxs(_Fragment, { children: [_jsx(Row, { label: "Speed factor", children: _jsx(NumberField, { value: system.rendererEmitterSettings.speedFactor ?? 0, step: 0.1, onChange: (v) => binding.apply((s) => (s.rendererEmitterSettings.speedFactor = v)) }) }), _jsx(Row, { label: "Length factor", children: _jsx(NumberField, { value: system.rendererEmitterSettings.lengthFactor ??
470
+ STRETCHED_LENGTH_FACTOR, step: 0.1, onChange: (v) => binding.apply((s) => (s.rendererEmitterSettings.lengthFactor = v)) }) })] })), _jsx(SubHeader, { title: "Material", hint: "Shader and blending settings applied to the particle sprite or mesh." }), materialLabel ? (_jsx(Row, { label: "Source", children: _jsx("div", { style: { fontSize: 12, color: theme.textDim, lineHeight: 1.45 }, children: materialLabel }) })) : null, _jsx(Row, { label: "Blend mode", children: _jsx(SelectField, { value: system.blending, options: [
470
471
  { value: 1, label: 'Additive' },
471
472
  { value: 2, label: 'Alpha blend' },
472
473
  { value: 3, label: 'Subtract' },
@@ -499,6 +500,7 @@ export function RendererModule({ binding, textureOptions, geometryOptions, resol
499
500
  settings.instancingUVs = undefined;
500
501
  settings.instancingUVs2 = undefined;
501
502
  settings.instancingNormals = undefined;
503
+ settings.instancingColors = undefined;
502
504
  s.instancingGeometry = new Float32Array(g.positions);
503
505
  s.instancingIndices = g.indices
504
506
  ? new Uint32Array(g.indices)
@@ -509,6 +511,8 @@ export function RendererModule({ binding, textureOptions, geometryOptions, resol
509
511
  s.instancingUVs2 = new Float32Array(g.uvs2);
510
512
  if (g.normals)
511
513
  settings.instancingNormals = new Float32Array(g.normals);
514
+ if (g.colors)
515
+ s.instancingColors = new Float32Array(g.colors);
512
516
  });
513
517
  return (_jsx(Row, { label: "Geometry", children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 6 }, children: [_jsx(SelectField, { value: preset, options: [
514
518
  ...(preset === 'custom' ? [{ value: 'custom', label: 'Custom (imported)' }] : []),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylon.quarks-editor",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "description": "Shuriken-style effect editor for babylon.quarks: headless edit-model core + React module-stack UI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -61,7 +61,7 @@
61
61
  "@babylonjs/materials": "^9.23.0",
62
62
  "@heroicons/react": ">=2.0.0",
63
63
  "@tanstack/react-virtual": ">=3.0.0",
64
- "babylon.quarks": "~1.0.0-rc.1",
64
+ "babylon.quarks": "~1.0.0",
65
65
  "react": ">=18",
66
66
  "react-dom": ">=18"
67
67
  },
@@ -25,11 +25,13 @@ function groupChildren(node: TransformNode): TransformNode[] {
25
25
 
26
26
  /** Reparents `only` onto `parent`, transferring the outgoing node's name if `only` doesn't
27
27
  * already have a meaningful one of its own, then disposes the now-empty wrapper. World
28
- * transform is preserved via `setParent`. */
28
+ * transform is preserved via `setParent`. The loaded root holds the effect's textures and
29
+ * materials, so `only` takes a hold first: a wrapper root goes, and with it that hold. */
29
30
  function collapseInto(wrapper: TransformNode, only: TransformNode, parent: Node | null): void {
30
31
  if (!hasMeaningfulName(only) && hasMeaningfulName(wrapper)) {
31
32
  only.name = wrapper.name;
32
33
  }
34
+ QuarksUtil.shareResources(wrapper, only);
33
35
  only.setParent(parent);
34
36
  wrapper.dispose(true, false);
35
37
  }
@@ -34,13 +34,14 @@ export function applyRendererMaterial(system: ParticleSystem, patch: RendererMat
34
34
  system.blending = patch.blendMode;
35
35
  }
36
36
  if (patch.transparent !== undefined) {
37
- settings.materialTransparent = patch.transparent;
37
+ // The setter, so a depth write not chosen follows the surface.
38
+ system.transparent = patch.transparent;
38
39
  }
39
40
  if (patch.depthTest !== undefined) {
40
41
  settings.materialDepthTest = patch.depthTest;
41
42
  }
42
43
  if (patch.depthWrite !== undefined) {
43
- settings.materialDepthWrite = patch.depthWrite;
44
+ system.depthWrite = patch.depthWrite;
44
45
  }
45
46
  if (patch.alphaTest !== undefined) {
46
47
  settings.materialAlphaTest = patch.alphaTest;
@@ -2,12 +2,23 @@ import React, {useEffect, useState} from 'react';
2
2
  import {InspectorLabel} from './InspectorLabel.js';
3
3
  import {inputStyle, rowStyle} from './theme.js';
4
4
 
5
- /** An inspector row: a label, with an optional hint, and its controls. */
5
+ /**
6
+ * An inspector row: a label, with an optional hint, and its controls. With an empty label the
7
+ * controls span the whole row, continuing the row above; the hint is then not shown.
8
+ */
6
9
  export function Row(props: {label: string; hint?: string; hintKey?: string; children: React.ReactNode}) {
7
10
  return (
8
11
  <div style={rowStyle}>
9
- <InspectorLabel label={props.label} hint={props.hint} hintKey={props.hintKey} />
10
- {props.children}
12
+ {props.label ? (
13
+ <>
14
+ <InspectorLabel label={props.label} hint={props.hint} hintKey={props.hintKey} />
15
+ {props.children}
16
+ </>
17
+ ) : (
18
+ // A row without a label continues the one above it across the whole width, rather
19
+ // than squeezing its fields into the label column.
20
+ <div style={{gridColumn: '1 / -1', minWidth: 0}}>{props.children}</div>
21
+ )}
11
22
  </div>
12
23
  );
13
24
  }
@@ -31,6 +31,7 @@ import {
31
31
  RandomColorBetweenGradient,
32
32
  RandomQuatGenerator,
33
33
  RenderMode,
34
+ STRETCHED_LENGTH_FACTOR,
34
35
  SizeOverLife,
35
36
  Vector3Function,
36
37
  normalizeTextureUV,
@@ -947,6 +948,11 @@ export interface GeometryOption {
947
948
  uvs2?: Float32Array | number[];
948
949
  /** Vertex normals, three values per vertex; without them lighting uses +Z. */
949
950
  normals?: Float32Array | number[];
951
+ /**
952
+ * Vertex colours, `r, g, b, a` per vertex, linear (glTF `COLOR_0`), which the particle colour
953
+ * is multiplied by; see `ParticleSystem.instancingColors`.
954
+ */
955
+ colors?: Float32Array | number[];
950
956
  }
951
957
 
952
958
  /** Vertex buffers a host loader (e.g. a GLB importer) returns for the Mesh render mode. */
@@ -1260,7 +1266,10 @@ export function RendererModule({
1260
1266
  </Row>
1261
1267
  <Row label="Length factor">
1262
1268
  <NumberField
1263
- value={(system.rendererEmitterSettings as {lengthFactor?: number}).lengthFactor ?? 2}
1269
+ value={
1270
+ (system.rendererEmitterSettings as {lengthFactor?: number}).lengthFactor ??
1271
+ STRETCHED_LENGTH_FACTOR
1272
+ }
1264
1273
  step={0.1}
1265
1274
  onChange={(v) =>
1266
1275
  binding.apply(
@@ -1494,6 +1503,7 @@ export function RendererModule({
1494
1503
  settings.instancingUVs = undefined;
1495
1504
  settings.instancingUVs2 = undefined;
1496
1505
  settings.instancingNormals = undefined;
1506
+ settings.instancingColors = undefined;
1497
1507
  s.instancingGeometry = new Float32Array(g.positions);
1498
1508
  s.instancingIndices = g.indices
1499
1509
  ? new Uint32Array(g.indices)
@@ -1501,6 +1511,7 @@ export function RendererModule({
1501
1511
  if (g.uvs) s.instancingUVs = new Float32Array(g.uvs);
1502
1512
  if (g.uvs2) s.instancingUVs2 = new Float32Array(g.uvs2);
1503
1513
  if (g.normals) settings.instancingNormals = new Float32Array(g.normals);
1514
+ if (g.colors) s.instancingColors = new Float32Array(g.colors);
1504
1515
  });
1505
1516
  return (
1506
1517
  <Row label="Geometry">