mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-02-07 08:21:10 +00:00
Add "clear midtextures" action
This commit is contained in:
parent
8c12299583
commit
c76ff0aab9
3 changed files with 102 additions and 2 deletions
|
@ -1723,6 +1723,51 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BeginAction("clearmidtextures")]
|
||||||
|
public void ClearMidtextures()
|
||||||
|
{
|
||||||
|
// Make list of selected linedefs
|
||||||
|
ICollection<Linedef> selected = General.Map.Map.GetSelectedLinedefs(true);
|
||||||
|
if ((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed) selected.Add(highlighted);
|
||||||
|
|
||||||
|
// Anything to do?
|
||||||
|
if (selected.Count > 0)
|
||||||
|
{
|
||||||
|
// Make undo
|
||||||
|
if (selected.Count > 1)
|
||||||
|
{
|
||||||
|
General.Map.UndoRedo.CreateUndo("Cleared midtextures of " + selected.Count + " linedefs");
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Cleared midtextures of " + selected.Count + " linedefs.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
General.Map.UndoRedo.CreateUndo("Cleared midtextures of 1 linedef");
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Cleared midtextures of 1 linedef.");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Linedef l in selected)
|
||||||
|
{
|
||||||
|
l.SetFlag(General.Map.Config.PegMidtextureFlag, false);
|
||||||
|
l.Front.SetTextureMid("-");
|
||||||
|
l.Back.SetTextureMid("-");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update cache values
|
||||||
|
General.Map.IsChanged = true;
|
||||||
|
General.Map.Map.Update();
|
||||||
|
|
||||||
|
// Invoke a new mousemove so that the highlighted item updates
|
||||||
|
MouseEventArgs e = new MouseEventArgs(MouseButtons.None, 0, (int)mousepos.x, (int)mousepos.y, 0);
|
||||||
|
OnMouseMove(e);
|
||||||
|
|
||||||
|
// Redraw screen
|
||||||
|
UpdateSelectionInfo(); //mxd
|
||||||
|
General.Interface.RefreshInfo();
|
||||||
|
General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd
|
||||||
|
General.Interface.RedrawDisplay();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[BeginAction("splitlinedefs")]
|
[BeginAction("splitlinedefs")]
|
||||||
public void SplitLinedefs()
|
public void SplitLinedefs()
|
||||||
{
|
{
|
||||||
|
|
|
@ -356,7 +356,7 @@ resetactionsandtags
|
||||||
{
|
{
|
||||||
title = "Reset actions and tags";
|
title = "Reset actions and tags";
|
||||||
category = "classic";
|
category = "classic";
|
||||||
description = "This resets the actions, effects and tags of all lines or sectors in your selection.";
|
description = "This resets the actions, effects and tags of all lines/sectors/things in your selection.";
|
||||||
allowkeys = true;
|
allowkeys = true;
|
||||||
allowmouse = true;
|
allowmouse = true;
|
||||||
allowscroll = true;
|
allowscroll = true;
|
||||||
|
@ -374,6 +374,17 @@ resetflags
|
||||||
default = 327762;
|
default = 327762;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearmidtextures
|
||||||
|
{
|
||||||
|
title = "Clear midtextures";
|
||||||
|
category = "classic";
|
||||||
|
description = "This removes all midtextures from the selected lines, and removes their Peg Midtexture flag.";
|
||||||
|
allowkeys = true;
|
||||||
|
allowmouse = true;
|
||||||
|
allowscroll = true;
|
||||||
|
default = 327762;
|
||||||
|
}
|
||||||
|
|
||||||
selectnonessential
|
selectnonessential
|
||||||
{
|
{
|
||||||
title = "Select non-essential vertices/lines";
|
title = "Select non-essential vertices/lines";
|
||||||
|
|
|
@ -3934,6 +3934,50 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
selection2.Count + (selection2.Count == 1 ? " thing." : " things."));
|
selection2.Count + (selection2.Count == 1 ? " thing." : " things."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BeginAction("clearmidtextures")]
|
||||||
|
public void ClearMidtextures()
|
||||||
|
{
|
||||||
|
// Make list of selected linedefs
|
||||||
|
List<VisualGeometry> selection = GetSelectedSurfaces();
|
||||||
|
|
||||||
|
// Anything to do?
|
||||||
|
if (selection.Count > 0)
|
||||||
|
{
|
||||||
|
// Make undo
|
||||||
|
if (selection.Count > 1)
|
||||||
|
{
|
||||||
|
General.Map.UndoRedo.CreateUndo("Cleared midtextures of " + selection.Count + " linedefs");
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Cleared midtextures of " + selection.Count + " linedefs.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
General.Map.UndoRedo.CreateUndo("Cleared midtextures of 1 linedef");
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Cleared midtextures of 1 linedef.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//check selection
|
||||||
|
foreach (VisualGeometry vg in selection)
|
||||||
|
{
|
||||||
|
if (vg.GeometryType == VisualGeometryType.WALL_MIDDLE)
|
||||||
|
{
|
||||||
|
if (vg.Sidedef.Other != null)
|
||||||
|
{
|
||||||
|
vg.Sidedef.SetTextureMid("-");
|
||||||
|
vg.Sidedef.Other.SetTextureMid("-");
|
||||||
|
}
|
||||||
|
vg.Sidedef.Line.SetFlag(General.Map.Config.PegMidtextureFlag, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
vg.Sector.UpdateSectorGeometry(true);
|
||||||
|
}
|
||||||
|
//update changed geometry
|
||||||
|
RebuildElementData();
|
||||||
|
UpdateChangedObjects();
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Cleared midtextures for " + selection.Count + (selection.Count == 1 ? " surface." : " surfaces."));
|
||||||
|
ShowTargetInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
[BeginAction("toggleslope")]
|
[BeginAction("toggleslope")]
|
||||||
public void ToggleSlope()
|
public void ToggleSlope()
|
||||||
|
|
Loading…
Reference in a new issue