Added: holding Control key while switching to/from Visual mode will now temporarily disable position synchronization (works only when 'Synchronize camera position between 2D and 3D modes' Preferences option is enabled).

Fixed severe lock-up after finishing dragging many vertices/linedefs/sectors in Classic modes.
Updated documentation ("Synchronizing camera position").
This commit is contained in:
MaxED 2016-04-29 21:38:43 +00:00 committed by spherallic
parent 87be49a8fd
commit 099f8d316c
13 changed files with 47 additions and 42 deletions

View File

@ -27,6 +27,9 @@
<p><img src="synch_cam3.jpg" alt="" width="740" height="515" /></p>
<p>If you leave Visual mode now, the map will be centered at Visual camera's location:</p>
<p><img src="synch_cam4.jpg" alt="" width="736" height="512" /></p>
<p>If you don't like this behaviour, you can disable it in the <a href="../../../w_preferences.html">Preferences window</a>.</p>
<p>If you don't like this behaviour, disable "<b>Synchronize camera position between 2D and 3D modes</b>" <a href="../../../w_preferences.html">Preferences</a> option.</p>
<h2>Additional keys:</h2>
<p>Holding <b>Shift</b> while switching to/from Visual mode will also synchronize selected map elements.<br />
Holding <b>Ctrl</b> while switching to/from Visual mode will temporarily disable camera synchronization (works only when "<b>Synchronize camera position between 2D and 3D modes</b>" <a href="../../../w_preferences.html">Preferences</a> option is enabled).</p>
</div>
</body>

View File

@ -653,7 +653,8 @@ namespace CodeImp.DoomBuilder.Editing
if(renderer.StartOverlay(true))
{
//mxd. Center 2d view on camera position in 3d view
if(General.Settings.GZSynchCameras && General.Editing.PreviousMode != null && General.Editing.PreviousMode.IsSubclassOf(typeof (VisualMode)))
if(General.Settings.GZSynchCameras && !General.Interface.CtrlState
&& General.Editing.PreviousMode != null && General.Editing.PreviousMode.IsSubclassOf(typeof(VisualMode)))
{
Vector2D campos = new Vector2D(General.Map.VisualCamera.Position.x, General.Map.VisualCamera.Position.y);
renderer2d.PositionView(campos.x, campos.y);

View File

@ -2269,7 +2269,7 @@ namespace CodeImp.DoomBuilder.Geometry
}
//mxd. Try to create/remove/reassign outer sidedefs. Selected linedefs and verts are marked
public static void AdjustOuterSidedefs(HashSet<Sector> selectedsectors, ICollection<Linedef> selectedlines)
public static void AdjustOuterSidedefs(HashSet<Sector> selectedsectors, HashSet<Linedef> selectedlines)
{
HashSet<Sidedef> outersides = new HashSet<Sidedef>();
HashSet<Linedef> singlesidedlines = new HashSet<Linedef>();

View File

@ -2583,7 +2583,7 @@ namespace CodeImp.DoomBuilder.Map
}
/// <summary>mxd. This finds the line closest to the specified position excluding given list of linedefs.</summary>
public Linedef NearestLinedef(Vector2D pos, ICollection<Linedef> linesToExclude)
public Linedef NearestLinedef(Vector2D pos, HashSet<Linedef> linesToExclude)
{
Linedef closest = null;
float distance = float.MaxValue;

View File

@ -169,6 +169,9 @@ namespace CodeImp.DoomBuilder.VisualModes
//mxd. Synch camera position to cursor position or center of the screen in 2d-mode
if(General.Settings.GZSynchCameras)
{
// Keep previous camera position if Control is held and camera was previously moved in Visual mode
if(!General.Interface.CtrlState || General.Map.VisualCamera.Position.GetLengthSq() == 0)
{
//If initial position is inside or nearby a sector - adjust camera.z accordingly
float posz = General.Map.VisualCamera.Position.z;
@ -198,6 +201,7 @@ namespace CodeImp.DoomBuilder.VisualModes
General.Map.VisualCamera.Position = new Vector3D(initialcameraposition.x, initialcameraposition.y, posz);
}
}
else
{
General.Map.VisualCamera.PositionAtThing();

View File

@ -119,7 +119,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
HashSet<Sector> toadjust = General.Map.Map.GetUnselectedSectorsFromLinedefs(selectedlines);
// Process outer sidedefs
Tools.AdjustOuterSidedefs(toadjust, selectedlines);
Tools.AdjustOuterSidedefs(toadjust, new HashSet<Linedef>(selectedlines));
}
// If only a single linedef was selected, deselect it now

View File

@ -128,7 +128,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
toadjust.UnionWith(General.Map.Map.GetUnselectedSectorsFromLinedefs(selectedlines));
// Process outer sidedefs
Tools.AdjustOuterSidedefs(toadjust, selectedlines);
Tools.AdjustOuterSidedefs(toadjust, new HashSet<Linedef>(selectedlines));
}
// If only a single sector was selected, deselect it now

View File

@ -103,7 +103,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
// Add sectors, which have all their linedefs selected
// (otherwise those would be destroyed after moving the selection)
ICollection<Linedef> selectedlines = General.Map.Map.LinedefsFromMarkedVertices(false, true, false);
HashSet<Linedef> selectedlines = new HashSet<Linedef>(General.Map.Map.LinedefsFromMarkedVertices(false, true, false));
HashSet<Sector> toadjust = General.Map.Map.GetUnselectedSectorsFromLinedefs(selectedlines);
// Process outer sidedefs

View File

@ -1488,7 +1488,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Update outer sides of the selection
HashSet<Sector> affectedsectors = new HashSet<Sector>(General.Map.Map.GetSelectedSectors(true));
affectedsectors.UnionWith(General.Map.Map.GetUnselectedSectorsFromLinedefs(selectedlines));
Tools.AdjustOuterSidedefs(affectedsectors, selectedlines);
Tools.AdjustOuterSidedefs(affectedsectors, new HashSet<Linedef>(selectedlines));
}
// Stitch geometry

View File

@ -1492,11 +1492,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//align things
int thingsCount = General.Map.Map.Things.Count;
foreach(Thing t in toAlign)
{
List<Linedef> excludedLines = new List<Linedef>();
HashSet<Linedef> excludedLines = new HashSet<Linedef>();
bool aligned;
do
@ -1507,7 +1505,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(!aligned)
{
excludedLines.Add(l);
if(excludedLines.Count == thingsCount)
if(excludedLines.Count == General.Map.Map.Linedefs.Count)
{
ThingTypeInfo tti = General.Map.Data.GetThingInfo(t.SRB2Type);
General.ErrorLogger.Add(ErrorType.Warning, "Unable to align " + tti.Title + " (index " + t.Index + ") to any linedef!");

View File

@ -100,7 +100,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(!merged)
{
List<Linedef> sectorlines = new List<Linedef>(sector.Sidedefs.Count);
HashSet<Linedef> sectorlines = new HashSet<Linedef>();
foreach(Sidedef side in sector.Sidedefs) sectorlines.Add(side.Line);
if(sectorlines.Count > 0)

View File

@ -1579,11 +1579,12 @@ gzdbvisualmode
{
title = "Visual Mode";
category = "modes";
description = "Switches to the visual editing mode. Hold Shift key to invert 'Synhcronise selection between Visual and Classic modes' setting.";
description = "Switches to the (G)ZDoom visual editing mode. Hold Shift key to invert 'Sync selection between Visual and Classic modes' setting.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
disregardshift = true;
disregardcontrol = true;
default = 81; //Q
}

View File

@ -3710,11 +3710,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//align things
int thingsCount = General.Map.Map.Things.Count;
foreach(Thing t in things)
{
List<Linedef> excludedLines = new List<Linedef>();
HashSet<Linedef> excludedLines = new HashSet<Linedef>();
bool aligned;
do
@ -3726,7 +3724,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
excludedLines.Add(l);
if(excludedLines.Count == thingsCount)
if(excludedLines.Count == General.Map.Map.Linedefs.Count)
{
ThingTypeInfo tti = General.Map.Data.GetThingInfo(t.SRB2Type);
General.ErrorLogger.Add(ErrorType.Warning, "Unable to align Thing ¹" + t.Index + " (" + tti.Title + ") to any linedef in a map!");