- Slope handles are not shown anymore when showing selection is disabled

- Smart pivot handles are now shown for the highlighted slope handle
This commit is contained in:
biwa 2020-02-24 12:54:59 +01:00
parent 37e8154556
commit afef349220
3 changed files with 35 additions and 9 deletions

View file

@ -640,7 +640,7 @@ namespace CodeImp.DoomBuilder.Rendering
private void RenderSlopeHandles()
{
if (visualslopehandles == null) return;
if (visualslopehandles == null || !showselection) return;
graphics.SetAlphaBlendEnable(true);
graphics.SetAlphaTestEnable(false);

View file

@ -471,12 +471,32 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Should we update the info on panels?
bool updateinfo = (newtarget.picked != target.picked);
if (updateinfo)
{
if (newtarget.picked is VisualSidedefSlope)
{
// Get the smart pivot handle for the targeted slope handle, so that it can be drawn
VisualSidedefSlope handle = VisualSidedefSlope.GetSmartPivotHandle((VisualSidedefSlope)newtarget.picked, this);
if (handle != null)
handle.SmartPivot = true;
}
else if(target.picked is VisualSidedefSlope)
{
// Clear smart pivot handles, otherwise it will keep being displayed
foreach (KeyValuePair<Sector, List<VisualSlope>> kvp in allslopehandles)
foreach (VisualSidedefSlope checkhandle in kvp.Value)
checkhandle.SmartPivot = false;
}
}
// Apply new target
target = newtarget;
// Show target info
if(updateinfo) ShowTargetInfo();
if (updateinfo)
ShowTargetInfo();
}
// This shows the picked target information
@ -1433,7 +1453,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
List<VisualSlope> handles = new List<VisualSlope>();
foreach (KeyValuePair<Sector, List<VisualSlope>> kvp in allslopehandles)
foreach (VisualSlope handle in kvp.Value)
if (handle.Selected || handle.Pivot || /* handle.SmartPivot || */ target.picked == handle)
if (handle.Selected || handle.Pivot || handle.SmartPivot || target.picked == handle)
handles.Add(handle);
renderer.SetVisualSlopeHandles(handles);
@ -4003,7 +4023,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (pickingmode != PickingMode.SlopeHandles)
pickingmode = PickingMode.SlopeHandles;
else
{
pickingmode = PickingMode.Default;
// Clear smart pivot handles, otherwise it will keep being displayed
foreach (KeyValuePair<Sector, List<VisualSlope>> kvp in allslopehandles)
foreach (VisualSidedefSlope checkhandle in kvp.Value)
checkhandle.SmartPivot = false;
}
}
[BeginAction("slopebetweenhandles")]

View file

@ -164,7 +164,7 @@ namespace CodeImp.DoomBuilder.VisualModes
/// </summary>
/// <param name="starthandle">The slope handle to start from (the one we need to find a pivot handle for)</param>
/// <returns></returns>
internal VisualSidedefSlope GetSmartPivotHandle(VisualSidedefSlope starthandle)
public static VisualSidedefSlope GetSmartPivotHandle(VisualSidedefSlope starthandle, BaseVisualMode mode)
{
VisualSidedefSlope handle = starthandle;
List<VisualSidedefSlope> potentialhandles = new List<VisualSidedefSlope>();
@ -207,9 +207,6 @@ namespace CodeImp.DoomBuilder.VisualModes
if (handle == starthandle)
return null;
if(handle != null)
handle.SmartPivot = true;
return handle;
}
@ -298,12 +295,14 @@ namespace CodeImp.DoomBuilder.VisualModes
// User didn't set a pivot handle, try to find the smart pivot handle
if(pivothandle == null)
pivothandle = GetSmartPivotHandle(this);
pivothandle = GetSmartPivotHandle(this, mode);
// Still no pivot handle, cancle
if (pivothandle == null)
return;
pivothandle.SmartPivot = true;
mode.CreateUndo("Change slope");
Plane originalplane = level.plane;