mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
Changed, "Select Similar", "Paste Properties Special" actions properties windows, Linedefs: removed "Sidedef Properties" from Linedef flags tab.
Fixed several issues with "Synchronized Things Selection" setting: - Things were not deselected after dragging a single sector. - Things were not deselected after editing properties of a single sector. - Things sector references were not updated after using "Join Sectors" and "Merge Sectors" actions. - Things (de)selection is now applied to all things, instead of only the ones visible using current Things Filter.
This commit is contained in:
parent
56baafe194
commit
e44b918b52
4 changed files with 65 additions and 43 deletions
|
@ -123,6 +123,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
General.Map.Map.ClearSelectedLinedefs();
|
||||
|
||||
//mxd. Also (de)select things?
|
||||
if(BuilderPlug.Me.SyncronizeThingEdit)
|
||||
{
|
||||
Sector s = General.GetByIndex(selectedsectors, 0);
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
if(t.Sector == s && t.Selected) t.Selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -527,11 +527,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd. Also (de)select things?
|
||||
if(General.Interface.AltState ^ BuilderPlug.Me.SyncronizeThingEdit)
|
||||
{
|
||||
foreach(Thing t in General.Map.ThingsFilter.VisibleThings)
|
||||
{
|
||||
if(t.Sector != s) continue;
|
||||
t.Selected = s.Selected;
|
||||
}
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
if(t.Sector == s && t.Selected != s.Selected) t.Selected = s.Selected;
|
||||
}
|
||||
|
||||
if(update)
|
||||
|
@ -825,7 +822,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd. Thing selection state may've changed
|
||||
if(General.Interface.AltState ^ BuilderPlug.Me.SyncronizeThingEdit) General.Interface.RedrawDisplay();
|
||||
}
|
||||
else if(BuilderPlug.Me.AutoClearSelection && (General.Map.Map.SelectedSectorsCount > 0 || (BuilderPlug.Me.SyncronizeThingEdit && General.Map.Map.SelectedThingsCount > 0))) //mxd
|
||||
else if(BuilderPlug.Me.AutoClearSelection) //mxd
|
||||
{
|
||||
if(General.Map.Map.SelectedSectorsCount > 0)
|
||||
{
|
||||
|
@ -916,15 +913,24 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd
|
||||
|
||||
// When a single sector was selected, deselect it now
|
||||
if (selected.Count == 1)
|
||||
if(selected.Count == 1)
|
||||
{
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
General.Map.Map.ClearSelectedLinedefs();
|
||||
|
||||
//mxd. Also deselect things?
|
||||
if(BuilderPlug.Me.SyncronizeThingEdit)
|
||||
{
|
||||
Sector s = General.GetByIndex(selected, 0);
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
if(t.Sector == s && t.Selected) t.Selected = false;
|
||||
}
|
||||
|
||||
UpdateEffectLabels(); //mxd
|
||||
}
|
||||
else if(result == DialogResult.Cancel) //mxd. Restore selection...
|
||||
{
|
||||
foreach (Sector s in selected) SelectSector(s, true, false);
|
||||
foreach(Sector s in selected) SelectSector(s, true, false);
|
||||
UpdateSelectedLabels(); //mxd
|
||||
}
|
||||
|
||||
|
@ -1634,7 +1640,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd. Add things?
|
||||
if(BuilderPlug.Me.SyncronizeThingEdit)
|
||||
{
|
||||
foreach(Thing t in General.Map.ThingsFilter.VisibleThings)
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
{
|
||||
if(t.Sector == null) t.DetermineSector();
|
||||
if(t.Sector == highlighted) selectedthings.Add(t);
|
||||
|
@ -1758,19 +1764,25 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public void JoinSectors()
|
||||
{
|
||||
// Worth our money?
|
||||
int count = General.Map.Map.GetSelectedSectors(true).Count;
|
||||
if(count > 1)
|
||||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true); //mxd
|
||||
if(selected.Count > 1)
|
||||
{
|
||||
// Make undo
|
||||
General.Map.UndoRedo.CreateUndo("Join " + count + " sectors");
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Joined " + count + " sectors.");
|
||||
General.Map.UndoRedo.CreateUndo("Join " + selected.Count + " sectors");
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Joined " + selected.Count + " sectors.");
|
||||
|
||||
//mxd. Things may require updating
|
||||
List<Thing> affectedthings = new List<Thing>();
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
if(t.Sector != null && selected.Contains(t.Sector)) affectedthings.Add(t);
|
||||
|
||||
// Merge
|
||||
JoinMergeSectors(false);
|
||||
|
||||
// Deselect
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
General.Map.Map.ClearSelectedLinedefs();
|
||||
//mxd. Things may require updating
|
||||
foreach(Thing t in affectedthings) t.DetermineSector();
|
||||
|
||||
// Map was changed
|
||||
General.Map.IsChanged = true;
|
||||
|
||||
//mxd. Clear selection info
|
||||
|
@ -1791,19 +1803,25 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public void MergeSectors()
|
||||
{
|
||||
// Worth our money?
|
||||
int count = General.Map.Map.GetSelectedSectors(true).Count;
|
||||
if(count > 1)
|
||||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true); //mxd
|
||||
if(selected.Count > 1)
|
||||
{
|
||||
// Make undo
|
||||
General.Map.UndoRedo.CreateUndo("Merge " + count + " sectors");
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Merged " + count + " sectors.");
|
||||
General.Map.UndoRedo.CreateUndo("Merge " + selected.Count + " sectors");
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Merged " + selected.Count + " sectors.");
|
||||
|
||||
//mxd. Things may require updating
|
||||
List<Thing> affectedthings = new List<Thing>();
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
if(t.Sector != null && selected.Contains(t.Sector)) affectedthings.Add(t);
|
||||
|
||||
// Merge
|
||||
JoinMergeSectors(true);
|
||||
|
||||
// Deselect
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
General.Map.Map.ClearSelectedLinedefs();
|
||||
//mxd. Things may require updating
|
||||
foreach(Thing t in affectedthings) t.DetermineSector();
|
||||
|
||||
// Map was changed
|
||||
General.Map.IsChanged = true;
|
||||
|
||||
//mxd. Clear selection info
|
||||
|
|
|
@ -485,9 +485,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd
|
||||
public class LinedefPropertiesCopySettings : MapElementPropertiesCopySettings
|
||||
{
|
||||
[FieldDescription(Description = "Sidedef Properties")]
|
||||
public bool SidedefProperties = true;
|
||||
|
||||
[FieldDescription(Description = "Action")]
|
||||
public bool Action = true;
|
||||
|
||||
|
@ -559,7 +556,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd. Applies selected linededf and sidedef settings
|
||||
public void Apply(Linedef l, LinedefPropertiesCopySettings settings, SidedefPropertiesCopySettings sidesettings)
|
||||
{
|
||||
if(settings.SidedefProperties && sidesettings != null)
|
||||
if(sidesettings != null)
|
||||
{
|
||||
if((front != null) && (l.Front != null)) front.Apply(l.Front, sidesettings);
|
||||
if((back != null) && (l.Back != null)) back.Apply(l.Back, sidesettings);
|
||||
|
@ -859,25 +856,24 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
if(linedefflags.Flags && !FlagsMatch(source.GetFlags(), target.GetFlags())) return false;
|
||||
if(linedefflags.SidedefProperties)
|
||||
|
||||
if(General.Map.UDMF)
|
||||
{
|
||||
if((source.Front == null && target.Front != null) || (source.Front != null && target.Front == null) ||
|
||||
(source.Back == null && target.Back != null) || (source.Back != null && target.Back == null))
|
||||
return false;
|
||||
// UI fields
|
||||
if(linedefflags.Alpha && !UniFields.ValuesMatch("alpha", source, target)) return false;
|
||||
if(linedefflags.RenderStyle && !UniFields.ValuesMatch("renderstyle", source, target)) return false;
|
||||
if(linedefflags.LockNumber && !UniFields.ValuesMatch("locknumber", source, target)) return false;
|
||||
if(linedefflags.Comment && !UniFields.ValuesMatch("comment", source, target)) return false;
|
||||
|
||||
if(source.Front != null && !PropertiesMatch(sideflags, source.Front, target.Front)) return false;
|
||||
if(source.Back != null && !PropertiesMatch(sideflags, source.Back, target.Back)) return false;
|
||||
// Custom fields
|
||||
if(linedefflags.Fields && !UniFields.CustomFieldsMatch(source.Fields, target.Fields)) return false;
|
||||
}
|
||||
if(!General.Map.UDMF) return true;
|
||||
|
||||
// UI fields
|
||||
if(linedefflags.Alpha && !UniFields.ValuesMatch("alpha", source, target)) return false;
|
||||
if(linedefflags.RenderStyle && !UniFields.ValuesMatch("renderstyle", source, target)) return false;
|
||||
if(linedefflags.LockNumber && !UniFields.ValuesMatch("locknumber", source, target)) return false;
|
||||
if(linedefflags.Comment && !UniFields.ValuesMatch("comment", source, target)) return false;
|
||||
|
||||
// Custom fields
|
||||
return !linedefflags.Fields || UniFields.CustomFieldsMatch(source.Fields, target.Fields);
|
||||
// Sidedef properties
|
||||
return (source.Front != null && target.Front != null && PropertiesMatch(sideflags, source.Front, target.Front)) ||
|
||||
(source.Front != null && target.Back != null && PropertiesMatch(sideflags, source.Front, target.Back)) ||
|
||||
(source.Back != null && target.Front != null && PropertiesMatch(sideflags, source.Back, target.Front)) ||
|
||||
(source.Back != null && target.Back != null && PropertiesMatch(sideflags, source.Back, target.Back));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -1248,7 +1248,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
if(BuilderPlug.Me.CopiedLinedefProps != null)
|
||||
{
|
||||
bool pastesideprops = (LinedefProperties.CopySettings.SidedefProperties && BuilderPlug.Me.CopiedSidedefProps != null); //mxd
|
||||
bool pastesideprops = (BuilderPlug.Me.CopiedSidedefProps != null); //mxd
|
||||
string pastetarget = (pastesideprops ? "linedef and sidedef" : "linedef"); //mxd
|
||||
mode.CreateUndo("Paste " + pastetarget + " properties");
|
||||
mode.SetActionResult("Pasted " + pastetarget + " properties.");
|
||||
|
|
Loading…
Reference in a new issue