Visual Mode: added "Apply Camera Rotation To Things" action that applies the Visual Mode's current camera pitch and yaw to the selected things. No default key bound

This commit is contained in:
biwa 2020-09-27 14:46:16 +02:00
parent 8064bc63b7
commit e6a7751c2d
2 changed files with 33 additions and 0 deletions

View file

@ -1445,3 +1445,13 @@ archbetweenhandles
allowmouse = true; allowmouse = true;
allowscroll = false; allowscroll = false;
} }
applycamerarotationtothings
{
title = "Apply Camera Rotation To Things";
category = "visual";
description = "Applies the Visual Mode's current camera pitch and yaw to the selected things.";
allowkeys = true;
allowmouse = true;
allowscroll = false;
}

View file

@ -4318,6 +4318,29 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
/// <summary>
/// Applies the Visual Mode's current camera pitch and yaw to the selected things
/// </summary>
[BeginAction("applycamerarotationtothings")]
public void ApplyCameraRotationToThings()
{
List<Thing> things = GetSelectedThings();
if(things.Count == 0)
{
General.Interface.DisplayStatus(StatusType.Warning, "Can't apply camera rotation to things: no things selected.");
return;
}
General.Map.UndoRedo.CreateUndo("Apply camera rotation to things");
foreach (Thing t in things)
{
t.Rotate(General.Map.VisualCamera.AngleXY);
t.SetPitch((int)Angle2D.RadToDeg(-General.Map.VisualCamera.AngleZ));
}
}
#endregion #endregion
#region ================== Texture Alignment #region ================== Texture Alignment