mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-19 05:48:07 -04:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
37 lines
837 B
C#
37 lines
837 B
C#
using Sandbox.Resources;
|
|
|
|
namespace Editor;
|
|
|
|
/// <summary>
|
|
/// A regular ResourceGeneratorControlWidget but we show a texture preview on the side.
|
|
/// </summary>
|
|
[CanEdit( typeof( Sandbox.Resources.TextureGenerator ) )]
|
|
public class TextureGeneratorControlWidget : ResourceGeneratorControlWidget
|
|
{
|
|
TextureWidget TextureWidget;
|
|
|
|
public TextureGeneratorControlWidget( ResourceGenerator generator, SerializedProperty property ) : base( generator, property )
|
|
{
|
|
|
|
}
|
|
|
|
protected override void BuildContent()
|
|
{
|
|
TextureWidget = new TextureWidget();
|
|
TextureWidget.FixedSize = Theme.RowHeight;
|
|
TextureWidget.Padding = 1;
|
|
|
|
Layout.Add( TextureWidget );
|
|
|
|
base.BuildContent();
|
|
}
|
|
|
|
protected override void OnResourceChanged( Resource resource )
|
|
{
|
|
if ( resource is Texture texture )
|
|
{
|
|
TextureWidget.Texture = texture;
|
|
}
|
|
}
|
|
}
|