mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +00:00
Draw Grid Mode: number of slices less than 3 will now be remembered correctly
Draw Grid Mode: added option to to draw the slices relative to the origin of the drawing (so that you don't have to change the slice interpolation all the time)
This commit is contained in:
parent
f10bf59775
commit
95dd6e284e
4 changed files with 81 additions and 36 deletions
|
@ -45,6 +45,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
private int horizontalslices;
|
private int horizontalslices;
|
||||||
private int verticalslices;
|
private int verticalslices;
|
||||||
private bool triangulate;
|
private bool triangulate;
|
||||||
|
private bool relativeinterpolation;
|
||||||
private GridLockMode gridlockmode;
|
private GridLockMode gridlockmode;
|
||||||
private InterpolationTools.Mode horizontalinterpolation;
|
private InterpolationTools.Mode horizontalinterpolation;
|
||||||
private InterpolationTools.Mode verticalinterpolation;
|
private InterpolationTools.Mode verticalinterpolation;
|
||||||
|
@ -472,7 +473,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
if(!p1.pos.IsFinite() || !p2.pos.IsFinite()) return;
|
if(!p1.pos.IsFinite() || !p2.pos.IsFinite()) return;
|
||||||
|
|
||||||
if(p1.pos.x < p2.pos.x)
|
// If relative interpolation is enabled the interpolation will use the point where the drawing
|
||||||
|
// started as the origin, not always the top left corner
|
||||||
|
if (relativeinterpolation)
|
||||||
|
{
|
||||||
|
start.x = p1.pos.x;
|
||||||
|
start.y = p1.pos.y;
|
||||||
|
end.x = p2.pos.x;
|
||||||
|
end.y = p2.pos.y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (p1.pos.x < p2.pos.x)
|
||||||
{
|
{
|
||||||
start.x = p1.pos.x;
|
start.x = p1.pos.x;
|
||||||
end.x = p2.pos.x;
|
end.x = p2.pos.x;
|
||||||
|
@ -483,7 +495,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
end.x = p1.pos.x;
|
end.x = p1.pos.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(p1.pos.y < p2.pos.y)
|
if (p1.pos.y < p2.pos.y)
|
||||||
{
|
{
|
||||||
start.y = p1.pos.y;
|
start.y = p1.pos.y;
|
||||||
end.y = p2.pos.y;
|
end.y = p2.pos.y;
|
||||||
|
@ -493,6 +505,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
start.y = p2.pos.y;
|
start.y = p2.pos.y;
|
||||||
end.y = p1.pos.y;
|
end.y = p1.pos.y;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
width = (int)(end.x - start.x);
|
width = (int)(end.x - start.x);
|
||||||
height = (int)(end.y - start.y);
|
height = (int)(end.y - start.y);
|
||||||
|
@ -507,8 +521,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
// Load stored settings
|
// Load stored settings
|
||||||
triangulate = General.Settings.ReadPluginSetting("drawgridmode.triangulate", false);
|
triangulate = General.Settings.ReadPluginSetting("drawgridmode.triangulate", false);
|
||||||
gridlockmode = (GridLockMode)General.Settings.ReadPluginSetting("drawgridmode.gridlockmode", 0);
|
gridlockmode = (GridLockMode)General.Settings.ReadPluginSetting("drawgridmode.gridlockmode", 0);
|
||||||
horizontalslices = Math.Max(General.Settings.ReadPluginSetting("drawgridmode.horizontalslices", 3), 3);
|
horizontalslices = Math.Max(General.Settings.ReadPluginSetting("drawgridmode.horizontalslices", 3), 1);
|
||||||
verticalslices = Math.Max(General.Settings.ReadPluginSetting("drawgridmode.verticalslices", 3), 3);
|
verticalslices = Math.Max(General.Settings.ReadPluginSetting("drawgridmode.verticalslices", 3), 1);
|
||||||
|
relativeinterpolation = General.Settings.ReadPluginSetting("drawgridmode.relativeinterpolation", true);
|
||||||
horizontalinterpolation = (InterpolationTools.Mode)General.Settings.ReadPluginSetting("drawgridmode.horizontalinterpolation", 0);
|
horizontalinterpolation = (InterpolationTools.Mode)General.Settings.ReadPluginSetting("drawgridmode.horizontalinterpolation", 0);
|
||||||
verticalinterpolation = (InterpolationTools.Mode)General.Settings.ReadPluginSetting("drawgridmode.verticalinterpolation", 0);
|
verticalinterpolation = (InterpolationTools.Mode)General.Settings.ReadPluginSetting("drawgridmode.verticalinterpolation", 0);
|
||||||
|
|
||||||
|
@ -527,10 +542,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
panel.OnGridLockModeChanged += OptionsPanelOnGridLockChanged;
|
panel.OnGridLockModeChanged += OptionsPanelOnGridLockChanged;
|
||||||
panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged;
|
panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged;
|
||||||
panel.OnShowGuidelinesChanged += OnShowGuidelinesChanged;
|
panel.OnShowGuidelinesChanged += OnShowGuidelinesChanged;
|
||||||
|
panel.OnRelativeInterpolationChanged += OnRelativeInterpolationChanged;
|
||||||
|
|
||||||
// Needs to be set after adding the OnContinuousDrawingChanged event...
|
// Needs to be set after adding the OnContinuousDrawingChanged event...
|
||||||
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawgridmode.continuousdrawing", false);
|
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawgridmode.continuousdrawing", false);
|
||||||
panel.ShowGuidelines = General.Settings.ReadPluginSetting("drawgridmode.showguidelines", false);
|
panel.ShowGuidelines = General.Settings.ReadPluginSetting("drawgridmode.showguidelines", false);
|
||||||
|
panel.RelativeInterpolation = relativeinterpolation;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void AddInterface()
|
protected override void AddInterface()
|
||||||
|
@ -548,6 +565,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
General.Settings.WritePluginSetting("drawgridmode.gridlockmode", (int)gridlockmode);
|
General.Settings.WritePluginSetting("drawgridmode.gridlockmode", (int)gridlockmode);
|
||||||
General.Settings.WritePluginSetting("drawgridmode.horizontalslices", horizontalslices);
|
General.Settings.WritePluginSetting("drawgridmode.horizontalslices", horizontalslices);
|
||||||
General.Settings.WritePluginSetting("drawgridmode.verticalslices", verticalslices);
|
General.Settings.WritePluginSetting("drawgridmode.verticalslices", verticalslices);
|
||||||
|
General.Settings.WritePluginSetting("drawgridmode.relativeinterpolation", relativeinterpolation);
|
||||||
General.Settings.WritePluginSetting("drawgridmode.horizontalinterpolation", (int)horizontalinterpolation);
|
General.Settings.WritePluginSetting("drawgridmode.horizontalinterpolation", (int)horizontalinterpolation);
|
||||||
General.Settings.WritePluginSetting("drawgridmode.verticalinterpolation", (int)verticalinterpolation);
|
General.Settings.WritePluginSetting("drawgridmode.verticalinterpolation", (int)verticalinterpolation);
|
||||||
General.Settings.WritePluginSetting("drawgridmode.continuousdrawing", panel.ContinuousDrawing);
|
General.Settings.WritePluginSetting("drawgridmode.continuousdrawing", panel.ContinuousDrawing);
|
||||||
|
@ -559,6 +577,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
panel = null;
|
panel = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void OnRelativeInterpolationChanged(object value, EventArgs e)
|
||||||
|
{
|
||||||
|
relativeinterpolation = (bool)value;
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Actions
|
#region ================== Actions
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.relativeinterpolation = new System.Windows.Forms.CheckBox();
|
||||||
this.showguidelines = new System.Windows.Forms.CheckBox();
|
this.showguidelines = new System.Windows.Forms.CheckBox();
|
||||||
this.continuousdrawing = new System.Windows.Forms.CheckBox();
|
this.continuousdrawing = new System.Windows.Forms.CheckBox();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
|
@ -215,15 +216,27 @@
|
||||||
//
|
//
|
||||||
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.groupBox3.Controls.Add(this.relativeinterpolation);
|
||||||
this.groupBox3.Controls.Add(this.showguidelines);
|
this.groupBox3.Controls.Add(this.showguidelines);
|
||||||
this.groupBox3.Controls.Add(this.continuousdrawing);
|
this.groupBox3.Controls.Add(this.continuousdrawing);
|
||||||
this.groupBox3.Location = new System.Drawing.Point(3, 225);
|
this.groupBox3.Location = new System.Drawing.Point(3, 225);
|
||||||
this.groupBox3.Name = "groupBox3";
|
this.groupBox3.Name = "groupBox3";
|
||||||
this.groupBox3.Size = new System.Drawing.Size(200, 71);
|
this.groupBox3.Size = new System.Drawing.Size(200, 98);
|
||||||
this.groupBox3.TabIndex = 11;
|
this.groupBox3.TabIndex = 11;
|
||||||
this.groupBox3.TabStop = false;
|
this.groupBox3.TabStop = false;
|
||||||
this.groupBox3.Text = "Additional options";
|
this.groupBox3.Text = "Additional options";
|
||||||
//
|
//
|
||||||
|
// relativeinterpolation
|
||||||
|
//
|
||||||
|
this.relativeinterpolation.AutoSize = true;
|
||||||
|
this.relativeinterpolation.Location = new System.Drawing.Point(20, 70);
|
||||||
|
this.relativeinterpolation.Name = "relativeinterpolation";
|
||||||
|
this.relativeinterpolation.Size = new System.Drawing.Size(125, 17);
|
||||||
|
this.relativeinterpolation.TabIndex = 17;
|
||||||
|
this.relativeinterpolation.Text = "Relative interpolation";
|
||||||
|
this.relativeinterpolation.UseVisualStyleBackColor = true;
|
||||||
|
this.relativeinterpolation.CheckedChanged += new System.EventHandler(this.relativeinterpolation_CheckedChanged);
|
||||||
|
//
|
||||||
// showguidelines
|
// showguidelines
|
||||||
//
|
//
|
||||||
this.showguidelines.AutoSize = true;
|
this.showguidelines.AutoSize = true;
|
||||||
|
@ -286,5 +299,6 @@
|
||||||
private System.Windows.Forms.ComboBox gridlockmode;
|
private System.Windows.Forms.ComboBox gridlockmode;
|
||||||
private System.Windows.Forms.Label label5;
|
private System.Windows.Forms.Label label5;
|
||||||
private System.Windows.Forms.CheckBox showguidelines;
|
private System.Windows.Forms.CheckBox showguidelines;
|
||||||
|
private System.Windows.Forms.CheckBox relativeinterpolation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
public event EventHandler OnGridLockModeChanged;
|
public event EventHandler OnGridLockModeChanged;
|
||||||
public event EventHandler OnContinuousDrawingChanged;
|
public event EventHandler OnContinuousDrawingChanged;
|
||||||
public event EventHandler OnShowGuidelinesChanged;
|
public event EventHandler OnShowGuidelinesChanged;
|
||||||
|
public event EventHandler OnRelativeInterpolationChanged;
|
||||||
|
|
||||||
private bool blockevents;
|
private bool blockevents;
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
public int MaxVerticalSlices { get { return (int)slicesV.Maximum; } set { slicesV.Maximum = value; } }
|
public int MaxVerticalSlices { get { return (int)slicesV.Maximum; } set { slicesV.Maximum = value; } }
|
||||||
public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } }
|
public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } }
|
||||||
public bool ShowGuidelines { get { return showguidelines.Checked; } set { showguidelines.Checked = value; } }
|
public bool ShowGuidelines { get { return showguidelines.Checked; } set { showguidelines.Checked = value; } }
|
||||||
|
public bool RelativeInterpolation { get { return relativeinterpolation.Checked; } set { relativeinterpolation.Checked = value; } }
|
||||||
|
|
||||||
public InterpolationMode HorizontalInterpolationMode
|
public InterpolationMode HorizontalInterpolationMode
|
||||||
{
|
{
|
||||||
|
@ -86,17 +88,22 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
if(mode == GridLockMode.NONE || mode == GridLockMode.HORIZONTAL) slicesV.Value = 3;
|
if(mode == GridLockMode.NONE || mode == GridLockMode.HORIZONTAL) slicesV.Value = 3;
|
||||||
blockevents = false;
|
blockevents = false;
|
||||||
|
|
||||||
if(OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
OnValueChanged?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void continuousdrawing_CheckedChanged(object sender, EventArgs e)
|
private void continuousdrawing_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if(OnContinuousDrawingChanged != null) OnContinuousDrawingChanged(continuousdrawing.Checked, EventArgs.Empty);
|
OnContinuousDrawingChanged?.Invoke(continuousdrawing.Checked, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showguidelines_CheckedChanged(object sender, EventArgs e)
|
private void showguidelines_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if(OnShowGuidelinesChanged != null) OnShowGuidelinesChanged(showguidelines.Checked, EventArgs.Empty);
|
OnShowGuidelinesChanged?.Invoke(showguidelines.Checked, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void relativeinterpolation_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OnRelativeInterpolationChanged?.Invoke(relativeinterpolation.Checked, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,9 +112,9 @@
|
||||||
<value>2.0</value>
|
<value>2.0</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="reader">
|
<resheader name="reader">
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
</root>
|
</root>
|
Loading…
Reference in a new issue