mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +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
9bd51a0186
commit
35f8c5e10e
3 changed files with 80 additions and 49 deletions
|
@ -30,6 +30,6 @@ using CodeImp.DoomBuilder;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.3.0.2942")]
|
||||
[assembly: AssemblyVersion("2.3.0.2943")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
[assembly: AssemblyHash("ee28f1d")]
|
||||
[assembly: AssemblyHash("9bd51a0")]
|
||||
|
|
|
@ -29,5 +29,5 @@ using System.Resources;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.3.0.2942")]
|
||||
[assembly: AssemblyVersion("2.3.0.2943")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
|
|
|
@ -1688,8 +1688,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
// This returns all selected objects
|
||||
internal List<IVisualEventReceiver> GetSelectedObjects(bool includesectors, bool includesidedefs, bool includethings, bool includevertices)
|
||||
// This returns all selected objects
|
||||
internal List<IVisualEventReceiver> GetSelectedObjects(bool includesectors, bool includesidedefs, bool includethings, bool includevertices)
|
||||
{
|
||||
List<IVisualEventReceiver> objs = new List<IVisualEventReceiver>();
|
||||
foreach(IVisualEventReceiver i in selectedobjects)
|
||||
|
@ -1951,54 +1951,82 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Actions
|
||||
|
||||
[BeginAction("clearselection", BaseAction = true)]
|
||||
// [ZZ] I moved this out of ClearSelection because "cut selection" action needs this to only affect things.
|
||||
private void ClearSelection(bool clearsectors, bool clearsidedefs, bool clearthings, bool clearvertices, bool displaystatus)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (vs.Value != null)
|
||||
{
|
||||
BaseVisualSector bvs = (BaseVisualSector)vs.Value;
|
||||
if (clearsectors)
|
||||
{
|
||||
if (bvs.Floor != null) bvs.Floor.Selected = false;
|
||||
if (bvs.Ceiling != null) bvs.Ceiling.Selected = false;
|
||||
foreach (VisualFloor vf in bvs.ExtraFloors) vf.Selected = false;
|
||||
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
|
||||
}
|
||||
|
||||
if (clearsidedefs)
|
||||
{
|
||||
foreach (Sidedef sd in vs.Key.Sidedefs)
|
||||
{
|
||||
//mxd. VisualSidedefParts can contain references to visual geometry, which is not present in VisualSector.sidedefgeometry
|
||||
bvs.GetSidedefParts(sd).DeselectAllParts();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clearthings)
|
||||
{
|
||||
foreach (KeyValuePair<Thing, VisualThing> vt in allthings)
|
||||
{
|
||||
if (vt.Value != null)
|
||||
{
|
||||
BaseVisualThing bvt = (BaseVisualThing)vt.Value;
|
||||
bvt.Selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
[BeginAction("clearselection", BaseAction = true)]
|
||||
public void ClearSelection()
|
||||
{
|
||||
selectedobjects = new List<IVisualEventReceiver>();
|
||||
|
||||
foreach(KeyValuePair<Sector, VisualSector> vs in allsectors)
|
||||
{
|
||||
if(vs.Value != null)
|
||||
{
|
||||
BaseVisualSector bvs = (BaseVisualSector)vs.Value;
|
||||
if(bvs.Floor != null) bvs.Floor.Selected = false;
|
||||
if(bvs.Ceiling != null) bvs.Ceiling.Selected = false;
|
||||
foreach(VisualFloor vf in bvs.ExtraFloors) vf.Selected = false;
|
||||
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)
|
||||
{
|
||||
//mxd. VisualSidedefParts can contain references to visual geometry, which is not present in VisualSector.sidedefgeometry
|
||||
bvs.GetSidedefParts(sd).DeselectAllParts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(KeyValuePair<Thing, VisualThing> vt in allthings)
|
||||
{
|
||||
if(vt.Value != null)
|
||||
{
|
||||
BaseVisualThing bvt = (BaseVisualThing)vt.Value;
|
||||
bvt.Selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
//mxd
|
||||
if(General.Map.UDMF)
|
||||
{
|
||||
foreach(KeyValuePair<Vertex, VisualVertexPair> pair in vertices) pair.Value.Deselect();
|
||||
}
|
||||
|
||||
//mxd
|
||||
General.Interface.DisplayStatus(StatusType.Selection, string.Empty);
|
||||
ClearSelection(true, true, true, true, true);
|
||||
}
|
||||
|
||||
[BeginAction("visualselect", BaseAction = true)]
|
||||
|
@ -3112,7 +3140,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
PreAction(UndoGroup.None);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, true);
|
||||
foreach(IVisualEventReceiver i in objs) i.OnDelete();
|
||||
PostAction();
|
||||
PostAction();
|
||||
|
||||
ClearSelection();
|
||||
}
|
||||
|
@ -3158,8 +3186,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.Map.IsChanged = true;
|
||||
General.Map.ThingsFilter.Update();
|
||||
|
||||
// Update event lines
|
||||
renderer.SetEventLines(LinksCollector.GetHelperShapes(General.Map.ThingsFilter.VisibleThings, blockmap));
|
||||
// [ZZ] Clear selected things.
|
||||
ClearSelection(false, false, true, false, false);
|
||||
|
||||
// Update event lines
|
||||
renderer.SetEventLines(LinksCollector.GetHelperShapes(General.Map.ThingsFilter.VisibleThings, blockmap));
|
||||
}
|
||||
|
||||
//mxd. We'll just use currently selected objects
|
||||
|
|
Loading…
Reference in a new issue