![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Singleton clipboard for node-graph copy / paste operations. More...
#include <Clipboard.h>
Public Member Functions | |
| void | CopySelectedNodes (NodeGraph *graph, int graphID) |
| Serialise currently selected nodes to JSON and write to the system clipboard. | |
| 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 mouse cursor. | |
Static Public Member Functions | |
| static NodeGraphClipboard & | Get () |
| Returns the singleton instance. | |
Private Member Functions | |
| NodeGraphClipboard ()=default | |
Static Private Attributes | |
| static const char * | k_ClipPrefix = "OLYMPE_NG_CLIP:" |
| Prefix that marks Olympe node-graph clipboard payloads. | |
Singleton clipboard for node-graph copy / paste operations.
Definition at line 41 of file Clipboard.h.
|
privatedefault |
Serialise currently selected nodes to JSON and write to the system clipboard.
| graph | Active NodeGraph (source of node data and selection). |
| graphID | Active graph ID (used to resolve ImNodes global UIDs). |
If no nodes are selected the clipboard is left unchanged.
Definition at line 70 of file Clipboard.cpp.
References Olympe::CLIP_GRAPH_ID_MULTIPLIER, GetComponentTypeID_Static(), k_ClipPrefix, Olympe::NodeTypeToString(), Olympe::GraphNode::posX, and SYSTEM_LOG.
Referenced by Olympe::NodeGraphPanel::HandleKeyboardShortcuts().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Returns the singleton instance.
Definition at line 60 of file Clipboard.cpp.
Referenced by Olympe::NodeGraphPanel::HandleKeyboardShortcuts().
Here is the caller graph for this function:| void Olympe::NodeGraphClipboard::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 mouse cursor.
| graph | Active NodeGraph (destination). |
| graphID | Active graph ID used to set ImNodes node positions via ImNodes::SetNodeGridSpacePos immediately after creation. |
| mousePosX | Paste anchor X in canvas (grid) space. |
| mousePosY | Paste anchor Y in canvas (grid) space. |
| snapToGrid | When true, each pasted node position is snapped to the nearest grid cell of size snapGridSize. |
| snapGridSize | Grid cell size used when snapToGrid is true. |
If the clipboard does not contain a valid Olympe payload this is a no-op.
Definition at line 143 of file Clipboard.cpp.
References Olympe::CLIP_GRAPH_ID_MULTIPLIER, GetComponentTypeID_Static(), k_ClipPrefix, Olympe::StringToNodeType(), and SYSTEM_LOG.
Referenced by Olympe::NodeGraphPanel::HandleKeyboardShortcuts().
Here is the call graph for this function:
Here is the caller graph for this function:Prefix that marks Olympe node-graph clipboard payloads.
Definition at line 80 of file Clipboard.h.
Referenced by CopySelectedNodes(), and PasteNodes().