Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5.0.0 #471

Open
wants to merge 304 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
304 commits
Select commit Hold shift + click to select a range
dd11264
fix: loading scene
julien-moreau Jul 13, 2024
e621676
feat: add support of resize texture directly in editor and model view…
julien-moreau Jul 14, 2024
d250bad
feat: add support of refresh rate for classic shadow maps
julien-moreau Jul 15, 2024
b64ed77
feat: add support of refresh rate for shadow maps in babylonjs-editor…
julien-moreau Jul 15, 2024
33abe44
chore: bump babylonjs-editor-tools to v0.0.5
julien-moreau Jul 15, 2024
b09df74
feat: minor improvements
julien-moreau Jul 15, 2024
22d59f8
feat: add support of "do not serialize" in graph
julien-moreau Jul 15, 2024
c44e0cf
fix: keep refresh rate when changing size of shadow map
julien-moreau Jul 16, 2024
1eba2f6
fix: update shadow map on each customized property in shadows inspector
julien-moreau Jul 16, 2024
68eaacf
feat: adding support of decorators in babylonjs-editor-tools
julien-moreau Jul 16, 2024
23a0777
chore: bump babylonjs-editor-tools to v0.0.6
julien-moreau Jul 16, 2024
b10f16e
fix: export of non POT textures using KTX and quality
julien-moreau Jul 16, 2024
5863b65
feat: adding support of SceneLinkNode to include scenes in scenes
julien-moreau Jul 17, 2024
1e9f62c
feat: adding support of scene node link in graph and preview
julien-moreau Jul 18, 2024
9cbf3bd
refact: scene link in tools
julien-moreau Jul 18, 2024
d34954e
chore: bump babylonjs-editor-tools to v0.0.7
julien-moreau Jul 18, 2024
d41857f
feat: adding support of collision mesh
julien-moreau Jul 19, 2024
a740164
feat: finalizing support of collision mesh
julien-moreau Jul 22, 2024
48e0cd9
fix: remove collision mesh materials from exported scene
julien-moreau Jul 22, 2024
aec2b46
feat: adding graph filters
julien-moreau Jul 22, 2024
3711b65
fix: detection of cycle reference in
julien-moreau Jul 24, 2024
8270666
feat: add render options in preview panel
julien-moreau Jul 24, 2024
45ed469
feat: set max simultaneous lights value to 32
julien-moreau Jul 24, 2024
024b5a3
fix: setup of collisions and copy/paste mesh with collisions
julien-moreau Jul 25, 2024
dd5d7ef
fix: minor fixes for shadows
julien-moreau Jul 26, 2024
5850fc5
feat: add signing function to release macOS versions
julien-moreau Jul 26, 2024
d4e8b94
feat: add support of "add plugin from npm"
julien-moreau Jul 27, 2024
7d01683
chore: dependencies and build commands
julien-moreau Jul 27, 2024
b43e281
fix: add npm plugin logs in console
julien-moreau Jul 27, 2024
f8e4ebe
feat: moving editor camera controls in preferences
julien-moreau Jul 27, 2024
8e54a83
feat: add support of some editor's camera controls preferences in loc…
julien-moreau Jul 29, 2024
10092be
fix: loading crash of collision meshes
julien-moreau Jul 29, 2024
3450f0c
fix: parenting in project
julien-moreau Jul 30, 2024
a79ab79
feat: minor improvements
julien-moreau Jul 31, 2024
e2ff3d3
fix: win32 build
julien-moreau Jul 31, 2024
164c814
chore: bump editor to v5.0.0-alpha.4
julien-moreau Jul 31, 2024
3d69218
fix: spacing in website
julien-moreau Jul 31, 2024
b2e699e
refact: project preferences
julien-moreau Aug 1, 2024
5d728ce
feat: preparing support of WebGPU
julien-moreau Aug 1, 2024
cbe00f4
chore: bump babylonjs to v7.18.0
julien-moreau Aug 1, 2024
9e0e6db
feat: creating documentation
julien-moreau Aug 2, 2024
3648939
docs: added "creating project" documentation
julien-moreau Aug 3, 2024
b983c3f
docs: starting "composing scene"
julien-moreau Aug 4, 2024
6a8bd31
docs: add more documentation for "composing scene"
julien-moreau Aug 5, 2024
51c18d5
docs: more documentation for "composing scene"
julien-moreau Aug 6, 2024
ec4a9ff
docs: finalizing "composing scene" documentation
julien-moreau Aug 6, 2024
9c51c07
docs: adding "managing assets" documentation
julien-moreau Aug 7, 2024
b855d1c
feat: a bit more design for landing page
julien-moreau Aug 8, 2024
25e66c8
chore: update yarn.lock
julien-moreau Aug 8, 2024
96d9bde
feat: add support of shared materials from assets when saving/loading…
julien-moreau Aug 8, 2024
d111d09
feat: improving support of multi material
julien-moreau Aug 8, 2024
15dfc48
docs: minor improvements
julien-moreau Aug 8, 2024
0c30a84
feat: add support of drag'n'drop to put custom material in multi-mate…
julien-moreau Aug 9, 2024
05880a5
chore: prepare editor v5.0.0-alpha.5
julien-moreau Aug 9, 2024
0f57cff
feat: add support of sitemap in website
julien-moreau Aug 10, 2024
d46b244
refact: minor refact for files
julien-moreau Aug 10, 2024
4fd75ce
fix: padding on website landing page for mobile
julien-moreau Aug 12, 2024
7aa8bdf
fix: download links in website
julien-moreau Aug 13, 2024
21e5368
feat: write quixel meshes as babylon format once imported with LOD su…
julien-moreau Aug 13, 2024
23a101f
feat: add log when meshes saved as babylon format in quixel plugin
julien-moreau Aug 13, 2024
9d6afa8
fix: now prevent close window and app quit when editor focused
julien-moreau Aug 15, 2024
0448d9d
feat: adding support of "upgrade" plugin from npm
julien-moreau Aug 15, 2024
7432f9d
feat: adding support of play/stop game/application in preview toolbar
julien-moreau Aug 15, 2024
5022642
fix: export project and better match for play address in preview panel
julien-moreau Aug 18, 2024
0dee34a
feat: improve UI for play button
julien-moreau Aug 18, 2024
d6d63da
refact: use play as a separated component
julien-moreau Aug 18, 2024
891ce92
feat: add refresh button when playing game / application
julien-moreau Aug 19, 2024
47e9c88
chore: bump babylonjs to v7.22.5
julien-moreau Aug 28, 2024
34ab2f7
feat: add support of per-window confirmation when quitting the app
julien-moreau Aug 31, 2024
b8b9101
fix: add babylonjs icon in electron close message dialog
julien-moreau Aug 31, 2024
3b70b8e
fix: use native image for native message box
julien-moreau Aug 31, 2024
3f17a6a
fix: distinct close and upgrade steps when upgrading a plugin
julien-moreau Sep 1, 2024
9ad742f
chore: update caniuse
julien-moreau Sep 1, 2024
2539f6a
feat: preparing support of custom window
julien-moreau Sep 3, 2024
0792fcc
feat: improve support of node material editor
julien-moreau Sep 3, 2024
3c0963b
chore: add clean command
julien-moreau Sep 3, 2024
fa32cdf
feat: adding support of GUI editor
julien-moreau Sep 4, 2024
23df1f7
feat: more design for gui editor
julien-moreau Sep 4, 2024
a1e3458
feat: adding support of gui decorator for applications
Sep 5, 2024
d111f1d
chore: bump electron-builder to v25.0.5
julien-moreau Sep 5, 2024
6976ebe
fix: events for asset updated + design for header of nme and ge
Sep 6, 2024
bb60f56
fix: usage of GUI in project using @guiFromAsset
julien-moreau Sep 7, 2024
4319750
feat: improve @guiFromAsset decorator to include callback once gui is…
julien-moreau Sep 9, 2024
1b72481
feat: starting basics of animation editor
Sep 12, 2024
7ef92e9
feat: beginning support of tracks panel in animation editor
Sep 13, 2024
5e16099
feat: adding support of timeline tracks
julien-moreau Sep 16, 2024
c85eb42
feat: adding support of movable animation keys
julien-moreau Sep 17, 2024
d73cd95
fix: store node-pty processes launched per window and close all relat…
julien-moreau Sep 17, 2024
77ce9b9
feat: add support of remove key in animation editor and undo/redo for…
julien-moreau Sep 17, 2024
2de2183
feat: add support of "add animation key" through context menu in time…
Sep 18, 2024
cbb018f
feat: add support of "play", "stop" and time tracker in animation edi…
Sep 18, 2024
c058ec5
feat: add tooltip for time tracker in animation editor
Sep 18, 2024
516e286
chore: adding new icon for win32 builds
Sep 18, 2024
84a0385
feat: adding more options to key inspector in animation editor
Sep 19, 2024
e3f0068
fix: crash on macOS 15 by updating electron version to v30.5.0
julien-moreau Sep 20, 2024
d3add20
feat: adding more gestures to control time in animation editor
Sep 20, 2024
331cd30
feat: now import previously saved animations in animation editor
julien-moreau Sep 21, 2024
3d13cf1
feat: add support of sound file inspector
julien-moreau Sep 23, 2024
02049f8
fix: serialize and parse animations of scene in projects
julien-moreau Sep 25, 2024
d3ef218
feat: add context menu support to add keys
julien-moreau Sep 25, 2024
eb4d571
feat: add property suggestion when adding a new track to animation ed…
julien-moreau Sep 25, 2024
721530c
feat: add support of moving multiple frames using shift key in animat…
Sep 26, 2024
27cf974
feat: beginning support of cinematic
julien-moreau Sep 26, 2024
e2ceaa1
feat: preparing support of cinematic in animation editor
julien-moreau Sep 26, 2024
2d4a5f5
feat: adding support of cinematics in tracks and timelines in animati…
Sep 27, 2024
0067882
feat: now draw tracks for cinematics and move time tracker
julien-moreau Sep 27, 2024
093c5de
feat: add support of "add cinematic key"
julien-moreau Sep 29, 2024
71a283b
Revert "feat: add support of "add cinematic key""
Oct 2, 2024
506b3b3
Revert "feat: now draw tracks for cinematics and move time tracker"
Oct 2, 2024
f046729
Revert "feat: adding support of cinematics in tracks and timelines in…
Oct 2, 2024
f022faf
Revert "feat: preparing support of cinematic in animation editor"
Oct 2, 2024
c38470f
fix: move cinematic to dedicated tool
Oct 2, 2024
cab7794
feat: adding support of cinematic editor
julien-moreau Oct 3, 2024
7796e50
feat: add support of property keys in cinematic editor
julien-moreau Oct 3, 2024
65368f2
feat: improve support of track item in cinematic editor to customize …
julien-moreau Oct 3, 2024
ad8efb7
feat: adding support of animation groups in cinematic editor
julien-moreau Oct 3, 2024
5a2d7d3
fix: generation of cinematic with multiple animation group keys per t…
julien-moreau Oct 19, 2024
509a2c5
feat: now serialize and save cinematic in cinematic editor
julien-moreau Oct 20, 2024
09106a1
feat: adding support of inspector in cinematic editor
julien-moreau Oct 29, 2024
a857984
feat: adding support of GUI in editor scene's graph
julien-moreau Nov 4, 2024
12d912d
feat: add support of "Add Cinematic" in assets browser
julien-moreau Nov 5, 2024
cbdf00c
fix: reset pipelines when changing camera in preview panel
julien-moreau Nov 5, 2024
203549d
feat: adding support of default rendering pipeline in cinematic editor
julien-moreau Nov 6, 2024
331b692
feat: add support of mp4 conversion for cinematic editor
julien-moreau Nov 6, 2024
c0640c5
feat: improve flow when converting video to mp4
julien-moreau Nov 7, 2024
baed8a3
feat: add support of preference to enable/disable experimental featur…
julien-moreau Nov 7, 2024
9df554f
fix: minor fixes in animation editor and cinematic editor
julien-moreau Nov 7, 2024
5ad172a
feat: shortcuts to animate DefaultRenderingPipeline in cinematic editor
julien-moreau Nov 10, 2024
d03f54a
chore: v5.0.0-alpha.6
julien-moreau Nov 10, 2024
b02639e
feat: improve UI of cinematic editor for tracks and timeline
julien-moreau Nov 12, 2024
581a095
fix: tracker in animation editor and cinematic editor in case scroll …
Nov 13, 2024
44dc1a7
fix: parse of tangents in cinematic editor
Nov 13, 2024
948fef0
feat: adding support of sounds
Nov 14, 2024
7b9aeea
chore: update Babylon.JS to v7.34.1
julien-moreau Nov 14, 2024
f473c61
feat: improve texture inspector field
julien-moreau Nov 14, 2024
eb43502
chore: up to date with some misc packages
julien-moreau Nov 17, 2024
0d58512
feat: adding support of spatial sounds
julien-moreau Nov 20, 2024
bf9d1a6
feat: add spatial propertes in sound inspector
Nov 21, 2024
e05075b
chore: update electron to v32.2.5
Nov 21, 2024
0a768ab
fix: conversion using ffmpeg in cinematic editor for win32
julien-moreau Nov 21, 2024
8ab1645
feat: add missing parameters for spatial sound Ref Distance and Rollo…
Nov 22, 2024
96bc4ed
chore: use ESM modules for build and postinstall scripts
Nov 22, 2024
2291275
feat: add support of camera gizmo in preview
Nov 22, 2024
b663081
fix: update shadow maps when a mesh is moving using gizmos in case of…
julien-moreau Nov 23, 2024
18bbd26
fix: fallback on local assimp loader when webserver for GLTF conversi…
julien-moreau Nov 24, 2024
784bc40
feat: add support of asset browser and "Update geometry..." for meshe…
julien-moreau Nov 24, 2024
007c786
feat: add support of speed in animation group key in cinematic editor
julien-moreau Nov 24, 2024
f68af62
feat: add way to remove animation groups
julien-moreau Nov 25, 2024
8c4c1c8
feat: add support of output FPS for cinematic editor
julien-moreau Nov 26, 2024
5c28150
fix: layout of cinematic editor when vertical scroll is enabled
julien-moreau Nov 26, 2024
94bf032
fix: layout of cinematic editor to always have key inspector opened
julien-moreau Nov 26, 2024
af266a5
feat: add support of material export
julien-moreau Dec 3, 2024
5024623
fix: restore support of context menu in preview
julien-moreau Dec 3, 2024
5cf3f98
feat: add support of multi-select with "Shift" key in assets browser
julien-moreau Dec 14, 2024
f7a6d5c
feat: starting decals inspector
julien-moreau Dec 17, 2024
b3fc595
feat: finalizing basics of decals inspector
Dec 18, 2024
7567c41
feat: now edit decals
Dec 18, 2024
9c16214
fix: localize overflow in inspector in tools not globally
julien-moreau Dec 18, 2024
2be615c
fix: usage of existing materials in project scene loader
Dec 20, 2024
8d6877d
feat: adding support of scene editor in separate window
julien-moreau Dec 25, 2024
1495fe9
feat: add way to hide icons helpers in preview panel
julien-moreau Dec 27, 2024
aea59e9
feat: add more filters to graph component
julien-moreau Dec 27, 2024
e570023
chore: update Babylon.JS to v7.44.0
julien-moreau Jan 20, 2025
429fea4
feat: save clear color and ambient color
julien-moreau Jan 20, 2025
7355cc6
feat: adding support of Havok Physics Engine
julien-moreau Jan 21, 2025
b6fb323
fix: add isCollisionMesh metadata in collision meshes and instances
julien-moreau Jan 21, 2025
795c3b3
fix: rework TS augmentations
julien-moreau Jan 21, 2025
b48f08f
feat: adding support of physics in mesh inspector
Jan 22, 2025
8534a85
feat: adding support of save/load/export physics
julien-moreau Jan 22, 2025
acfffe3
fix: save/load/export physics aggregate
julien-moreau Jan 22, 2025
00b5a95
feat: improving physics inspector for meshes
Jan 22, 2025
90a9935
refact: physics inspector
Jan 22, 2025
bbdca4a
fix: mesh physics inspector
Jan 23, 2025
a32b6c5
fix: await scene reset before loading new scene to avoid runtime errors
Jan 23, 2025
9e9ff86
fix: update toggles in preview toolbar
Jan 24, 2025
1b822b4
feat: update template default values
Jan 24, 2025
e208f3e
feat: compute editor preview image for folders
Jan 24, 2025
6c8b628
chore: fix yarn.lock
julien-moreau Jan 25, 2025
fcf8a17
fix: size of toolbar for window in dashboard
Jan 30, 2025
6c43004
feat: add way to quickly launch project via dashboard
Jan 31, 2025
9b382f1
chore: publish babylonjs-editor-tools & babylonjs-editor-quixel-plugin
julien-moreau Jan 31, 2025
0401e12
feat: add way to rename node in graph using double-click
julien-moreau Feb 2, 2025
9195456
chore: add concurrently
julien-moreau Feb 2, 2025
d121362
feat: add CommandOrControl+B to run project
julien-moreau Feb 2, 2025
7b978e0
fix: havok path on win32
julien-moreau Feb 2, 2025
497e120
refact: group files per theme
julien-moreau Feb 4, 2025
e9ec004
refact: move dashboard create dialog in dedicated component
julien-moreau Feb 4, 2025
0b00e3b
feat: adding user feedbacks using toasts when running project from da…
julien-moreau Feb 4, 2025
5125ee1
fix: flickering of dashboard window when appearing
julien-moreau Feb 4, 2025
b1c6873
feat: add support of xterm.js in dashboard
Feb 5, 2025
8a7a64c
fix: xterm letter spacing in dashboard
julien-moreau Feb 6, 2025
46997c6
feat: some minor UI improvements in dashboard
julien-moreau Feb 6, 2025
69c6ab7
fix: optimized scene generation by using stat last modification date …
julien-moreau Feb 6, 2025
2c4546d
feat: add support of rounded windows for Windows
julien-moreau Feb 7, 2025
f3ec0ee
fix: add padding for window controls in dashboard
julien-moreau Feb 7, 2025
5f83fc1
chore: relevease v5.0.0-alpha.7
julien-moreau Feb 7, 2025
711fbdd
feat: add support of simple search in assets browser
julien-moreau Feb 7, 2025
4998260
feat: improve renaming file/folder in assets browser
julien-moreau Feb 7, 2025
8275438
chore: use same TypeScript version in all packages
julien-moreau Feb 8, 2025
cdf1286
fix: filter lost projects in dashboard by testing if they still exist…
julien-moreau Feb 8, 2025
bf3660e
feat: add chromatic aberration, glow and vignette support in Default …
julien-moreau Feb 9, 2025
2774d63
fix: save collision type when changed before computing collision mesh
julien-moreau Feb 9, 2025
beaca7f
feat: improve design in cinematic editor
julien-moreau Feb 9, 2025
51e21ff
feat: adding support of particle systems
julien-moreau Feb 9, 2025
e0cbc75
feat: improve support of particle systems
julien-moreau Feb 9, 2025
337ce82
feat: add support of animated sheets in particle systems
julien-moreau Feb 9, 2025
ae35821
feat: improve order and UI for particle system inspector
julien-moreau Feb 10, 2025
4aa7367
fix: check availability of Node.js, yarn and Visual Studio Code befor…
julien-moreau Feb 10, 2025
3c5d23b
fix: use node-pty to check availability of Node.js, Yarn and Visual S…
julien-moreau Feb 11, 2025
57a685b
feat: improve support of save/load morph targets
julien-moreau Feb 12, 2025
db1d716
fix: add special color for Default Rendering Pipeline in cinematic ed…
julien-moreau Feb 12, 2025
55c72ba
feat: adding support of sound tracks in cinematic editor
julien-moreau Feb 12, 2025
dc05092
feat: finalizing basic support of sounds in cinematic editor
julien-moreau Feb 12, 2025
947a133
fix: include sounds and particle systems when search is defined in sc…
Feb 13, 2025
c714479
feat: adding support of gradients in particle systems inspector
Feb 13, 2025
68c09aa
fix: stop sound after custom duration in cinematic editor
julien-moreau Feb 16, 2025
17aef60
feat: add shortcut to configure engine to use compressed textures in …
julien-moreau Feb 16, 2025
8b0b2ea
fix: split parts of cinematic into multiple video files and merge the…
julien-moreau Feb 17, 2025
8439155
feat: add support of custom dimensions for engine in preview panel
julien-moreau Feb 19, 2025
4ccea45
feat: adding support of volumetric light scattering post-process
Feb 20, 2025
1f2b3c6
feat: finalizing support of Volumetric Light Scattering post-process
Feb 20, 2025
c97bc1a
fix: export all supported extensions in public folder
Feb 20, 2025
da91a10
feat: add range export for cinematic editor
julien-moreau Feb 21, 2025
481a198
feat: add commands for particle systems in command palette
Feb 21, 2025
97d40cf
feat: beginning support of visible properties from script in editor i…
Feb 21, 2025
fc3e90f
feat: add support of Vector2 and Vector3 in visible properties for ed…
julien-moreau Feb 21, 2025
d43aff4
fix: computed path for script worker on win32 platform
julien-moreau Feb 21, 2025
ebe2499
feat: add support of Color3 & Color4 visible properties in inspector …
julien-moreau Feb 22, 2025
fe579a8
chore: add gitignore in template
julien-moreau Feb 22, 2025
1e0bda2
docs: beginning "adding scripts" section in documentation
julien-moreau Feb 22, 2025
b7c126f
feat: add support of adding scripts from editor in assets browser panel
julien-moreau Feb 22, 2025
47b7058
docs: improve "adding scripts" documentation
julien-moreau Feb 22, 2025
ff1d7a4
feat: add support of compressed ktx texture files in cached folder
julien-moreau Feb 22, 2025
d3e69c8
chore: "yarn build" now builds all modules
julien-moreau Feb 22, 2025
3a35b34
feat: finalizing support of compressed textures
julien-moreau Feb 23, 2025
e20c2e8
feat: add support of separated animation group files in scenes
julien-moreau Feb 24, 2025
d026214
chore: babylonjs-editor-tools is now require-able by the editor using…
Feb 26, 2025
48f71d2
feat: add support of loading cinematics using babylonjs-editor-tools
julien-moreau Feb 27, 2025
e622a3d
chore: fix exports order in package.json of babylonjs-editor-tools
julien-moreau Feb 27, 2025
46723f7
fix: minor fixes for website
julien-moreau Feb 27, 2025
59cf941
fix: reworked mansion experiment
julien-moreau Feb 28, 2025
0fd6182
feat: adding support of rendering configuration per-camera
julien-moreau Feb 28, 2025
4cef5a1
fix: website build
julien-moreau Mar 1, 2025
e57b94b
feat: refact babylonjs-editor-tools and change loadScene function sig…
julien-moreau Mar 1, 2025
461afaa
feat: now remove old non-exported assets
julien-moreau Mar 1, 2025
40cf93b
fix: wait for waiting items before resolving loadScene promise in bab…
julien-moreau Mar 2, 2025
a0cb9fc
feat: adding support of events in cinematic editor
Mar 6, 2025
56b1508
fix: save transform nodes states in cinematic editor
Mar 6, 2025
28b7cf6
feat: adding support of events in cinematic generator in babylonjs-ed…
julien-moreau Mar 7, 2025
0f9a106
feat: now handle physics when rendering cinematic
Mar 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: now control rotations as degrees
Julien Moreau-Mathis authored and julien-moreau committed Jul 27, 2024
commit 5516fb3be9dd3d1c91a1720b09db41cff12b7436
55 changes: 42 additions & 13 deletions editor/src/editor/layout/inspector/fields/number.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from "react";

import { Scalar } from "babylonjs";
import { Scalar, Tools } from "babylonjs";

import { registerSimpleUndoRedo } from "../../../../tools/undoredo";
import { getInspectorPropertyValue, setInspectorEffectivePropertyValue } from "../../../../tools/property";
@@ -12,19 +12,27 @@ export interface IEditorInspectorNumberFieldProps extends IEditorInspectorFieldP
max?: number;

step?: number;
asDegrees?: boolean;

onChange?: (value: number) => void;
}

export function EditorInspectorNumberField(props: IEditorInspectorNumberFieldProps) {
const [pointerDown, setPointerDown] = useState(false);

const [value, setValue] = useState<string>(getInspectorPropertyValue(props.object, props.property)?.toString() ?? "");
const [oldValue, setOldValue] = useState<string>(getInspectorPropertyValue(props.object, props.property)?.toString() ?? "");

const step = props.step ?? 0.01;
const digitCount = props.step?.toString().split(".")[1]?.length ?? 2;

let startValue = getInspectorPropertyValue(props.object, props.property) ?? 0;
if (props.asDegrees) {
startValue = Tools.ToDegrees(startValue).toFixed(digitCount);
} else {
startValue = startValue.toFixed(digitCount);
}

const [value, setValue] = useState<string>(startValue);
const [oldValue, setOldValue] = useState<string>(startValue);

const hasMinMax = props.min !== undefined && props.max !== undefined;
const ratio = hasMinMax ? (Scalar.InverseLerp(props.min!, props.max!, parseFloat(value)) * 100).toFixed(0) : 0;

@@ -46,12 +54,16 @@ export function EditorInspectorNumberField(props: IEditorInspectorNumberFieldPro
if (!isNaN(float)) {
if (props.min !== undefined && float < props.min) {
float = props.min;
setValue(float.toString());
setValue(float.toFixed(digitCount));
}

if (props.max !== undefined && float > props.max) {
float = props.max;
setValue(float.toString());
setValue(float.toFixed(digitCount));
}

if (props.asDegrees) {
float = Tools.ToRadians(float);
}

setInspectorEffectivePropertyValue(props.object, props.property, float);
@@ -66,10 +78,15 @@ export function EditorInspectorNumberField(props: IEditorInspectorNumberFieldPro
onKeyUp={(ev) => ev.key === "Enter" && ev.currentTarget.blur()}
onBlur={(ev) => {
if (ev.currentTarget.value !== oldValue && !props.noUndoRedo) {
const oldValueFloat = parseFloat(oldValue);
const newValueFloat = parseFloat(ev.currentTarget.value);
let oldValueFloat = parseFloat(oldValue);
let newValueFloat = parseFloat(ev.currentTarget.value);

if (!isNaN(oldValueFloat) && !isNaN(newValueFloat)) {
if (props.asDegrees) {
oldValueFloat = Tools.ToRadians(oldValueFloat);
newValueFloat = Tools.ToRadians(newValueFloat);
}

registerSimpleUndoRedo({
object: props.object,
property: props.property,
@@ -120,22 +137,34 @@ export function EditorInspectorNumberField(props: IEditorInspectorNumberFieldPro
}

setValue(v.toFixed(digitCount));
setInspectorEffectivePropertyValue(props.object, props.property, v);
props.onChange?.(v);

let finalValue = v;
if (props.asDegrees) {
finalValue = Tools.ToRadians(finalValue);
}

setInspectorEffectivePropertyValue(props.object, props.property, finalValue);
props.onChange?.(finalValue);
});

document.body.addEventListener("mouseup", mouseUpListener = () => {
setPointerDown(false);
setValue(v.toFixed(digitCount));

if (v !== oldV && !props.noUndoRedo) {
setValue(v.toFixed(digitCount));

let finalValue = v;
if (props.asDegrees) {
finalValue = Tools.ToRadians(finalValue);
}

if (!isNaN(v) && !isNaN(oldV)) {
registerSimpleUndoRedo({
object: props.object,
property: props.property,

oldValue: oldV,
newValue: v,
newValue: finalValue,
oldValue: props.asDegrees ? Tools.ToRadians(oldV) : oldV,
});

setOldValue(v.toFixed(digitCount));
9 changes: 5 additions & 4 deletions editor/src/editor/layout/inspector/fields/vector.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,8 @@ import { IEditorInspectorFieldProps } from "./field";
import { EditorInspectorNumberField } from "./number";

export interface IEditorInspectorVectorFieldProps extends IEditorInspectorFieldProps {

step?: number;
asDegrees?: boolean;
}

export function EditorInspectorVectorField(props: IEditorInspectorVectorFieldProps) {
@@ -13,9 +14,9 @@ export function EditorInspectorVectorField(props: IEditorInspectorVectorFieldPro
</div>

<div className="flex gap-2">
<EditorInspectorNumberField object={props.object} property={`${props.property}.x`} noUndoRedo={props.noUndoRedo} />
<EditorInspectorNumberField object={props.object} property={`${props.property}.y`} noUndoRedo={props.noUndoRedo} />
<EditorInspectorNumberField object={props.object} property={`${props.property}.z`} noUndoRedo={props.noUndoRedo} />
<EditorInspectorNumberField object={props.object} property={`${props.property}.x`} noUndoRedo={props.noUndoRedo} asDegrees={props.asDegrees} step={props.step} />
<EditorInspectorNumberField object={props.object} property={`${props.property}.y`} noUndoRedo={props.noUndoRedo} asDegrees={props.asDegrees} step={props.step} />
<EditorInspectorNumberField object={props.object} property={`${props.property}.z`} noUndoRedo={props.noUndoRedo} asDegrees={props.asDegrees} step={props.step} />
</div>
</div>
);
4 changes: 2 additions & 2 deletions editor/src/editor/layout/inspector/transform.tsx
Original file line number Diff line number Diff line change
@@ -78,12 +78,12 @@ export class EditorTransformNodeInspector extends Component<IEditorInspectorImpl
const o = { proxy };

return (
<EditorInspectorVectorField label={<div className="w-14">Rotation</div>} object={o} property="proxy" />
<EditorInspectorVectorField label={<div className="w-14">Rotation</div>} object={o} property="proxy" asDegrees step={0.1} />
);
}

return (
<EditorInspectorVectorField label={<div className="w-14">Rotation</div>} object={object} property="rotation" />
<EditorInspectorVectorField label={<div className="w-14">Rotation</div>} object={object} property="rotation" asDegrees step={0.1} />
);
}
}