Add log actions
This commit is contained in:
parent
eb35ee8050
commit
14b5088e26
|
|
@ -3,6 +3,8 @@
|
||||||
#include <NazaraEditor/Core/Core.hpp>
|
#include <NazaraEditor/Core/Core.hpp>
|
||||||
#include <NazaraEditor/Core/Application/Action.hpp>
|
#include <NazaraEditor/Core/Application/Action.hpp>
|
||||||
#include <NazaraEditor/Core/Application/ActionStack.hpp>
|
#include <NazaraEditor/Core/Application/ActionStack.hpp>
|
||||||
|
#include <NazaraEditor/Core/Application/Actions/EditorAction_Log_Clear.hpp>
|
||||||
|
#include <NazaraEditor/Core/Application/Actions/EditorAction_Log_CopyToClipboard.hpp>
|
||||||
#include <NazaraEditor/Core/Application/BaseApplication.hpp>
|
#include <NazaraEditor/Core/Application/BaseApplication.hpp>
|
||||||
#include <NazaraEditor/Core/Application/EditorLogger.hpp>
|
#include <NazaraEditor/Core/Application/EditorLogger.hpp>
|
||||||
#include <NazaraEditor/Core/Application/Level.hpp>
|
#include <NazaraEditor/Core/Application/Level.hpp>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <NazaraEditor/Core/Application/Action.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
class NAZARAEDITOR_CORE_API EditorAction_Log_Clear final
|
||||||
|
: public EditorAction
|
||||||
|
{
|
||||||
|
EDITORACTION_BODY(EditorAction_Log_Clear, false);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void Execute() override;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <NazaraEditor/Core/Application/Action.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
class NAZARAEDITOR_CORE_API EditorAction_Log_CopyToClipboard final
|
||||||
|
: public EditorAction
|
||||||
|
{
|
||||||
|
EDITORACTION_BODY(EditorAction_Log_CopyToClipboard, false);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void Execute() override;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
#include <NazaraEditor/Core/Application/Actions/EditorAction_Log_Clear.hpp>
|
||||||
|
#include <NazaraEditor/Core/Application/EditorLogger.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
void EditorAction_Log_Clear::Execute()
|
||||||
|
{
|
||||||
|
Nz::EditorLogger::Instance()->Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
#include <NazaraEditor/Core/Application/Actions/EditorAction_Log_CopyToClipboard.hpp>
|
||||||
|
#include <NazaraEditor/Core/Application/EditorLogger.hpp>
|
||||||
|
|
||||||
|
#include <Nazara/Platform.hpp>
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
void EditorAction_Log_CopyToClipboard::Execute()
|
||||||
|
{
|
||||||
|
auto& lines = Nz::EditorLogger::Instance()->GetLog();
|
||||||
|
if (lines.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << lines[0];
|
||||||
|
for (size_t i = 1; i < lines.size(); ++i)
|
||||||
|
oss << '\n' << lines[i];
|
||||||
|
|
||||||
|
Nz::Clipboard::SetString(oss.str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -43,6 +43,20 @@ int WinMain(int argc, char* argv[])
|
||||||
app.RegisterWindow<NzEditor::InspectorWindow>();
|
app.RegisterWindow<NzEditor::InspectorWindow>();
|
||||||
app.RegisterWindow<NzEditor::OutputWindow>();
|
app.RegisterWindow<NzEditor::OutputWindow>();
|
||||||
|
|
||||||
|
Nz::TextureParams texParams;
|
||||||
|
texParams.renderDevice = Nz::Graphics::Instance()->GetRenderDevice();
|
||||||
|
texParams.loadFormat = Nz::PixelFormat::RGBA8_SRGB;
|
||||||
|
app.RegisterAction<Nz::EditorAction_Log_Clear>({
|
||||||
|
.description = "Clears log output",
|
||||||
|
.path = "Clear",
|
||||||
|
.category = "Output",
|
||||||
|
});
|
||||||
|
app.RegisterAction<Nz::EditorAction_Log_CopyToClipboard>({
|
||||||
|
.description = "Copies log output to clipboard",
|
||||||
|
.path = "Copy to Clipboard",
|
||||||
|
.category = "Output",
|
||||||
|
});
|
||||||
|
|
||||||
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