![]() |
ezEngine Release 26.3
|
An intermediate representation for serializing/deserializing reflected objects. More...
#include <AbstractObjectGraph.h>
Public Types | |
| using | FilterFunction = ezDelegate< bool(const ezAbstractObjectNode *, const ezAbstractObjectNode::Property *)> |
Public Member Functions | |
| void | Clear () |
| ezAbstractObjectNode * | Clone (ezAbstractObjectGraph &ref_cloneTarget, const ezAbstractObjectNode *pRootNode=nullptr, FilterFunction filter=FilterFunction()) const |
| ezStringView | RegisterString (ezStringView sString) |
| const ezAbstractObjectNode * | GetNode (const ezUuid &guid) const |
| ezAbstractObjectNode * | GetNode (const ezUuid &guid) |
| const ezAbstractObjectNode * | GetNodeByName (ezStringView sName) const |
| ezAbstractObjectNode * | GetNodeByName (ezStringView sName) |
| ezAbstractObjectNode * | AddNode (const ezUuid &guid, ezStringView sType, ezUInt32 uiTypeVersion, ezStringView sNodeName={}) |
| void | RemoveNode (const ezUuid &guid) |
| const ezMap< ezUuid, ezAbstractObjectNode * > & | GetAllNodes () const |
| ezMap< ezUuid, ezAbstractObjectNode * > & | GetAllNodes () |
| void | ReMapNodeGuids (const ezUuid &seedGuid, bool bRemapInverse=false) |
| Remaps all node guids by adding the given seed, or if bRemapInverse is true, by subtracting it/ This is mostly used to remap prefab instance graphs to their prefab template graph. | |
| void | ReMapNodeGuidsToMatchGraph (ezAbstractObjectNode *pRoot, const ezAbstractObjectGraph &rhsGraph, const ezAbstractObjectNode *pRhsRoot) |
| Tries to remap the guids of this graph to those in rhsGraph by walking in both down the hierarchy, starting at root and rhsRoot. | |
| void | FindTransitiveHull (const ezUuid &rootGuid, ezSet< ezUuid > &out_reachableNodes) const |
| Finds everything accessible by the given root node. | |
| void | PruneGraph (const ezUuid &rootGuid) |
| Deletes everything not accessible by the given root node. | |
| void | ModifyNodeViaNativeCounterpart (ezAbstractObjectNode *pRootNode, ezDelegate< void(void *, const ezRTTI *)> callback) |
| Allows a node to be modified as a native object and automatically syncs changes back. | |
| ezAbstractObjectNode * | CopyNodeIntoGraph (const ezAbstractObjectNode *pNode) |
| Allows to copy a node from another graph into this graph. | |
| ezAbstractObjectNode * | CopyNodeIntoGraph (const ezAbstractObjectNode *pNode, FilterFunction &ref_filter) |
| void | CreateDiffWithBaseGraph (const ezAbstractObjectGraph &base, ezDeque< ezAbstractGraphDiffOperation > &out_diffResult) const |
| void | ApplyDiff (ezDeque< ezAbstractGraphDiffOperation > &ref_diff) |
| void | MergeDiffs (const ezDeque< ezAbstractGraphDiffOperation > &lhs, const ezDeque< ezAbstractGraphDiffOperation > &rhs, ezDeque< ezAbstractGraphDiffOperation > &ref_out) const |
An intermediate representation for serializing/deserializing reflected objects.
The AbstractObjectGraph represents objects and their properties in a type-independent way, allowing for versioning, patching, and format conversion. It serves as the core of ezEngine's serialization system and enables advanced features like:
Structure:
| void ezAbstractObjectGraph::ModifyNodeViaNativeCounterpart | ( | ezAbstractObjectNode * | pRootNode, |
| ezDelegate< void(void *, const ezRTTI *)> | callback | ||
| ) |
Allows a node to be modified as a native object and automatically syncs changes back.
This temporarily converts the node (and its sub-hierarchy) to native objects, calls the provided callback to allow modifications, then converts the modified objects back to the graph representation. This is useful for applying complex modifications that are easier to implement on native objects. Changes to the object hierarchy (adding/removing children) will be reflected in the graph.
| void ezAbstractObjectGraph::ReMapNodeGuidsToMatchGraph | ( | ezAbstractObjectNode * | pRoot, |
| const ezAbstractObjectGraph & | rhsGraph, | ||
| const ezAbstractObjectNode * | pRhsRoot | ||
| ) |
Tries to remap the guids of this graph to those in rhsGraph by walking in both down the hierarchy, starting at root and rhsRoot.
Note that in case of array properties the remapping assumes element indices to be equal on both sides which will cause all moves inside the arrays to be lost as there is no way of recovering this information without an equality criteria. This function is mostly used to remap a graph from a native object to a graph from ezDocumentObjects to allow applying native side changes to the original ezDocumentObject hierarchy using diffs.