Editor-side settings for the cable and pipe route tools. Holds the surface mount toggles (range, plate size, bolts, collars, spacing, tags, material), exposes them as AnchorOptions and mount site lists, and shows the current mount status in the inspector.
namespace AdvancedMappingTools;
public sealed partial class CableRouteSettings : IRouteAnchorSettings
{
[Property, Group( "Surface Mounts" ), WideMode, Description( "Offset mounting stations between cables so individual mounting plates can remain separate." )]
public bool MountStagger { get; set; } = true;
[Property, Group( "Surface Mounts" ), WideMode, Description( "Generate clamps and mounts only after a real surface hit. Plates are measured in world units; clamp sizes follow the route." )]
public bool MountsEnabled { get; set; }
[Property, Group( "Surface Mounts" ), Range( 1, 4096, slider: false ), WideMode]
public float MountRange { get; set; } = 256;
[Property, Group( "Surface Mounts" ), Range( 0, 128, slider: false ), WideMode]
public float MountMinimum { get; set; } = .01f;
[Property, Group( "Surface Mounts" ), Range( 1, 512, slider: false ), WideMode]
public float MountWidth { get; set; } = 12;
[Property, Group( "Surface Mounts" ), Range( 1, 512, slider: false ), WideMode]
public float MountHeight { get; set; } = 16;
[Property, Group( "Surface Mounts" ), Range( .1f, 64, slider: false ), WideMode]
public float MountThickness { get; set; } = 1;
[Property, Group( "Surface Mounts" ), Range( 0, 128, slider: false ), WideMode]
public float MountClearance { get; set; }
[Property, Group( "Surface Mounts" ), Range( -180, 180, slider: false ), WideMode]
public float MountRotation { get; set; }
[Property, Group( "Surface Mounts" ), WideMode]
public bool MountBolts { get; set; } = true;
[Property, Group( "Surface Mounts" ), Range( .1f, 8, slider: false ), WideMode]
public float MountBoltRadius { get; set; } = .65f;
[Property, Group( "Surface Mounts" ), WideMode]
public bool MountConnector { get; set; } = true;
[Property, Group( "Surface Mounts" ), Range( .1f, 32, slider: false ), WideMode]
public float MountConnectorWidth { get; set; } = 2;
[Property, Group( "Surface Mounts" ), WideMode, Description( "Reject plates whose corners are not supported by a continuous surface." )]
public bool MountCheckEdges { get; set; } = true;
[Property, Group( "Surface Mounts" ), WideMode]
public string MountIncludeTags { get; set; } = "";
[Property, Group( "Surface Mounts" ), WideMode]
public string MountExcludeTags { get; set; } = "";
[Property, Group( "Surface Mounts" ), ResourceType( "vmat" ), WideMode]
public string MountMaterial { get; set; }
[Property, Group( "Surface Mounts" ), WideMode]
public bool ShowMountDebug { get; set; }
[System.Text.Json.Serialization.JsonIgnore, Property, ReadOnly, Group( "Surface Mounts" ), WideMode]
public string MountStatus => MountsEnabled ? AnchorIntegration.Status( MountOwner ) : "Surface mounts off.";
public AnchorOptions MountOptions() => new()
{
Range = MountRange,
Minimum = MountMinimum,
Width = MountWidth,
Height = MountHeight,
Thickness = MountThickness,
Clearance = MountClearance,
Rotation = MountRotation,
Bolts = MountBolts,
BoltRadius = MountBoltRadius,
Connector = MountConnector,
ConnectorWidth = MountConnectorWidth,
CheckEdges = MountCheckEdges,
IncludeTags = MountIncludeTags,
ExcludeTags = MountExcludeTags,
Material = MountMaterial
};
[Property, Group( "Surface Mounts" ), WideMode]
public RouteMountDirection MountDirection { get; set; } = RouteMountDirection.Back;
[Property, Group( "Surface Mounts" ), Range( 8, 2048, slider: false ), WideMode]
public float MountSpacing { get; set; } = 128;
[Property, Group( "Surface Mounts" ), Range( 0, 1 ), WideMode]
public float MountPhase { get; set; } = .5f;
[Property, Group( "Surface Mounts" ), WideMode, Description( "Skip connectors blocked by other parts of this route." )]
public bool MountAvoidAssembly { get; set; } = true;
[Property, Group( "Surface Mounts" ), WideMode]
public bool MountCollars { get; set; } = true;
[Property, Group( "Surface Mounts" ), Range( .25f, 32, slider: false ), WideMode]
public float MountCollarWidth { get; set; } = 4;
[Property, Group( "Surface Mounts" ), Range( .1f, 16, slider: false ), WideMode]
public float MountCollarThickness { get; set; } = 1;
[System.Text.Json.Serialization.JsonIgnore]
public string MountOwner => "Cable Route Mounts";
public IEnumerable<AnchorSite> MountSites() => RouteMounting.CableSites( this );
}
public sealed partial class PipeRouteSettings : IRouteAnchorSettings
{
[Property, Group( "Surface Mounts" ), WideMode, Description( "Generate clamps and mounts only after a real surface hit. Plates are measured in world units; clamp sizes follow the route." )]
public bool MountsEnabled { get; set; }
[Property, Group( "Surface Mounts" ), Range( 1, 4096, slider: false ), WideMode]
public float MountRange { get; set; } = 256;
[Property, Group( "Surface Mounts" ), Range( 0, 128, slider: false ), WideMode]
public float MountMinimum { get; set; } = .01f;
[Property, Group( "Surface Mounts" ), Range( 1, 512, slider: false ), WideMode]
public float MountWidth { get; set; } = 12;
[Property, Group( "Surface Mounts" ), Range( 1, 512, slider: false ), WideMode]
public float MountHeight { get; set; } = 16;
[Property, Group( "Surface Mounts" ), Range( .1f, 64, slider: false ), WideMode]
public float MountThickness { get; set; } = 1;
[Property, Group( "Surface Mounts" ), Range( 0, 128, slider: false ), WideMode]
public float MountClearance { get; set; }
[Property, Group( "Surface Mounts" ), Range( -180, 180, slider: false ), WideMode]
public float MountRotation { get; set; }
[Property, Group( "Surface Mounts" ), WideMode]
public bool MountBolts { get; set; } = true;
[Property, Group( "Surface Mounts" ), Range( .1f, 8, slider: false ), WideMode]
public float MountBoltRadius { get; set; } = .65f;
[Property, Group( "Surface Mounts" ), WideMode]
public bool MountConnector { get; set; } = true;
[Property, Group( "Surface Mounts" ), Range( .1f, 32, slider: false ), WideMode]
public float MountConnectorWidth { get; set; } = 2;
[Property, Group( "Surface Mounts" ), WideMode, Description( "Reject plates whose corners are not supported by a continuous surface." )]
public bool MountCheckEdges { get; set; } = true;
[Property, Group( "Surface Mounts" ), WideMode]
public string MountIncludeTags { get; set; } = "";
[Property, Group( "Surface Mounts" ), WideMode]
public string MountExcludeTags { get; set; } = "";
[Property, Group( "Surface Mounts" ), ResourceType( "vmat" ), WideMode]
public string MountMaterial { get; set; }
[Property, Group( "Surface Mounts" ), WideMode]
public bool ShowMountDebug { get; set; }
[System.Text.Json.Serialization.JsonIgnore, Property, ReadOnly, Group( "Surface Mounts" ), WideMode]
public string MountStatus => MountsEnabled ? AnchorIntegration.Status( MountOwner ) : "Surface mounts off.";
public AnchorOptions MountOptions() => new()
{
Range = MountRange,
Minimum = MountMinimum,
Width = MountWidth,
Height = MountHeight,
Thickness = MountThickness,
Clearance = MountClearance,
Rotation = MountRotation,
Bolts = MountBolts,
BoltRadius = MountBoltRadius,
Connector = MountConnector,
ConnectorWidth = MountConnectorWidth,
CheckEdges = MountCheckEdges,
IncludeTags = MountIncludeTags,
ExcludeTags = MountExcludeTags,
Material = MountMaterial
};
[Property, Group( "Surface Mounts" ), WideMode]
public RouteMountDirection MountDirection { get; set; } = RouteMountDirection.Back;
[Property, Group( "Surface Mounts" ), Range( 8, 2048, slider: false ), WideMode]
public float MountSpacing { get; set; } = 128;
[Property, Group( "Surface Mounts" ), Range( 0, 1 ), WideMode]
public float MountPhase { get; set; } = .5f;
[Property, Group( "Surface Mounts" ), WideMode, Description( "Skip connectors blocked by other parts of this route." )]
public bool MountAvoidAssembly { get; set; } = true;
[Property, Group( "Surface Mounts" ), WideMode]
public bool MountCollars { get; set; } = true;
[Property, Group( "Surface Mounts" ), Range( .25f, 32, slider: false ), WideMode]
public float MountCollarWidth { get; set; } = 4;
[Property, Group( "Surface Mounts" ), Range( .1f, 16, slider: false ), WideMode]
public float MountCollarThickness { get; set; } = 1;
[System.Text.Json.Serialization.JsonIgnore]
public string MountOwner => "Pipe Route Mounts";
public IEnumerable<AnchorSite> MountSites() => RouteMounting.PipeSites( this );
public override IReadOnlySet<string> UnusedOptions
{
get
{
var hidden = RouteMounting.Hidden( this );
PipeGroundSupport.Hide( hidden, this );
return hidden;
}
}
}