Files
sbox-public/game/addons/tools/Code/Scene/Tools/Component/EnvmapProbe.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

36 lines
844 B
C#

using Sandbox;
namespace Editor;
public class EnvmapProbeTool : EditorTool<EnvmapProbe>
{
private IDisposable _componentUndoScope;
public override void OnUpdate()
{
var envmapProbe = GetSelectedComponent<EnvmapProbe>();
if ( envmapProbe == null )
return;
var currentBounds = envmapProbe.Bounds;
using ( Gizmo.Scope( "EnvmapPrope Collider Editor", envmapProbe.WorldTransform ) )
{
if ( Gizmo.Control.BoundingBox( "Bounds", currentBounds, out var newBounds ) )
{
if ( Gizmo.WasLeftMousePressed )
{
_componentUndoScope = SceneEditorSession.Active.UndoScope( "Resize EnvmapPrope Bounds" ).WithComponentChanges( envmapProbe ).Push();
}
envmapProbe.Bounds = newBounds;
}
if ( Gizmo.WasLeftMouseReleased )
{
_componentUndoScope?.Dispose();
_componentUndoScope = null;
}
}
}
}