Skip to content

Commit fef6420

Browse files
committed
feat: snap to ground for each item in multi selection
1 parent fc84a35 commit fef6420

File tree

3 files changed

+52
-6
lines changed

3 files changed

+52
-6
lines changed

CodeWalker/WorldForm.Designer.cs

Lines changed: 22 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CodeWalker/WorldForm.cs

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ public partial class WorldForm : Form, DXForm
189189
WorldSnapMode SnapModePrev = WorldSnapMode.Ground;//also the default snap mode
190190
float SnapGridSize = 1.0f;
191191

192+
public bool SnapMultiSelectEach = false;
192193

193194
public bool EditEntityPivot { get; set; } = false;
194195

@@ -1757,12 +1758,31 @@ private void Widget_OnPositionChange(Vector3 newpos, Vector3 oldpos)
17571758
{
17581759
//called during UpdateWidgets()
17591760

1760-
newpos = SnapPosition(newpos);
1761+
17611762

1762-
if (newpos == oldpos) return;
1763+
if (SnapMultiSelectEach && SelectedItem.MultipleSelectionItems != null)
1764+
{
1765+
for (int i = 0; i < SelectedItem.MultipleSelectionItems.Length; i++)
1766+
{
1767+
MapSelection item = SelectedItem.MultipleSelectionItems[i];
1768+
Vector3 posToGround = item.WidgetPosition;
1769+
posToGround.Z = newpos.Z;
1770+
1771+
Vector3 tempNewPos = SnapPosition(posToGround);
17631772

1764-
SelectedItem.SetPosition(newpos, EditEntityPivot);
1773+
if (tempNewPos == item.WidgetPosition) return;
17651774

1775+
item.SetPosition(tempNewPos, EditEntityPivot);
1776+
}
1777+
}
1778+
else
1779+
{
1780+
newpos = SnapPosition(newpos);
1781+
1782+
if (newpos == oldpos) return;
1783+
1784+
SelectedItem.SetPosition(newpos, EditEntityPivot);
1785+
}
17661786
SelectedItem.UpdateGraphics(this);
17671787

17681788
if (ProjectForm != null)
@@ -8014,6 +8034,12 @@ private void SubtitleTimer_Tick(object sender, EventArgs e)
80148034
SubtitleTimer.Enabled = false;
80158035
SubtitleLabel.Visible = false;
80168036
}
8037+
8038+
private void RelativeSnapForEachItemToolStripMenuItem_Click(object sender, EventArgs e)
8039+
{
8040+
RelativeGroundForEachItemToolStripMenuItem.Checked = !RelativeGroundForEachItemToolStripMenuItem.Checked;
8041+
SnapMultiSelectEach = RelativeGroundForEachItemToolStripMenuItem.Checked;
8042+
}
80178043
}
80188044

80198045
public enum WorldControlMode

CodeWalker/WorldForm.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ ufo
250250
<data name="ToolbarWorldSpaceButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
251251
<value>
252252
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
253-
vQAADr0BR/uQrQAAAThJREFUOE+dk01ugzAQhTlBj+MDIJC4A1yEa7DMnlWaSiAu0ZI7BNi0XaRpF7Bg
253+
vAAADrwBlbxySQAAAThJREFUOE+dk01ugzAQhTlBj+MDIJC4A1yEa7DMnlWaSiAu0ZI7BNi0XaRpF7Bg
254254
4/pzbMsQ0qod6SX2zHvPP4yDdUzTJBR2CieF2YAxOWFot6GKDwrlMAyyKAqZZZkMw1AjTVOdowYHrpFd
255255
w4if67p2os/L1wI2DwfuwkRNSitu2+NdA1szJqUVC7ZGYb9/dOQtA/6bptFjcxyBwY7zkfwL0KDF4ESC
256256
7bHCx/miCf7qYJ1jjjYYx3Fm0nfDXfJWzhjMzuBweJJvr++b5K1dOQN7hP9AH0H96EvM83zh7q+2zsH1

0 commit comments

Comments
 (0)