|
Kemena3D
|
A complete node-based shader graph: nodes, links, and identity. More...
#include <kshadernode.h>
Public Member Functions | |
| int | newId () |
| Allocates and returns a fresh unique id. | |
| kShaderNode * | findNode (int id) |
| Finds a node by id. | |
| const kShaderNode * | findNode (int id) const |
| Finds a node by id (const overload). | |
| const kShaderLink * | incomingLink (int nodeId, int pinId) const |
| Finds the link feeding a given input pin. | |
| bool | isPinConnected (int nodeId, int pinId) const |
| Tests whether a pin has any link attached. | |
| void | removeLinksByNode (int nodeId) |
| Removes every link touching the given node. | |
| void | removeLinksByPin (int nodeId, int pinId) |
| Removes every link touching the given pin. | |
| kShaderNode | makeNode (kShaderNodeType type, float x, float y) |
| Creates a node of a given type with its default pins wired up. | |
| nlohmann::json | toJson () const |
| Serializes the graph to JSON. | |
| void | fromJson (const nlohmann::json &j) |
| Rebuilds the graph from a JSON representation. | |
Public Attributes | |
| kString | uuid |
| Stable unique identifier for the graph asset. | |
| kString | name |
| Display name of the graph. | |
| std::vector< kShaderNode > | nodes |
| All nodes in the graph. | |
| std::vector< kShaderLink > | links |
| All links between node pins. | |
| int | nextId = 1 |
| Next id to hand out via newId(). | |
| bool | dirty = false |
| True when the graph has unsaved changes. | |
A complete node-based shader graph: nodes, links, and identity.
Owns its nodes and links, hands out unique ids, tracks a dirty flag for the editor, and provides queries, edits, a node factory, and JSON I/O.
| kShaderNode * kemena::kShaderGraph::findNode | ( | int | id | ) |
Finds a node by id.
| id | Node id to look up. |
| const kShaderNode * kemena::kShaderGraph::findNode | ( | int | id | ) | const |
Finds a node by id (const overload).
| id | Node id to look up. |
| void kemena::kShaderGraph::fromJson | ( | const nlohmann::json & | j | ) |
Rebuilds the graph from a JSON representation.
| j | JSON object previously produced by toJson(). |
| const kShaderLink * kemena::kShaderGraph::incomingLink | ( | int | nodeId, |
| int | pinId ) const |
Finds the link feeding a given input pin.
| nodeId | Destination node id. |
| pinId | Destination input pin id. |
| bool kemena::kShaderGraph::isPinConnected | ( | int | nodeId, |
| int | pinId ) const |
Tests whether a pin has any link attached.
| nodeId | Owning node id. |
| pinId | Pin id to test. |
| kShaderNode kemena::kShaderGraph::makeNode | ( | kShaderNodeType | type, |
| float | x, | ||
| float | y ) |
Creates a node of a given type with its default pins wired up.
| type | Node type to construct. |
| x | Initial canvas X position. |
| y | Initial canvas Y position. |
|
inline |
Allocates and returns a fresh unique id.
| void kemena::kShaderGraph::removeLinksByNode | ( | int | nodeId | ) |
Removes every link touching the given node.
| nodeId | Node whose links should be removed. |
| void kemena::kShaderGraph::removeLinksByPin | ( | int | nodeId, |
| int | pinId ) |
Removes every link touching the given pin.
| nodeId | Owning node id. |
| pinId | Pin id whose links should be removed. |
| nlohmann::json kemena::kShaderGraph::toJson | ( | ) | const |
Serializes the graph to JSON.
| bool kemena::kShaderGraph::dirty = false |
True when the graph has unsaved changes.
| std::vector<kShaderLink> kemena::kShaderGraph::links |
All links between node pins.
| kString kemena::kShaderGraph::name |
Display name of the graph.
| int kemena::kShaderGraph::nextId = 1 |
Next id to hand out via newId().
| std::vector<kShaderNode> kemena::kShaderGraph::nodes |
All nodes in the graph.
| kString kemena::kShaderGraph::uuid |
Stable unique identifier for the graph asset.