Prevent FOF sides from being offset/scaled multiple times at once

This commit is contained in:
spherallic 2024-07-29 15:35:03 +02:00
parent 0fa960c868
commit 35ca4797c8
2 changed files with 43 additions and 9 deletions

View file

@ -3556,7 +3556,23 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
PreAction(UndoGroup.TextureOffsetChange); PreAction(UndoGroup.TextureOffsetChange);
IEnumerable<IVisualEventReceiver> objs = RemoveDuplicateSidedefs(GetSelectedObjects(true, true, false, false, false)); IEnumerable<IVisualEventReceiver> objs = RemoveDuplicateSidedefs(GetSelectedObjects(true, true, false, false, false));
foreach(IVisualEventReceiver i in objs) i.OnChangeTextureOffset(ox, oy, true);
// sphere: Have to keep track of processed FOF sides, so they don't get Y offset moved multiple times
HashSet<Sidedef> processed = new HashSet<Sidedef>();
foreach (IVisualEventReceiver i in objs)
{
if (i is VisualMiddle3D && oy != 0)
{
VisualMiddle3D vm = i as VisualMiddle3D;
if (!processed.Contains(vm.ExtraFloor.Linedef.Front))
{
processed.Add(vm.ExtraFloor.Linedef.Front);
i.OnChangeTextureOffset(ox, oy, true);
}
}
else
i.OnChangeTextureOffset(ox, oy, true);
}
PostAction(); PostAction();
} }
@ -3577,8 +3593,25 @@ namespace CodeImp.DoomBuilder.BuilderModes
private void ScaleTexture(int incrementx, int incrementy) private void ScaleTexture(int incrementx, int incrementy)
{ {
PreAction(UndoGroup.TextureScaleChange); PreAction(UndoGroup.TextureScaleChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false, false); IEnumerable<IVisualEventReceiver> objs = RemoveDuplicateSidedefs(GetSelectedObjects(true, true, true, false, false));
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(incrementx, incrementy);
// sphere: Have to keep track of processed FOF sides, so they don't get scaled multiple times
HashSet<Sidedef> processed = new HashSet<Sidedef>();
foreach (IVisualEventReceiver i in objs)
{
if (i is VisualMiddle3D)
{
VisualMiddle3D vm = i as VisualMiddle3D;
if (!processed.Contains(vm.ExtraFloor.Linedef.Front))
{
processed.Add(vm.ExtraFloor.Linedef.Front);
i.OnChangeScale(incrementx, incrementy);
}
}
else
i.OnChangeScale(incrementx, incrementy);
}
PostAction(); PostAction();
} }

View file

@ -46,6 +46,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
#endregion #endregion
#region ================== Properties #region ================== Properties
public Effect3DFloor ExtraFloor { get { return extrafloor; } }
#endregion #endregion