moving actions register to their respective files
This commit is contained in:
parent
d80069b345
commit
014e40a268
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
NAZARAEDITOR_CORE_API void RegisterEditorActions(class EditorBaseApplication& app);
|
||||||
|
|
||||||
class NAZARAEDITOR_CORE_API EditorAction_Quit final
|
class NAZARAEDITOR_CORE_API EditorAction_Quit final
|
||||||
: public EditorAction
|
: public EditorAction
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
NAZARAEDITOR_CORE_API void RegisterLevelActions(class EditorBaseApplication& app);
|
||||||
|
|
||||||
class NAZARAEDITOR_CORE_API EditorAction_Level_New final
|
class NAZARAEDITOR_CORE_API EditorAction_Level_New final
|
||||||
: public EditorAction
|
: public EditorAction
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
NAZARAEDITOR_CORE_API void RegisterLogActions(class EditorBaseApplication& app);
|
||||||
|
|
||||||
class NAZARAEDITOR_CORE_API EditorAction_Log_Clear final
|
class NAZARAEDITOR_CORE_API EditorAction_Log_Clear final
|
||||||
: public EditorAction
|
: public EditorAction
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,16 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
void RegisterEditorActions(EditorBaseApplication& app)
|
||||||
|
{
|
||||||
|
app.RegisterAction<Nz::EditorAction_Quit>({
|
||||||
|
.description = "LOC_EDITOR_ACTION_QUIT_DESC",
|
||||||
|
.path = { "LOC_EDITOR_MENU_FILE", "LOC_EDITOR_MENU_QUIT" },
|
||||||
|
.category = "General",
|
||||||
|
.shortcut = Nz::Shortcut::Create(Nz::Keyboard::VKey::F4, false, false, true),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void EditorAction_Quit::Execute()
|
void EditorAction_Quit::Execute()
|
||||||
{
|
{
|
||||||
Nz::EditorBaseApplication::Instance()->GetPopupManager().CreatePopup({
|
Nz::EditorBaseApplication::Instance()->GetPopupManager().CreatePopup({
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,35 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
void RegisterLevelActions(EditorBaseApplication& app)
|
||||||
|
{
|
||||||
|
Nz::TextureParams texParams;
|
||||||
|
texParams.renderDevice = Nz::Graphics::Instance()->GetRenderDevice();
|
||||||
|
texParams.loadFormat = Nz::PixelFormat::RGBA8_SRGB;
|
||||||
|
|
||||||
|
app.RegisterAction<Nz::EditorAction_Level_New>({
|
||||||
|
.description = "LOC_EDITOR_ACTION_LEVEL_NEW_DESC",
|
||||||
|
.path = { "LOC_EDITOR_MENU_FILE", "LOC_EDITOR_MENU_LEVEL", "LOC_EDITOR_MENU_NEW" },
|
||||||
|
.category = "General",
|
||||||
|
.shortcut = Nz::Shortcut::Create(Nz::Keyboard::VKey::N, true, true),
|
||||||
|
.icon = Nz::Texture::LoadFromFile("assets/editor/icons/file_new.png", texParams)
|
||||||
|
});
|
||||||
|
app.RegisterAction<Nz::EditorAction_Level_Open>({
|
||||||
|
.description = "LOC_EDITOR_ACTION_LEVEL_OPEN_DESC",
|
||||||
|
.path = { "LOC_EDITOR_MENU_FILE", "LOC_EDITOR_MENU_LEVEL", "LOC_EDITOR_MENU_OPEN" },
|
||||||
|
.category = "General",
|
||||||
|
.shortcut = Nz::Shortcut::Create(Nz::Keyboard::VKey::O, true, true),
|
||||||
|
.icon = Nz::Texture::LoadFromFile("assets/editor/icons/file_open.png", texParams)
|
||||||
|
});
|
||||||
|
app.RegisterAction<Nz::EditorAction_Level_Save>({
|
||||||
|
.description = "LOC_EDITOR_ACTION_LEVEL_SAVE_DESC",
|
||||||
|
.path = { "LOC_EDITOR_MENU_FILE", "LOC_EDITOR_MENU_LEVEL", "LOC_EDITOR_MENU_SAVE" },
|
||||||
|
.category = "General",
|
||||||
|
.shortcut = Nz::Shortcut::Create(Nz::Keyboard::VKey::S, true, true),
|
||||||
|
.icon = Nz::Texture::LoadFromFile("assets/editor/icons/file_save.png", texParams)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void EditorAction_Level_New::Execute()
|
void EditorAction_Level_New::Execute()
|
||||||
{
|
{
|
||||||
Nz::EditorBaseApplication::Instance()->GetPopupManager().CreatePopup({
|
Nz::EditorBaseApplication::Instance()->GetPopupManager().CreatePopup({
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,20 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
void RegisterLogActions(EditorBaseApplication& app)
|
||||||
|
{
|
||||||
|
app.RegisterAction<Nz::EditorAction_Log_Clear>({
|
||||||
|
.description = "LOC_EDITOR_ACTION_LOG_CLEAR_DESC",
|
||||||
|
.path = { "LOC_EDITOR_MENU_LOG_CLEAR" },
|
||||||
|
.category = "Output",
|
||||||
|
});
|
||||||
|
app.RegisterAction<Nz::EditorAction_Log_CopyToClipboard>({
|
||||||
|
.description = "LOC_EDITOR_ACTION_LOG_COPY_DESC",
|
||||||
|
.path = { "LOC_EDITOR_MENU_LOG_COPY" },
|
||||||
|
.category = "Output",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void EditorAction_Log_Clear::Execute()
|
void EditorAction_Log_Clear::Execute()
|
||||||
{
|
{
|
||||||
Nz::EditorBaseApplication::Instance()->GetLogger().Clear();
|
Nz::EditorBaseApplication::Instance()->GetLogger().Clear();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
#include <NazaraEditor/Editor/Application.hpp>
|
#include <NazaraEditor/Editor/Application.hpp>
|
||||||
|
#include <NazaraEditor/Editor/UI/AssetsWindow.hpp>
|
||||||
|
#include <NazaraEditor/Editor/UI/InspectorWindow.hpp>
|
||||||
|
#include <NazaraEditor/Editor/UI/LevelWindow.hpp>
|
||||||
|
#include <NazaraEditor/Editor/UI/MainWindow.hpp>
|
||||||
|
#include <NazaraEditor/Editor/UI/OutputWindow.hpp>
|
||||||
|
|
||||||
#include <NazaraLocalization/Localization.hpp>
|
#include <NazaraLocalization/Localization.hpp>
|
||||||
|
|
||||||
|
|
@ -6,6 +11,16 @@ namespace NzEditor
|
||||||
{
|
{
|
||||||
Application::Application()
|
Application::Application()
|
||||||
{
|
{
|
||||||
|
RegisterWindow<NzEditor::MainWindow>();
|
||||||
|
RegisterWindow<NzEditor::AssetsWindow>();
|
||||||
|
RegisterWindow<NzEditor::LevelWindow>();
|
||||||
|
RegisterWindow<NzEditor::InspectorWindow>();
|
||||||
|
RegisterWindow<NzEditor::OutputWindow>();
|
||||||
|
|
||||||
|
Nz::RegisterLevelActions(*this);
|
||||||
|
Nz::RegisterEditorActions(*this);
|
||||||
|
Nz::RegisterLogActions(*this);
|
||||||
|
|
||||||
Nz::Localization::OnLocaleInstalled.Connect([this](std::string_view locale) {
|
Nz::Localization::OnLocaleInstalled.Connect([this](std::string_view locale) {
|
||||||
RegisterAction<Nz::EditorAction_SetLocale>({
|
RegisterAction<Nz::EditorAction_SetLocale>({
|
||||||
.className = std::format("{}_{}", Nz::EditorAction_SetLocale::GetClassName(), locale),
|
.className = std::format("{}_{}", Nz::EditorAction_SetLocale::GetClassName(), locale),
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,6 @@
|
||||||
#include <NazaraEditor/Core.hpp>
|
#include <NazaraEditor/Core.hpp>
|
||||||
|
|
||||||
#include <NazaraEditor/Editor/Application.hpp>
|
#include <NazaraEditor/Editor/Application.hpp>
|
||||||
#include <NazaraEditor/Editor/UI/AssetsWindow.hpp>
|
|
||||||
#include <NazaraEditor/Editor/UI/InspectorWindow.hpp>
|
|
||||||
#include <NazaraEditor/Editor/UI/LevelWindow.hpp>
|
|
||||||
#include <NazaraEditor/Editor/UI/MainWindow.hpp>
|
|
||||||
#include <NazaraEditor/Editor/UI/OutputWindow.hpp>
|
|
||||||
|
|
||||||
NAZARA_REQUEST_DEDICATED_GPU()
|
NAZARA_REQUEST_DEDICATED_GPU()
|
||||||
|
|
||||||
|
|
@ -38,57 +33,9 @@ int WinMain(int argc, char* argv[])
|
||||||
|
|
||||||
ImGui::EnsureContextOnThisThread();
|
ImGui::EnsureContextOnThisThread();
|
||||||
|
|
||||||
app.RegisterWindow<NzEditor::MainWindow>();
|
|
||||||
app.RegisterWindow<NzEditor::AssetsWindow>();
|
|
||||||
app.RegisterWindow<NzEditor::LevelWindow>();
|
|
||||||
app.RegisterWindow<NzEditor::InspectorWindow>();
|
|
||||||
app.RegisterWindow<NzEditor::OutputWindow>();
|
|
||||||
|
|
||||||
Nz::Localization::Instance()->LoadLocalizationFile(resourceDir / "localization.csv");
|
Nz::Localization::Instance()->LoadLocalizationFile(resourceDir / "localization.csv");
|
||||||
Nz::Localization::Instance()->SetLocale("en-US");
|
Nz::Localization::Instance()->SetLocale("en-US");
|
||||||
|
|
||||||
Nz::TextureParams texParams;
|
|
||||||
texParams.renderDevice = Nz::Graphics::Instance()->GetRenderDevice();
|
|
||||||
texParams.loadFormat = Nz::PixelFormat::RGBA8_SRGB;
|
|
||||||
|
|
||||||
app.RegisterAction<Nz::EditorAction_Level_New>({
|
|
||||||
.description = "LOC_EDITOR_ACTION_LEVEL_NEW_DESC",
|
|
||||||
.path = { "LOC_EDITOR_MENU_FILE", "LOC_EDITOR_MENU_LEVEL", "LOC_EDITOR_MENU_NEW" },
|
|
||||||
.category = "General",
|
|
||||||
.shortcut = Nz::Shortcut::Create(Nz::Keyboard::VKey::N, true, true),
|
|
||||||
.icon = Nz::Texture::LoadFromFile(app.GetResourceFolder() / "icons" / "file_new.png", texParams)
|
|
||||||
});
|
|
||||||
app.RegisterAction<Nz::EditorAction_Level_Open>({
|
|
||||||
.description = "LOC_EDITOR_ACTION_LEVEL_OPEN_DESC",
|
|
||||||
.path = { "LOC_EDITOR_MENU_FILE", "LOC_EDITOR_MENU_LEVEL", "LOC_EDITOR_MENU_OPEN" },
|
|
||||||
.category = "General",
|
|
||||||
.shortcut = Nz::Shortcut::Create(Nz::Keyboard::VKey::O, true, true),
|
|
||||||
.icon = Nz::Texture::LoadFromFile(app.GetResourceFolder() / "icons" / "file_open.png", texParams)
|
|
||||||
});
|
|
||||||
app.RegisterAction<Nz::EditorAction_Level_Save>({
|
|
||||||
.description = "LOC_EDITOR_ACTION_LEVEL_SAVE_DESC",
|
|
||||||
.path = { "LOC_EDITOR_MENU_FILE", "LOC_EDITOR_MENU_LEVEL", "LOC_EDITOR_MENU_SAVE" },
|
|
||||||
.category = "General",
|
|
||||||
.shortcut = Nz::Shortcut::Create(Nz::Keyboard::VKey::S, true, true),
|
|
||||||
.icon = Nz::Texture::LoadFromFile(app.GetResourceFolder() / "icons" / "file_save.png", texParams)
|
|
||||||
});
|
|
||||||
app.RegisterAction<Nz::EditorAction_Log_Clear>({
|
|
||||||
.description = "LOC_EDITOR_ACTION_LOG_CLEAR_DESC",
|
|
||||||
.path = { "LOC_EDITOR_MENU_LOG_CLEAR" },
|
|
||||||
.category = "Output",
|
|
||||||
});
|
|
||||||
app.RegisterAction<Nz::EditorAction_Log_CopyToClipboard>({
|
|
||||||
.description = "LOC_EDITOR_ACTION_LOG_COPY_DESC",
|
|
||||||
.path = { "LOC_EDITOR_MENU_LOG_COPY" },
|
|
||||||
.category = "Output",
|
|
||||||
});
|
|
||||||
app.RegisterAction<Nz::EditorAction_Quit>({
|
|
||||||
.description = "LOC_EDITOR_ACTION_QUIT_DESC",
|
|
||||||
.path = { "LOC_EDITOR_MENU_FILE", "LOC_EDITOR_MENU_QUIT" },
|
|
||||||
.category = "General",
|
|
||||||
.shortcut = Nz::Shortcut::Create(Nz::Keyboard::VKey::F4, false, false, true),
|
|
||||||
});
|
|
||||||
|
|
||||||
entt::meta<Nz::NodeComponent>()
|
entt::meta<Nz::NodeComponent>()
|
||||||
.type(entt::type_hash<Nz::NodeComponent>::value())
|
.type(entt::type_hash<Nz::NodeComponent>::value())
|
||||||
.func<&Nz::ReflectComponent<Nz::EditorPropertyInspector<Nz::EditorRenderer>, Nz::NodeComponent>>(entt::hashed_string("Reflect"));
|
.func<&Nz::ReflectComponent<Nz::EditorPropertyInspector<Nz::EditorRenderer>, Nz::NodeComponent>>(entt::hashed_string("Reflect"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue