Fix this file encoding bullshit hopefully once and for all and get a commit where the state machine asset can be opened without crashing the editor

This commit is contained in:
Kevin Poretti 2022-04-02 23:13:12 -04:00
parent 965322a4ae
commit 1627d08314
9 changed files with 139 additions and 139 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,91 +1,91 @@
#include "States/SNGStateMachineEditor.h" #include "States/SNGStateMachineEditor.h"
#define LOCTEXT_NAMESPACE "SNGStateMachineEditor" #define LOCTEXT_NAMESPACE "SNGStateMachineEditor"
const FName SNGStateMachineEditorAppName = FName(TEXT("SNGStateMachineEditorAppName")); const FName SNGStateMachineEditorAppName = FName(TEXT("SNGStateMachineEditorAppName"));
void FSNGStateMachineEditor::RegisterTabSpawners(const TSharedRef<FTabManager>& InTabManager) void FSNGStateMachineEditor::RegisterTabSpawners(const TSharedRef<FTabManager>& InTabManager)
{ {
/* /*
WorkspaceMenuCategory = TabManager->AddLocalWorkspaceMenuCategory(LOCTEXT("WorkspaceMenu_SNGStateMachineEditor", "SNG State Machine Editor")); WorkspaceMenuCategory = TabManager->AddLocalWorkspaceMenuCategory(LOCTEXT("WorkspaceMenu_SNGStateMachineEditor", "SNG State Machine Editor"));
TSharedRef<FWorkspaceItem> WorkspaceMenuCatRef = WorkspaceMenuCategory.ToSharedRef(); TSharedRef<FWorkspaceItem> WorkspaceMenuCatRef = WorkspaceMenuCategory.ToSharedRef();
FAssetEditorToolkit::RegisterTabSpawners(TabManager); FAssetEditorToolkit::RegisterTabSpawners(TabManager);
TabManager->RegisterTabSpawner(GraphCanvasTabId, ) TabManager->RegisterTabSpawner(GraphCanvasTabId, )
.SetDisplayName(LOCTEXT("GraphCanvasTab", "Graph")) .SetDisplayName(LOCTEXT("GraphCanvasTab", "Graph"))
.SetGroup(WorkspaceMenuCategoryRef) .SetGroup(WorkspaceMenuCategoryRef)
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "GraphEditor.EventGraph_16x")); .SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "GraphEditor.EventGraph_16x"));
TabManager->RegisterTabSpawner(PropertiesTabId, FOnSpawnTab::CreateSP(this, &FSoundSubmixEditor::SpawnTab_Properties)) TabManager->RegisterTabSpawner(PropertiesTabId, FOnSpawnTab::CreateSP(this, &FSoundSubmixEditor::SpawnTab_Properties))
.SetDisplayName(LOCTEXT("PropertiesTab", "Details")) .SetDisplayName(LOCTEXT("PropertiesTab", "Details"))
.SetGroup(WorkspaceMenuCategoryRef) .SetGroup(WorkspaceMenuCategoryRef)
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tabs.Details"));\ .SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tabs.Details"));\
*/ */
} }
void FSNGStateMachineEditor::UnregisterTabSpawners(const TSharedRef<FTabManager>& InTabManager) void FSNGStateMachineEditor::UnregisterTabSpawners(const TSharedRef<FTabManager>& InTabManager)
{ {
IStateMachineEditor::UnregisterTabSpawners(InTabManager); IStateMachineEditor::UnregisterTabSpawners(InTabManager);
} }
FText FSNGStateMachineEditor::GetBaseToolkitName() const FText FSNGStateMachineEditor::GetBaseToolkitName() const
{ {
return LOCTEXT("SNGStateMachineEditorAppLabel", "SNG State Machine Editor"); return LOCTEXT("SNGStateMachineEditorAppLabel", "SNG State Machine Editor");
} }
FText FSNGStateMachineEditor::GetToolkitName() const FText FSNGStateMachineEditor::GetToolkitName() const
{ {
const bool bDirtyState = StateMachineEdited->GetOutermost()->IsDirty(); const bool bDirtyState = StateMachineEdited->GetOutermost()->IsDirty();
/* /*
FFormatNamedArguments Args; FFormatNamedArguments Args;
Args.Add(TEXT("StateMachineName", FText::FromString(StateMachineEdited->GetName()))); Args.Add(TEXT("StateMachineName", FText::FromString(StateMachineEdited->GetName())));
Args.Add(TEXT("DirtyState"), bDirtyState ? FText::FromString("*") : FText::GetEmpty()); Args.Add(TEXT("DirtyState"), bDirtyState ? FText::FromString("*") : FText::GetEmpty());
return FText::Format(LOCTEXT("SNGStateMachineEditorToolkitName", "{StateMachineName}{DirtyState}"), Args); return FText::Format(LOCTEXT("SNGStateMachineEditorToolkitName", "{StateMachineName}{DirtyState}"), Args);
*/ */
return FText::FromString(StateMachineEdited->GetName()); return FText::FromString(StateMachineEdited->GetName());
} }
FText FSNGStateMachineEditor::GetToolkitToolTipText() const FText FSNGStateMachineEditor::GetToolkitToolTipText() const
{ {
return IStateMachineEditor::GetToolkitToolTipText(); return IStateMachineEditor::GetToolkitToolTipText();
} }
FLinearColor FSNGStateMachineEditor::GetWorldCentricTabColorScale() const FLinearColor FSNGStateMachineEditor::GetWorldCentricTabColorScale() const
{ {
return FLinearColor::Blue; return FLinearColor::Blue;
} }
FString FSNGStateMachineEditor::GetWorldCentricTabPrefix() const FString FSNGStateMachineEditor::GetWorldCentricTabPrefix() const
{ {
return FString("NOT IMPLEMENTED"); return FString("NOT IMPLEMENTED");
} }
FString FSNGStateMachineEditor::GetDocumentationLink() const FString FSNGStateMachineEditor::GetDocumentationLink() const
{ {
return IStateMachineEditor::GetDocumentationLink(); return IStateMachineEditor::GetDocumentationLink();
} }
void FSNGStateMachineEditor::SaveAsset_Execute() void FSNGStateMachineEditor::SaveAsset_Execute()
{ {
FAssetEditorToolkit::SaveAsset_Execute(); FAssetEditorToolkit::SaveAsset_Execute();
} }
void FSNGStateMachineEditor::SaveAssetAs_Execute() void FSNGStateMachineEditor::SaveAssetAs_Execute()
{ {
IStateMachineEditor::SaveAssetAs_Execute(); IStateMachineEditor::SaveAssetAs_Execute();
} }
void FSNGStateMachineEditor::FocusWindow(UObject* ObjectToFocusOn) void FSNGStateMachineEditor::FocusWindow(UObject* ObjectToFocusOn)
{ {
BringToolkitToFront(); BringToolkitToFront();
//JumpToObject //JumpToObject
} }
void FSNGStateMachineEditor::InitStateMachineEditor(const EToolkitMode::Type Mode, void FSNGStateMachineEditor::InitStateMachineEditor(const EToolkitMode::Type Mode,
const TSharedPtr<IToolkitHost>& InitToolkitHost, USNGStateMachine* StateMachine) const TSharedPtr<IToolkitHost>& InitToolkitHost, USNGStateMachine* StateMachine)
{ {
StateMachineEdited = StateMachine; StateMachineEdited = StateMachine;
//FAssetEditorToolkit::InitAssetEditor(Mode, InitToolkitHost, SNGStateMachineEditorAppName, , true, true, StateMachine); //FAssetEditorToolkit::InitAssetEditor(Mode, InitToolkitHost, SNGStateMachineEditorAppName, , true, true, StateMachine);
} }

View File

@ -1,43 +1,43 @@
// Project Sword & Gun Copyright © 2021 Kevin Poretti // Project Sword & Gun Copyright © 2021 Kevin Poretti
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "IStateMachineEditor.h" #include "IStateMachineEditor.h"
#include "States/SNGStateMachine.h" #include "States/SNGStateMachine.h"
#include "Toolkits/SimpleAssetEditor.h" #include "Toolkits/SimpleAssetEditor.h"
class FSNGStateMachineEditor : public IStateMachineEditor class FSNGStateMachineEditor : public IStateMachineEditor
{ {
public: public:
/** IToolkit Interface */ /** IToolkit Interface */
virtual void RegisterTabSpawners(const TSharedRef<FTabManager>& InTabManager) override; virtual void RegisterTabSpawners(const TSharedRef<FTabManager>& InTabManager) override;
virtual void UnregisterTabSpawners(const TSharedRef<FTabManager>& InTabManager) override; virtual void UnregisterTabSpawners(const TSharedRef<FTabManager>& InTabManager) override;
virtual FText GetBaseToolkitName() const override; virtual FText GetBaseToolkitName() const override;
virtual FText GetToolkitName() const override; virtual FText GetToolkitName() const override;
virtual FName GetToolkitFName() const override { return FName(TEXT("SNGStateMachineEditor")); } virtual FName GetToolkitFName() const override { return FName(TEXT("SNGStateMachineEditor")); }
virtual FText GetToolkitToolTipText() const override; virtual FText GetToolkitToolTipText() const override;
virtual FLinearColor GetWorldCentricTabColorScale() const override; virtual FLinearColor GetWorldCentricTabColorScale() const override;
virtual FString GetWorldCentricTabPrefix() const override; virtual FString GetWorldCentricTabPrefix() const override;
/** FAssetEditorToolkit interface */ /** FAssetEditorToolkit interface */
virtual FString GetDocumentationLink() const override; virtual FString GetDocumentationLink() const override;
virtual bool CanSaveAsset() const override { return true; } virtual bool CanSaveAsset() const override { return true; }
virtual bool CanSaveAssetAs() const override { return true; } virtual bool CanSaveAssetAs() const override { return true; }
virtual void SaveAsset_Execute() override; virtual void SaveAsset_Execute() override;
virtual void SaveAssetAs_Execute() override; virtual void SaveAssetAs_Execute() override;
/** IAssetEditorInstance interface */ /** IAssetEditorInstance interface */
virtual void FocusWindow(UObject* ObjectToFocusOn = nullptr) override; virtual void FocusWindow(UObject* ObjectToFocusOn = nullptr) override;
void InitStateMachineEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost>& InitToolkitHost, USNGStateMachine* StateMachine); void InitStateMachineEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost>& InitToolkitHost, USNGStateMachine* StateMachine);
private: private:
/** State machien being edited */ /** State machien being edited */
USNGStateMachine* StateMachineEdited; USNGStateMachine* StateMachineEdited;
/** Graph Editor */ /** Graph Editor */
TSharedPtr<SGraphEditor> GraphEditorView; TSharedPtr<SGraphEditor> GraphEditorView;
}; };