mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-01-30 20:50:41 +00:00
Fixed: cutting a thing in visual mode would leave disposed BaseVisualThings in the selection. (reported by DOOMGABR)
This commit is contained in:
parent
9fb9a72cf3
commit
505865d135
1 changed files with 75 additions and 44 deletions
|
@ -2166,49 +2166,77 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
|
|
||||||
#region ================== Actions
|
#region ================== Actions
|
||||||
|
|
||||||
[BeginAction("clearselection", BaseAction = true)]
|
// [ZZ] I moved this out of ClearSelection because "cut selection" action needs this to only affect things.
|
||||||
public void ClearSelection()
|
private void ClearSelection(bool clearsectors, bool clearsidedefs, bool clearthings, bool clearvertices, bool displaystatus)
|
||||||
{
|
{
|
||||||
selectedobjects = new List<IVisualEventReceiver>();
|
selectedobjects.RemoveAll(obj =>
|
||||||
|
{
|
||||||
|
return ((obj is BaseVisualGeometrySector && clearsectors) ||
|
||||||
|
(obj is BaseVisualGeometrySidedef && clearsidedefs) ||
|
||||||
|
(obj is BaseVisualThing && clearthings) ||
|
||||||
|
(obj is BaseVisualVertex && clearvertices));
|
||||||
|
});
|
||||||
|
|
||||||
foreach(KeyValuePair<Sector, VisualSector> vs in allsectors)
|
//
|
||||||
|
foreach (KeyValuePair<Sector, VisualSector> vs in allsectors)
|
||||||
{
|
{
|
||||||
if(vs.Value != null)
|
if (vs.Value != null)
|
||||||
{
|
{
|
||||||
BaseVisualSector bvs = (BaseVisualSector)vs.Value;
|
BaseVisualSector bvs = (BaseVisualSector)vs.Value;
|
||||||
if(bvs.Floor != null) bvs.Floor.Selected = false;
|
if (clearsectors)
|
||||||
if(bvs.Ceiling != null) bvs.Ceiling.Selected = false;
|
{
|
||||||
foreach(VisualFloor vf in bvs.ExtraFloors) vf.Selected = false;
|
if (bvs.Floor != null) bvs.Floor.Selected = false;
|
||||||
foreach(VisualCeiling vc in bvs.ExtraCeilings) vc.Selected = false;
|
if (bvs.Ceiling != null) bvs.Ceiling.Selected = false;
|
||||||
foreach(VisualFloor vf in bvs.ExtraBackFloors) vf.Selected = false; //mxd
|
foreach (VisualFloor vf in bvs.ExtraFloors) vf.Selected = false;
|
||||||
foreach(VisualCeiling vc in bvs.ExtraBackCeilings) vc.Selected = false; //mxd
|
foreach (VisualCeiling vc in bvs.ExtraCeilings) vc.Selected = false;
|
||||||
|
foreach (VisualFloor vf in bvs.ExtraBackFloors) vf.Selected = false; //mxd
|
||||||
|
foreach (VisualCeiling vc in bvs.ExtraBackCeilings) vc.Selected = false; //mxd
|
||||||
|
}
|
||||||
|
|
||||||
foreach(Sidedef sd in vs.Key.Sidedefs)
|
if (clearsidedefs)
|
||||||
|
{
|
||||||
|
foreach (Sidedef sd in vs.Key.Sidedefs)
|
||||||
{
|
{
|
||||||
//mxd. VisualSidedefParts can contain references to visual geometry, which is not present in VisualSector.sidedefgeometry
|
//mxd. VisualSidedefParts can contain references to visual geometry, which is not present in VisualSector.sidedefgeometry
|
||||||
bvs.GetSidedefParts(sd).DeselectAllParts();
|
bvs.GetSidedefParts(sd).DeselectAllParts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach(KeyValuePair<Thing, VisualThing> vt in allthings)
|
if (clearthings)
|
||||||
{
|
{
|
||||||
if(vt.Value != null)
|
foreach (KeyValuePair<Thing, VisualThing> vt in allthings)
|
||||||
|
{
|
||||||
|
if (vt.Value != null)
|
||||||
{
|
{
|
||||||
BaseVisualThing bvt = (BaseVisualThing)vt.Value;
|
BaseVisualThing bvt = (BaseVisualThing)vt.Value;
|
||||||
bvt.Selected = false;
|
bvt.Selected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
|
||||||
if(General.Map.UDMF)
|
|
||||||
{
|
|
||||||
foreach(KeyValuePair<Vertex, VisualVertexPair> pair in vertices) pair.Value.Deselect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
|
if (clearvertices)
|
||||||
|
{
|
||||||
|
if (General.Map.UDMF)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<Vertex, VisualVertexPair> pair in vertices) pair.Value.Deselect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//mxd
|
||||||
|
if (displaystatus)
|
||||||
|
{
|
||||||
General.Interface.DisplayStatus(StatusType.Selection, string.Empty);
|
General.Interface.DisplayStatus(StatusType.Selection, string.Empty);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[BeginAction("clearselection", BaseAction = true)]
|
||||||
|
public void ClearSelection()
|
||||||
|
{
|
||||||
|
ClearSelection(true, true, true, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
[BeginAction("visualselect", BaseAction = true)]
|
[BeginAction("visualselect", BaseAction = true)]
|
||||||
public void BeginSelect()
|
public void BeginSelect()
|
||||||
|
@ -3401,6 +3429,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
General.Map.IsChanged = true;
|
General.Map.IsChanged = true;
|
||||||
General.Map.ThingsFilter.Update();
|
General.Map.ThingsFilter.Update();
|
||||||
|
|
||||||
|
// [ZZ] Clear selected things.
|
||||||
|
ClearSelection(false, false, true, false, false);
|
||||||
|
|
||||||
// Update event lines
|
// Update event lines
|
||||||
renderer.SetEventLines(LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings, blockmap, bsp, useblockmap));
|
renderer.SetEventLines(LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings, blockmap, bsp, useblockmap));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue