/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/EditorPlugins/ProcGen/EditorPluginProcGen/Actions/ProcGenActions.cpp
61 строка
2 KB
Jan Krassnigg
Reorganized menu structure and added support for global mapping names (#1018)
28 июл 2023, 09:18
Не верифицирован
28 июл 2023, 09:18
fb024c5
Код
Авторство
О чём код?
#include <EditorPluginProcGen/EditorPluginProcGenPCH.h> #include <EditorPluginProcGen/Actions/ProcGenActions.h> #include <EditorPluginProcGen/ProcGenGraphAsset/ProcGenGraphAsset.h> #include <GuiFoundation/Action/ActionManager.h> ezActionDescriptorHandle ezProcGenActions::s_hCategory; ezActionDescriptorHandle ezProcGenActions::s_hDumpAST; ezActionDescriptorHandle ezProcGenActions::s_hDumpDisassembly; void ezProcGenActions::RegisterActions() { s_hCategory = EZ_REGISTER_CATEGORY("ProcGen"); s_hDumpAST = EZ_REGISTER_ACTION_1("ProcGen.DumpAST", ezActionScope::Document, "ProcGen Graph", "", ezProcGenAction, ezProcGenAction::ActionType::DumpAST); s_hDumpDisassembly = EZ_REGISTER_ACTION_1("ProcGen.DumpDisassembly", ezActionScope::Document, "ProcGen Graph", "", ezProcGenAction, ezProcGenAction::ActionType::DumpDisassembly); } void ezProcGenActions::UnregisterActions() { ezActionManager::UnregisterAction(s_hCategory); ezActionManager::UnregisterAction(s_hDumpAST); ezActionManager::UnregisterAction(s_hDumpDisassembly); } void ezProcGenActions::MapMenuActions() { ezActionMap* pMap = ezActionMapManager::GetActionMap("ProcGenAssetMenuBar"); EZ_ASSERT_DEV(pMap != nullptr, "Mapping the actions failed!"); pMap->MapAction(s_hCategory, "G.Tools.Document", 10.0f); pMap->MapAction(s_hDumpAST, "G.Tools.Document", "ProcGen", 1.0f); pMap->MapAction(s_hDumpDisassembly, "G.Tools.Document", "ProcGen", 2.0f); pMap = ezActionMapManager::GetActionMap("ProcGenAssetToolBar"); EZ_ASSERT_DEV(pMap != nullptr, "Mapping the actions failed!"); pMap->MapAction(s_hCategory, "", 10.0f); pMap->MapAction(s_hDumpAST, "ProcGen", 1.0f); pMap->MapAction(s_hDumpDisassembly, "ProcGen", 2.0f); } ////////////////////////////////////////////////////////////////////////// EZ_BEGIN_DYNAMIC_REFLECTED_TYPE(ezProcGenAction, 0, ezRTTINoAllocator) EZ_END_DYNAMIC_REFLECTED_TYPE; ezProcGenAction::ezProcGenAction(const ezActionContext& context, const char* szName, ActionType type) : ezButtonAction(context, szName, false, "") , m_Type(type) { } ezProcGenAction::~ezProcGenAction() = default; void ezProcGenAction::Execute(const ezVariant& value) { if (auto pAssetDocument = ezDynamicCast<ezProcGenGraphAssetDocument*>(GetContext().m_pDocument)) { pAssetDocument->DumpSelectedOutput(m_Type == ActionType::DumpAST, m_Type == ActionType::DumpDisassembly); } }