@volter/editor-threejs 0.5.81 → 0.5.83
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/editor-threejs",
|
|
3
3
|
"author": "Volter AI, Inc.",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.83",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -135,12 +135,12 @@
|
|
|
135
135
|
"serving": "./dist-node/serving.mjs"
|
|
136
136
|
},
|
|
137
137
|
"dependencies": {
|
|
138
|
-
"@volter/editor-project": "0.5.
|
|
138
|
+
"@volter/editor-project": "0.5.83",
|
|
139
139
|
"@sparkjsdev/spark": "^2.1.0",
|
|
140
140
|
"three.quarks": "^0.16.0",
|
|
141
141
|
"zod": "^4.3.6",
|
|
142
142
|
"typescript": "5.9.3",
|
|
143
|
-
"@volter/editor-sdk": "0.5.
|
|
143
|
+
"@volter/editor-sdk": "0.5.83",
|
|
144
144
|
"postprocessing": "6.38.3",
|
|
145
145
|
"quarks.core": "0.16.0",
|
|
146
146
|
"@fortawesome/free-solid-svg-icons": "^7.2.0"
|
|
@@ -23,6 +23,7 @@ import { captureSizeFromCommand } from '@volter/editor-sdk/kit/capture-size';
|
|
|
23
23
|
import type { EditorShellStore, HelperVisibility } from './editor-shell-store';
|
|
24
24
|
import { editorHost } from '@volter/editor-sdk/host';
|
|
25
25
|
import { entityObject3D } from './entity-object';
|
|
26
|
+
import { VIEWPORT_SHADING_MODES } from '../render/viewport-shading';
|
|
26
27
|
import { focusedStageStore } from '@volter/editor-sdk/kit/stage-context';
|
|
27
28
|
import {
|
|
28
29
|
setViewGridVisible,
|
|
@@ -239,9 +240,17 @@ export const viewportCommands: CommandContribution['commands'] = {
|
|
|
239
240
|
}),
|
|
240
241
|
'set-shading-mode': verb((store, cmd) => {
|
|
241
242
|
const documentSession = activeObject3DDocumentSession();
|
|
243
|
+
// A MODE THE VIEWPORT DOES NOT DRAW IS REFUSED BY NAME: an unknown one reached the renderer
|
|
244
|
+
// and every frame after it threw (`editor.shading('material')`).
|
|
245
|
+
const mode = cmd['mode'];
|
|
246
|
+
const known: readonly string[] = documentSession
|
|
247
|
+
? [...VIEWPORT_SHADING_MODES, 'uv', 'vertex-colors']
|
|
248
|
+
: VIEWPORT_SHADING_MODES;
|
|
249
|
+
if (typeof mode !== 'string' || !known.includes(mode)) {
|
|
250
|
+
return { ok: false, error: `No shading mode "${String(mode)}"; the modes are ${known.join(', ')}.` };
|
|
251
|
+
}
|
|
242
252
|
// `preview` and `rendered` are lit as a stage says (Blender's Material Preview and Rendered);
|
|
243
253
|
// where no stage says, they would draw as Solid under another name.
|
|
244
|
-
const mode = cmd['mode'];
|
|
245
254
|
if (mode === 'preview' || mode === 'rendered') {
|
|
246
255
|
const documentId = activeWorkspaceDocumentId();
|
|
247
256
|
const stageKind = documentId ? viewPresentationBinding(documentId)?.stageKind : undefined;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { createNeutralMatcapTexture } from './matcap-texture';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Temporary developer-facing shading modes. These never become scene data. `preview` is authored
|
|
6
|
+
* materials lit by a preview (Blender's Material Preview) and `rendered` authored materials lit by
|
|
7
|
+
* the scene (Blender's Rendered), each as a stage says.
|
|
8
|
+
*/
|
|
9
|
+
export const VIEWPORT_SHADING_MODES = [
|
|
10
|
+
'solid',
|
|
11
|
+
'preview',
|
|
12
|
+
'rendered',
|
|
13
|
+
'clay',
|
|
14
|
+
'unlit',
|
|
15
|
+
'wireframe',
|
|
16
|
+
'matcap',
|
|
17
|
+
'normals',
|
|
18
|
+
'overdraw',
|
|
19
|
+
] as const;
|
|
20
|
+
export type ViewportShadingMode = (typeof VIEWPORT_SHADING_MODES)[number];
|
|
17
21
|
|
|
18
22
|
type MaterialPair = {
|
|
19
23
|
clay: THREE.MeshStandardMaterial;
|