Added option to reselect changed map elements after undo/redo

This commit is contained in:
biwa 2021-10-24 19:22:00 +02:00
parent 161e5ed5b5
commit a0971e0ef2
9 changed files with 112 additions and 22 deletions

View file

@ -93,6 +93,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
private LabelDisplayOption sectorlabeldisplayoption;
private LabelDisplayOption slopevertexlabeldisplayoption;
private PreferencesForm preferencesform;
private bool selectchangedafterundoredo;
// TMP
public List<Line3D> drawlines;
@ -124,6 +125,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
public float HighlightSlopeRange { get { return highlightsloperange; } }
public List<SlopeVertexGroup> SlopeVertexGroups { get { return slopevertexgroups; } set { slopevertexgroups = value; } }
public float StitchRange { get { return stitchrange; } }
public bool SelectChangedAfterUndoRedo { get { return selectchangedafterundoredo; } internal set { selectchangedafterundoredo = value; } }
public Sector SlopeDataSector { get { return slopedatasector; } set { slopedatasector = value; } }
@ -471,7 +473,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
stitchrange = (float)General.Settings.ReadPluginSetting("BuilderModes", "stitchrange", 20);
slopevertexlabeldisplayoption = (LabelDisplayOption)General.Settings.ReadPluginSetting("slopevertexlabeldisplayoption", (int)LabelDisplayOption.Always);
sectorlabeldisplayoption = (LabelDisplayOption)General.Settings.ReadPluginSetting("sectorlabeldisplayoption", (int)LabelDisplayOption.Always);
selectchangedafterundoredo = General.Settings.ReadPluginSetting("BuilderModes", "selectchangedafterundoredo", false);
}
public void StoreSlopeVertexGroupsInSector()

View file

@ -1321,6 +1321,13 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
// Get all 3D floors in case th undo did affect them
threedfloors = BuilderPlug.GetThreeDFloors(General.Map.Map.Sectors.ToList());
// Select changed map elements
if (BuilderPlug.Me.SelectChangedAfterUndoRedo)
{
General.Map.Map.SelectMarkedGeometry(true, true);
General.Map.Map.ConvertSelection(SelectionType.Sectors);
}
// Clear labels
SetupLabels();
UpdateLabels();
@ -1341,6 +1348,13 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
// Get all 3D floors in case th redo did affect them
threedfloors = BuilderPlug.GetThreeDFloors(General.Map.Map.Sectors.ToList());
// Select changed map elements
if (BuilderPlug.Me.SelectChangedAfterUndoRedo)
{
General.Map.Map.SelectMarkedGeometry(true, true);
General.Map.Map.ConvertSelection(SelectionType.Sectors);
}
// Clear labels
SetupLabels();
UpdateLabels();

View file

@ -863,6 +863,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Recreate the blockmap to not include the potentially un-done lines anymore
CreateBlockmap();
// Select changed map elements
if (BuilderPlug.Me.SelectChangedafterUndoRedo)
{
General.Map.Map.SelectMarkedGeometry(true, true);
General.Map.Map.ConvertSelection(SelectionType.Linedefs);
}
// If something is highlighted make sure to update the association so that it contains valid data
if (highlighted != null && !highlighted.IsDisposed)
highlightasso.Set(highlighted);
@ -880,6 +887,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Recreate the blockmap to include the potentially re-done linedefs again
CreateBlockmap();
// Select changed map elements
if (BuilderPlug.Me.SelectChangedafterUndoRedo)
{
General.Map.Map.SelectMarkedGeometry(true, true);
General.Map.Map.ConvertSelection(SelectionType.Linedefs);
}
// If something is highlighted make sure to update the association so that it contains valid data
if (highlighted != null && !highlighted.IsDisposed)
highlightasso.Set(highlighted);

View file

@ -1522,6 +1522,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Recreate the blockmap to not include the potentially un-done sectors and things anymore
CreateBlockmap();
// Select changed map elements
if (BuilderPlug.Me.SelectChangedafterUndoRedo)
{
General.Map.Map.SelectMarkedGeometry(true, true);
General.Map.Map.ConvertSelection(SelectionType.Sectors);
}
// Clear the cache of things that already got their sector determined
determinedsectorthings = new ConcurrentDictionary<Thing, bool>();
@ -1551,6 +1558,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Recreate the blockmap to include the potentially re-done sectors and things again
CreateBlockmap();
// Select changed map elements
if (BuilderPlug.Me.SelectChangedafterUndoRedo)
{
General.Map.Map.SelectMarkedGeometry(true, true);
General.Map.Map.ConvertSelection(SelectionType.Sectors);
}
// Clear the cache of things that already got their sector determined
determinedsectorthings = new ConcurrentDictionary<Thing, bool>();

View file

@ -584,6 +584,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnUndoEnd();
// Select changed map elements
if (BuilderPlug.Me.SelectChangedafterUndoRedo)
{
General.Map.Map.SelectMarkedGeometry(true, true);
General.Map.Map.ConvertSelection(SelectionType.Things);
}
// If something is highlighted make sure to update the association so that it contains valid data
if (highlighted != null && !highlighted.IsDisposed)
highlightasso.Set(highlighted);
@ -598,6 +605,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnRedoEnd();
// Select changed map elements
if (BuilderPlug.Me.SelectChangedafterUndoRedo)
{
General.Map.Map.SelectMarkedGeometry(true, true);
General.Map.Map.ConvertSelection(SelectionType.Things);
}
// If something is highlighted make sure to update the association so that it contains valid data
if (highlighted != null && !highlighted.IsDisposed)
highlightasso.Set(highlighted);

View file

@ -569,6 +569,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Recreate the blockmap
CreateBlockmap();
// Select changed map elements
if (BuilderPlug.Me.SelectChangedafterUndoRedo)
{
General.Map.Map.SelectMarkedGeometry(true, true);
General.Map.Map.ConvertSelection(SelectionType.Vertices);
}
}
public override void OnRedoEnd()
@ -577,6 +584,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Recreate the blockmap
CreateBlockmap();
// Select changed map elements
if (BuilderPlug.Me.SelectChangedafterUndoRedo)
{
General.Map.Map.SelectMarkedGeometry(true, true);
General.Map.Map.ConvertSelection(SelectionType.Vertices);
}
}
//mxd

View file

@ -142,6 +142,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private int eventlinelabelstyle; // 0 = Action only, 1 = Action + short arguments, 2 = action + full arguments
private bool eventlinedistinctcolors;
private bool useoppositesmartpivothandle;
private bool selectchangedafterundoredo;
#endregion
@ -201,6 +202,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public int EventLineLabelStyle { get { return eventlinelabelstyle; } internal set { eventlinelabelstyle = value; } }
public bool EventLineDistinctColors { get { return eventlinedistinctcolors; } internal set { eventlinedistinctcolors = value; } }
public bool UseOppositeSmartPivotHandle { get { return useoppositesmartpivothandle; } internal set { useoppositesmartpivothandle = value; } }
public bool SelectChangedafterUndoRedo { get { return selectchangedafterundoredo; } internal set { selectchangedafterundoredo = value; } }
//mxd. "Make Door" action persistent settings
internal MakeDoorSettings MakeDoor;
@ -309,6 +311,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
eventlinelabelstyle = General.Settings.ReadPluginSetting("eventlinelabelstyle", 2);
eventlinedistinctcolors = General.Settings.ReadPluginSetting("eventlinedistinctcolors", true);
useoppositesmartpivothandle = General.Settings.ReadPluginSetting("useoppositesmartpivothandle", true);
selectchangedafterundoredo = General.Settings.ReadPluginSetting("selectchangedafterundoredo", false);
}
//mxd. Load settings, which can be changed via UI

View file

@ -43,6 +43,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.defaultbrightness = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.label11 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.selectafterundoredo = new System.Windows.Forms.CheckBox();
this.useoppositesmartpivothandle = new System.Windows.Forms.CheckBox();
this.additivepaintselect = new System.Windows.Forms.CheckBox();
this.switchviewmodes = new System.Windows.Forms.CheckBox();
this.autodrawonedit = new System.Windows.Forms.CheckBox();
@ -78,7 +80,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.label10 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.heightbysidedef = new System.Windows.Forms.ComboBox();
this.useoppositesmartpivothandle = new System.Windows.Forms.CheckBox();
this.tabs.SuspendLayout();
this.taboptions.SuspendLayout();
this.groupBox5.SuspendLayout();
@ -274,6 +275,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//
// groupBox3
//
this.groupBox3.Controls.Add(this.selectafterundoredo);
this.groupBox3.Controls.Add(this.useoppositesmartpivothandle);
this.groupBox3.Controls.Add(this.additivepaintselect);
this.groupBox3.Controls.Add(this.switchviewmodes);
@ -294,10 +296,30 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.groupBox3.TabStop = false;
this.groupBox3.Text = " Options ";
//
// selectafterundoredo
//
this.selectafterundoredo.AutoSize = true;
this.selectafterundoredo.Location = new System.Drawing.Point(13, 336);
this.selectafterundoredo.Name = "selectafterundoredo";
this.selectafterundoredo.Size = new System.Drawing.Size(246, 17);
this.selectafterundoredo.TabIndex = 12;
this.selectafterundoredo.Text = "Select changed map elements after undo/redo";
this.selectafterundoredo.UseVisualStyleBackColor = true;
//
// useoppositesmartpivothandle
//
this.useoppositesmartpivothandle.AutoSize = true;
this.useoppositesmartpivothandle.Location = new System.Drawing.Point(13, 313);
this.useoppositesmartpivothandle.Name = "useoppositesmartpivothandle";
this.useoppositesmartpivothandle.Size = new System.Drawing.Size(321, 17);
this.useoppositesmartpivothandle.TabIndex = 12;
this.useoppositesmartpivothandle.Text = "Opposite side/vertex is smart pivot handle on triangular sectors";
this.useoppositesmartpivothandle.UseVisualStyleBackColor = true;
//
// additivepaintselect
//
this.additivepaintselect.AutoSize = true;
this.additivepaintselect.Location = new System.Drawing.Point(13, 135);
this.additivepaintselect.Location = new System.Drawing.Point(13, 131);
this.additivepaintselect.Name = "additivepaintselect";
this.additivepaintselect.Size = new System.Drawing.Size(233, 17);
this.additivepaintselect.TabIndex = 11;
@ -307,7 +329,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// switchviewmodes
//
this.switchviewmodes.AutoSize = true;
this.switchviewmodes.Location = new System.Drawing.Point(13, 308);
this.switchviewmodes.Location = new System.Drawing.Point(13, 290);
this.switchviewmodes.Name = "switchviewmodes";
this.switchviewmodes.Size = new System.Drawing.Size(317, 17);
this.switchviewmodes.TabIndex = 10;
@ -328,7 +350,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// syncSelection
//
this.syncSelection.AutoSize = true;
this.syncSelection.Location = new System.Drawing.Point(13, 283);
this.syncSelection.Location = new System.Drawing.Point(13, 267);
this.syncSelection.Name = "syncSelection";
this.syncSelection.Size = new System.Drawing.Size(295, 17);
this.syncSelection.TabIndex = 9;
@ -338,7 +360,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// dontMoveGeometryOutsideBounds
//
this.dontMoveGeometryOutsideBounds.AutoSize = true;
this.dontMoveGeometryOutsideBounds.Location = new System.Drawing.Point(13, 258);
this.dontMoveGeometryOutsideBounds.Location = new System.Drawing.Point(13, 244);
this.dontMoveGeometryOutsideBounds.Name = "dontMoveGeometryOutsideBounds";
this.dontMoveGeometryOutsideBounds.Size = new System.Drawing.Size(323, 17);
this.dontMoveGeometryOutsideBounds.TabIndex = 8;
@ -348,7 +370,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// autoaligntexturesoncreate
//
this.autoaligntexturesoncreate.AutoSize = true;
this.autoaligntexturesoncreate.Location = new System.Drawing.Point(13, 233);
this.autoaligntexturesoncreate.Location = new System.Drawing.Point(13, 221);
this.autoaligntexturesoncreate.Name = "autoaligntexturesoncreate";
this.autoaligntexturesoncreate.Size = new System.Drawing.Size(233, 17);
this.autoaligntexturesoncreate.TabIndex = 7;
@ -358,7 +380,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// autodragonpaste
//
this.autodragonpaste.AutoSize = true;
this.autodragonpaste.Location = new System.Drawing.Point(13, 208);
this.autodragonpaste.Location = new System.Drawing.Point(13, 198);
this.autodragonpaste.Name = "autodragonpaste";
this.autodragonpaste.Size = new System.Drawing.Size(201, 17);
this.autodragonpaste.TabIndex = 6;
@ -368,7 +390,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// visualmodeclearselection
//
this.visualmodeclearselection.AutoSize = true;
this.visualmodeclearselection.Location = new System.Drawing.Point(13, 183);
this.visualmodeclearselection.Location = new System.Drawing.Point(13, 176);
this.visualmodeclearselection.Name = "visualmodeclearselection";
this.visualmodeclearselection.Size = new System.Drawing.Size(231, 17);
this.visualmodeclearselection.TabIndex = 5;
@ -378,7 +400,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// autoclearselection
//
this.autoclearselection.AutoSize = true;
this.autoclearselection.Location = new System.Drawing.Point(13, 158);
this.autoclearselection.Location = new System.Drawing.Point(13, 153);
this.autoclearselection.Name = "autoclearselection";
this.autoclearselection.Size = new System.Drawing.Size(241, 17);
this.autoclearselection.TabIndex = 4;
@ -398,7 +420,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// editnewsector
//
this.editnewsector.AutoSize = true;
this.editnewsector.Location = new System.Drawing.Point(13, 87);
this.editnewsector.Location = new System.Drawing.Point(13, 85);
this.editnewsector.Name = "editnewsector";
this.editnewsector.Size = new System.Drawing.Size(253, 17);
this.editnewsector.TabIndex = 2;
@ -408,7 +430,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// additiveselect
//
this.additiveselect.AutoSize = true;
this.additiveselect.Location = new System.Drawing.Point(13, 112);
this.additiveselect.Location = new System.Drawing.Point(13, 108);
this.additiveselect.Name = "additiveselect";
this.additiveselect.Size = new System.Drawing.Size(207, 17);
this.additiveselect.TabIndex = 3;
@ -710,16 +732,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.heightbysidedef.Size = new System.Drawing.Size(309, 21);
this.heightbysidedef.TabIndex = 0;
//
// useoppositesmartpivothandle
//
this.useoppositesmartpivothandle.AutoSize = true;
this.useoppositesmartpivothandle.Location = new System.Drawing.Point(13, 333);
this.useoppositesmartpivothandle.Name = "useoppositesmartpivothandle";
this.useoppositesmartpivothandle.Size = new System.Drawing.Size(321, 17);
this.useoppositesmartpivothandle.TabIndex = 12;
this.useoppositesmartpivothandle.Text = "Opposite side/vertex is smart pivot handle on triangular sectors";
this.useoppositesmartpivothandle.UseVisualStyleBackColor = true;
//
// PreferencesForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -799,5 +811,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.ComboBox eventlinelabelvisibility;
private System.Windows.Forms.ComboBox eventlinelabelstyle;
private System.Windows.Forms.CheckBox useoppositesmartpivothandle;
private System.Windows.Forms.CheckBox selectafterundoredo;
}
}

View file

@ -68,6 +68,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
eventlinelabelvisibility.SelectedIndex = General.Settings.ReadPluginSetting("eventlinelabelvisibility", 3);
eventlinelabelstyle.SelectedIndex = General.Settings.ReadPluginSetting("eventlinelabelstyle", 2);
useoppositesmartpivothandle.Checked = General.Settings.ReadPluginSetting("useoppositesmartpivothandle", true);
selectafterundoredo.Checked = General.Settings.ReadPluginSetting("selectchangedafterundoredo", false);
}
#endregion
@ -99,6 +100,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Settings.WritePluginSetting("eventlinelabelvisibility", eventlinelabelvisibility.SelectedIndex);
General.Settings.WritePluginSetting("eventlinelabelstyle", eventlinelabelstyle.SelectedIndex);
General.Settings.WritePluginSetting("useoppositesmartpivothandle", useoppositesmartpivothandle.Checked);
General.Settings.WritePluginSetting("selectchangedafterundoredo", selectafterundoredo.Checked);
General.Settings.SwitchViewModes = switchviewmodes.Checked; //mxd
General.Settings.SplitLineBehavior = (SplitLineBehavior)splitbehavior.SelectedIndex;//mxd