123 Commits over 92 Days - 0.06cph!
Potential optimization in CreatePrefabObjectLookup
This helps a bit when cloning larger prefabs, not sure how much it will reflect in our benchmarks, on my machine the gains were quite small.
Hide transform gizmos for prefab root in the prefab editor for now.
Hide transform widget for prefab root in the prefab editor for now.
Related to sbox-issues/issues/7316 sbox-issues/issues/7577 sbox-issues/issues/6785
Catch serialization errors when pasting game objects
Fixes sbox-issues/issues/7645
Fix undo for TagSet ControlWidget
Fix regression when cloning List of user defined classes that contain a member called "Prefab"
Fixes sbox-issues/issues/7638
Fix being able to select prefabinstance child objects when using box selection in scene editor
Remove old undo system (#1824)
Removes all the private members/method related to the old undo system.
Strips functionality from all public methods, but holds on to the public method stubs, so we don't completely break older editor tools. Older tools will still compile but their undo/redo won't do anything anymore.
Scene editor, select outermost prefab instance when clicking on a nested prefab instance
Fix iterating modified collection when cloning components & gameobjects
Fix iterating modified collection when updating prefab instances
Don't allow parenting to prefab instances via scenetree
Play error sound when drop operation fails.
Fixes sbox-issues/issues/7628
Move gameobject creation for empty/new prefabs into the correct scene scope
Should avoid the GO being created in the wrong scene.
Related: sbox-issues/issues/7602
Fix scene hierarchy right click (context menu) delay
Always refresh PrefabCacheScenes PostLoad even if the prefab didn't change. Ensures types of older assemblies are refreshed.
Should fix issue where TypeLibrary.GetType() would return null when reconnecting to a server.
The root of the issue was that typelibrary got refreshed on reconnect while the prefabcachescenes were not.
Automatically break prefab instances if part of the instance is reparented to another game object.
A warning is emitted when this happens.
Fix edge case for nav agent ground trace
Properly simulate deceleration for nav agents
New logic also tries to decelerate them as fast as possible
Some minor spline tweaks I forgot to backport from scenestaging
Spline Class (#1817)
General purpose spline class for 3D.
Uses a composite 3D cubic Bezier curve under the hood.
Shape and behavior of the spline are controlled through points and handles.
Two consecutive points and their handles define one segment/curve of the spline.
The spline can be turned into a loop (Beziergon), which combined with linear handles can also be used to create a polygon.
Splines are useful for animations, camera movements, marking areas, or procedural geometry generation.
Fix breaking from prefab not refreshing editor selection
Fixes sbox-issues/issues/7502
Add viewport option to toggle default prefab lighting
https://files.facepunch.com/lolleko/2025/February/02_20-07-ConsciousCormorant.mp4
sbox-issues/issues/5527
Skip hotload for DtNode, hopefully fixes issue when hotreloading while navmesh query is in progress.
Catch type library returning null, event if it really shouldn't return null in the first place.
Related: sbox-issues/issues/7496
Optimize ComponentList.GetAll by getting rid of LINQ
The combination of recursion and LINQ allocated a lot of garbage in GetAll, this would result in a heap reallocation during many GetAll calls.
Removing LINQ yielded a nice performance improvement.
Getting rid of the recursion gives another tiny performance improvement, but not big enough to justify the reduction in code readability.
I can not show results directly for ComponentList.GetAll, because the function executes too fast after the optimization and is no longer captured by the sample profiler.
But here are the improvements for PhysiscsWorld.OnIntersection, which makes heavy use of ComponentList.GetAll internally via InvokeListeners<T>().
Before:
Function Name: Sandbox.PhysicsWorld.OnIntersection
Number of Functions: 2907
Total time: 9s 406ms 99µs
Maximum: 11ms 86µs
Top Quartile: 3ms 848µs
Average: 3ms 235µs
Median: 3ms 176µs
Bottom Quartile: 2ms 684µs
Minimum: 20µs
After:
Function Name: Sandbox.PhysicsWorld.OnIntersection
Number of Functions: 2779
Total time: 3s 661ms 358µs
Maximum: 6ms 971µs
Top Quartile: 1ms 552µs
Average: 1ms 317µs
Median: 1ms 220µs
Bottom Quartile: 975µs
Minimum: 19µs
Related to sbox-deathmatch/issues/104
Use ReflectionQueryCache in Component Serialization
Refactor parts of CloneHelpers into a ReflectionQueryCache
Optimize Network.RegisterProperties by caching reflection data (#1815)
Fix property filter for cloning & Fix NRE in CheckRequiredComponents
Tiny optimization in GameObject.MakeNameUnique
Avoid TypeLibrary for component creation during cloning
Cache member list of cloneable properties (-> 2 times faster clone)
Cache property list for CheckRequireComponent (another 2x improvement in clone)
Fix NavAgent ground trace for MapColliders (Run two traces instead of one trace with RunAll)
Fix NavMeshAreas not linking to their collider correctly if deserialized in the "wrong" order
Fix sphere trace returning incorrect HitPosition when using SceneTrace.RunAll()
Fix assert to diagnose "Can't parent to a gameobject in a different scene" breaking if Components ToString is overwritten
Fix duplication of bone gameobjects on save/load when both CreateBoneObjects and CreateAttachements are enabled on a SkinnedModelRenderer
Ensure sceneundosnapshots are only disposed once
Disallow undo/redo while an editor action is underway (e.g. dragging something)
Plays relaxing sound if attempted.
Fixes sbox-issues/issues/7397
Add comment to reference rewiring
Handle cloned references to the prefab root when root is referenced from list or other nested properties.
Fixes: sbox-deathmatch/issues/100
Throw if attempting to clone invalid gameobject
Make sure all components captured by UndoScope are valid
Don't process implicitly created components in PostClone
sbox-issues/issues/7459
Bump navmesh agent ground trace distance even more
Fix NRE and undo for MaterialDropping
Refresh PrefabCacheScene when prefabfile is reloaded/changed
Fixes sbox-issues/issues/7458
Clone: Ignore initialization of objects that where implicitly created during cloning
Scene Delete: fix selection change causing wrong items to be deleted
Fixes sbox-issues/issues/7457
Use IsValid() instead of null check
Fix NRE when trying to undo snapshot parent for scenes/prefabs
Fix NRE when last gameobject in hierachy is dragged
Fixes sbox-issues/issues/7456
Improved undo system (#1775)
**Goal:** Move away from snapshotting whole scenes as much as possible. Get rid of edit log, mouse up hack and other stuff.
The documentation for the new system serves as a nice summary for the API changes added in this PR: https://docs.facepunch.com/doc/scene-undo-system-d4mhnmtil1
Changes:
- Fixes a third of our undo actions, which were partially or completely broken
- Removes EditLog and replaces it with scope based undo system.
- UndoScopes define what objects and events are captured for undo.
- Internal system automatically generates a minimal snapshot of all changes made and restores them on undo/redo
- Full Scene is only captured when an Gameobject or Component is deleted.
- This should make the new system faster and "snappier"
- Removes the mouse up/undo accumulation hack; By adding `StartEdit/FinishEdit` events to our `ControlWidgets` & `SerializedObject`.
Obsolete:
- ISceneEditorSession.AddSelectionUndo & SceneEditorSession.OnEditLog
- ISceneEditorSession.OnEditLog & SceneEditorSession.OnEditLog
- ISceneEditorSession.RecordChange & SceneEditorSession.RecordChange
- SceneEditorSession.PushUndoSelection
- SceneEditorSession.FullUndoSnapshot
- UndoSystem.SetSnapshotFunction
- UndoSystem.Snapshot
- GameObject.EditLog
- Component.EditLog
Resolves [#4477](sbox-issues/issues/4477)