mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-19 13:59:22 -04:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
36 lines
844 B
C#
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;
|
|
}
|
|
}
|
|
}
|
|
}
|