项目文件夹

文件
2026-07-13 13:15:05 +08:00

52 行
1.6 KiB
C#

此文件含有模棱两可的 Unicode 字符
此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。
using ImGuiNET;
using T3.Core.DataTypes;
using T3.Core.Operator.Slots;
using T3.Editor.Gui.Styling;
namespace T3.Editor.Gui.OutputUi;
internal sealed class BufferWithViewsOutputUi : OutputUi<BufferWithViews>
{
public override IOutputUi Clone()
{
return new BufferWithViewsOutputUi()
{
OutputDefinition = OutputDefinition,
PosOnCanvas = PosOnCanvas,
Size = Size
};
}
protected override void DrawTypedValue(ISlot slot, string viewId)
{
var type = typeof(BufferWithViews);
ImGui.PushFont(Fonts.FontSmall);
ImGui.PushStyleColor(ImGuiCol.Text, UiColors.TextMuted.Rgba);
ImGui.TextUnformatted(type.Namespace);
ImGui.PopStyleColor();
ImGui.PopFont();
ImGui.TextUnformatted(type.Name);
if (slot is not Slot<BufferWithViews> bufferSlot
|| bufferSlot.Value?.Buffer == null || bufferSlot.Value.Srv == null)
{
ImGui.TextUnformatted("Undefined");
return;
}
try
{
ImGui.Dummy(new Vector2(5,5));
var elementCount = bufferSlot.Value.Srv.Description.Buffer.ElementCount;
var totalSize = bufferSlot.Value.Buffer.Description.SizeInBytes;
ImGui.TextUnformatted($"{elementCount} × {totalSize/elementCount}");
ImGui.TextUnformatted($"{totalSize} bytes");
}
catch (Exception e)
{
ImGui.TextUnformatted("Can't access buffer: " + e.Message);
}
}
}