mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-05-23 06:16:31 -04:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
28 lines
614 B
C#
28 lines
614 B
C#
|
|
namespace Editor.MovieMaker.BlockDisplays;
|
|
|
|
#nullable enable
|
|
|
|
public abstract class ThumbnailBlockItem<T> : PropertyBlockItem<T>
|
|
{
|
|
protected abstract Pixmap? GetThumbnail();
|
|
|
|
protected override void OnPaint()
|
|
{
|
|
base.OnPaint();
|
|
|
|
if ( GetThumbnail() is { } thumb )
|
|
{
|
|
Paint.Draw( LocalRect.Contain( Height ), thumb, 0.5f );
|
|
}
|
|
}
|
|
}
|
|
|
|
public sealed class ResourceBlockItem<T> : ThumbnailBlockItem<T>
|
|
where T : Resource
|
|
{
|
|
protected override Pixmap? GetThumbnail() => Block.GetValue( Block.TimeRange.Start ) is { ResourcePath: { } path }
|
|
? AssetSystem.FindByPath( path )?.GetAssetThumb()
|
|
: null;
|
|
}
|