You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Renamed lots of UI text and tooltips to improve UX - Hid the 'Propagate' and 'Per Instance' buttons until this feature is properly supported - Flipped radio buttons so they're on top of 'instant' buttons - Renamed 'Any' to 'Mesh' in the top level UI (meaning, 'any part of the mesh') - Added group name title text for 'Mesh', 'Polygon', 'Edge', 'Vertex' - Reversed order of top level buttons, removed 'Select' label - 'Remove Subdivision Level' now greys out if there is nothing already subdivided - Fixed lots of non-unity build issues #codereview richard.talbotwatkin #rb none [CL 3509887 by Mike Fricker in Dev-Geometry branch]
106 lines
3.4 KiB
C++
106 lines
3.4 KiB
C++
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "ExtendEdge.h"
|
|
#include "IMeshEditorModeEditingContract.h"
|
|
#include "IMeshEditorModeUIContract.h"
|
|
#include "UICommandInfo.h"
|
|
#include "EditableMesh.h"
|
|
#include "MeshElement.h"
|
|
#include "MultiBoxBuilder.h"
|
|
#include "UICommandList.h"
|
|
#include "ViewportInteractor.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "MeshEditorMode"
|
|
|
|
|
|
void UExtendEdgeCommand::RegisterUICommand( FBindingContext* BindingContext )
|
|
{
|
|
UI_COMMAND_EXT( BindingContext, /* Out */ UICommandInfo, "ExtendEdge", "Extend", "Creates a new polygon from the selected edge by clicking and dragging outward from an edge.", EUserInterfaceActionType::RadioButton, FInputChord() );
|
|
}
|
|
|
|
|
|
void UExtendEdgeCommand::ApplyDuringDrag( IMeshEditorModeEditingContract& MeshEditorMode, UViewportInteractor* ViewportInteractor )
|
|
{
|
|
// Extend edge
|
|
static TMap< UEditableMesh*, TArray<FMeshElement> > MeshesWithEdgesToExtend;
|
|
MeshEditorMode.GetSelectedMeshesAndEdges( /* Out */ MeshesWithEdgesToExtend );
|
|
|
|
if( MeshesWithEdgesToExtend.Num() > 0 )
|
|
{
|
|
MeshEditorMode.DeselectAllMeshElements();
|
|
|
|
static TArray<FMeshElement> MeshElementsToSelect;
|
|
MeshElementsToSelect.Reset();
|
|
|
|
for( auto& MeshAndEdges : MeshesWithEdgesToExtend )
|
|
{
|
|
UEditableMesh* EditableMesh = MeshAndEdges.Key;
|
|
const TArray<FMeshElement>& EdgeElementsToExtend = MeshAndEdges.Value;
|
|
|
|
static TArray<FEdgeID> EdgeIDsToExtend;
|
|
EdgeIDsToExtend.Reset();
|
|
|
|
for( const FMeshElement& EdgeElementToExtend : EdgeElementsToExtend )
|
|
{
|
|
const FEdgeID EdgeID( EdgeElementToExtend.ElementAddress.ElementID );
|
|
|
|
EdgeIDsToExtend.Add( EdgeID );
|
|
}
|
|
|
|
|
|
verify( !EditableMesh->AnyChangesToUndo() );
|
|
|
|
{
|
|
// Extend the edge
|
|
const bool bWeldNeighbors = true; // @todo mesheditor urgent extrude: Make optional somehow
|
|
static TArray<FEdgeID> NewExtendedEdgeIDs;
|
|
NewExtendedEdgeIDs.Reset();
|
|
EditableMesh->ExtendEdges( EdgeIDsToExtend, bWeldNeighbors, /* Out */ NewExtendedEdgeIDs );
|
|
|
|
// Make sure the new edges are selected
|
|
for( int32 NewEdgeNumber = 0; NewEdgeNumber < NewExtendedEdgeIDs.Num(); ++NewEdgeNumber )
|
|
{
|
|
const FEdgeID NewExtendedEdgeID = NewExtendedEdgeIDs[ NewEdgeNumber ];
|
|
|
|
const FMeshElement& MeshElement = EdgeElementsToExtend[ NewEdgeNumber ];
|
|
|
|
FMeshElement NewExtendedEdgeMeshElement;
|
|
{
|
|
NewExtendedEdgeMeshElement.Component = MeshElement.Component;
|
|
NewExtendedEdgeMeshElement.ElementAddress = MeshElement.ElementAddress;
|
|
NewExtendedEdgeMeshElement.ElementAddress.ElementID = NewExtendedEdgeID;
|
|
}
|
|
|
|
// Queue selection of this new element. We don't want it to be part of the current action.
|
|
MeshElementsToSelect.Add( NewExtendedEdgeMeshElement );
|
|
}
|
|
}
|
|
|
|
MeshEditorMode.TrackUndo( EditableMesh, EditableMesh->MakeUndo() );
|
|
}
|
|
|
|
MeshEditorMode.SelectMeshElements( MeshElementsToSelect );
|
|
}
|
|
}
|
|
|
|
|
|
void UExtendEdgeCommand::AddToVRRadialMenuActionsMenu( IMeshEditorModeUIContract& MeshEditorMode, FMenuBuilder& MenuBuilder, TSharedPtr<FUICommandList> CommandList, const FName TEMPHACK_StyleSetName, class UVREditorMode* VRMode )
|
|
{
|
|
if( MeshEditorMode.GetMeshElementSelectionMode() == EEditableMeshElementType::Edge )
|
|
{
|
|
MenuBuilder.AddMenuEntry(
|
|
LOCTEXT( "VRExtendEdge", "Extend" ),
|
|
FText(),
|
|
FSlateIcon( TEMPHACK_StyleSetName, "MeshEditorMode.EdgeExtend" ),
|
|
MakeUIAction( MeshEditorMode ),
|
|
NAME_None,
|
|
EUserInterfaceActionType::ToggleButton
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|
|
|