Files
UnrealEngineUWP/Engine/Plugins/Editor/MeshEditor/Source/PolygonModeling/SelectAllGeometryCollectionCommand.cpp
Ryan Durand 28d3d740dd (Integrating from Dev-EngineMerge to Main)
Second batch of remaining Engine copyright updates.

#rnx
#rb none
#jira none

[CL 10871196 by Ryan Durand in Main branch]
2019-12-27 07:44:07 -05:00

75 lines
2.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SelectAllGeometryCollectionCommand.h"
#include "Editor.h"
#include "EditorSupportDelegates.h"
#include "Engine/Selection.h"
#include "Framework/Commands/UIAction.h"
#include "GeometryCollection/GeometryCollection.h"
#include "GeometryCollection/GeometryCollectionClusteringUtility.h"
#include "GeometryCollection/GeometryCollectionComponent.h"
#include "GeometryCollection/GeometryCollectionObject.h"
#include "IMeshEditorModeEditingContract.h"
#include "IMeshEditorModeUIContract.h"
#include "MeshFractureSettings.h"
#include "ScopedTransaction.h"
#define LOCTEXT_NAMESPACE "SelectedGeometryCollectionCommand"
DEFINE_LOG_CATEGORY(LogSelectAllGeometryCommand);
FUIAction USelectAllGeometryCollectionCommand::MakeUIAction(class IMeshEditorModeUIContract& MeshEditorMode)
{
FUIAction UIAction;
{
FExecuteAction ExecuteAction(FExecuteAction::CreateLambda([&MeshEditorMode, this]
{
this->Execute(MeshEditorMode);
}));
UIAction = FUIAction(
ExecuteAction,
FCanExecuteAction::CreateLambda([&MeshEditorMode] { return (MeshEditorMode.GetSelectedEditableMeshes().Num() > 0); }));
}
return UIAction;
}
void USelectAllGeometryCollectionCommand::RegisterUICommand( FBindingContext* BindingContext )
{
UI_COMMAND_EXT( BindingContext, /* Out */ UICommandInfo, "SelectAllMeshClusters", "Select All", "Select All Mesh Clusters.", EUserInterfaceActionType::Button, FInputChord() );
}
void USelectAllGeometryCollectionCommand::Execute(IMeshEditorModeEditingContract& MeshEditorMode)
{
if (MeshEditorMode.GetActiveAction() != NAME_None)
{
return;
}
if (MeshEditorMode.GetSelectedEditableMeshes().Num() == 0)
{
return;
}
FScopedTransaction Transaction(LOCTEXT("SelectAllMeshChunks", "Select All Mesh Chunks"));
MeshEditorMode.CommitSelectedMeshes();
TArray<UEditableMesh*> SelectedMeshes = MeshEditorMode.GetSelectedEditableMeshes();
for (UEditableMesh* Mesh : SelectedMeshes)
{
UGeometryCollectionComponent* GeometryCollectionComponent = GetGeometryCollectionComponent(Mesh);
if (GeometryCollectionComponent)
{
FScopedColorEdit EditBoneColor = GeometryCollectionComponent->EditBoneSelection();
EditBoneColor.SelectBones(GeometryCollection::ESelectionMode::AllGeometry);
}
}
}
#undef LOCTEXT_NAMESPACE