GraphSetUndoMode Class Reference

#include <node_undo.h>

Detailed Description

GraphSetUndoMode is an RAII-based convenience wrapper to ensure modifications done to a node graph do not interfere with other components with write access to the same node graph.

The life-time of the instance should enclose the node graph modification:

MAXON_SCOPE // My graph modification.
{
auto transaction = node.GetGraph().BeginTransaction() iferr_return;
.. // The change applied to the node graph.
transaction.Commit() iferr_return;
}
Definition: node_undo.h:49
#define MAXON_SCOPE
Definition: apibase.h:2886
#define iferr_return
Definition: resultbase.h:1524
Definition: node.h:10

Public Member Functions

 GraphSetUndoMode (const GraphModelRef &graph)
 
 ~GraphSetUndoMode ()
 

Private Attributes

const GraphModelRef & _graph
 
Bool _previous
 

Constructor & Destructor Documentation

◆ GraphSetUndoMode()

GraphSetUndoMode ( const GraphModelRef &  graph)
explicit

Constructs the RAII-based wrapper.

Parameters
[in]graphThe node graph that is to be modified.

◆ ~GraphSetUndoMode()

Resets the undo state of the specified node graph.

Member Data Documentation

◆ _graph

const GraphModelRef& _graph
private

◆ _previous

Bool _previous
private