Skip to content

Commit 36122b4

Browse files
sboxbotNolankicks
andauthored
Add VolumetricFogVolumeTool editor tool to edit volume bounds (#3465)
Co-authored-by: Kicks <nolandimensions@gmail.com>
1 parent ab81dd2 commit 36122b4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Sandbox;
2+
3+
namespace Editor;
4+
5+
public class VolumetricFogVolumeTool : EditorTool<VolumetricFogVolume>
6+
{
7+
private IDisposable _componentUndoScope;
8+
9+
public override void OnUpdate()
10+
{
11+
var volumetricFogVolume = GetSelectedComponent<VolumetricFogVolume>();
12+
if ( volumetricFogVolume == null )
13+
return;
14+
15+
var currentBounds = volumetricFogVolume.Bounds;
16+
17+
using ( Gizmo.Scope( "Volumetric Fog Volume Editor", volumetricFogVolume.WorldTransform ) )
18+
{
19+
if ( Gizmo.Control.BoundingBox( "Bounds", currentBounds, out var newBounds ) )
20+
{
21+
if ( Gizmo.WasLeftMousePressed )
22+
{
23+
_componentUndoScope = SceneEditorSession.Active.UndoScope( "Resize Volumetric Fog Volume Bounds" ).WithComponentChanges( volumetricFogVolume ).Push();
24+
}
25+
volumetricFogVolume.Bounds = newBounds;
26+
}
27+
28+
if ( Gizmo.WasLeftMouseReleased )
29+
{
30+
_componentUndoScope?.Dispose();
31+
_componentUndoScope = null;
32+
}
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)