Allow selecting only single- or double-sided linedefs in Visual Mode.

This commit is contained in:
sphere 2021-03-31 16:08:43 +02:00
parent 76f2816e82
commit f8bbe45c7b
2 changed files with 44 additions and 2 deletions

View file

@ -324,7 +324,7 @@ selectsinglesided
{
title = "Select Single-sided";
category = "linedefs";
description = "This keeps only the single-sided lines in your selection selected.";
description = "This keeps only the single-sided lines in your selection selected. Also works in Visual Mode.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
@ -335,7 +335,7 @@ selectdoublesided
{
title = "Select Double-sided";
category = "linedefs";
description = "This keeps only the double-sided lines in your selection selected.";
description = "This keeps only the double-sided lines in your selection selected. Also works in Visual Mode.";
allowkeys = true;
allowmouse = true;
allowscroll = true;

View file

@ -4098,6 +4098,48 @@ namespace CodeImp.DoomBuilder.BuilderModes
GetTargetEventReceiver(true).OnPaintSelectEnd();
}
// This keeps only the single-sided lines selected
[BeginAction("selectsinglesided")]
public void SelectSingleSided()
{
int counter = 0;
List<VisualGeometry> selected = GetSelectedSurfaces();
foreach (VisualGeometry vg in selected)
if (vg is BaseVisualGeometrySidedef)
{
if (vg.Sidedef.Other != null)
vg.Selected = false;
else
counter++;
}
General.Interface.DisplayStatus(StatusType.Action, "Selected only single-sided linedefs (" + counter + ")");
General.Interface.RedrawDisplay();
UpdateSelectionInfo();
UpdateChangedObjects();
}
// This keeps only the double-sided lines selected
[BeginAction("selectdoublesided")]
public void SelectDoubleSided()
{
int counter = 0;
List<VisualGeometry> selected = GetSelectedSurfaces();
foreach (VisualGeometry vg in selected)
if (vg is BaseVisualGeometrySidedef)
{
if (vg.Sidedef.Other == null)
vg.Selected = false;
else
counter++;
}
General.Interface.DisplayStatus(StatusType.Action, "Selected only double-sided linedefs (" + counter + ")");
General.Interface.RedrawDisplay();
UpdateSelectionInfo();
UpdateChangedObjects();
}
#endregion
#region ================== Texture Alignment