each basic mode now takes care of converting the current selection as best as possible for that mode

This commit is contained in:
codeimp 2008-09-10 12:44:38 +00:00
parent e9fea4b543
commit 8a3e761896
4 changed files with 56 additions and 51 deletions

View file

@ -106,28 +106,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnEngage();
renderer.SetPresentation(Presentation.Standard);
// Convert geometry selection to linedefs selection
General.Map.Map.ClearAllMarks();
General.Map.Map.MarkSelectedVertices(true, true);
ICollection<Linedef> lines = General.Map.Map.LinedefsFromMarkedVertices(false, true, false);
foreach(Linedef l in lines) l.Selected = true;
General.Map.Map.ClearSelectedSectors();
General.Map.Map.ClearSelectedVertices();
}
// Mode disengages
public override void OnDisengage()
{
base.OnDisengage();
// Check which mode we are switching to
if(General.Map.NewMode is VerticesMode)
{
// Convert selection to vertices
// Clear selected linedefs
General.Map.Map.ClearSelectedLinedefs();
}
else if(General.Map.NewMode is SectorsMode)
{
// Convert selection to sectors
// Clear selected linedefs
General.Map.Map.ClearSelectedLinedefs();
}
// Hide highlight info
General.Interface.HideInfo();

View file

@ -165,28 +165,36 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnEngage();
renderer.SetPresentation(Presentation.Standard);
}
// Convert geometry selection to sectors only
General.Map.Map.ClearAllMarks();
General.Map.Map.MarkSelectedVertices(true, true);
ICollection<Linedef> lines = General.Map.Map.LinedefsFromMarkedVertices(false, true, false);
foreach(Linedef l in lines) l.Selected = true;
General.Map.Map.ClearMarkedSectors(true);
foreach(Linedef l in General.Map.Map.Linedefs)
{
if(!l.Selected)
{
if(l.Front != null) l.Front.Sector.Marked = false;
if(l.Back != null) l.Back.Sector.Marked = false;
}
}
General.Map.Map.ClearAllSelected();
foreach(Sector s in General.Map.Map.Sectors)
{
if(s.Marked)
{
s.Selected = true;
foreach(Sidedef sd in s.Sidedefs) sd.Line.Selected = true;
}
}
}
// Mode disengages
public override void OnDisengage()
{
base.OnDisengage();
// Check which mode we are switching to
if(General.Map.NewMode is VerticesMode)
{
// Convert selection to vertices
// Clear selected sectors
General.Map.Map.ClearSelectedSectors();
}
else if(General.Map.NewMode is LinedefsMode)
{
// Convert selection to linedefs
// Clear selected sectors
General.Map.Map.ClearSelectedSectors();
}
// Hide highlight info
General.Interface.HideInfo();

View file

@ -106,6 +106,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnEngage();
renderer.SetPresentation(Presentation.Things);
// Convert geometry selection to linedefs selection
General.Map.Map.ClearAllMarks();
General.Map.Map.MarkSelectedVertices(true, true);
ICollection<Linedef> lines = General.Map.Map.LinedefsFromMarkedVertices(false, true, false);
foreach(Linedef l in lines) l.Selected = true;
General.Map.Map.ClearSelectedSectors();
General.Map.Map.ClearSelectedVertices();
}
// Mode disengages

View file

@ -101,31 +101,28 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Mode engages
public override void OnEngage()
{
ICollection<Vertex> verts;
base.OnEngage();
renderer.SetPresentation(Presentation.Standard);
// Convert geometry selection to vertices only
General.Map.Map.ClearAllMarks();
General.Map.Map.MarkSelectedLinedefs(true, true);
General.Map.Map.MarkSelectedSectors(true, true);
verts = General.Map.Map.GetVerticesFromLinesMarks(true);
foreach(Vertex v in verts) v.Selected = true;
verts = General.Map.Map.GetVerticesFromSectorsMarks(true);
foreach(Vertex v in verts) v.Selected = true;
General.Map.Map.ClearSelectedSectors();
General.Map.Map.ClearSelectedLinedefs();
}
// Mode disengages
public override void OnDisengage()
{
base.OnDisengage();
// Check which mode we are switching to
if(General.Map.NewMode is LinedefsMode)
{
// Convert selection to linedefs
// Clear selected vertices
General.Map.Map.ClearSelectedVertices();
}
else if(General.Map.NewMode is SectorsMode)
{
// Convert selection to sectors
// Clear selected vertices
General.Map.Map.ClearSelectedVertices();
}
// Hide highlight info
General.Interface.HideInfo();
}