editor/AdvancedMappingTools/Architecture/RoofStudioWalls.cs

Part of the Roof Studio settings class in the Advanced Mapping Tools editor package. Adds the gable overhang, gable thickness and wall margin properties plus the clamped internal accessors that resolve them into eave overhang, end overhang and gable wall thickness.

namespace AdvancedMappingTools;
public sealed partial class RoofStudioSettings
{
	/// <summary>How far the roof reaches past the gable ends. Minus one is the same as Overhang along the eaves.</summary>
	[Property, Group( "Roof" ), Title( "Gable Overhang (-1 = Overhang)" ), Range( -1, 128, slider: false ), WideMode]
	public float GableOverhang { get; set; } = -1;

	/// <summary>Thickness of the closed gable ends of a hollow roof. Zero matches the wall the roof sits on.</summary>
	[Property, Group( "Roof Interior" ), Title( "Gable Thickness (0 = Wall)" ), Range( 0, 64, slider: false ), WideMode]
	public float GableThickness { get; set; }

	/// <summary>
	/// Half the wall thickness, set when the corners snap onto walls. The roof then covers the walls up
	/// to their outer faces, so closed gables carry those faces on up and only the overhang reaches past.
	/// </summary>
	[Property, Advanced, Group( "Roof" ), Title( "Wall Margin" ), Range( 0, 64, slider: false ), WideMode]
	public float WallMargin { get; set; }

	internal float EaveOverhang => Math.Clamp( float.IsFinite( Overhang ) ? Overhang : 0, 0, 128 );
	internal float EndOverhang => !float.IsFinite( GableOverhang ) || GableOverhang < 0 ? EaveOverhang : Math.Clamp( GableOverhang, 0, 128 );
	internal float GableWall => GableThickness > 0 ? Math.Clamp( GableThickness, .5f, 64 ) : WallMargin > 0 ? Math.Clamp( WallMargin * 2, .5f, 64 ) : 0;
}