Get RAPTOR

RaptorStyle

Drawing helpers, colours and fonts shared by RAPTOR's browsers.

NamespaceAssemblyKindStability
Raptor.EditorToolsRaptor.Editorclasspreview, since 0.1.0
public static class RaptorStyle

Fields

AccentComponent

public static readonly Color AccentComponent;

The accent of component rows.

AccentCyan

public static readonly Color AccentCyan;

The secondary accent.

AccentGreen

public static readonly Color AccentGreen;

The active accent.

ControlDisabled

public static readonly Color ControlDisabled;

A disabled control's fill.

ControlFill

public static readonly Color ControlFill;

A resting control's fill.

ControlHover

public static readonly Color ControlHover;

A hovered control's fill.

CornerRadius

public const float CornerRadius;

A tile's corner radius.

FaintBorder

public static readonly Color FaintBorder;

A faint border.

GlowExtent

public const float GlowExtent;

How far the active-tile glow extends past the tile edge, in pixels. It does not exceed PanelPad, the tiles' inset, so the panel does not clip the glow.

GlyphZone

public const float GlyphZone;

The width reserved for the glyph in a watermark header.

HoverFill

public static readonly Color HoverFill;

A hovered row's fill.

HoverTint

public static readonly Color HoverTint;

The hover tint.

IconSize

public const float IconSize;

A tile icon's size.

PanelColor

public static readonly Color PanelColor;

A panel's fill.

PanelPad

public const float PanelPad;

A panel's padding.

RecessFill

public static readonly Color RecessFill;

A recessed field's fill.

SelectFill

public static readonly Color SelectFill;

A selected control's fill.

SelectFillHover

public static readonly Color SelectFillHover;

A hovered selected control's fill.

SelectTint

public static readonly Color SelectTint;

The selection tint.

TextMuted

public static readonly Color TextMuted;

Muted text.

TextPrimary

public static readonly Color TextPrimary;

Primary text.

TextSecondary

public static readonly Color TextSecondary;

Secondary text.

TileColor

public static readonly Color TileColor;

A tile's fill.

TileGap

public const float TileGap;

The gap between tiles.

WindowBg

public static readonly Color WindowBg;

A window's background.

Properties

DisplayFace

public static Font DisplayFace { get; }

The display font, Geist Medium. It is loaded once and shared with the scene tool.

Mono

public static Font Mono { get; }

The bundled monospace font, medium weight.

MonoRegular

public static Font MonoRegular { get; }

The bundled monospace font, regular weight.

Methods

DrawFrame

public static void DrawFrame(Rect r, Color color, float thickness)

Draws a square-cornered outline.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view.
colorColorThe colour.
thicknessfloatThe stroke width, in points.

DrawGlyphHeaderPanel

public static void DrawGlyphHeaderPanel(Rect r, Texture glyph, string eyebrow, string name, float glyphOpacity = 0.4f)

Draws the tool-header watermark behind the context bar's controls. The tool's glyph fades in from the left, with the uppercase eyebrow and the tool name right-aligned. Pass the context bar's full-height header area as r. Only the left corners are rounded. Draws on Repaint only.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
glyphTextureThe glyph texture.
eyebrowstringThe small label above the name.
namestringThe name.
glyphOpacityfloat0.4fThe glyph's opacity.

DrawMaterialPreviewPanel

public static void DrawMaterialPreviewPanel(Rect r, Material active)

Draws a material preview panel for the active paint slot, as in the scene tool's Surfaces material panel. The texture fades in from the left, with a MATERIAL eyebrow and the material name right-aligned.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view.
activeMaterialThe material shown.

DrawMaterialPreviewPanel

public static void DrawMaterialPreviewPanel(Rect r, Material subject, string eyebrow, string[] metaLines)

Draws a material preview panel with a custom eyebrow, such as PAINTING or INSPECTING, and optional meta lines stacked right-aligned under the name.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view.
subjectMaterialThe material shown.
eyebrowstringThe small label above the name.
metaLinesstring[]Lines under the name, or null.

DrawMaterialPreviewPanel

public static void DrawMaterialPreviewPanel(Rect r, Material subject, string eyebrow, string[] metaLines, string footerLine, bool strongFirstMeta, Vector2? previewPan = null)

Draws a material preview panel with a footer line, such as the asset's folder path, pinned to the bottom. strongFirstMeta draws the first meta line, such as "PACK ยท 512x512", in primary text above the muted lines.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
subjectMaterialThe material shown.
eyebrowstringThe small label above the name.
metaLinesstring[]Lines under the name, or null.
footerLinestringA line pinned to the bottom, or null.
strongFirstMetaboolWhether to draw the first meta line in primary text.
previewPanVector2?nullThe texture pan, or null.

DrawPreviewPanel

public static void DrawPreviewPanel(Rect r, Texture preview, string eyebrow, string name, string[] metaLines, string footerLine = null, bool strongFirstMeta = false, Vector2? previewPan = null)

Draws the shared preview panel for any thumbnail Texture, as used by the Material Browser and prefab browsers. The thumbnail fades in from the left, with the uppercase eyebrow, the name and any meta lines right-aligned.

ParameterTypeDefaultDescription
rRectThe rect in GUI coordinates of the current view.
previewTextureThe thumbnail.
eyebrowstringThe small label above the name.
namestringThe name.
metaLinesstring[]Lines under the name, or null.
footerLinestringnullA line pinned to the bottom, or null.
strongFirstMetaboolfalseWhether to draw the first meta line in primary text.
previewPanVector2?nullThe texture pan, or null.

DrawRoundedPanel

public static void DrawRoundedPanel(Rect r)

Draws a rounded panel background with a 1 px dark edge and the panel fill, at the tile corner radius. Draw it before the panel's content.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view.

DrawRoundedPanel

public static void DrawRoundedPanel(Rect r, Color fill)

Draws a rounded panel background with a 1 px dark edge and the given fill. Draw it before the panel's content.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view.
fillColorThe fill colour.

DrawTileGlow

public static void DrawTileGlow(Rect tileRect, Color color)

Draws a soft accent glow around an active tile. Call it after drawing the tile. The glow is hollow, so it does not cover the glyph.

ParameterTypeDescription
tileRectRectThe tile's rect.
colorColorThe glow colour. Its alpha scales the glow's strength.

GlyphHeaderWidth

public static float GlyphHeaderWidth(string eyebrow, string name)

Returns the width the watermark header needs, made up of GlyphZone, the wider of the eyebrow and name, and right padding. RaptorDrawTool.HeaderWidth uses it to size the context bar.

ParameterTypeDescription
eyebrowstringThe small label above the name.
namestringThe name.

Returns: The header width.

MaterialPreview

public static Texture MaterialPreview(Material m)

Returns the material's albedo texture (URP, glTF or built-in), or its asset thumbnail if it has none.

ParameterTypeDescription
mMaterialThe material.

Returns: The texture.

RoundedFill

public static void RoundedFill(Rect r, Color color, float radius)

Draws a filled rounded rectangle.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view.
colorColorThe colour.
radiusfloatThe corner radius, in points.

RoundedRing

public static void RoundedRing(Rect r, Color color, float thickness, float radius)

Draws a rounded outline with the given stroke width.

ParameterTypeDescription
rRectThe rect in GUI coordinates of the current view.
colorColorThe colour.
thicknessfloatThe stroke width, in points.
radiusfloatThe corner radius, in points.

SolidTex

public static Texture2D SolidTex(ref Texture2D cache, Color color)

Returns a 1x1 texture of one colour, cached in the caller's field.

ParameterTypeDescription
cacheref Texture2DThe caller's cache field.
colorColorThe colour.

Returns: The texture.