2021-01-30 21:39:06 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <hex.hpp>
|
|
|
|
|
|
|
|
#include <imgui.h>
|
2022-02-01 17:09:40 +00:00
|
|
|
#include <hex/ui/view.hpp>
|
2021-01-30 21:39:06 +00:00
|
|
|
#include <hex/data_processor/node.hpp>
|
|
|
|
#include <hex/data_processor/link.hpp>
|
|
|
|
|
2023-02-09 22:07:04 +00:00
|
|
|
#include "content/helpers/provider_extra_data.hpp"
|
|
|
|
|
2021-01-30 21:39:06 +00:00
|
|
|
#include <array>
|
|
|
|
#include <string>
|
|
|
|
|
2021-12-07 21:47:41 +00:00
|
|
|
namespace hex::plugin::builtin {
|
2021-01-30 21:39:06 +00:00
|
|
|
|
|
|
|
class ViewDataProcessor : public View {
|
|
|
|
public:
|
2023-02-09 22:07:04 +00:00
|
|
|
using Workspace = ProviderExtraData::Data::DataProcessor::Workspace;
|
|
|
|
|
2021-01-30 21:39:06 +00:00
|
|
|
ViewDataProcessor();
|
|
|
|
~ViewDataProcessor() override;
|
|
|
|
|
|
|
|
void drawContent() override;
|
|
|
|
|
2023-02-09 22:07:04 +00:00
|
|
|
static nlohmann::json saveNode(const dp::Node *node);
|
|
|
|
static nlohmann::json saveNodes(const Workspace &workspace);
|
|
|
|
|
|
|
|
static std::unique_ptr<dp::Node> loadNode(const nlohmann::json &data);
|
|
|
|
static void loadNodes(Workspace &workspace, const nlohmann::json &data);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static void eraseLink(Workspace &workspace, int id);
|
|
|
|
static void eraseNodes(Workspace &workspace, const std::vector<int> &ids);
|
|
|
|
static void processNodes(Workspace &workspace);
|
|
|
|
|
|
|
|
void reloadCustomNodes();
|
2021-01-30 21:39:06 +00:00
|
|
|
private:
|
2023-02-09 22:07:04 +00:00
|
|
|
bool m_updateNodePositions = false;
|
2021-01-30 21:39:06 +00:00
|
|
|
int m_rightClickedId = -1;
|
|
|
|
ImVec2 m_rightClickedCoords;
|
|
|
|
|
2022-02-05 21:19:32 +00:00
|
|
|
bool m_continuousEvaluation = false;
|
|
|
|
|
2023-02-09 22:07:04 +00:00
|
|
|
struct CustomNode {
|
|
|
|
std::string name;
|
|
|
|
nlohmann::json data;
|
|
|
|
};
|
2021-05-17 21:17:58 +00:00
|
|
|
|
2023-02-09 22:07:04 +00:00
|
|
|
std::vector<CustomNode> m_customNodes;
|
2021-01-30 21:39:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|