Skip to content
Snippets Groups Projects
Commit e1b271e9 authored by Sebastian Pape's avatar Sebastian Pape
Browse files

Initial commit

parents
Branches
No related tags found
No related merge requests found
# Visual Studio 2015 user specific files
.vs/
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
*.ipa
# These project files can be generated by the engine
*.xcodeproj
*.xcworkspace
*.sln
*.suo
*.opensdf
*.sdf
*.VC.db
*.VC.opendb
# Precompiled Assets
SourceArt/**/*.png
SourceArt/**/*.tga
# Binary Files
Binaries/*
Plugins/*/Binaries/*
# Builds
Build/*
# Whitelist PakBlacklist-<BuildConfiguration>.txt files
!Build/*/
Build/*/**
!Build/*/PakBlacklist*.txt
# Don't ignore icon files in Build
!Build/**/*.ico
# Configuration files generated by the Editor
Saved/*
# Compiled source files for the engine to use
Intermediate/*
Plugins/*/Intermediate/*
# Cache files for the editor to use
DerivedDataCache/*
LocalDerivedDataCache/*
\ No newline at end of file
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.0",
"FriendlyName": "CAVELaunchButton",
"Description": "",
"Category": "Other",
"CreatedBy": "",
"CreatedByURL": "",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"CanContainContent": false,
"IsBetaVersion": false,
"EnabledByDefault" : true,
"Modules": [
{
"Name": "CAVELaunchButton",
"Type": "Editor",
"LoadingPhase": "Default"
}
]
}
\ No newline at end of file
Resources/ButtonIcon_40x.png

5.47 KiB

Resources/Icon128.png

14.1 KiB

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class CAVELaunchButton : ModuleRules
{
public CAVELaunchButton(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Projects",
"InputCore",
"UnrealEd",
"LevelEditor",
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "CAVELaunchButton.h"
#include <stdlib.h>
#include "CAVELaunchButtonStyle.h"
#include "CAVELaunchButtonCommands.h"
#include "Misc/MessageDialog.h"
#include "Framework/MultiBox/MultiBoxBuilder.h"
#include "LevelEditor.h"
#define LOCTEXT_NAMESPACE "FCAVELaunchButtonModule"
void FCAVELaunchButtonModule::StartupModule()
{
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
FCAVELaunchButtonStyle::Initialize();
FCAVELaunchButtonStyle::ReloadTextures();
FCAVELaunchButtonCommands::Register();
PluginCommands = MakeShareable(new FUICommandList);
PluginCommands->MapAction(
FCAVELaunchButtonCommands::Get().PluginAction,
FExecuteAction::CreateRaw(this, &FCAVELaunchButtonModule::PluginButtonClicked),
FCanExecuteAction());
FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
{
TSharedPtr<FExtender> ToolbarExtender = MakeShareable(new FExtender);
ToolbarExtender->AddToolBarExtension("Game", EExtensionHook::First, PluginCommands, FToolBarExtensionDelegate::CreateRaw(this, &FCAVELaunchButtonModule::AddToolbarExtension));
LevelEditorModule.GetToolBarExtensibilityManager()->AddExtender(ToolbarExtender);
}
}
void FCAVELaunchButtonModule::ShutdownModule()
{
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.
FCAVELaunchButtonStyle::Shutdown();
FCAVELaunchButtonCommands::Unregister();
}
void FCAVELaunchButtonModule::PluginButtonClicked()
{
int result = system("C:\\test.bat");
}
void FCAVELaunchButtonModule::AddMenuExtension(FMenuBuilder& Builder)
{
Builder.AddMenuEntry(FCAVELaunchButtonCommands::Get().PluginAction);
}
void FCAVELaunchButtonModule::AddToolbarExtension(FToolBarBuilder& Builder)
{
Builder.AddToolBarButton(FCAVELaunchButtonCommands::Get().PluginAction);
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FCAVELaunchButtonModule, CAVELaunchButton)
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "CAVELaunchButtonCommands.h"
#define LOCTEXT_NAMESPACE "FCAVELaunchButtonModule"
void FCAVELaunchButtonCommands::RegisterCommands()
{
UI_COMMAND(PluginAction, "PlayInCAVE", "Launch current project in CAVE", EUserInterfaceActionType::Button, FInputGesture());
}
#undef LOCTEXT_NAMESPACE
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "CAVELaunchButtonStyle.h"
#include "CAVELaunchButton.h"
#include "Framework/Application/SlateApplication.h"
#include "Styling/SlateStyleRegistry.h"
#include "Slate/SlateGameResources.h"
#include "Interfaces/IPluginManager.h"
TSharedPtr< FSlateStyleSet > FCAVELaunchButtonStyle::StyleInstance = NULL;
void FCAVELaunchButtonStyle::Initialize()
{
if (!StyleInstance.IsValid())
{
StyleInstance = Create();
FSlateStyleRegistry::RegisterSlateStyle(*StyleInstance);
}
}
void FCAVELaunchButtonStyle::Shutdown()
{
FSlateStyleRegistry::UnRegisterSlateStyle(*StyleInstance);
ensure(StyleInstance.IsUnique());
StyleInstance.Reset();
}
FName FCAVELaunchButtonStyle::GetStyleSetName()
{
static FName StyleSetName(TEXT("CAVELaunchButtonStyle"));
return StyleSetName;
}
#define IMAGE_BRUSH( RelativePath, ... ) FSlateImageBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ )
#define BOX_BRUSH( RelativePath, ... ) FSlateBoxBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ )
#define BORDER_BRUSH( RelativePath, ... ) FSlateBorderBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ )
#define TTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".ttf") ), __VA_ARGS__ )
#define OTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".otf") ), __VA_ARGS__ )
const FVector2D Icon16x16(16.0f, 16.0f);
const FVector2D Icon20x20(20.0f, 20.0f);
const FVector2D Icon40x40(40.0f, 40.0f);
TSharedRef< FSlateStyleSet > FCAVELaunchButtonStyle::Create()
{
TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("CAVELaunchButtonStyle"));
Style->SetContentRoot(IPluginManager::Get().FindPlugin("CAVELaunchButton")->GetBaseDir() / TEXT("Resources"));
Style->Set("CAVELaunchButton.PluginAction", new IMAGE_BRUSH(TEXT("ButtonIcon_40x"), Icon40x40));
return Style;
}
#undef IMAGE_BRUSH
#undef BOX_BRUSH
#undef BORDER_BRUSH
#undef TTF_FONT
#undef OTF_FONT
void FCAVELaunchButtonStyle::ReloadTextures()
{
if (FSlateApplication::IsInitialized())
{
FSlateApplication::Get().GetRenderer()->ReloadTextureResources();
}
}
const ISlateStyle& FCAVELaunchButtonStyle::Get()
{
return *StyleInstance;
}
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
class FToolBarBuilder;
class FMenuBuilder;
class FCAVELaunchButtonModule : public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
/** This function will be bound to Command. */
void PluginButtonClicked();
private:
void AddToolbarExtension(FToolBarBuilder& Builder);
void AddMenuExtension(FMenuBuilder& Builder);
private:
TSharedPtr<class FUICommandList> PluginCommands;
};
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Framework/Commands/Commands.h"
#include "CAVELaunchButtonStyle.h"
class FCAVELaunchButtonCommands : public TCommands<FCAVELaunchButtonCommands>
{
public:
FCAVELaunchButtonCommands()
: TCommands<FCAVELaunchButtonCommands>(TEXT("CAVELaunchButton"), NSLOCTEXT("Contexts", "CAVELaunchButton", "CAVELaunchButton Plugin"), NAME_None, FCAVELaunchButtonStyle::GetStyleSetName())
{
}
// TCommands<> interface
virtual void RegisterCommands() override;
public:
TSharedPtr< FUICommandInfo > PluginAction;
};
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Styling/SlateStyle.h"
class FCAVELaunchButtonStyle
{
public:
static void Initialize();
static void Shutdown();
/** reloads textures used by slate renderer */
static void ReloadTextures();
/** @return The Slate style set for the Shooter game */
static const ISlateStyle& Get();
static FName GetStyleSetName();
private:
static TSharedRef< class FSlateStyleSet > Create();
private:
static TSharedPtr< class FSlateStyleSet > StyleInstance;
};
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment