// Copyright Epic Games, Inc. All Rights Reserved. #include "ModSupportEditorCommands.h" #include "Interfaces/IPluginManager.h" #define LOCTEXT_NAMESPACE "FModSupportEditorModule" void FModSupportEditorCommands::RegisterCommands() { UI_COMMAND(CreateModAction, "Create Mod", "Create a new Mod package in a mod plugin", EUserInterfaceActionType::Button, FInputGesture()); UI_COMMAND(PackageModAction, "Package Mod", "Share and distribute your Mod", EUserInterfaceActionType::Button, FInputGesture()); } TArray> FModSupportEditorCommands::RegisterModCommands(const TArray>& ModList) const { TArray> AvailableModActions; AvailableModActions.Reserve(ModList.Num()); FModSupportEditorCommands* MutableThis = const_cast(this); for (int32 Index = 0; Index < ModList.Num(); ++Index) { AvailableModActions.Add(TSharedPtr()); TSharedRef Mod = ModList[Index]; FString CommandName = "ModEditor_" + Mod->GetName(); FUICommandInfo::MakeCommandInfo(MutableThis->AsShared(), AvailableModActions[Index], FName(*CommandName), FText::FromString(Mod->GetName()), FText::FromString(Mod->GetBaseDir()), FSlateIcon(), EUserInterfaceActionType::Button, FInputGesture()); } return AvailableModActions; } void FModSupportEditorCommands::UnregisterModCommands(TArray>& UICommands) const { FModSupportEditorCommands* MutableThis = const_cast(this); for (TSharedPtr Command : UICommands) { FUICommandInfo::UnregisterCommandInfo(MutableThis->AsShared(), Command.ToSharedRef()); } } #undef LOCTEXT_NAMESPACE