31#include "../system/system_utils.h"
32#include "../third_party/imgui/imgui.h"
33#include "../third_party/imnodes/imnodes.h"
34#include "../third_party/nlohmann/json.hpp"
86 std::vector<GraphNode*> selectedNodes;
87 selectedNodes.reserve(
static_cast<size_t>(
numSelected));
96 selectedNodes.push_back(
node);
101 if (selectedNodes.empty())
120 for (
auto it =
node->parameters.begin();
it !=
node->parameters.end(); ++
it)
134 ImGui::SetClipboardText(
clipStr.c_str());
147 if (
graph ==
nullptr)
150 const char*
rawClip = ImGui::GetClipboardText();
168 SYSTEM_LOG <<
"[NodeGraphClipboard] Paste failed: invalid JSON payload.\n";
174 SYSTEM_LOG <<
"[NodeGraphClipboard] Paste failed: missing 'nodes' array.\n";
188 std::string nodeName;
189 std::string actionType;
190 std::string conditionType;
191 std::string decoratorType;
199 if (
nodeObj.contains(
"actionType") &&
nodeObj[
"actionType"].is_string())
201 if (
nodeObj.contains(
"conditionType") &&
nodeObj[
"conditionType"].is_string())
203 if (
nodeObj.contains(
"decoratorType") &&
nodeObj[
"decoratorType"].is_string())
231 newNode->actionType = actionType;
232 newNode->conditionType = conditionType;
233 newNode->decoratorType = decoratorType;
241 if (
it.value().is_string())
242 newNode->parameters[
it.key()] =
it.value().get<std::string>();
Node-graph clipboard: copy/paste selected nodes via ImGui system clipboard.
ComponentTypeID GetComponentTypeID_Static()
Singleton clipboard for node-graph copy / paste operations.
void PasteNodes(NodeGraph *graph, int graphID, float mousePosX, float mousePosY, bool snapToGrid=false, float snapGridSize=16.0f)
Read the system clipboard, deserialise nodes and create them in the active graph under the current mo...
static NodeGraphClipboard & Get()
Returns the singleton instance.
void CopySelectedNodes(NodeGraph *graph, int graphID)
Serialise currently selected nodes to JSON and write to the system clipboard.
static const char * k_ClipPrefix
Prefix that marks Olympe node-graph clipboard payloads.
< Provides AssetID and INVALID_ASSET_ID
const char * NodeTypeToString(NodeType type)
static constexpr int CLIP_GRAPH_ID_MULTIPLIER
NodeType StringToNodeType(const std::string &str)