mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
Floodfill and texture alignment now stay within selection, if a selection was made
This commit is contained in:
parent
64d06d0417
commit
129dbf241c
3 changed files with 62 additions and 3 deletions
|
@ -154,8 +154,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
mode.Renderer.SetCrosshairBusy(true);
|
mode.Renderer.SetCrosshairBusy(true);
|
||||||
General.Interface.RedrawDisplay();
|
General.Interface.RedrawDisplay();
|
||||||
|
|
||||||
|
if(mode.IsSingleSelection)
|
||||||
|
{
|
||||||
|
// Clear all marks, this will align everything it can
|
||||||
|
General.Map.Map.ClearMarkedSectors(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Limit the alignment to selection only
|
||||||
|
General.Map.Map.ClearMarkedSectors(true);
|
||||||
|
List<Sector> sectors = mode.GetSelectedSectors();
|
||||||
|
foreach(Sector s in sectors) s.Marked = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Do the fill
|
// Do the fill
|
||||||
Tools.FloodfillFlats(this.Sector.Sector, fillceilings, oldtexturelong, newtextureimage, true);
|
Tools.FloodfillFlats(this.Sector.Sector, fillceilings, oldtexturelong, newtextureimage, false);
|
||||||
|
|
||||||
// Get the changed sectors
|
// Get the changed sectors
|
||||||
List<Sector> changes = General.Map.Map.GetMarkedSectors(true);
|
List<Sector> changes = General.Map.Map.GetMarkedSectors(true);
|
||||||
|
|
|
@ -332,8 +332,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
ImageData newtextureimage = General.Map.Data.GetTextureImage(newtexture);
|
ImageData newtextureimage = General.Map.Data.GetTextureImage(newtexture);
|
||||||
if(newtextureimage != null)
|
if(newtextureimage != null)
|
||||||
{
|
{
|
||||||
|
if(mode.IsSingleSelection)
|
||||||
|
{
|
||||||
|
// Clear all marks, this will align everything it can
|
||||||
|
General.Map.Map.ClearMarkedSidedefs(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Limit the alignment to selection only
|
||||||
|
General.Map.Map.ClearMarkedSidedefs(true);
|
||||||
|
List<Sidedef> sides = mode.GetSelectedSidedefs();
|
||||||
|
foreach(Sidedef sd in sides) sd.Marked = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Do the alignment
|
// Do the alignment
|
||||||
Tools.FloodfillTextures(this.Sidedef, oldtexturelong, newtextureimage, true);
|
Tools.FloodfillTextures(this.Sidedef, oldtexturelong, newtextureimage, false);
|
||||||
|
|
||||||
// Get the changed sidedefs
|
// Get the changed sidedefs
|
||||||
List<Sidedef> changes = General.Map.Map.GetMarkedSidedefs(true);
|
List<Sidedef> changes = General.Map.Map.GetMarkedSidedefs(true);
|
||||||
|
@ -365,8 +378,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
// Make sure the texture is loaded (we need the texture size)
|
// Make sure the texture is loaded (we need the texture size)
|
||||||
if(!base.Texture.IsImageLoaded) base.Texture.LoadImage();
|
if(!base.Texture.IsImageLoaded) base.Texture.LoadImage();
|
||||||
|
|
||||||
|
if(mode.IsSingleSelection)
|
||||||
|
{
|
||||||
|
// Clear all marks, this will align everything it can
|
||||||
|
General.Map.Map.ClearMarkedSidedefs(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Limit the alignment to selection only
|
||||||
|
General.Map.Map.ClearMarkedSidedefs(true);
|
||||||
|
List<Sidedef> sides = mode.GetSelectedSidedefs();
|
||||||
|
foreach(Sidedef sd in sides) sd.Marked = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Do the alignment
|
// Do the alignment
|
||||||
Tools.AutoAlignTextures(this.Sidedef, base.Texture, alignx, aligny, true);
|
Tools.AutoAlignTextures(this.Sidedef, base.Texture, alignx, aligny, false);
|
||||||
|
|
||||||
// Get the changed sidedefs
|
// Get the changed sidedefs
|
||||||
List<Sidedef> changes = General.Map.Map.GetMarkedSidedefs(true);
|
List<Sidedef> changes = General.Map.Map.GetMarkedSidedefs(true);
|
||||||
|
|
|
@ -643,6 +643,26 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
return linedefs;
|
return linedefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This returns all selected sidedefs, no doubles
|
||||||
|
public List<Sidedef> GetSelectedSidedefs()
|
||||||
|
{
|
||||||
|
Dictionary<Sidedef, int> added = new Dictionary<Sidedef, int>();
|
||||||
|
List<Sidedef> sidedefs = new List<Sidedef>();
|
||||||
|
foreach(IVisualEventReceiver i in selectedobjects)
|
||||||
|
{
|
||||||
|
if(i is BaseVisualGeometrySidedef)
|
||||||
|
{
|
||||||
|
Sidedef sd = (i as BaseVisualGeometrySidedef).Sidedef;
|
||||||
|
if(!added.ContainsKey(sd))
|
||||||
|
{
|
||||||
|
sidedefs.Add(sd);
|
||||||
|
added.Add(sd, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sidedefs;
|
||||||
|
}
|
||||||
|
|
||||||
// This returns all selected things, no doubles
|
// This returns all selected things, no doubles
|
||||||
public List<Thing> GetSelectedThings()
|
public List<Thing> GetSelectedThings()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue