58 lines
2.1 KiB
C++
58 lines
2.1 KiB
C++
// Copyright 2016 Mookie. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Widgets/SCompoundWidget.h"
|
|
#include "Widgets/DeclarativeSyntaxSupport.h"
|
|
#include "EBBulletProperties.h"
|
|
#include "EBMaterialResponseMap.h"
|
|
|
|
class SButton;
|
|
class STextBlock;
|
|
|
|
class EASYBALLISTICSEDITOR_API SEBJsonImportExportTool : public SCompoundWidget
|
|
{
|
|
public:
|
|
SLATE_BEGIN_ARGS(SEBJsonImportExportTool) {}
|
|
SLATE_END_ARGS()
|
|
|
|
void Construct(const FArguments& InArgs);
|
|
|
|
private:
|
|
// Button handlers
|
|
FReply OnExportBulletPropertiesClicked();
|
|
FReply OnImportBulletPropertiesClicked();
|
|
FReply OnExportMaterialResponseClicked();
|
|
FReply OnImportMaterialResponseClicked();
|
|
|
|
// File dialog helpers
|
|
bool OpenFileDialog(const FString& DialogTitle, const FString& DefaultPath, const FString& FileTypes, FString& OutFilename);
|
|
bool SaveFileDialog(const FString& DialogTitle, const FString& DefaultPath, const FString& FileTypes, FString& OutFilename);
|
|
|
|
// JSON conversion functions
|
|
TSharedPtr<FJsonObject> BulletPropertiesToJson(const FMathematicalBulletProperties& Properties);
|
|
bool JsonToBulletProperties(const TSharedPtr<FJsonObject>& JsonObject, FMathematicalBulletProperties& OutProperties);
|
|
|
|
TSharedPtr<FJsonObject> MaterialResponseToJson(const FEBMaterialResponseMapEntry& Entry);
|
|
bool JsonToMaterialResponse(const TSharedPtr<FJsonObject>& JsonObject, FEBMaterialResponseMapEntry& OutEntry);
|
|
|
|
TSharedPtr<FJsonObject> MaterialPropertiesToJson(const FMathematicalMaterialProperties& Properties);
|
|
bool JsonToMaterialProperties(const TSharedPtr<FJsonObject>& JsonObject, FMathematicalMaterialProperties& OutProperties);
|
|
|
|
// Status text
|
|
TSharedPtr<STextBlock> StatusText;
|
|
void UpdateStatus(const FString& Message);
|
|
};
|
|
|
|
class EASYBALLISTICSEDITOR_API FEBJsonImportExportTool
|
|
{
|
|
public:
|
|
static void RegisterMenus();
|
|
static void UnregisterMenus();
|
|
static void OpenImportExportWindow();
|
|
|
|
private:
|
|
static TSharedRef<SDockTab> OnSpawnImportExportTab(const class FSpawnTabArgs& SpawnTabArgs);
|
|
static const FName ImportExportTabName;
|
|
}; |