@babylonjs/inspector 9.29.0 → 9.31.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.
Files changed (71) hide show
  1. package/bin/inspector-bridge.mjs +4730 -4446
  2. package/bin/inspector-cli.mjs +4765 -3866
  3. package/lib/components/curveEditor/animatableAnimations.d.ts +27 -0
  4. package/lib/components/properties/nodes/gaussianSplattingProperties.d.ts +13 -2
  5. package/lib/{extensionsListService-DfE1ZOnF.js → extensionsListService-O8zrOnmL.js} +5 -2
  6. package/lib/{extensionsListService-DfE1ZOnF.js.map → extensionsListService-O8zrOnmL.js.map} +1 -1
  7. package/lib/gif-ut7hgn9U.js +45 -0
  8. package/lib/gif-ut7hgn9U.js.map +1 -0
  9. package/lib/{index-CZ1-Y-Rv.js → index-DbbhJJ1G.js} +321 -85
  10. package/lib/index-DbbhJJ1G.js.map +1 -0
  11. package/lib/index.js +4 -1
  12. package/lib/index.js.map +1 -1
  13. package/lib/lite/animationProperties-BKVw6_ls.js +95 -0
  14. package/lib/lite/animationProperties-BKVw6_ls.js.map +1 -0
  15. package/lib/lite/animationUtils.d.ts +47 -0
  16. package/lib/lite/components/properties/animationProperties.d.ts +48 -0
  17. package/lib/lite/directTextureBinding-C5MB2OV2.js +99 -0
  18. package/lib/lite/directTextureBinding-C5MB2OV2.js.map +1 -0
  19. package/lib/lite/dynamicMaterialField-L_nQAxAA.js +107 -0
  20. package/lib/lite/dynamicMaterialField-L_nQAxAA.js.map +1 -0
  21. package/lib/lite/engineExplorerService.d.ts +3 -1
  22. package/lib/lite/{extensionsListService-D1JivcAu.js → extensionsListService-Bl1rTNl1.js} +2 -2
  23. package/lib/lite/{extensionsListService-D1JivcAu.js.map → extensionsListService-Bl1rTNl1.js.map} +1 -1
  24. package/lib/lite/{index-D8vFySa7.js → index-Cy8gzpYG.js} +1453 -394
  25. package/lib/lite/index-Cy8gzpYG.js.map +1 -0
  26. package/lib/lite/index.js +1 -1
  27. package/lib/lite/nodeMaterialProperties-ELFMlzS1.js +182 -0
  28. package/lib/lite/nodeMaterialProperties-ELFMlzS1.js.map +1 -0
  29. package/lib/lite/pbrMaterialProperties-jfJddBxY.js +614 -0
  30. package/lib/lite/pbrMaterialProperties-jfJddBxY.js.map +1 -0
  31. package/lib/lite/services/panes/properties/animationPropertiesService.d.ts +5 -0
  32. package/lib/lite/services/panes/properties/materialPropertiesService.d.ts +3 -1
  33. package/lib/lite/services/panes/properties/materials/directTextureBinding.d.ts +29 -0
  34. package/lib/lite/services/panes/properties/materials/dynamicMaterialField.d.ts +35 -0
  35. package/lib/lite/services/panes/properties/materials/materialAdapterTypes.d.ts +11 -0
  36. package/lib/lite/services/panes/properties/materials/materialReachability.d.ts +9 -0
  37. package/lib/lite/services/panes/properties/materials/nodeMaterialProperties.d.ts +8 -0
  38. package/lib/lite/services/panes/properties/materials/pbrMaterialProperties.d.ts +8 -0
  39. package/lib/lite/services/panes/properties/materials/shaderMaterialProperties.d.ts +8 -0
  40. package/lib/lite/services/panes/properties/materials/standardMaterialProperties.d.ts +8 -0
  41. package/lib/lite/services/panes/properties/materials/useDirectMaterialOperations.d.ts +31 -0
  42. package/lib/lite/services/panes/properties/textureMetadataProperties.d.ts +14 -0
  43. package/lib/lite/services/panes/properties/texturePropertiesService.d.ts +3 -1
  44. package/lib/lite/services/panes/properties/useLatestAsyncOperation.d.ts +24 -0
  45. package/lib/lite/services/panes/scene/animationGroupExplorerService.d.ts +7 -0
  46. package/lib/lite/services/panes/scene/materialExplorerService.d.ts +2 -1
  47. package/lib/lite/services/panes/scene/materialTopologyBindings.d.ts +13 -0
  48. package/lib/lite/services/panes/scene/sceneResourceIndexService.d.ts +36 -0
  49. package/lib/lite/services/panes/scene/sceneResources.d.ts +55 -11
  50. package/lib/lite/services/panes/scene/textureExplorerService.d.ts +2 -1
  51. package/lib/lite/services/pickingService.d.ts +10 -0
  52. package/lib/lite/shaderMaterialProperties-CTH_KfBK.js +229 -0
  53. package/lib/lite/shaderMaterialProperties-CTH_KfBK.js.map +1 -0
  54. package/lib/lite/standardMaterialProperties-BbYdFX86.js +287 -0
  55. package/lib/lite/standardMaterialProperties-BbYdFX86.js.map +1 -0
  56. package/lib/lite/textureMetadataProperties-BdNmp0Pk.js +221 -0
  57. package/lib/lite/textureMetadataProperties-BdNmp0Pk.js.map +1 -0
  58. package/lib/lite/useDirectMaterialOperations-D6V7OtC1.js +83 -0
  59. package/lib/lite/useDirectMaterialOperations-D6V7OtC1.js.map +1 -0
  60. package/lib/lite/useLatestAsyncOperation-k59AgA3B.js +78 -0
  61. package/lib/lite/useLatestAsyncOperation-k59AgA3B.js.map +1 -0
  62. package/lib/{quickCreateToolsService-owfaw163.js → quickCreateToolsService-Cs46Amv7.js} +5 -2
  63. package/lib/{quickCreateToolsService-owfaw163.js.map → quickCreateToolsService-Cs46Amv7.js.map} +1 -1
  64. package/lib/{reflectorService-oIAxxpQt.js → reflectorService-C43FgOiC.js} +5 -2
  65. package/lib/{reflectorService-oIAxxpQt.js.map → reflectorService-C43FgOiC.js.map} +1 -1
  66. package/lib/services/panes/properties/gaussianSplattingDebugController.d.ts +46 -0
  67. package/package.json +8 -8
  68. package/lib/gif-5DieAkSF.js +0 -38
  69. package/lib/gif-5DieAkSF.js.map +0 -1
  70. package/lib/index-CZ1-Y-Rv.js.map +0 -1
  71. package/lib/lite/index-D8vFySa7.js.map +0 -1
package/lib/lite/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Accordion, a as AccordionSection, b as AccordionSectionItem, B as BooleanBadgePropertyLine, c as BridgeCommandRegistryIdentity, d as BuiltInsExtensionFeed, e as Button, f as ButtonLine, C as Checkbox, g as CheckboxPropertyLine, h as ChildWindow, i as Collapse, j as ComboBox, k as ComboBoxPropertyLine, l as ConstructorFactory, D as DraggableLine, m as Dropdown, E as EngineContextIdentity, n as EngineExplorerServiceIdentity, o as EntitySelector, p as ErrorBoundary, q as ExplorerServiceIdentity, r as ExtensibleAccordion, F as FileUploadLine, G as GetPropertyDescriptor, H as HexPropertyLine, I as InfoLabel, s as InterceptFunction, t as InterceptProperty, v as IsPropertyReadonly, w as LineContainer, L as Link, x as LinkPropertyLine, y as List, M as MakeDialogTeachingMoment, z as MakeLazyComponent, J as MakeModularBridge, K as MakeModularTool, N as MakePopoverTeachingMoment, O as MakeTeachingMoment, P as MessageBar, Q as NumberDropdown, R as NumberDropdownPropertyLine, T as NumberInputPropertyLine, U as ObservableCollection, V as Pane, W as PlaceholderPropertyLine, X as Popover, Y as PositionedPopover, Z as PropertiesServiceIdentity, _ as PropertyContext, $ as PropertyLine, a0 as SearchBar, a1 as SearchBox, a2 as SelectionServiceDefinition, a3 as SelectionServiceIdentity, a4 as SettingsServiceIdentity, a5 as SettingsStore, a6 as SettingsStoreIdentity, S as ShellServiceIdentity, a7 as ShowInspector, a8 as SidePaneContainer, a9 as Slider, aa as SpinButton, ab as SpinButtonPropertyLine, ac as StringDropdown, ad as StringDropdownPropertyLine, ae as StringifiedPropertyLine, af as Switch, ag as SwitchPropertyLine, ah as SyncedSliderInput, ai as SyncedSliderPropertyLine, aj as TeachingMoment, ak as TextAreaPropertyLine, al as TextInput, am as TextInputPropertyLine, an as TextPropertyLine, ao as Textarea, ap as Theme, aq as ThemeServiceIdentity, ar as ToastProvider, as as ToggleButton, at as Tooltip, au as UploadButton, av as WatcherServiceIdentity, aw as useAngleConverters, ax as useAsyncResource, ay as useEventListener, az as useEventfulState, aA as useInterceptObservable, aB as useKeyListener, aC as useKeyState, aD as useObservableCollection, aE as useObservableState, aF as useOrderedObservableCollection, aG as usePollingObservable, aH as usePropertyChangedNotifier, aI as useResource, aJ as useTheme, aK as useThemeMode, aL as useToast } from './index-D8vFySa7.js';
1
+ export { A as Accordion, y as AccordionSection, z as AccordionSectionItem, v as BooleanBadgePropertyLine, E as BridgeCommandRegistryIdentity, F as BuiltInsExtensionFeed, H as Button, B as ButtonLine, I as Checkbox, J as CheckboxPropertyLine, K as ChildWindow, O as Collapse, Q as ComboBox, U as ComboBoxPropertyLine, W as ConstructorFactory, X as DraggableLine, Y as Dropdown, Z as EngineContextIdentity, _ as EngineExplorerServiceIdentity, $ as EntitySelector, a0 as ErrorBoundary, a1 as ExplorerServiceIdentity, a2 as ExtensibleAccordion, a3 as FileUploadLine, a4 as GetPropertyDescriptor, a5 as HexPropertyLine, a6 as InfoLabel, a7 as InterceptFunction, a8 as InterceptProperty, a9 as IsPropertyReadonly, aa as LineContainer, L as Link, w as LinkPropertyLine, ab as List, ac as MakeDialogTeachingMoment, ad as MakeLazyComponent, ae as MakeModularBridge, af as MakeModularTool, ag as MakePopoverTeachingMoment, ah as MakeTeachingMoment, M as MessageBar, ai as NumberDropdown, m as NumberDropdownPropertyLine, N as NumberInputPropertyLine, aj as ObservableCollection, ak as Pane, al as PlaceholderPropertyLine, am as Popover, an as PositionedPopover, ao as PropertiesServiceIdentity, ap as PropertyContext, P as PropertyLine, aq as SearchBar, ar as SearchBox, as as SelectionServiceDefinition, at as SelectionServiceIdentity, au as SettingsServiceIdentity, av as SettingsStore, aw as SettingsStoreIdentity, S as ShellServiceIdentity, ax as ShowInspector, ay as SidePaneContainer, az as Slider, aA as SpinButton, aB as SpinButtonPropertyLine, aC as StringDropdown, n as StringDropdownPropertyLine, g as StringifiedPropertyLine, aD as Switch, f as SwitchPropertyLine, aE as SyncedSliderInput, e as SyncedSliderPropertyLine, aF as TeachingMoment, aG as TextAreaPropertyLine, aH as TextInput, k as TextInputPropertyLine, T as TextPropertyLine, aI as Textarea, aJ as Theme, aK as ThemeServiceIdentity, aL as ToastProvider, aM as ToggleButton, aN as Tooltip, aO as UploadButton, aP as WatcherServiceIdentity, aQ as useAngleConverters, aR as useAsyncResource, aS as useEventListener, aT as useEventfulState, aU as useInterceptObservable, aV as useKeyListener, aW as useKeyState, aX as useObservableCollection, o as useObservableState, aY as useOrderedObservableCollection, aZ as usePollingObservable, p as usePropertyChangedNotifier, a_ as useResource, a$ as useTheme, b0 as useThemeMode, b1 as useToast } from './index-Cy8gzpYG.js';
2
2
  import '@babylonjs/core/Misc/observable.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
@@ -0,0 +1,182 @@
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import { getMaterialSource, getMaterialFamily, isMaterialView, getTextureMetadata } from '@babylonjs/lite';
3
+ import { Body1 } from '@fluentui/react-components';
4
+ import { useCallback } from 'react';
5
+ import { o as useObservableState, T as TextPropertyLine, b as useWatchedValue, C as ComputedProperty, D as DerivedProperty, k as TextInputPropertyLine } from './index-Cy8gzpYG.js';
6
+ import { D as DirectTextureBinding } from './directTextureBinding-C5MB2OV2.js';
7
+ import { D as DynamicMaterialField, V as ValidateDynamicValue } from './dynamicMaterialField-L_nQAxAA.js';
8
+ import { u as useDirectMaterialOperations } from './useDirectMaterialOperations-D6V7OtC1.js';
9
+ import '@babylonjs/core/Misc/observable.js';
10
+ import '@fluentui/react-icons';
11
+ import '@babylonjs/core/Misc/dataStorage.js';
12
+ import '@babylonjs/core/Misc/asyncLock.js';
13
+ import '@babylonjs/core/Misc/deferred.js';
14
+ import '@fluentui-contrib/react-resize-handle';
15
+ import '@fluentui/react-motion-components-preview';
16
+ import '@babylonjs/core/Misc/logger.js';
17
+ import 'react-dom/client';
18
+ import '@fluentui-contrib/react-virtualizer';
19
+ import '@babylonjs/core/Misc/uniqueIdGenerator.js';
20
+ import '@babylonjs/core/Maths/math.color.js';
21
+ import '@babylonjs/core/Maths/math.vector.js';
22
+ import './useLatestAsyncOperation-k59AgA3B.js';
23
+
24
+ function ReadName(target) {
25
+ try {
26
+ const name = target.name;
27
+ return name === undefined ? "" : typeof name === "string" ? name : undefined;
28
+ }
29
+ catch {
30
+ return undefined;
31
+ }
32
+ }
33
+ const NodeGeneral = (props) => {
34
+ const { material, resourceIndexService, selectionService } = props;
35
+ const { source, record, operations, commit } = useDirectMaterialOperations(material, resourceIndexService, selectionService);
36
+ const name = useWatchedValue(material, ReadName);
37
+ if (!record) {
38
+ return jsx(TextPropertyLine, { label: "Error", value: "This material is no longer available in an inspected scene." });
39
+ }
40
+ const family = getMaterialFamily(source);
41
+ const pending = operations["material.name"]?.pending;
42
+ const error = operations["material.name"]?.error;
43
+ return (jsxs(Fragment, { children: [jsxs("div", { "aria-busy": pending, children: [name === undefined ? (jsx(ComputedProperty, { component: TextPropertyLine, target: material, getValue: () => "Unavailable: Material name is not a string or cannot be read.", label: "Name", uniqueId: "material.name" })) : (jsx(DerivedProperty, { component: TextInputPropertyLine, target: material, getValue: ReadName, setValue: (target, next) => commit({
44
+ id: "material.name",
45
+ oldValue: ReadName(target),
46
+ newValue: next,
47
+ invalidate: "owned",
48
+ apply: () => {
49
+ target.name = next;
50
+ },
51
+ }), label: "Name", uniqueId: "material.name", disabled: pending, description: error ? `Error: ${error}` : undefined })), pending ? jsx(Body1, { role: "status", children: "Applying Name\u2026" }) : undefined, error ? jsx(Body1, { role: "alert", children: error }) : undefined] }), jsx(TextPropertyLine, { label: "Family", value: family ?? "node" }), jsx(TextPropertyLine, { label: "Selection", value: isMaterialView(material) ? "MaterialView" : "Material" }), isMaterialView(material) ? jsx(TextPropertyLine, { label: "Source", value: record.displayName }) : undefined] }));
52
+ };
53
+ function ValueLength(type) {
54
+ switch (type) {
55
+ case "f32":
56
+ return 1;
57
+ case "vec2f":
58
+ return 2;
59
+ case "vec3f":
60
+ return 3;
61
+ case "vec4f":
62
+ return 4;
63
+ }
64
+ }
65
+ function FieldType(type) {
66
+ switch (type) {
67
+ case "f32":
68
+ return "number";
69
+ case "vec2f":
70
+ return "vec2";
71
+ case "vec3f":
72
+ return "vec3";
73
+ case "vec4f":
74
+ return "vec4";
75
+ }
76
+ }
77
+ const NodeValueField = (props) => {
78
+ const { material, name, type, resourceIndexService, selectionService } = props;
79
+ const node = getMaterialSource(material);
80
+ const { operations, commit } = useDirectMaterialOperations(material, resourceIndexService, selectionService);
81
+ const id = `node.input:${name}`;
82
+ const read = useCallback(() => {
83
+ const input = node.inputs[name];
84
+ if (!input || input.type !== type) {
85
+ return undefined;
86
+ }
87
+ const value = input.value;
88
+ if (type === "f32") {
89
+ return typeof value === "number" ? value : undefined;
90
+ }
91
+ return Array.isArray(value) && value.length === ValueLength(type) ? [...value] : undefined;
92
+ }, [node, name, type]);
93
+ const write = (value) => {
94
+ let oldValue;
95
+ try {
96
+ oldValue = read();
97
+ }
98
+ catch {
99
+ // A stale or unreadable input is reported by the guarded apply below.
100
+ }
101
+ const newValue = typeof value === "number" ? value : [...value];
102
+ commit({
103
+ id,
104
+ propertyOwner: node.inputs[name],
105
+ propertyKey: "value",
106
+ oldValue,
107
+ newValue,
108
+ invalidate: "owned",
109
+ apply: () => {
110
+ const input = node.inputs[name];
111
+ if (!input || input.type !== type) {
112
+ throw new Error(`Property "${id}" is stale or unsupported for a Node material.`);
113
+ }
114
+ input.value = ValidateDynamicValue(id, newValue, ValueLength(type));
115
+ },
116
+ });
117
+ };
118
+ return (jsx(DynamicMaterialField, { target: node, id: id, label: name, type: FieldType(type), read: read, write: write, unavailable: `Node input "${name}" has no readable ${type} value.`, pending: operations[id]?.pending, error: operations[id]?.error }));
119
+ };
120
+ const NodeTextureField = (props) => {
121
+ const { material, name, resourceIndexService, selectionService } = props;
122
+ const { source, record, operations, commit } = useDirectMaterialOperations(material, resourceIndexService, selectionService);
123
+ const node = source;
124
+ const id = `node.texture:${name}`;
125
+ let texture;
126
+ try {
127
+ const input = node.inputs[name];
128
+ if (!input || input.type !== "texture2d") {
129
+ throw new Error("The input is no longer a texture.");
130
+ }
131
+ texture = input.texture;
132
+ }
133
+ catch {
134
+ return jsx(TextPropertyLine, { label: name, value: `Unavailable: Node texture input "${name}" is unreadable.` });
135
+ }
136
+ if (!record) {
137
+ return jsx(TextPropertyLine, { label: "Error", value: "This material is no longer available in an inspected scene." });
138
+ }
139
+ return (jsx(DirectTextureBinding, { record: record, resourceIndexService: resourceIndexService, selectionService: selectionService, operations: operations, commit: commit, id: id, label: name, value: texture, read: () => {
140
+ const current = node.inputs[name];
141
+ return current?.type === "texture2d" ? current.texture : undefined;
142
+ }, acceptedKinds: ["2d"], invalidate: "rebuild", apply: (nextTexture) => {
143
+ const input = node.inputs[name];
144
+ if (!input || input.type !== "texture2d") {
145
+ throw new Error(`Texture binding "${id}" is stale or unsupported for a Node material.`);
146
+ }
147
+ if (nextTexture) {
148
+ const metadata = getTextureMetadata(nextTexture);
149
+ if (metadata?.kind !== "2d" || metadata.sampleType === "depth" || metadata.sampleType === "sint" || metadata.sampleType === "uint") {
150
+ throw new TypeError(`Texture binding "${id}" requires a float-sampled Texture2D value.`);
151
+ }
152
+ }
153
+ input.texture = nextTexture;
154
+ } }));
155
+ };
156
+ /**
157
+ * Displays sorted Node material properties and texture bindings directly.
158
+ * @param props The selected material section and instance services.
159
+ * @returns Node material property content.
160
+ */
161
+ const NodeMaterialAdapter = (props) => {
162
+ const { material, section, resourceIndexService } = props;
163
+ const node = getMaterialSource(material);
164
+ const getNames = useCallback(() => Object.keys(node.inputs).sort(), [node]);
165
+ const names = useObservableState(getNames, resourceIndexService.onChanged);
166
+ if (section === "general") {
167
+ return jsx(NodeGeneral, { ...props });
168
+ }
169
+ if (section === "inputs") {
170
+ if (!resourceIndexService.getMaterialRecord(getMaterialSource(material))) {
171
+ return jsx(TextPropertyLine, { label: "Error", value: "This material is no longer available in an inspected scene." });
172
+ }
173
+ return (jsx(Fragment, { children: names.map((name) => {
174
+ const type = node.inputs[name]?.type;
175
+ return type === "texture2d" ? (jsx(NodeTextureField, { ...props, name: name }, name)) : type ? (jsx(NodeValueField, { ...props, name: name, type: type }, name)) : undefined;
176
+ }) }));
177
+ }
178
+ return null;
179
+ };
180
+
181
+ export { NodeMaterialAdapter };
182
+ //# sourceMappingURL=nodeMaterialProperties-ELFMlzS1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodeMaterialProperties-ELFMlzS1.js","sources":["../../../../../../../../../../dev/inspector-v2/src/lite/services/panes/properties/materials/nodeMaterialProperties.tsx"],"sourcesContent":["import { getMaterialFamily, getMaterialSource, getTextureMetadata, isMaterialView, type NodeInputHandle, type NodeMaterial, type Texture2D } from \"@babylonjs/lite\";\nimport { Body1 } from \"@fluentui/react-components\";\nimport { type FunctionComponent, useCallback } from \"react\";\n\nimport { TextInputPropertyLine } from \"shared-ui-components/fluent/hoc/propertyLines/inputPropertyLine\";\nimport { TextPropertyLine } from \"shared-ui-components/fluent/hoc/propertyLines/textPropertyLine\";\nimport { useObservableState } from \"shared-ui-components/modularTool/hooks/observableHooks\";\n\nimport { ComputedProperty, DerivedProperty } from \"../../../../../components/properties/boundProperty\";\nimport { useWatchedValue } from \"../../../../../contexts/watcherContext\";\nimport { DirectTextureBinding } from \"./directTextureBinding\";\nimport { DynamicMaterialField, ValidateDynamicValue, type DynamicFieldType, type DynamicFieldValue } from \"./dynamicMaterialField\";\nimport { type MaterialAdapterProps } from \"./materialAdapterTypes\";\nimport { useDirectMaterialOperations } from \"./useDirectMaterialOperations\";\n\nfunction ReadName(target: object): string | undefined {\n try {\n const name = (target as { name?: unknown }).name;\n return name === undefined ? \"\" : typeof name === \"string\" ? name : undefined;\n } catch {\n return undefined;\n }\n}\n\nconst NodeGeneral: FunctionComponent<MaterialAdapterProps> = (props) => {\n const { material, resourceIndexService, selectionService } = props;\n const { source, record, operations, commit } = useDirectMaterialOperations(material, resourceIndexService, selectionService);\n const name = useWatchedValue(material, ReadName);\n if (!record) {\n return <TextPropertyLine label=\"Error\" value=\"This material is no longer available in an inspected scene.\" />;\n }\n const family = getMaterialFamily(source);\n const pending = operations[\"material.name\"]?.pending;\n const error = operations[\"material.name\"]?.error;\n return (\n <>\n <div aria-busy={pending}>\n {name === undefined ? (\n <ComputedProperty\n component={TextPropertyLine}\n target={material}\n getValue={() => \"Unavailable: Material name is not a string or cannot be read.\"}\n label=\"Name\"\n uniqueId=\"material.name\"\n />\n ) : (\n <DerivedProperty\n component={TextInputPropertyLine}\n target={material}\n getValue={ReadName as () => string}\n setValue={(target, next) =>\n commit({\n id: \"material.name\",\n oldValue: ReadName(target),\n newValue: next,\n invalidate: \"owned\",\n apply: () => {\n (target as { name?: string }).name = next;\n },\n })\n }\n label=\"Name\"\n uniqueId=\"material.name\"\n disabled={pending}\n description={error ? `Error: ${error}` : undefined}\n />\n )}\n {pending ? <Body1 role=\"status\">Applying Name…</Body1> : undefined}\n {error ? <Body1 role=\"alert\">{error}</Body1> : undefined}\n </div>\n <TextPropertyLine label=\"Family\" value={family ?? \"node\"} />\n <TextPropertyLine label=\"Selection\" value={isMaterialView(material) ? \"MaterialView\" : \"Material\"} />\n {isMaterialView(material) ? <TextPropertyLine label=\"Source\" value={record.displayName} /> : undefined}\n </>\n );\n};\n\ntype ValueInputType = Exclude<NodeInputHandle[\"type\"], \"texture2d\">;\n\nfunction ValueLength(type: ValueInputType): 1 | 2 | 3 | 4 {\n switch (type) {\n case \"f32\":\n return 1;\n case \"vec2f\":\n return 2;\n case \"vec3f\":\n return 3;\n case \"vec4f\":\n return 4;\n }\n}\n\nfunction FieldType(type: ValueInputType): DynamicFieldType {\n switch (type) {\n case \"f32\":\n return \"number\";\n case \"vec2f\":\n return \"vec2\";\n case \"vec3f\":\n return \"vec3\";\n case \"vec4f\":\n return \"vec4\";\n }\n}\n\nconst NodeValueField: FunctionComponent<MaterialAdapterProps & { name: string; type: ValueInputType }> = (props) => {\n const { material, name, type, resourceIndexService, selectionService } = props;\n const node = getMaterialSource(material) as NodeMaterial;\n const { operations, commit } = useDirectMaterialOperations(material, resourceIndexService, selectionService);\n const id = `node.input:${name}`;\n const read = useCallback((): DynamicFieldValue | undefined => {\n const input = node.inputs[name];\n if (!input || input.type !== type) {\n return undefined;\n }\n const value = input.value;\n if (type === \"f32\") {\n return typeof value === \"number\" ? value : undefined;\n }\n return Array.isArray(value) && value.length === ValueLength(type) ? [...value] : undefined;\n }, [node, name, type]);\n const write = (value: DynamicFieldValue) => {\n let oldValue: DynamicFieldValue | undefined;\n try {\n oldValue = read();\n } catch {\n // A stale or unreadable input is reported by the guarded apply below.\n }\n const newValue = typeof value === \"number\" ? value : [...value];\n commit({\n id,\n propertyOwner: node.inputs[name],\n propertyKey: \"value\",\n oldValue,\n newValue,\n invalidate: \"owned\",\n apply: () => {\n const input = node.inputs[name];\n if (!input || input.type !== type) {\n throw new Error(`Property \"${id}\" is stale or unsupported for a Node material.`);\n }\n input.value = ValidateDynamicValue(id, newValue, ValueLength(type));\n },\n });\n };\n return (\n <DynamicMaterialField\n target={node}\n id={id}\n label={name}\n type={FieldType(type)}\n read={read}\n write={write}\n unavailable={`Node input \"${name}\" has no readable ${type} value.`}\n pending={operations[id]?.pending}\n error={operations[id]?.error}\n />\n );\n};\n\nconst NodeTextureField: FunctionComponent<MaterialAdapterProps & { name: string }> = (props) => {\n const { material, name, resourceIndexService, selectionService } = props;\n const { source, record, operations, commit } = useDirectMaterialOperations(material, resourceIndexService, selectionService);\n const node = source as NodeMaterial;\n const id = `node.texture:${name}`;\n let texture: Texture2D | null | undefined;\n try {\n const input = node.inputs[name];\n if (!input || input.type !== \"texture2d\") {\n throw new Error(\"The input is no longer a texture.\");\n }\n texture = input.texture;\n } catch {\n return <TextPropertyLine label={name} value={`Unavailable: Node texture input \"${name}\" is unreadable.`} />;\n }\n if (!record) {\n return <TextPropertyLine label=\"Error\" value=\"This material is no longer available in an inspected scene.\" />;\n }\n return (\n <DirectTextureBinding\n record={record}\n resourceIndexService={resourceIndexService}\n selectionService={selectionService}\n operations={operations}\n commit={commit}\n id={id}\n label={name}\n value={texture}\n read={() => {\n const current = node.inputs[name];\n return current?.type === \"texture2d\" ? current.texture : undefined;\n }}\n acceptedKinds={[\"2d\"]}\n invalidate=\"rebuild\"\n apply={(nextTexture) => {\n const input = node.inputs[name];\n if (!input || input.type !== \"texture2d\") {\n throw new Error(`Texture binding \"${id}\" is stale or unsupported for a Node material.`);\n }\n if (nextTexture) {\n const metadata = getTextureMetadata(nextTexture);\n if (metadata?.kind !== \"2d\" || metadata.sampleType === \"depth\" || metadata.sampleType === \"sint\" || metadata.sampleType === \"uint\") {\n throw new TypeError(`Texture binding \"${id}\" requires a float-sampled Texture2D value.`);\n }\n }\n input.texture = nextTexture as Texture2D | null;\n }}\n />\n );\n};\n\n/**\n * Displays sorted Node material properties and texture bindings directly.\n * @param props The selected material section and instance services.\n * @returns Node material property content.\n */\nexport const NodeMaterialAdapter: FunctionComponent<MaterialAdapterProps> = (props) => {\n const { material, section, resourceIndexService } = props;\n const node = getMaterialSource(material) as NodeMaterial;\n const getNames = useCallback(() => Object.keys(node.inputs).sort(), [node]);\n const names = useObservableState(getNames, resourceIndexService.onChanged);\n if (section === \"general\") {\n return <NodeGeneral {...props} />;\n }\n if (section === \"inputs\") {\n if (!resourceIndexService.getMaterialRecord(getMaterialSource(material))) {\n return <TextPropertyLine label=\"Error\" value=\"This material is no longer available in an inspected scene.\" />;\n }\n return (\n <>\n {names.map((name) => {\n const type = node.inputs[name]?.type;\n return type === \"texture2d\" ? (\n <NodeTextureField key={name} {...props} name={name} />\n ) : type ? (\n <NodeValueField key={name} {...props} name={name} type={type} />\n ) : undefined;\n })}\n </>\n );\n }\n return null;\n};\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAeA,SAAS,QAAQ,CAAC,MAAc,EAAA;AAC5B,IAAA,IAAI;AACA,QAAA,MAAM,IAAI,GAAI,MAA6B,CAAC,IAAI;QAChD,OAAO,IAAI,KAAK,SAAS,GAAG,EAAE,GAAG,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,SAAS;IAChF;AAAE,IAAA,MAAM;AACJ,QAAA,OAAO,SAAS;IACpB;AACJ;AAEA,MAAM,WAAW,GAA4C,CAAC,KAAK,KAAI;IACnE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,GAAG,KAAK;AAClE,IAAA,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,2BAA2B,CAAC,QAAQ,E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