codeAPI Reference
s&box LineDefinition: Trail line resource
LineDefinition GameResource API Reference
LineDefinition is a GameResource for trail line definitions used by the Trail tool. It implements IDefinitionResource and configures material properties for line rendering.
Type Signature
CSHARP
[AssetType(Name = "Sandbox Line", Extension = "ldef", Category = "Sandbox", Flags = AssetTypeFlags.NoEmbedding | AssetTypeFlags.IncludeThumbnails)]
public class LineDefinition : GameResource, IDefinitionResource
{
[Property]
public string Title { get; set; }
[Property]
public string Description { get; set; }
[Property, Group("Material")]
public Material Material { get; set; }
[Property, Group("Material")]
public bool WorldSpace { get; set; } = true;
[Property, Range(1, 128), Group("Material")]
public float UnitsPerTexture { get; set; } = 32.0f;
[Property, Group("Material")]
public bool Opaque { get; set; } = true;
[Property, Group("Material")]
public BlendMode BlendMode { get; set; }
public override Bitmap RenderThumbnail(ThumbnailOptions options);
protected override Bitmap CreateAssetTypeIcon(int width, int height);
}Properties
- string Title { get; set; } - Display title for the line definition
- string Description { get; set; } - Description of the line definition
- Material Material { get; set; } - The material to use for line rendering
- bool WorldSpace { get; set; } = true - Whether the line is in world space
- float UnitsPerTexture { get; set; } = 32.0f - Texture tiling scale (1-128)
- bool Opaque { get; set; } = true - Whether the line is opaque
- BlendMode BlendMode { get; set; } - Blend mode for the material
Methods
RenderThumbnail(ThumbnailOptions options)
Renders a thumbnail from the material's color texture, or a white bitmap if no material.CreateAssetTypeIcon(int width, int height)
Creates the asset type icon with a sparkle emoji and blue color.Usage
CSHARP
[AssetType(Name = "Sandbox Line", Extension = "ldef", Category = "Sandbox")]
public class MyLineDefinition : LineDefinition
{
[Property]
public Material Material { get; set; } = "materials/lines/my_line.vmat";
[Property]
public string Title { get; set; } = "My Line";
[Property]
public bool WorldSpace { get; set; } = true;
[Property]
public float UnitsPerTexture { get; set; } = 64.0f;
}Notes
- Used by the Trail tool for creating custom line types
- Material should have a "g_tColor" texture for thumbnail rendering
- UnitsPerTexture controls texture tiling along the line
- WorldSpace determines if the line is affected by camera movement
- BlendMode controls transparency/additive blending
Was this helpful?