Files
sbox-public/engine/Sandbox.Tools/ControlWidget/SphereControlWidget.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

37 lines
853 B
C#

namespace Editor;
[CustomEditor( typeof( Sphere ) )]
public class SphereControlWidget : ControlWidget
{
SerializedObject obj;
public SphereControlWidget( SerializedProperty property ) : base( property )
{
property.TryGetAsObject( out obj );
PaintBackground = false;
Layout = Layout.Row();
Layout.Spacing = 2;
var radius = Layout.Add( Create( obj.GetProperty( "Radius" ) ) );
var center = Layout.Add( Create( obj.GetProperty( "Center" ) ) );
if ( radius is FloatControlWidget radiusWidget )
{
radiusWidget.MaximumWidth = 80;
radiusWidget.Icon = "radio_button_checked";
radiusWidget.Label = null;
radiusWidget.MakeRanged( SerializedProperty );
}
foreach ( var child in center.Children )
{
if ( child is FloatControlWidget floatWidget )
{
floatWidget.MakeRanged( SerializedProperty );
}
}
}
}