@babylonjs/inspector 9.26.0 → 9.26.1
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/lib/browser-CANgtOiM.js.map +1 -1
- package/lib/components/properties/boundProperty.d.ts +16 -0
- package/lib/components/properties/metadataProperties.d.ts +5 -1
- package/lib/{extensionsListService-DVpZa3gV.js → extensionsListService-2sqR5MRD.js} +3 -4
- package/lib/{extensionsListService-DVpZa3gV.js.map → extensionsListService-2sqR5MRD.js.map} +1 -1
- package/lib/gif-5DieAkSF.js.map +1 -1
- package/lib/{index-C5ggNiyY.js → index-DvyGGbVg.js} +244 -90
- package/lib/index-DvyGGbVg.js.map +1 -0
- package/lib/index.js +3 -4
- package/lib/index.js.map +1 -1
- package/lib/lite/components/properties/cameraProperties.d.ts +11 -0
- package/lib/lite/components/properties/lightProperties.d.ts +33 -0
- package/lib/lite/components/properties/sceneNodeProperties.d.ts +8 -0
- package/lib/lite/{extensionsListService-xgITNk9y.js → extensionsListService-BP2ToO_O.js} +2 -4
- package/lib/lite/{extensionsListService-xgITNk9y.js.map → extensionsListService-BP2ToO_O.js.map} +1 -1
- package/lib/lite/{index-DmQN3QdU.js → index-6eEEtyAL.js} +1363 -194
- package/lib/lite/index-6eEEtyAL.js.map +1 -0
- package/lib/lite/index.js +2 -4
- package/lib/lite/index.js.map +1 -1
- package/lib/lite/sceneEntityUtils.d.ts +19 -0
- package/lib/lite/services/panes/properties/cameraPropertiesService.d.ts +3 -0
- package/lib/lite/services/panes/properties/lightPropertiesService.d.ts +3 -0
- package/lib/lite/services/panes/properties/sceneNodePropertiesService.d.ts +3 -0
- package/lib/lite/services/panes/properties/shadowGeneratorPropertiesService.d.ts +4 -0
- package/lib/lite/services/panes/scene/cameraExplorerService.d.ts +7 -0
- package/lib/lite/services/panes/scene/lightExplorerService.d.ts +6 -0
- package/lib/lite/services/panes/scene/meshExplorerService.d.ts +4 -1
- package/lib/lite/services/panes/scene/sceneSelectionUtils.d.ts +3 -0
- package/lib/lite/services/panes/scene/shadowGeneratorExplorerService.d.ts +6 -0
- package/lib/{quickCreateToolsService-0rVa_CjZ.js → quickCreateToolsService-B0RAjMcI.js} +4 -5
- package/lib/{quickCreateToolsService-0rVa_CjZ.js.map → quickCreateToolsService-B0RAjMcI.js.map} +1 -1
- package/lib/{reflectorService-pyDncbYA.js → reflectorService-CUFxJIMt.js} +4 -5
- package/lib/{reflectorService-pyDncbYA.js.map → reflectorService-CUFxJIMt.js.map} +1 -1
- package/package.json +1 -1
- package/lib/index-C5ggNiyY.js.map +0 -1
- package/lib/lite/index-DmQN3QdU.js.map +0 -1
|
@@ -4,16 +4,14 @@ import { createContext, forwardRef, useContext, useState, useCallback, Component
|
|
|
4
4
|
import { tokens, makeStyles, Tooltip as Tooltip$1, Button as Button$1, Spinner, useFluent, Accordion as Accordion$1, AccordionHeader, Subtitle2Stronger, AccordionPanel, Divider, MessageBar as MessageBar$1, MessageBarBody, AccordionItem, SearchBox as SearchBox$1, Portal, mergeClasses, createLightTheme, createDarkTheme, createDOMRenderer, FluentProvider, RendererProvider, TeachingPopover, TeachingPopoverSurface, TeachingPopoverHeader, TeachingPopoverBody, useId, useToastController, Toast, ToastTitle, Toaster, Menu, MenuTrigger, SplitButton, MenuPopover, MenuList, MenuItem, Toolbar as Toolbar$1, ToolbarRadioButton, MenuGroup, MenuGroupHeader, Link as Link$1, Caption1, Body1, ToggleButton as ToggleButton$1, InfoLabel as InfoLabel$1, Body1Strong, Checkbox as Checkbox$1, Switch as Switch$1, Dropdown as Dropdown$1, Option, useMergedRefs, Input, Slider as Slider$1, MenuItemRadio, Dialog as Dialog$1, DialogSurface, DialogBody, DialogTitle, DialogContent, DialogActions, List as List$1, ListItem, useComboboxFilter, Combobox, MessageBarTitle, Popover as Popover$1, PopoverTrigger, PopoverSurface, Field, Textarea as Textarea$1, PresenceBadge, treeItemLevelToken, typographyStyles, FlatTree, FlatTreeItem, MenuDivider, TreeItemLayout, MenuItemCheckbox, ColorPicker, ColorArea, ColorSlider, AlphaSlider, ColorSwatch, Badge, Label, Subtitle2, ToolbarButton, ToolbarDivider, DialogTrigger } from '@fluentui/react-components';
|
|
5
5
|
import { ErrorCircleRegular, EyeFilled, EyeOffRegular, CheckmarkFilled, EditRegular, FilterRegular, PinFilled, PinRegular, ArrowCircleUpRegular, PanelLeftExpandRegular, PanelRightExpandRegular, PanelLeftContractRegular, PanelRightContractRegular, PictureInPictureEnterRegular, MoreHorizontalRegular, LayoutColumnTwoFocusLeftFilled, LayoutColumnTwoSplitLeftFocusTopLeftFilled, LayoutColumnTwoSplitLeftFocusBottomLeftFilled, LayoutColumnTwoFocusRightFilled, LayoutColumnTwoSplitRightFocusTopRightFilled, LayoutColumnTwoSplitRightFocusBottomRightFilled, SettingsRegular, ChevronCircleRight16Regular, ChevronCircleRight20Regular, ChevronCircleDown16Regular, ChevronCircleDown20Regular, Copy16Regular, CopyRegular, DocumentTextRegular, ArrowBidirectionalUpDownFilled, ArrowClockwiseRegular, WeatherSunnyRegular, WeatherMoonRegular, InfoRegular, WarningRegular, CheckmarkCircleRegular, DeleteFilled, LinkDismissRegular, LinkEditRegular, AddRegular, DeleteRegular, ArrowUploadRegular, createFluentIcon, TextSortAscendingRegular, GlobeRegular, ArrowExpandAllRegular, ArrowCollapseAllRegular, ChevronRightRegular, CubeTreeRegular, BugRegular, ArrowDownloadRegular, StopRegular, RecordRegular, DataBarHorizontalRegular, WrenchRegular, PlugDisconnectedRegular, PlugConnectedRegular, PlugConnectedCheckmarkRegular, ArrowRotateClockwiseRegular, ArrowExpandRegular, SelectObjectRegular, CubeRegular, CameraRegular, SaveRegular, LinkRegular, ArrowSyncRegular, FullScreenMaximizeRegular, ChevronDownRegular, CircleSmallFilled, PreviousRegular, ArrowPreviousRegular, TriangleLeftRegular, RecordStopRegular, PlayRegular, ArrowNextRegular, NextRegular, PauseRegular, ArrowUndoRegular, BracesRegular, BracesDismiss16Regular, EyeRegular, CloudArrowUpRegular, CloudArrowDownRegular, EyeOffFilled, ArrowMoveFilled, StopFilled, PlayFilled, LockOpenRegular, LockClosedRegular, ResizeRegular, ChevronUpRegular, ArrowResetRegular, CircleHalfFillRegular, EyedropperRegular, PaintBucketRegular, InkStrokeRegular, StackRegular, FilmstripRegular, PauseFilled, WeatherSunnyLowFilled, HeadphonesSoundWaveRegular, ArrowEnterUpRegular, SoundWaveCircleRegular, SoundWaveCircleFilled, CatchUpRegular, LayerRegular, FlowchartRegular, FrameRegular, AppGenericRegular, RectangleLandscapeRegular, BorderOutsideRegular, BorderNoneRegular, MyLocationRegular, BubbleMultipleRegular, LightbulbRegular, VideoFilled, VideoRegular, FlashlightRegular, FlashlightOffRegular, DropRegular, BlurRegular, PipelineRegular, PersonWalkingRegular, DataLineRegular, PersonSquareRegular, LayerDiagonalPersonRegular, ImageEditRegular, ImageRegular, TargetRegular, DismissRegular, PersonFeedbackRegular, BranchRegular } from '@fluentui/react-icons';
|
|
6
6
|
import { DataStorage } from '@babylonjs/core/Misc/dataStorage.js';
|
|
7
|
-
import { Logger } from '@babylonjs/core/Misc/logger.js';
|
|
8
7
|
import { AsyncLock } from '@babylonjs/core/Misc/asyncLock.js';
|
|
9
8
|
import { Deferred } from '@babylonjs/core/Misc/deferred.js';
|
|
10
9
|
import { useResizeHandle } from '@fluentui-contrib/react-resize-handle';
|
|
11
10
|
import { Collapse as Collapse$1, Fade } from '@fluentui/react-motion-components-preview';
|
|
12
|
-
import {
|
|
13
|
-
import { Clamp } from '@babylonjs/core/Maths/math.scalar.functions.js';
|
|
11
|
+
import { Logger } from '@babylonjs/core/Misc/logger.js';
|
|
14
12
|
import { createRoot } from 'react-dom/client';
|
|
15
13
|
import { Color3, Color4 } from '@babylonjs/core/Maths/math.color.js';
|
|
16
|
-
import { Vector3, Quaternion, Matrix, Vector2,
|
|
14
|
+
import { Vector3, Quaternion, Matrix, Vector2, TmpVectors } from '@babylonjs/core/Maths/math.vector.js';
|
|
17
15
|
import { UniqueIdGenerator } from '@babylonjs/core/Misc/uniqueIdGenerator.js';
|
|
18
16
|
import { VirtualizerScrollView } from '@fluentui-contrib/react-virtualizer';
|
|
19
17
|
import { FontAsset } from '@babylonjs/addons/msdfText/fontAsset.js';
|
|
@@ -140,6 +138,7 @@ import { MinTemperatureKelvin, MaxTintMagnitude } from '@babylonjs/core/Maths/co
|
|
|
140
138
|
import { Skeleton } from '@babylonjs/core/Bones/skeleton.js';
|
|
141
139
|
import { Sprite } from '@babylonjs/core/Sprites/sprite.js';
|
|
142
140
|
import { SpriteManager } from '@babylonjs/core/Sprites/spriteManager.js';
|
|
141
|
+
import { Clamp } from '@babylonjs/core/Maths/math.scalar.functions.js';
|
|
143
142
|
import { GetTextureDataAsync, WhenTextureReadyAsync } from '@babylonjs/core/Misc/textureTools.js';
|
|
144
143
|
import { KeyboardEventTypes } from '@babylonjs/core/Events/keyboardEvents.js';
|
|
145
144
|
import { PointerEventTypes } from '@babylonjs/core/Events/pointerEvents.js';
|
|
@@ -573,9 +572,32 @@ function useKeyState(key, options) {
|
|
|
573
572
|
// Storage Helpers
|
|
574
573
|
// ============================================================================
|
|
575
574
|
const STORAGE_KEY_ROOT = "Babylon/Accordion";
|
|
575
|
+
const InMemoryStorage = new Map();
|
|
576
|
+
// eslint-disable-next-line no-console
|
|
577
|
+
const Warn = (message) => globalThis.console?.warn?.(message);
|
|
578
|
+
const ReadStoredString = (key) => {
|
|
579
|
+
try {
|
|
580
|
+
return globalThis.localStorage?.getItem(key) ?? InMemoryStorage.get(key) ?? "";
|
|
581
|
+
}
|
|
582
|
+
catch {
|
|
583
|
+
return InMemoryStorage.get(key) ?? "";
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
const WriteStoredString = (key, value) => {
|
|
587
|
+
try {
|
|
588
|
+
if (globalThis.localStorage) {
|
|
589
|
+
globalThis.localStorage.setItem(key, value);
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
catch {
|
|
594
|
+
// Fall through to in-memory persistence when localStorage is unavailable.
|
|
595
|
+
}
|
|
596
|
+
InMemoryStorage.set(key, value);
|
|
597
|
+
};
|
|
576
598
|
const ReadFromStorage = (path, initial) => {
|
|
577
599
|
try {
|
|
578
|
-
const stored =
|
|
600
|
+
const stored = ReadStoredString(`${STORAGE_KEY_ROOT}/${path}`);
|
|
579
601
|
return stored ? JSON.parse(stored) : initial;
|
|
580
602
|
}
|
|
581
603
|
catch {
|
|
@@ -583,7 +605,7 @@ const ReadFromStorage = (path, initial) => {
|
|
|
583
605
|
}
|
|
584
606
|
};
|
|
585
607
|
const WriteToStorage = (path, data) => {
|
|
586
|
-
|
|
608
|
+
WriteStoredString(`${STORAGE_KEY_ROOT}/${path}`, JSON.stringify(data));
|
|
587
609
|
};
|
|
588
610
|
// ============================================================================
|
|
589
611
|
// Reducer
|
|
@@ -741,7 +763,7 @@ function useAccordionSectionItemState(props) {
|
|
|
741
763
|
const prevItemIdRef = useRef(itemId);
|
|
742
764
|
useEffect(() => {
|
|
743
765
|
if (accordionCtx && prevItemIdRef.current !== itemId) {
|
|
744
|
-
|
|
766
|
+
Warn(`Accordion: The uniqueId "${itemId}" in section "${sectionCtx?.sectionId}" has changed from "${prevItemIdRef.current}". ` +
|
|
745
767
|
`Each item must have a unique, stable ID for pin/hide persistence to work correctly.`);
|
|
746
768
|
}
|
|
747
769
|
prevItemIdRef.current = itemId;
|
|
@@ -753,7 +775,7 @@ function useAccordionSectionItemState(props) {
|
|
|
753
775
|
}
|
|
754
776
|
const { registeredItemIds } = accordionCtx;
|
|
755
777
|
if (registeredItemIds.has(itemUniqueId)) {
|
|
756
|
-
|
|
778
|
+
Warn(`Accordion: Duplicate uniqueId "${itemId}" detected in section "${sectionCtx?.sectionId}". ` +
|
|
757
779
|
`Each item must have a unique ID within its section for pin/hide persistence to work correctly.`);
|
|
758
780
|
}
|
|
759
781
|
registeredItemIds.set(itemUniqueId, itemLabel ?? itemId);
|
|
@@ -3363,7 +3385,11 @@ function copyCommandToClipboard(strCommand) {
|
|
|
3363
3385
|
// babylonNamespace is either "" (ES6) or "BABYLON."
|
|
3364
3386
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3365
3387
|
function getClassNameWithNamespace(obj) {
|
|
3366
|
-
|
|
3388
|
+
if ((typeof obj !== "object" && typeof obj !== "function") || obj === null) {
|
|
3389
|
+
return { className: "Unknown", babylonNamespace: "" };
|
|
3390
|
+
}
|
|
3391
|
+
const candidate = obj;
|
|
3392
|
+
let className = candidate.getClassName?.() ?? candidate.constructor?.name ?? "Unknown";
|
|
3367
3393
|
if (className.includes("BABYLON.")) {
|
|
3368
3394
|
className = className.split("BABYLON.")[1];
|
|
3369
3395
|
}
|
|
@@ -3976,7 +4002,7 @@ const SpinButton = forwardRef((props, ref) => {
|
|
|
3976
4002
|
return !invalid;
|
|
3977
4003
|
}, [min, max, props.validator, props.forceInt]);
|
|
3978
4004
|
// Constrain a value to the valid range by clamping to [min, max].
|
|
3979
|
-
const constrainValue = useCallback((v) =>
|
|
4005
|
+
const constrainValue = useCallback((v) => Math.min(max ?? Infinity, Math.max(min ?? -Infinity, v)), [min, max]);
|
|
3980
4006
|
const tryCommitValue = useCallback((currVal) => {
|
|
3981
4007
|
if (validateValue(currVal) && currVal !== lastCommittedValue.current) {
|
|
3982
4008
|
lastCommittedValue.current = currVal;
|
|
@@ -5269,7 +5295,7 @@ function MakeModularTool(options) {
|
|
|
5269
5295
|
}
|
|
5270
5296
|
// Register the extension list service (for browsing/installing extensions) if extension feeds are provided.
|
|
5271
5297
|
if (extensionFeeds.length > 0) {
|
|
5272
|
-
const { ExtensionListServiceDefinition } = await import('./extensionsListService-
|
|
5298
|
+
const { ExtensionListServiceDefinition } = await import('./extensionsListService-2sqR5MRD.js');
|
|
5273
5299
|
serviceContainer.addService(ExtensionListServiceDefinition);
|
|
5274
5300
|
}
|
|
5275
5301
|
// Register all external services (that make up a unique tool).
|
|
@@ -6665,6 +6691,22 @@ function ComputedProperty(props) {
|
|
|
6665
6691
|
const value = useWatchedValue(target, getValue);
|
|
6666
6692
|
return jsx(Component, { ...{ ...rest, value } });
|
|
6667
6693
|
}
|
|
6694
|
+
/**
|
|
6695
|
+
* Renders an editable property-line component for a value derived from a target.
|
|
6696
|
+
*
|
|
6697
|
+
* This is useful for method-backed values, readonly object references, or values whose UI
|
|
6698
|
+
* representation differs from their stored representation. The getter follows the Preferred
|
|
6699
|
+
* Watch Mode, while the setter owns the runtime-specific write-back.
|
|
6700
|
+
* @param props The target, derived getter, write-back function, and property-line component props.
|
|
6701
|
+
* @returns The editable derived property-line component.
|
|
6702
|
+
*/
|
|
6703
|
+
function DerivedProperty(props) {
|
|
6704
|
+
const {
|
|
6705
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
6706
|
+
component: Component, target, getValue, setValue, ...rest } = props;
|
|
6707
|
+
const value = useWatchedValue(target, getValue);
|
|
6708
|
+
return jsx(Component, { ...{ ...rest, value, onChange: (changedValue) => setValue(target, changedValue) } });
|
|
6709
|
+
}
|
|
6668
6710
|
function GetOnCopyString(value, propertyPath) {
|
|
6669
6711
|
const valueStr = GenerateCopyString(value);
|
|
6670
6712
|
return `globalThis.debugNode.${propertyPath} = ${valueStr};`;
|
|
@@ -10368,14 +10410,14 @@ const DefaultInspectorExtensionFeed = new BuiltInsExtensionFeed("Inspector", [
|
|
|
10368
10410
|
description: "Adds a new panel for easy creation of various Babylon assets. This is a WIP extension...expect changes!",
|
|
10369
10411
|
keywords: ["creation", "tools"],
|
|
10370
10412
|
...BabylonWebResources,
|
|
10371
|
-
getExtensionModuleAsync: async () => await import('./quickCreateToolsService-
|
|
10413
|
+
getExtensionModuleAsync: async () => await import('./quickCreateToolsService-B0RAjMcI.js'),
|
|
10372
10414
|
},
|
|
10373
10415
|
{
|
|
10374
10416
|
name: "Reflector",
|
|
10375
10417
|
description: "Sends a serialized snapshot of the scene to the Babylon.js Sandbox through the Reflector Bridge. The snapshot is sent once and is read-only, so it does not stay in sync with this scene.",
|
|
10376
10418
|
keywords: ["reflector", "bridge", "snapshot", "sync", "sandbox", "tools"],
|
|
10377
10419
|
...BabylonWebResources,
|
|
10378
|
-
getExtensionModuleAsync: async () => await import('./reflectorService-
|
|
10420
|
+
getExtensionModuleAsync: async () => await import('./reflectorService-CUFxJIMt.js'),
|
|
10379
10421
|
},
|
|
10380
10422
|
]);
|
|
10381
10423
|
|
|
@@ -11292,97 +11334,209 @@ function _ShowInspector(target, options, configuration) {
|
|
|
11292
11334
|
}
|
|
11293
11335
|
|
|
11294
11336
|
/**
|
|
11295
|
-
*
|
|
11296
|
-
*
|
|
11297
|
-
* @
|
|
11298
|
-
* @returns Component wrapping a colorPicker component with a property line
|
|
11337
|
+
* Runtime-neutral controlled color editor with RGB or RGBA sliders and an injected picker.
|
|
11338
|
+
* @param props The controlled color, runtime adapter, and property-line presentation.
|
|
11339
|
+
* @returns The color property line.
|
|
11299
11340
|
*/
|
|
11300
|
-
const
|
|
11301
|
-
|
|
11302
|
-
const [
|
|
11341
|
+
const ControlledColorPropertyLine = (props) => {
|
|
11342
|
+
const { adapter, value, onChange, propertyLineRef } = props;
|
|
11343
|
+
const [currentValue, setCurrentValue] = useState(value);
|
|
11303
11344
|
useEffect(() => {
|
|
11304
|
-
|
|
11305
|
-
}, [
|
|
11306
|
-
const
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
newColor = Color4.FromColor3(color, value);
|
|
11310
|
-
}
|
|
11311
|
-
else {
|
|
11312
|
-
newColor = color.clone();
|
|
11313
|
-
newColor[key] = value / 255;
|
|
11314
|
-
}
|
|
11315
|
-
setColor(newColor); // Create a new object to trigger re-render
|
|
11316
|
-
props.onChange(newColor);
|
|
11345
|
+
setCurrentValue(value);
|
|
11346
|
+
}, [value]);
|
|
11347
|
+
const handleChange = (newValue) => {
|
|
11348
|
+
setCurrentValue(newValue);
|
|
11349
|
+
onChange(newValue);
|
|
11317
11350
|
};
|
|
11318
|
-
const
|
|
11319
|
-
|
|
11320
|
-
|
|
11351
|
+
const onSliderChange = (componentValue, component) => {
|
|
11352
|
+
const color = adapter.getColor(currentValue);
|
|
11353
|
+
handleChange(adapter.createColor({
|
|
11354
|
+
...color,
|
|
11355
|
+
[component]: component === "a" ? componentValue : componentValue / 255,
|
|
11356
|
+
}, currentValue));
|
|
11321
11357
|
};
|
|
11322
|
-
|
|
11323
|
-
})
|
|
11324
|
-
|
|
11358
|
+
const color = adapter.getColor(currentValue);
|
|
11359
|
+
return (jsx(PropertyLine, { ref: propertyLineRef, ...props, expandedContent: jsx(ColorSliders, { color: color, onSliderChange: onSliderChange }), children: createElement(adapter.picker, {
|
|
11360
|
+
value: currentValue,
|
|
11361
|
+
onChange: handleChange,
|
|
11362
|
+
isLinearMode: props.isLinearMode,
|
|
11363
|
+
disabled: props.disabled,
|
|
11364
|
+
className: props.className,
|
|
11365
|
+
style: props.style,
|
|
11366
|
+
title: props.title,
|
|
11367
|
+
}) }));
|
|
11368
|
+
};
|
|
11369
|
+
const ColorSliders = (props) => {
|
|
11370
|
+
const { color, onSliderChange } = props;
|
|
11371
|
+
return (jsxs(Fragment, { children: [jsx(SyncedSliderPropertyLine, { label: "R", value: color.r * 255, min: 0, max: 255, onChange: (value) => onSliderChange(value, "r") }), jsx(SyncedSliderPropertyLine, { label: "G", value: color.g * 255, min: 0, max: 255, onChange: (value) => onSliderChange(value, "g") }), jsx(SyncedSliderPropertyLine, { label: "B", value: color.b * 255, min: 0, max: 255, onChange: (value) => onSliderChange(value, "b") }), color.a === undefined ? undefined : (jsx(SyncedSliderPropertyLine, { label: "A", value: color.a, min: 0, max: 1, step: 0.01, onChange: (value) => onSliderChange(value, "a") }))] }));
|
|
11372
|
+
};
|
|
11373
|
+
|
|
11374
|
+
const Picker = (props) => jsx(ColorPickerPopup, { ...props });
|
|
11375
|
+
const Adapter = {
|
|
11376
|
+
picker: Picker,
|
|
11377
|
+
getColor: (value) => value,
|
|
11378
|
+
createColor: (color, source) => {
|
|
11379
|
+
if (source instanceof Color4) {
|
|
11380
|
+
return new Color4(color.r, color.g, color.b, color.a ?? source.a);
|
|
11381
|
+
}
|
|
11382
|
+
return source.clone().set(color.r, color.g, color.b);
|
|
11383
|
+
},
|
|
11384
|
+
};
|
|
11385
|
+
const ColorPropertyLine = forwardRef((props, ref) => jsx(ControlledColorPropertyLine, { ...props, adapter: Adapter, propertyLineRef: ref }));
|
|
11386
|
+
ColorPropertyLine.displayName = "ColorPropertyLine";
|
|
11387
|
+
/**
|
|
11388
|
+
* Edits a Babylon.js Color3 value.
|
|
11389
|
+
* @param props The controlled color and property-line presentation.
|
|
11390
|
+
* @returns The Color3 property line.
|
|
11391
|
+
*/
|
|
11325
11392
|
const Color3PropertyLine = ColorPropertyLine;
|
|
11393
|
+
/**
|
|
11394
|
+
* Edits a Babylon.js Color4 value.
|
|
11395
|
+
* @param props The controlled color and property-line presentation.
|
|
11396
|
+
* @returns The Color4 property line.
|
|
11397
|
+
*/
|
|
11326
11398
|
const Color4PropertyLine = ColorPropertyLine;
|
|
11327
11399
|
|
|
11328
|
-
const HasZ = (vector) => !(vector instanceof Vector2);
|
|
11329
|
-
const HasW = (vector) => vector instanceof Vector4 || vector instanceof Quaternion;
|
|
11330
11400
|
/**
|
|
11331
|
-
*
|
|
11332
|
-
*
|
|
11333
|
-
* @
|
|
11334
|
-
* @returns
|
|
11401
|
+
* Runtime-neutral controlled editor for two-, three-, and four-component numeric values.
|
|
11402
|
+
* @param props The value, change callback, component adapter, and property-line presentation.
|
|
11403
|
+
* @returns The tensor property line.
|
|
11335
11404
|
*/
|
|
11336
|
-
const
|
|
11337
|
-
|
|
11338
|
-
const converted = (
|
|
11339
|
-
const formatted = (
|
|
11340
|
-
const [
|
|
11341
|
-
const { min, max } = props;
|
|
11342
|
-
const onChange = (val, key) => {
|
|
11343
|
-
const value = props.valueConverter ? props.valueConverter.to(val) : val;
|
|
11344
|
-
const newVector = vector.clone();
|
|
11345
|
-
newVector[key] = value; // The syncedSlider for 'w' is only rendered when vector is a Vector4, so this is safe
|
|
11346
|
-
setVector(newVector);
|
|
11347
|
-
props.onChange(newVector);
|
|
11348
|
-
};
|
|
11405
|
+
const ControlledTensorPropertyLine = (props) => {
|
|
11406
|
+
const { adapter, min, max, unit, step, precision, valueConverter } = props;
|
|
11407
|
+
const converted = (value) => (valueConverter ? valueConverter.from(value) : value);
|
|
11408
|
+
const formatted = (value) => converted(value).toFixed(precision ?? (step !== undefined ? Math.max(0, CalculatePrecision(step)) : 2));
|
|
11409
|
+
const [value, setValue] = useState(props.value);
|
|
11349
11410
|
useEffect(() => {
|
|
11350
|
-
|
|
11411
|
+
setValue(props.value);
|
|
11351
11412
|
}, [props.value, props.expandedContent]);
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
const
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11358
|
-
const
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
|
|
11362
|
-
const
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11367
|
-
|
|
11413
|
+
const onComponentChange = (componentValue, component) => {
|
|
11414
|
+
const storedValue = valueConverter ? valueConverter.to(componentValue) : componentValue;
|
|
11415
|
+
const newValue = adapter.withComponent(value, component, storedValue);
|
|
11416
|
+
setValue(newValue);
|
|
11417
|
+
props.onChange(newValue);
|
|
11418
|
+
};
|
|
11419
|
+
const summary = adapter.components.map((component) => formatted(adapter.getComponent(props.value, component))).join(", ");
|
|
11420
|
+
return (jsx(PropertyLine, { ...props, expandedContent: jsxs(Fragment, { children: [props.expandedContent, jsx(TensorSliders, { value: value, adapter: adapter, min: min, max: max, unit: unit, step: step, precision: precision, converted: converted, onChange: onComponentChange })] }), children: jsx(Body1, { children: `[${summary}]` }) }));
|
|
11421
|
+
};
|
|
11422
|
+
const TensorSliders = (props) => {
|
|
11423
|
+
const { value, adapter, min, max, unit, step, precision, converted, onChange } = props;
|
|
11424
|
+
return (jsx(Fragment, { children: adapter.components.map((component) => (jsx(NumberInputPropertyLine, { label: component.toUpperCase(), value: converted(adapter.getComponent(value, component)), min: min, max: max, onChange: (componentValue) => onChange(componentValue, component), unit: unit, step: step, precision: precision }, component))) }));
|
|
11425
|
+
};
|
|
11426
|
+
const RadiansToDegreesConverter = {
|
|
11427
|
+
from: (value) => (value * 180) / Math.PI,
|
|
11428
|
+
to: (value) => (value * Math.PI) / 180,
|
|
11429
|
+
};
|
|
11430
|
+
/**
|
|
11431
|
+
* Runtime-neutral controlled Euler rotation editor.
|
|
11432
|
+
* @param props The rotation value, runtime adapter, and display options.
|
|
11433
|
+
* @returns The rotation property line.
|
|
11434
|
+
*/
|
|
11435
|
+
const ControlledRotationVectorPropertyLine = (props) => {
|
|
11436
|
+
const { useDegrees, ...rest } = props;
|
|
11437
|
+
return (jsx(ControlledTensorPropertyLine, { ...rest, unit: useDegrees ? "°" : "rad", valueConverter: useDegrees ? RadiansToDegreesConverter : undefined, step: useDegrees ? 1 : 0.01, precision: useDegrees ? 1 : 2 }));
|
|
11438
|
+
};
|
|
11439
|
+
/**
|
|
11440
|
+
* Runtime-neutral controlled quaternion editor with optional Euler presentation.
|
|
11441
|
+
* @param props The quaternion value, runtime conversion adapter, and display options.
|
|
11442
|
+
* @returns The quaternion or Euler property line.
|
|
11443
|
+
*/
|
|
11444
|
+
const ControlledQuaternionPropertyLine = (props) => {
|
|
11445
|
+
const { adapter, useEuler, useDegrees, ...rest } = props;
|
|
11446
|
+
const [quaternion, setQuaternion] = useState(props.value);
|
|
11368
11447
|
useEffect(() => {
|
|
11369
|
-
|
|
11448
|
+
setQuaternion(props.value);
|
|
11370
11449
|
}, [props.value]);
|
|
11371
|
-
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
setQuat(val);
|
|
11375
|
-
props.onChange(val);
|
|
11450
|
+
const onQuaternionChange = (value) => {
|
|
11451
|
+
setQuaternion(value);
|
|
11452
|
+
props.onChange(value);
|
|
11376
11453
|
};
|
|
11377
|
-
|
|
11378
|
-
const
|
|
11379
|
-
|
|
11454
|
+
if (useEuler) {
|
|
11455
|
+
const quaternionSummary = adapter.quaternion.components.map((component) => adapter.quaternion.getComponent(quaternion, component).toFixed(4)).join(", ");
|
|
11456
|
+
return (jsx(ControlledTensorPropertyLine, { ...rest, nullable: false, ignoreNullable: false, value: adapter.toEuler(quaternion), adapter: adapter.euler, valueConverter: useDegrees ? RadiansToDegreesConverter : undefined, onChange: (value) => onQuaternionChange(adapter.fromEuler(value, quaternion)), unit: useDegrees ? "°" : "rad", step: useDegrees ? 1 : 0.01, precision: useDegrees ? 1 : 2, expandedContent: jsx(TextPropertyLine, { label: "Quaternion", value: `[${quaternionSummary}]` }) }));
|
|
11457
|
+
}
|
|
11458
|
+
return (jsx(ControlledTensorPropertyLine, { ...rest, nullable: false, value: quaternion, adapter: adapter.quaternion, onChange: onQuaternionChange, unit: useDegrees ? "°" : "rad", step: useDegrees ? 1 : 0.01, precision: useDegrees ? 1 : 2 }));
|
|
11459
|
+
};
|
|
11460
|
+
|
|
11461
|
+
function CreateCoreTensorAdapter(components) {
|
|
11462
|
+
return {
|
|
11463
|
+
components,
|
|
11464
|
+
getComponent: (value, component) => {
|
|
11465
|
+
switch (component) {
|
|
11466
|
+
case "x":
|
|
11467
|
+
return value.x;
|
|
11468
|
+
case "y":
|
|
11469
|
+
return value.y;
|
|
11470
|
+
case "z":
|
|
11471
|
+
return "z" in value ? value.z : 0;
|
|
11472
|
+
case "w":
|
|
11473
|
+
return "w" in value ? value.w : 0;
|
|
11474
|
+
}
|
|
11475
|
+
},
|
|
11476
|
+
withComponent: (value, component, componentValue) => {
|
|
11477
|
+
const result = value.clone();
|
|
11478
|
+
switch (component) {
|
|
11479
|
+
case "x":
|
|
11480
|
+
result.x = componentValue;
|
|
11481
|
+
break;
|
|
11482
|
+
case "y":
|
|
11483
|
+
result.y = componentValue;
|
|
11484
|
+
break;
|
|
11485
|
+
case "z":
|
|
11486
|
+
if ("z" in result) {
|
|
11487
|
+
result.z = componentValue;
|
|
11488
|
+
}
|
|
11489
|
+
break;
|
|
11490
|
+
case "w":
|
|
11491
|
+
if ("w" in result) {
|
|
11492
|
+
result.w = componentValue;
|
|
11493
|
+
}
|
|
11494
|
+
break;
|
|
11495
|
+
}
|
|
11496
|
+
return result;
|
|
11497
|
+
},
|
|
11380
11498
|
};
|
|
11381
|
-
|
|
11499
|
+
}
|
|
11500
|
+
const Vector2Adapter = CreateCoreTensorAdapter(["x", "y"]);
|
|
11501
|
+
const Vector3Adapter = CreateCoreTensorAdapter(["x", "y", "z"]);
|
|
11502
|
+
const Vector4Adapter = CreateCoreTensorAdapter(["x", "y", "z", "w"]);
|
|
11503
|
+
const QuaternionTensorAdapter = CreateCoreTensorAdapter(["x", "y", "z", "w"]);
|
|
11504
|
+
const QuaternionAdapter = {
|
|
11505
|
+
quaternion: QuaternionTensorAdapter,
|
|
11506
|
+
euler: Vector3Adapter,
|
|
11507
|
+
fromEuler: (value) => Quaternion.FromEulerAngles(value.x, value.y, value.z),
|
|
11508
|
+
toEuler: (value) => value.toEulerAngles(),
|
|
11382
11509
|
};
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
|
|
11510
|
+
/**
|
|
11511
|
+
* Edits a Babylon.js Vector2 value.
|
|
11512
|
+
* @param props The controlled vector and property-line presentation.
|
|
11513
|
+
* @returns The Vector2 property line.
|
|
11514
|
+
*/
|
|
11515
|
+
const Vector2PropertyLine = (props) => jsx(ControlledTensorPropertyLine, { ...props, adapter: Vector2Adapter });
|
|
11516
|
+
/**
|
|
11517
|
+
* Edits a Babylon.js Vector3 value.
|
|
11518
|
+
* @param props The controlled vector and property-line presentation.
|
|
11519
|
+
* @returns The Vector3 property line.
|
|
11520
|
+
*/
|
|
11521
|
+
const Vector3PropertyLine = (props) => jsx(ControlledTensorPropertyLine, { ...props, adapter: Vector3Adapter });
|
|
11522
|
+
/**
|
|
11523
|
+
* Edits a Babylon.js Vector4 value.
|
|
11524
|
+
* @param props The controlled vector and property-line presentation.
|
|
11525
|
+
* @returns The Vector4 property line.
|
|
11526
|
+
*/
|
|
11527
|
+
const Vector4PropertyLine = (props) => jsx(ControlledTensorPropertyLine, { ...props, adapter: Vector4Adapter });
|
|
11528
|
+
/**
|
|
11529
|
+
* Edits a Babylon.js Euler rotation value.
|
|
11530
|
+
* @param props The controlled rotation and property-line presentation.
|
|
11531
|
+
* @returns The Euler rotation property line.
|
|
11532
|
+
*/
|
|
11533
|
+
const RotationVectorPropertyLine = (props) => (jsx(ControlledRotationVectorPropertyLine, { ...props, adapter: Vector3Adapter }));
|
|
11534
|
+
/**
|
|
11535
|
+
* Edits a Babylon.js Quaternion value with optional Euler presentation.
|
|
11536
|
+
* @param props The controlled quaternion and property-line presentation.
|
|
11537
|
+
* @returns The quaternion property line.
|
|
11538
|
+
*/
|
|
11539
|
+
const QuaternionPropertyLine = (props) => jsx(ControlledQuaternionPropertyLine, { ...props, adapter: QuaternionAdapter });
|
|
11386
11540
|
|
|
11387
11541
|
function IsInspectableObject(entity) {
|
|
11388
11542
|
return !!entity.inspectableCustomProperties;
|
|
@@ -28392,5 +28546,5 @@ function DetachDebugLayer() {
|
|
|
28392
28546
|
// Attach Inspector v2 to Scene.debugLayer as a side effect for back compat.
|
|
28393
28547
|
AttachDebugLayer();
|
|
28394
28548
|
|
|
28395
|
-
export {
|
|
28396
|
-
//# sourceMappingURL=index-
|
|
28549
|
+
export { FactorGradientComponent as $, Accordion as A, Button as B, CheckboxPropertyLine as C, Color4PropertyLine as D, ColorPickerPopup as E, ColorStepGradientComponent as F, ComboBox as G, ComboBoxPropertyLine as H, ComputedProperty as I, ConstructorFactory as J, ConvertOptions as K, Link as L, MessageBar as M, NumberInputPropertyLine as N, DebugServiceIdentity as O, Popover as P, DerivedProperty as Q, DetachDebugLayer as R, ShellServiceIdentity as S, TextInputPropertyLine as T, DraggableLine as U, Vector3PropertyLine as V, Dropdown as W, EntitySelector as X, ErrorBoundary as Y, ExplorerServiceIdentity as Z, ExtensibleAccordion as _, useToast as a, TextureSelector as a$, FactorGradientList as a0, FileUploadLine as a1, GetPropertyDescriptor as a2, GizmoServiceIdentity as a3, HexPropertyLine as a4, InfoLabel as a5, InputHexField as a6, InputHsvField as a7, Inspector as a8, InterceptFunction as a9, RotationVectorPropertyLine as aA, SceneExplorerServiceIdentity as aB, SearchBar as aC, SearchBox as aD, SelectionServiceDefinition as aE, SettingsServiceIdentity as aF, SettingsStore as aG, SettingsStoreIdentity as aH, ShowInspector as aI, SidePaneContainer as aJ, SkeletonSelector as aK, Slider as aL, SpinButton as aM, StartInspectable as aN, StatsServiceIdentity as aO, StringDropdown as aP, StringDropdownPropertyLine as aQ, StringifiedPropertyLine as aR, Switch as aS, SwitchPropertyLine as aT, SyncedSliderInput as aU, SyncedSliderPropertyLine as aV, TeachingMoment as aW, TextAreaPropertyLine as aX, TextInput as aY, TextPropertyLine as aZ, Textarea as a_, InterceptProperty as aa, IsPropertyReadonly as ab, LineContainer as ac, LinkPropertyLine as ad, LinkToEntityPropertyLine as ae, List as af, MakeDialogTeachingMoment as ag, MakeLazyComponent as ah, MakeModularBridge as ai, MakeModularTool as aj, MakePopoverTeachingMoment as ak, MakePropertyHook as al, MakeTeachingMoment as am, MaterialSelector as an, NodeSelector as ao, NumberDropdown as ap, NumberDropdownPropertyLine as aq, ObservableCollection as ar, Pane as as, PlaceholderPropertyLine as at, PositionedPopover as au, PropertiesServiceIdentity as av, Property as aw, PropertyContext as ax, PropertyLine as ay, QuaternionPropertyLine as az, useInterceptObservable as b, TextureUpload as b0, Theme as b1, ThemeServiceIdentity as b2, ToastProvider as b3, ToggleButton as b4, Tooltip as b5, UploadButton as b6, Vector2PropertyLine as b7, Vector4PropertyLine as b8, WatcherServiceIdentity as b9, inspectorAssetNotFoundHandler as ba, useAngleConverters as bb, useAsyncResource as bc, useColor3Property as bd, useColor4Property as be, useEventListener as bf, useEventfulState as bg, useKeyListener as bh, useKeyState as bi, useObservableCollection as bj, useOrderedObservableCollection as bk, usePollingObservable as bl, usePropertyChangedNotifier as bm, useQuaternionProperty as bn, useResource as bo, useTheme as bp, useThemeMode as bq, useVector3Property as br, LinkToEntity as c, SpinButtonPropertyLine as d, useProperty as e, SceneContextIdentity as f, SelectionServiceIdentity as g, useObservableState as h, AccordionSection as i, ButtonLine as j, ToolsServiceIdentity as k, AccordionSectionItem as l, AttachDebugLayer as m, BooleanBadgePropertyLine as n, BoundProperty as o, BridgeCommandRegistryIdentity as p, BuiltInsExtensionFeed as q, Checkbox as r, ChildWindow as s, Collapse as t, useExtensionManager as u, Color3GradientComponent as v, Color3GradientList as w, Color3PropertyLine as x, Color4GradientComponent as y, Color4GradientList as z };
|
|
28550
|
+
//# sourceMappingURL=index-DvyGGbVg.js.map
|