diff --git a/Content/Material/Function/MF_PositionAndNormmalVAT.uasset b/Content/Material/Function/MF_PositionAndNormmalVAT.uasset index aae06f2..b307569 100644 Binary files a/Content/Material/Function/MF_PositionAndNormmalVAT.uasset and b/Content/Material/Function/MF_PositionAndNormmalVAT.uasset differ diff --git a/Content/Material/Mat_PositionAndNormalVAT.uasset b/Content/Material/Mat_PositionAndNormalVAT.uasset index 4a5bd78..dcadd71 100644 Binary files a/Content/Material/Mat_PositionAndNormalVAT.uasset and b/Content/Material/Mat_PositionAndNormalVAT.uasset differ diff --git a/Source/ZenoEditor/Private/UI/Menu/VATEditorExtenderService.cpp b/Source/ZenoEditor/Private/UI/Menu/VATEditorExtenderService.cpp index 82e81d8..08f803a 100644 --- a/Source/ZenoEditor/Private/UI/Menu/VATEditorExtenderService.cpp +++ b/Source/ZenoEditor/Private/UI/Menu/VATEditorExtenderService.cpp @@ -19,30 +19,24 @@ #define LOCTEXT_NAMESPACE "FVATEditorExtenderService" FVATEditorExtenderService::FVATEditorExtenderService() - : CommandList(MakeShared()) + : FZenoEditorExtenderServiceBase() { } void FVATEditorExtenderService::Register() { - MapAction(); - - FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked("LevelEditor"); - MenuBarExtender = MakeShareable(new FExtender); - + FZenoEditorExtenderServiceBase::Register(); MenuBarExtender->AddMenuBarExtension("Help", EExtensionHook::After, CommandList, FMenuBarExtensionDelegate::CreateRaw(this, &FVATEditorExtenderService::ExtendMenuBar)); - - LevelEditorModule.GetMenuExtensibilityManager()->AddExtender(MenuBarExtender); } void FVATEditorExtenderService::Unregister() { + FZenoEditorExtenderServiceBase::Unregister(); } void FVATEditorExtenderService::ExtendMenuBar(FMenuBarBuilder& Builder) { - const FName ZenoHook = "MENU_Zeno"; - Builder.AddPullDownMenu(LOCTEXT("Zeno", "Zeno"), LOCTEXT("ZenoTooltip", "Zeno Tools"), FNewMenuDelegate::CreateRaw(this, &FVATEditorExtenderService::ExtendVATPullDownMenu), ZenoHook, ZenoHook); + Builder.AddPullDownMenu(LOCTEXT("Zeno", "Zeno"), LOCTEXT("ZenoTooltip", "Zeno Tools"), FNewMenuDelegate::CreateRaw(this, &FVATEditorExtenderService::ExtendVATPullDownMenu), ZenoHookLabel, ZenoHookLabel); } void FVATEditorExtenderService::ExtendVATPullDownMenu(FMenuBuilder& Builder) diff --git a/Source/ZenoEditor/Private/UI/Menu/ZenoEditorMenuExtender.cpp b/Source/ZenoEditor/Private/UI/Menu/ZenoEditorMenuExtender.cpp index 78892a6..27506b7 100644 --- a/Source/ZenoEditor/Private/UI/Menu/ZenoEditorMenuExtender.cpp +++ b/Source/ZenoEditor/Private/UI/Menu/ZenoEditorMenuExtender.cpp @@ -1,5 +1,26 @@ #include "UI/Menu/ZenoEditorMenuExtender.h" +#include "LevelEditor.h" + +FZenoEditorExtenderServiceBase::FZenoEditorExtenderServiceBase() + : CommandList(MakeShared()) +{ +} + +void FZenoEditorExtenderServiceBase::Register() +{ + MapAction(); + FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked("LevelEditor"); + MenuBarExtender = MakeShareable(new FExtender); + LevelEditorModule.GetMenuExtensibilityManager()->AddExtender(MenuBarExtender); +} + +void FZenoEditorExtenderServiceBase::Unregister() +{ + FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked("LevelEditor"); + LevelEditorModule.GetMenuExtensibilityManager()->RemoveExtender(MenuBarExtender); +} + void FZenoEditorMenuExtender::Register() { for (const auto Pair : Services) diff --git a/Source/ZenoEditor/Private/UI/Menu/ZenoEmbedGraphEditorExtenderService.cpp b/Source/ZenoEditor/Private/UI/Menu/ZenoEmbedGraphEditorExtenderService.cpp new file mode 100644 index 0000000..4fa4749 --- /dev/null +++ b/Source/ZenoEditor/Private/UI/Menu/ZenoEmbedGraphEditorExtenderService.cpp @@ -0,0 +1,52 @@ +#include "UI/Menu/ZenoEmbedGraphEditorExtenderService.h" + +#include "LevelEditor.h" +#include "ZenoEditorCommand.h" + +#define LOCTEXT_NAMESPACE "FZenoEmbedGraphEditorExtenderService" + +FZenoEmbedGraphEditorExtenderService::FZenoEmbedGraphEditorExtenderService() + : FZenoEditorExtenderServiceBase() +{ +} + +void FZenoEmbedGraphEditorExtenderService::Register() +{ + FZenoEditorExtenderServiceBase::Register(); + MenuBarExtender->AddMenuBarExtension("Help", EExtensionHook::After, CommandList, FMenuBarExtensionDelegate::CreateRaw(this, &FZenoEmbedGraphEditorExtenderService::ExtendTopMenuBar)); +} + +void FZenoEmbedGraphEditorExtenderService::Unregister() +{ + FZenoEditorExtenderServiceBase::Unregister(); +} + +FZenoEmbedGraphEditorExtenderService& FZenoEmbedGraphEditorExtenderService::Get() +{ + static FZenoEmbedGraphEditorExtenderService Service; + return Service; +} + +void FZenoEmbedGraphEditorExtenderService::ExtendTopMenuBar(FMenuBarBuilder& Builder) +{ + Builder.AddPullDownMenu(LOCTEXT("Zeno", "Zeno"), LOCTEXT("ZenoTooltip", "Zeno Tools"), FNewMenuDelegate::CreateRaw(this, &FZenoEmbedGraphEditorExtenderService::ExtendEmbedPullDownMenu), ZenoHookLabel, ZenoHookLabel); +} + +void FZenoEmbedGraphEditorExtenderService::ExtendEmbedPullDownMenu(FMenuBuilder& Builder) +{ + Builder.AddMenuEntry(FZenoEditorCommand::Get().Debug); +} + +void FZenoEmbedGraphEditorExtenderService::MapAction() +{ + CommandList->MapAction(FZenoEditorCommand::Get().Debug, FExecuteAction::CreateRaw(this, &FZenoEmbedGraphEditorExtenderService::Debug)); +} + +void FZenoEmbedGraphEditorExtenderService::Debug() +{ + UE_LOG(LogTemp, Error, TEXT("123")); +} + +#undef LOCTEXT_NAMESPACE + +REGISTER_EDITOR_EXTENDER_SERVICE("Embed", FZenoEmbedGraphEditorExtenderService); diff --git a/Source/ZenoEditor/Public/UI/Menu/VATEditorExtenderService.h b/Source/ZenoEditor/Public/UI/Menu/VATEditorExtenderService.h index c98dc2b..808b865 100644 --- a/Source/ZenoEditor/Public/UI/Menu/VATEditorExtenderService.h +++ b/Source/ZenoEditor/Public/UI/Menu/VATEditorExtenderService.h @@ -1,7 +1,7 @@ #pragma once #include "ZenoEditorMenuExtender.h" -class FVATEditorExtenderService final : public IZenoEditorExtenderService +class FVATEditorExtenderService final : public FZenoEditorExtenderServiceBase { public: FVATEditorExtenderService(); @@ -11,14 +11,10 @@ class FVATEditorExtenderService final : public IZenoEditorExtenderService void ExtendMenuBar(FMenuBarBuilder& Builder); void ExtendVATPullDownMenu(FMenuBuilder& Builder); - void MapAction(); + virtual void MapAction() override; static FVATEditorExtenderService& Get(); -private: - TSharedPtr MenuBarExtender; - TSharedPtr CommandList; - private: void Debug(); void ImportWavefrontObjFile(); diff --git a/Source/ZenoEditor/Public/UI/Menu/ZenoEditorMenuExtender.h b/Source/ZenoEditor/Public/UI/Menu/ZenoEditorMenuExtender.h index f795256..aa1b6ab 100644 --- a/Source/ZenoEditor/Public/UI/Menu/ZenoEditorMenuExtender.h +++ b/Source/ZenoEditor/Public/UI/Menu/ZenoEditorMenuExtender.h @@ -8,6 +8,22 @@ class IZenoEditorExtenderService virtual void Unregister() = 0; }; +class FZenoEditorExtenderServiceBase : public IZenoEditorExtenderService +{ +public: + FZenoEditorExtenderServiceBase(); + + virtual void Register() override; + virtual void Unregister() override; + virtual void MapAction() {}; + +protected: + TSharedPtr CommandList; + TSharedPtr MenuBarExtender; + + inline static FName ZenoHookLabel = "MENU_Zeno"; +}; + class FZenoEditorMenuExtender final : public IZenoEditorExtenderService { public: diff --git a/Source/ZenoEditor/Public/UI/Menu/ZenoEmbedGraphEditorExtenderService.h b/Source/ZenoEditor/Public/UI/Menu/ZenoEmbedGraphEditorExtenderService.h new file mode 100644 index 0000000..47566c3 --- /dev/null +++ b/Source/ZenoEditor/Public/UI/Menu/ZenoEmbedGraphEditorExtenderService.h @@ -0,0 +1,23 @@ +#pragma once +#include "ZenoEditorMenuExtender.h" + +class FZenoEmbedGraphEditorExtenderService final : public FZenoEditorExtenderServiceBase +{ +public: + FZenoEmbedGraphEditorExtenderService(); + + virtual void Register() override; + virtual void Unregister() override; + + static FZenoEmbedGraphEditorExtenderService& Get(); + +private: + void ExtendTopMenuBar(FMenuBarBuilder& Builder); + void ExtendEmbedPullDownMenu(FMenuBuilder& Builder); + +protected: + virtual void MapAction() override; + + // Actions + void Debug(); +};