From 9218e8e476e0ec39bf8dbb293f4bf81d2b45eb16 Mon Sep 17 00:00:00 2001
From: TheGamerzs <44209534+TheGamerzs@users.noreply.github.com>
Date: Fri, 4 Apr 2025 23:52:53 +0100
Subject: [PATCH 1/2] feat: snap to ground for each item in multi selection
---
CodeWalker/WorldForm.Designer.cs | 24 ++++++++++++++++++++++--
CodeWalker/WorldForm.cs | 32 +++++++++++++++++++++++++++++---
CodeWalker/WorldForm.resx | 2 +-
3 files changed, 52 insertions(+), 6 deletions(-)
diff --git a/CodeWalker/WorldForm.Designer.cs b/CodeWalker/WorldForm.Designer.cs
index 297836ab9..a42a98423 100644
--- a/CodeWalker/WorldForm.Designer.cs
+++ b/CodeWalker/WorldForm.Designer.cs
@@ -291,6 +291,8 @@ private void InitializeComponent()
this.ToolbarRotationSnapping45Button = new System.Windows.Forms.ToolStripMenuItem();
this.ToolbarRotationSnapping90Button = new System.Windows.Forms.ToolStripMenuItem();
this.ToolbarRotationSnappingCustomButton = new System.Windows.Forms.ToolStripMenuItem();
+ this.multiSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.RelativeGroundForEachItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.ToolbarUndoButton = new System.Windows.Forms.ToolStripSplitButton();
this.ToolbarUndoListButton = new System.Windows.Forms.ToolStripMenuItem();
@@ -2928,7 +2930,7 @@ private void InitializeComponent()
this.ToolbarCameraModeButton});
this.Toolbar.Location = new System.Drawing.Point(1, 0);
this.Toolbar.Name = "Toolbar";
- this.Toolbar.Size = new System.Drawing.Size(554, 25);
+ this.Toolbar.Size = new System.Drawing.Size(585, 25);
this.Toolbar.TabIndex = 6;
this.Toolbar.Text = "toolStrip1";
//
@@ -3302,7 +3304,8 @@ private void InitializeComponent()
this.ToolbarSnapToGridButton,
this.ToolbarSnapToGroundGridButton,
this.ToolbarSnapGridSizeButton,
- this.ToolbarRotationSnappingButton});
+ this.ToolbarRotationSnappingButton,
+ this.multiSelectionToolStripMenuItem});
this.ToolbarSnapButton.Image = ((System.Drawing.Image)(resources.GetObject("ToolbarSnapButton.Image")));
this.ToolbarSnapButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.ToolbarSnapButton.Name = "ToolbarSnapButton";
@@ -3415,6 +3418,21 @@ private void InitializeComponent()
this.ToolbarRotationSnappingCustomButton.Text = "Custom...";
this.ToolbarRotationSnappingCustomButton.Click += new System.EventHandler(this.ToolbarRotationSnappingCustomButton_Click);
//
+ // multiSelectionToolStripMenuItem
+ //
+ this.multiSelectionToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.RelativeGroundForEachItemToolStripMenuItem});
+ this.multiSelectionToolStripMenuItem.Name = "multiSelectionToolStripMenuItem";
+ this.multiSelectionToolStripMenuItem.Size = new System.Drawing.Size(205, 22);
+ this.multiSelectionToolStripMenuItem.Text = "Multi Selection";
+ //
+ // RelativeGroundForEachItemToolStripMenuItem
+ //
+ this.RelativeGroundForEachItemToolStripMenuItem.Name = "RelativeGroundForEachItemToolStripMenuItem";
+ this.RelativeGroundForEachItemToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.RelativeGroundForEachItemToolStripMenuItem.Text = "Relative Item Snap";
+ this.RelativeGroundForEachItemToolStripMenuItem.Click += new System.EventHandler(this.RelativeSnapForEachItemToolStripMenuItem_Click);
+ //
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
@@ -3978,5 +3996,7 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem ToolsMenuAudioExplorer;
private System.Windows.Forms.CheckBox SaveTimeOfDayCheckBox;
private System.Windows.Forms.CheckBox SavePositionCheckBox;
+ private System.Windows.Forms.ToolStripMenuItem multiSelectionToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem RelativeGroundForEachItemToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/CodeWalker/WorldForm.cs b/CodeWalker/WorldForm.cs
index d16a0bd0a..cd91ec053 100644
--- a/CodeWalker/WorldForm.cs
+++ b/CodeWalker/WorldForm.cs
@@ -189,6 +189,7 @@ public partial class WorldForm : Form, DXForm
WorldSnapMode SnapModePrev = WorldSnapMode.Ground;//also the default snap mode
float SnapGridSize = 1.0f;
+ public bool SnapMultiSelectEach = false;
public bool EditEntityPivot { get; set; } = false;
@@ -1757,12 +1758,31 @@ private void Widget_OnPositionChange(Vector3 newpos, Vector3 oldpos)
{
//called during UpdateWidgets()
- newpos = SnapPosition(newpos);
+
- if (newpos == oldpos) return;
+ if (SnapMultiSelectEach && SelectedItem.MultipleSelectionItems != null)
+ {
+ for (int i = 0; i < SelectedItem.MultipleSelectionItems.Length; i++)
+ {
+ MapSelection item = SelectedItem.MultipleSelectionItems[i];
+ Vector3 posToGround = item.WidgetPosition;
+ posToGround.Z = newpos.Z;
+
+ Vector3 tempNewPos = SnapPosition(posToGround);
- SelectedItem.SetPosition(newpos, EditEntityPivot);
+ if (tempNewPos == item.WidgetPosition) continue;
+ item.SetPosition(tempNewPos, EditEntityPivot);
+ }
+ }
+ else
+ {
+ newpos = SnapPosition(newpos);
+
+ if (newpos == oldpos) return;
+
+ SelectedItem.SetPosition(newpos, EditEntityPivot);
+ }
SelectedItem.UpdateGraphics(this);
if (ProjectForm != null)
@@ -8014,6 +8034,12 @@ private void SubtitleTimer_Tick(object sender, EventArgs e)
SubtitleTimer.Enabled = false;
SubtitleLabel.Visible = false;
}
+
+ private void RelativeSnapForEachItemToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ RelativeGroundForEachItemToolStripMenuItem.Checked = !RelativeGroundForEachItemToolStripMenuItem.Checked;
+ SnapMultiSelectEach = RelativeGroundForEachItemToolStripMenuItem.Checked;
+ }
}
public enum WorldControlMode
diff --git a/CodeWalker/WorldForm.resx b/CodeWalker/WorldForm.resx
index 58c461c37..c429d88a8 100644
--- a/CodeWalker/WorldForm.resx
+++ b/CodeWalker/WorldForm.resx
@@ -250,7 +250,7 @@ ufo
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
- vQAADr0BR/uQrQAAAThJREFUOE+dk01ugzAQhTlBj+MDIJC4A1yEa7DMnlWaSiAu0ZI7BNi0XaRpF7Bg
+ vAAADrwBlbxySQAAAThJREFUOE+dk01ugzAQhTlBj+MDIJC4A1yEa7DMnlWaSiAu0ZI7BNi0XaRpF7Bg
4/pzbMsQ0qod6SX2zHvPP4yDdUzTJBR2CieF2YAxOWFot6GKDwrlMAyyKAqZZZkMw1AjTVOdowYHrpFd
w4if67p2os/L1wI2DwfuwkRNSitu2+NdA1szJqUVC7ZGYb9/dOQtA/6bptFjcxyBwY7zkfwL0KDF4ESC
7bHCx/miCf7qYJ1jjjYYx3Fm0nfDXfJWzhjMzuBweJJvr++b5K1dOQN7hP9AH0H96EvM83zh7q+2zsH1
From f0b7120fbfb821822aaba6a60049531f2eee8cdc Mon Sep 17 00:00:00 2001
From: TheGamerzs <44209534+TheGamerzs@users.noreply.github.com>
Date: Sat, 5 Apr 2025 13:01:40 +0100
Subject: [PATCH 2/2] feat: add options for ground snap
---
CodeWalker/App.config | 6 +
CodeWalker/Properties/Settings.Designer.cs | 26 +++-
CodeWalker/Properties/Settings.settings | 6 +
CodeWalker/WorldForm.Designer.cs | 150 +++++++++++++++------
CodeWalker/WorldForm.cs | 26 +++-
CodeWalker/WorldForm.resx | 51 +++----
6 files changed, 196 insertions(+), 69 deletions(-)
diff --git a/CodeWalker/App.config b/CodeWalker/App.config
index 92333c5b9..192f9a6be 100644
--- a/CodeWalker/App.config
+++ b/CodeWalker/App.config
@@ -264,6 +264,12 @@
False
+
+ 20
+
+
+ 3
+
diff --git a/CodeWalker/Properties/Settings.Designer.cs b/CodeWalker/Properties/Settings.Designer.cs
index 0f3be0473..4994de5b2 100644
--- a/CodeWalker/Properties/Settings.Designer.cs
+++ b/CodeWalker/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace CodeWalker.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.13.0.0")]
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -986,5 +986,29 @@ public bool GTAGen9 {
this["GTAGen9"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("20")]
+ public float SnapGroundDown {
+ get {
+ return ((float)(this["SnapGroundDown"]));
+ }
+ set {
+ this["SnapGroundDown"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("3")]
+ public float SnapGroundUp {
+ get {
+ return ((float)(this["SnapGroundUp"]));
+ }
+ set {
+ this["SnapGroundUp"] = value;
+ }
+ }
}
}
diff --git a/CodeWalker/Properties/Settings.settings b/CodeWalker/Properties/Settings.settings
index cda837fff..70e742726 100644
--- a/CodeWalker/Properties/Settings.settings
+++ b/CodeWalker/Properties/Settings.settings
@@ -255,5 +255,11 @@
False
+
+ 20
+
+
+ 3
+
\ No newline at end of file
diff --git a/CodeWalker/WorldForm.Designer.cs b/CodeWalker/WorldForm.Designer.cs
index a42a98423..b164f4e07 100644
--- a/CodeWalker/WorldForm.Designer.cs
+++ b/CodeWalker/WorldForm.Designer.cs
@@ -159,8 +159,12 @@ private void InitializeComponent()
this.label14 = new System.Windows.Forms.Label();
this.OptionsHelpersTabPage = new System.Windows.Forms.TabPage();
this.SnapAngleUpDown = new System.Windows.Forms.NumericUpDown();
- this.label33 = new System.Windows.Forms.Label();
+ this.label34 = new System.Windows.Forms.Label();
this.SnapGridSizeUpDown = new System.Windows.Forms.NumericUpDown();
+ this.label35 = new System.Windows.Forms.Label();
+ this.SnapGroundUp_UpDown = new System.Windows.Forms.NumericUpDown();
+ this.label33 = new System.Windows.Forms.Label();
+ this.SnapGroundDown_UpDown = new System.Windows.Forms.NumericUpDown();
this.label26 = new System.Windows.Forms.Label();
this.SkeletonsCheckBox = new System.Windows.Forms.CheckBox();
this.AudioOuterBoundsCheckBox = new System.Windows.Forms.CheckBox();
@@ -348,6 +352,8 @@ private void InitializeComponent()
this.OptionsHelpersTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.SnapAngleUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.SnapGridSizeUpDown)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.SnapGroundUp_UpDown)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.SnapGroundDown_UpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.BoundsRangeTrackBar)).BeginInit();
this.OptionsLightingTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.CloudParamTrackBar)).BeginInit();
@@ -1992,8 +1998,12 @@ private void InitializeComponent()
// OptionsHelpersTabPage
//
this.OptionsHelpersTabPage.Controls.Add(this.SnapAngleUpDown);
- this.OptionsHelpersTabPage.Controls.Add(this.label33);
+ this.OptionsHelpersTabPage.Controls.Add(this.label34);
this.OptionsHelpersTabPage.Controls.Add(this.SnapGridSizeUpDown);
+ this.OptionsHelpersTabPage.Controls.Add(this.label35);
+ this.OptionsHelpersTabPage.Controls.Add(this.SnapGroundUp_UpDown);
+ this.OptionsHelpersTabPage.Controls.Add(this.label33);
+ this.OptionsHelpersTabPage.Controls.Add(this.SnapGroundDown_UpDown);
this.OptionsHelpersTabPage.Controls.Add(this.label26);
this.OptionsHelpersTabPage.Controls.Add(this.SkeletonsCheckBox);
this.OptionsHelpersTabPage.Controls.Add(this.AudioOuterBoundsCheckBox);
@@ -2026,15 +2036,15 @@ private void InitializeComponent()
// SnapAngleUpDown
//
this.SnapAngleUpDown.DecimalPlaces = 1;
- this.SnapAngleUpDown.Location = new System.Drawing.Point(98, 279);
+ this.SnapAngleUpDown.Location = new System.Drawing.Point(110, 332);
this.SnapAngleUpDown.Maximum = new decimal(new int[] {
180,
0,
0,
0});
this.SnapAngleUpDown.Name = "SnapAngleUpDown";
- this.SnapAngleUpDown.Size = new System.Drawing.Size(96, 20);
- this.SnapAngleUpDown.TabIndex = 32;
+ this.SnapAngleUpDown.Size = new System.Drawing.Size(84, 20);
+ this.SnapAngleUpDown.TabIndex = 36;
this.SnapAngleUpDown.Value = new decimal(new int[] {
50,
0,
@@ -2042,19 +2052,19 @@ private void InitializeComponent()
65536});
this.SnapAngleUpDown.ValueChanged += new System.EventHandler(this.SnapAngleUpDown_ValueChanged);
//
- // label33
+ // label34
//
- this.label33.AutoSize = true;
- this.label33.Location = new System.Drawing.Point(4, 281);
- this.label33.Name = "label33";
- this.label33.Size = new System.Drawing.Size(91, 13);
- this.label33.TabIndex = 31;
- this.label33.Text = "Snap angle (deg):";
+ this.label34.AutoSize = true;
+ this.label34.Location = new System.Drawing.Point(4, 334);
+ this.label34.Name = "label34";
+ this.label34.Size = new System.Drawing.Size(91, 13);
+ this.label34.TabIndex = 35;
+ this.label34.Text = "Snap angle (deg):";
//
// SnapGridSizeUpDown
//
this.SnapGridSizeUpDown.DecimalPlaces = 2;
- this.SnapGridSizeUpDown.Location = new System.Drawing.Point(98, 253);
+ this.SnapGridSizeUpDown.Location = new System.Drawing.Point(110, 306);
this.SnapGridSizeUpDown.Maximum = new decimal(new int[] {
1000,
0,
@@ -2066,8 +2076,8 @@ private void InitializeComponent()
0,
131072});
this.SnapGridSizeUpDown.Name = "SnapGridSizeUpDown";
- this.SnapGridSizeUpDown.Size = new System.Drawing.Size(96, 20);
- this.SnapGridSizeUpDown.TabIndex = 30;
+ this.SnapGridSizeUpDown.Size = new System.Drawing.Size(84, 20);
+ this.SnapGridSizeUpDown.TabIndex = 34;
this.SnapGridSizeUpDown.Value = new decimal(new int[] {
100,
0,
@@ -2075,22 +2085,78 @@ private void InitializeComponent()
131072});
this.SnapGridSizeUpDown.ValueChanged += new System.EventHandler(this.SnapGridSizeUpDown_ValueChanged);
//
+ // label35
+ //
+ this.label35.AutoSize = true;
+ this.label35.Location = new System.Drawing.Point(4, 308);
+ this.label35.Name = "label35";
+ this.label35.Size = new System.Drawing.Size(76, 13);
+ this.label35.TabIndex = 33;
+ this.label35.Text = "Snap grid size:";
+ //
+ // SnapGroundUp_UpDown
+ //
+ this.SnapGroundUp_UpDown.DecimalPlaces = 1;
+ this.SnapGroundUp_UpDown.Location = new System.Drawing.Point(110, 279);
+ this.SnapGroundUp_UpDown.Minimum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 65536});
+ this.SnapGroundUp_UpDown.Name = "SnapGroundUp_UpDown";
+ this.SnapGroundUp_UpDown.Size = new System.Drawing.Size(84, 20);
+ this.SnapGroundUp_UpDown.TabIndex = 32;
+ this.SnapGroundUp_UpDown.Value = new decimal(new int[] {
+ 300,
+ 0,
+ 0,
+ 131072});
+ this.SnapGroundUp_UpDown.ValueChanged += new System.EventHandler(this.SnapGroundUp_UpDown_ValueChanged);
+ //
+ // label33
+ //
+ this.label33.AutoSize = true;
+ this.label33.Location = new System.Drawing.Point(4, 281);
+ this.label33.Name = "label33";
+ this.label33.Size = new System.Drawing.Size(86, 13);
+ this.label33.TabIndex = 31;
+ this.label33.Text = "Snap ground up:";
+ //
+ // SnapGroundDown_UpDown
+ //
+ this.SnapGroundDown_UpDown.DecimalPlaces = 1;
+ this.SnapGroundDown_UpDown.Location = new System.Drawing.Point(110, 253);
+ this.SnapGroundDown_UpDown.Minimum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 65536});
+ this.SnapGroundDown_UpDown.Name = "SnapGroundDown_UpDown";
+ this.SnapGroundDown_UpDown.Size = new System.Drawing.Size(84, 20);
+ this.SnapGroundDown_UpDown.TabIndex = 30;
+ this.SnapGroundDown_UpDown.Value = new decimal(new int[] {
+ 2000,
+ 0,
+ 0,
+ 131072});
+ this.SnapGroundDown_UpDown.ValueChanged += new System.EventHandler(this.SnapGroundDown_UpDown_ValueChanged);
+ //
// label26
//
this.label26.AutoSize = true;
this.label26.Location = new System.Drawing.Point(4, 255);
this.label26.Name = "label26";
- this.label26.Size = new System.Drawing.Size(76, 13);
+ this.label26.Size = new System.Drawing.Size(100, 13);
this.label26.TabIndex = 29;
- this.label26.Text = "Snap grid size:";
+ this.label26.Text = "Snap ground down:";
//
// SkeletonsCheckBox
//
this.SkeletonsCheckBox.AutoSize = true;
- this.SkeletonsCheckBox.Location = new System.Drawing.Point(10, 411);
+ this.SkeletonsCheckBox.Location = new System.Drawing.Point(10, 466);
this.SkeletonsCheckBox.Name = "SkeletonsCheckBox";
this.SkeletonsCheckBox.Size = new System.Drawing.Size(101, 17);
- this.SkeletonsCheckBox.TabIndex = 38;
+ this.SkeletonsCheckBox.TabIndex = 42;
this.SkeletonsCheckBox.Text = "Show skeletons";
this.SkeletonsCheckBox.UseVisualStyleBackColor = true;
this.SkeletonsCheckBox.CheckedChanged += new System.EventHandler(this.SkeletonsCheckBox_CheckedChanged);
@@ -2100,10 +2166,10 @@ private void InitializeComponent()
this.AudioOuterBoundsCheckBox.AutoSize = true;
this.AudioOuterBoundsCheckBox.Checked = true;
this.AudioOuterBoundsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
- this.AudioOuterBoundsCheckBox.Location = new System.Drawing.Point(10, 457);
+ this.AudioOuterBoundsCheckBox.Location = new System.Drawing.Point(10, 512);
this.AudioOuterBoundsCheckBox.Name = "AudioOuterBoundsCheckBox";
this.AudioOuterBoundsCheckBox.Size = new System.Drawing.Size(147, 17);
- this.AudioOuterBoundsCheckBox.TabIndex = 40;
+ this.AudioOuterBoundsCheckBox.TabIndex = 44;
this.AudioOuterBoundsCheckBox.Text = "Show audio outer bounds";
this.AudioOuterBoundsCheckBox.UseVisualStyleBackColor = true;
this.AudioOuterBoundsCheckBox.CheckedChanged += new System.EventHandler(this.AudioOuterBoundsCheckBox_CheckedChanged);
@@ -2111,10 +2177,10 @@ private void InitializeComponent()
// PopZonesCheckBox
//
this.PopZonesCheckBox.AutoSize = true;
- this.PopZonesCheckBox.Location = new System.Drawing.Point(10, 388);
+ this.PopZonesCheckBox.Location = new System.Drawing.Point(10, 443);
this.PopZonesCheckBox.Name = "PopZonesCheckBox";
this.PopZonesCheckBox.Size = new System.Drawing.Size(136, 17);
- this.PopZonesCheckBox.TabIndex = 37;
+ this.PopZonesCheckBox.TabIndex = 41;
this.PopZonesCheckBox.Text = "Show population zones";
this.PopZonesCheckBox.UseVisualStyleBackColor = true;
this.PopZonesCheckBox.CheckedChanged += new System.EventHandler(this.PopZonesCheckBox_CheckedChanged);
@@ -2122,10 +2188,10 @@ private void InitializeComponent()
// NavMeshesCheckBox
//
this.NavMeshesCheckBox.AutoSize = true;
- this.NavMeshesCheckBox.Location = new System.Drawing.Point(10, 365);
+ this.NavMeshesCheckBox.Location = new System.Drawing.Point(10, 420);
this.NavMeshesCheckBox.Name = "NavMeshesCheckBox";
this.NavMeshesCheckBox.Size = new System.Drawing.Size(113, 17);
- this.NavMeshesCheckBox.TabIndex = 36;
+ this.NavMeshesCheckBox.TabIndex = 40;
this.NavMeshesCheckBox.Text = "Show nav meshes";
this.NavMeshesCheckBox.UseVisualStyleBackColor = true;
this.NavMeshesCheckBox.CheckedChanged += new System.EventHandler(this.NavMeshesCheckBox_CheckedChanged);
@@ -2133,10 +2199,10 @@ private void InitializeComponent()
// TrainPathsCheckBox
//
this.TrainPathsCheckBox.AutoSize = true;
- this.TrainPathsCheckBox.Location = new System.Drawing.Point(10, 342);
+ this.TrainPathsCheckBox.Location = new System.Drawing.Point(10, 397);
this.TrainPathsCheckBox.Name = "TrainPathsCheckBox";
this.TrainPathsCheckBox.Size = new System.Drawing.Size(105, 17);
- this.TrainPathsCheckBox.TabIndex = 35;
+ this.TrainPathsCheckBox.TabIndex = 39;
this.TrainPathsCheckBox.Text = "Show train paths";
this.TrainPathsCheckBox.UseVisualStyleBackColor = true;
this.TrainPathsCheckBox.CheckedChanged += new System.EventHandler(this.TrainPathsCheckBox_CheckedChanged);
@@ -2146,10 +2212,10 @@ private void InitializeComponent()
this.PathsDepthClipCheckBox.AutoSize = true;
this.PathsDepthClipCheckBox.Checked = true;
this.PathsDepthClipCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
- this.PathsDepthClipCheckBox.Location = new System.Drawing.Point(10, 434);
+ this.PathsDepthClipCheckBox.Location = new System.Drawing.Point(10, 489);
this.PathsDepthClipCheckBox.Name = "PathsDepthClipCheckBox";
this.PathsDepthClipCheckBox.Size = new System.Drawing.Size(102, 17);
- this.PathsDepthClipCheckBox.TabIndex = 39;
+ this.PathsDepthClipCheckBox.TabIndex = 43;
this.PathsDepthClipCheckBox.Text = "Paths depth clip";
this.PathsDepthClipCheckBox.UseVisualStyleBackColor = true;
this.PathsDepthClipCheckBox.CheckedChanged += new System.EventHandler(this.PathsDepthClipCheckBox_CheckedChanged);
@@ -2159,10 +2225,10 @@ private void InitializeComponent()
this.PathBoundsCheckBox.AutoSize = true;
this.PathBoundsCheckBox.Checked = true;
this.PathBoundsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
- this.PathBoundsCheckBox.Location = new System.Drawing.Point(98, 319);
+ this.PathBoundsCheckBox.Location = new System.Drawing.Point(98, 374);
this.PathBoundsCheckBox.Name = "PathBoundsCheckBox";
this.PathBoundsCheckBox.Size = new System.Drawing.Size(86, 17);
- this.PathBoundsCheckBox.TabIndex = 34;
+ this.PathBoundsCheckBox.TabIndex = 38;
this.PathBoundsCheckBox.Text = "Path bounds";
this.PathBoundsCheckBox.UseVisualStyleBackColor = true;
this.PathBoundsCheckBox.CheckedChanged += new System.EventHandler(this.PathBoundsCheckBox_CheckedChanged);
@@ -2244,10 +2310,10 @@ private void InitializeComponent()
// PathsCheckBox
//
this.PathsCheckBox.AutoSize = true;
- this.PathsCheckBox.Location = new System.Drawing.Point(10, 319);
+ this.PathsCheckBox.Location = new System.Drawing.Point(10, 374);
this.PathsCheckBox.Name = "PathsCheckBox";
this.PathsCheckBox.Size = new System.Drawing.Size(82, 17);
- this.PathsCheckBox.TabIndex = 33;
+ this.PathsCheckBox.TabIndex = 37;
this.PathsCheckBox.Text = "Show paths";
this.PathsCheckBox.UseVisualStyleBackColor = true;
this.PathsCheckBox.CheckedChanged += new System.EventHandler(this.PathsCheckBox_CheckedChanged);
@@ -2930,7 +2996,7 @@ private void InitializeComponent()
this.ToolbarCameraModeButton});
this.Toolbar.Location = new System.Drawing.Point(1, 0);
this.Toolbar.Name = "Toolbar";
- this.Toolbar.Size = new System.Drawing.Size(585, 25);
+ this.Toolbar.Size = new System.Drawing.Size(554, 25);
this.Toolbar.TabIndex = 6;
this.Toolbar.Text = "toolStrip1";
//
@@ -3429,7 +3495,7 @@ private void InitializeComponent()
// RelativeGroundForEachItemToolStripMenuItem
//
this.RelativeGroundForEachItemToolStripMenuItem.Name = "RelativeGroundForEachItemToolStripMenuItem";
- this.RelativeGroundForEachItemToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.RelativeGroundForEachItemToolStripMenuItem.Size = new System.Drawing.Size(171, 22);
this.RelativeGroundForEachItemToolStripMenuItem.Text = "Relative Item Snap";
this.RelativeGroundForEachItemToolStripMenuItem.Click += new System.EventHandler(this.RelativeSnapForEachItemToolStripMenuItem_Click);
//
@@ -3695,6 +3761,8 @@ private void InitializeComponent()
this.OptionsHelpersTabPage.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.SnapAngleUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.SnapGridSizeUpDown)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.SnapGroundUp_UpDown)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.SnapGroundDown_UpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.BoundsRangeTrackBar)).EndInit();
this.OptionsLightingTabPage.ResumeLayout(false);
this.OptionsLightingTabPage.PerformLayout();
@@ -3961,8 +4029,6 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem ToolbarSnapToGroundButton;
private System.Windows.Forms.ToolStripMenuItem ToolbarSnapToGridButton;
private System.Windows.Forms.ToolStripMenuItem ToolbarSnapToGroundGridButton;
- private System.Windows.Forms.NumericUpDown SnapGridSizeUpDown;
- private System.Windows.Forms.Label label26;
private System.Windows.Forms.CheckBox RenderEntitiesCheckBox;
private System.Windows.Forms.ToolStripMenuItem ToolbarSelectOcclusionButton;
private System.Windows.Forms.CheckBox CarGeneratorsCheckBox;
@@ -3978,8 +4044,6 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem ToolbarNewYbnButton;
private System.Windows.Forms.ToolStripMenuItem ToolbarNewYtypButton;
private System.Windows.Forms.ToolStripMenuItem ToolbarOpenFolderButton;
- private System.Windows.Forms.NumericUpDown SnapAngleUpDown;
- private System.Windows.Forms.Label label33;
private System.Windows.Forms.ToolStripMenuItem ToolbarRotationSnappingButton;
private System.Windows.Forms.ToolStripMenuItem ToolbarRotationSnappingOffButton;
private System.Windows.Forms.ToolStripMenuItem ToolbarRotationSnapping1Button;
@@ -3998,5 +4062,13 @@ private void InitializeComponent()
private System.Windows.Forms.CheckBox SavePositionCheckBox;
private System.Windows.Forms.ToolStripMenuItem multiSelectionToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem RelativeGroundForEachItemToolStripMenuItem;
+ private System.Windows.Forms.NumericUpDown SnapAngleUpDown;
+ private System.Windows.Forms.Label label34;
+ private System.Windows.Forms.NumericUpDown SnapGridSizeUpDown;
+ private System.Windows.Forms.Label label35;
+ private System.Windows.Forms.NumericUpDown SnapGroundUp_UpDown;
+ private System.Windows.Forms.Label label33;
+ private System.Windows.Forms.NumericUpDown SnapGroundDown_UpDown;
+ private System.Windows.Forms.Label label26;
}
}
\ No newline at end of file
diff --git a/CodeWalker/WorldForm.cs b/CodeWalker/WorldForm.cs
index cd91ec053..c222980c1 100644
--- a/CodeWalker/WorldForm.cs
+++ b/CodeWalker/WorldForm.cs
@@ -187,6 +187,8 @@ public partial class WorldForm : Form, DXForm
WorldSnapMode SnapMode = WorldSnapMode.None;
WorldSnapMode SnapModePrev = WorldSnapMode.Ground;//also the default snap mode
+ float SnapGroundDown = 20.0f;
+ float SnapGroundUp = 3.0f;
float SnapGridSize = 1.0f;
public bool SnapMultiSelectEach = false;
@@ -1718,17 +1720,15 @@ private void UpdateWidgets()
private Vector3 GetGroundPoint(Vector3 p)
{
- float uplimit = 3.0f;
- float downlimit = 20.0f;
Ray ray = new Ray(p, new Vector3(0, 0, -1.0f));
ray.Position.Z += 0.1f;
- SpaceRayIntersectResult hit = space.RayIntersect(ray, downlimit);
+ SpaceRayIntersectResult hit = space.RayIntersect(ray, SnapGroundDown);
if (hit.Hit)
{
return hit.Position;
}
- ray.Position.Z += uplimit;
- hit = space.RayIntersect(ray, downlimit);
+ ray.Position.Z += SnapGroundUp;
+ hit = space.RayIntersect(ray, SnapGroundDown);
if (hit.Hit)
{
return hit.Position;
@@ -1774,6 +1774,8 @@ private void Widget_OnPositionChange(Vector3 newpos, Vector3 oldpos)
item.SetPosition(tempNewPos, EditEntityPivot);
}
+
+ SelectedItem.MultipleSelectionCenter = newpos;
}
else
{
@@ -4842,6 +4844,8 @@ private void LoadSettings()
BoundsRangeTrackBar.Value = s.BoundsRange;
ErrorConsoleCheckBox.Checked = s.ShowErrorConsole;
StatusBarCheckBox.Checked = s.ShowStatusBar;
+ SnapGroundDown_UpDown.Value=(decimal)s.SnapGroundDown;
+ SnapGroundUp_UpDown.Value = (decimal)s.SnapGroundUp;
SnapGridSizeUpDown.Value = (decimal)s.SnapGridSize;
SetRotationSnapping(s.SnapRotationDegrees);
TimeOfDayTrackBar.Value = s.TimeOfDay;
@@ -4892,6 +4896,8 @@ private void SaveSettings()
s.BoundsRange = BoundsRangeTrackBar.Value;
s.ShowErrorConsole = ErrorConsoleCheckBox.Checked;
s.ShowStatusBar = StatusBarCheckBox.Checked;
+ s.SnapGroundDown = (float)SnapGroundDown_UpDown.Value;
+ s.SnapGroundUp = (float)SnapGroundUp_UpDown.Value;
s.SnapRotationDegrees = (float)SnapAngleUpDown.Value;
s.SnapGridSize = (float)SnapGridSizeUpDown.Value;
s.LODLights = LODLightsCheckBox.Checked;
@@ -8000,6 +8006,16 @@ private void CloudParamComboBox_KeyPress(object sender, KeyPressEventArgs e)
e.Handled = true;
}
+ private void SnapGroundDown_UpDown_ValueChanged(object sender, EventArgs e)
+ {
+ SnapGroundDown = (float)SnapGroundDown_UpDown.Value;
+ }
+
+ private void SnapGroundUp_UpDown_ValueChanged(object sender, EventArgs e)
+ {
+ SnapGroundUp = (float)SnapGroundUp_UpDown.Value;
+ }
+
private void SnapGridSizeUpDown_ValueChanged(object sender, EventArgs e)
{
SnapGridSize = (float)SnapGridSizeUpDown.Value;
diff --git a/CodeWalker/WorldForm.resx b/CodeWalker/WorldForm.resx
index c429d88a8..53db388f0 100644
--- a/CodeWalker/WorldForm.resx
+++ b/CodeWalker/WorldForm.resx
@@ -163,6 +163,9 @@ ufo
559, 17
+
+ 559, 17
+
@@ -237,6 +240,14 @@ ufo
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB4SURBVDhP3ZC7DcAgDEQZKTMwHOvSIFriS7BlEB+HMic9
QJbvFThLUkpXzjkSpaeuzMPlEELx3jdsBauyCHBY6UWYPQI93KEljQD3jL6EGzN6x0bASyNYwkKU8Udm
gd6TMnIikDJyIqjVNz8T7FgKrAwFX6lVinM3aJ05lWDPRRcAAAAASUVORK5CYII=
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0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