GraphDescription Class Reference

#include <graphdescription.h>

Detailed Description

Provides functions and constants to read and write node graphs from and into the graph description format.

A graph description is JSON-like format to describe complete or partial node graphs for arbitrary node spaces. Graph descriptions can describe node types and their attributes over their labels in a natural language, absolute and lazy node paths, and queries to select entities in a graph by their values. Graph descriptions are primarily intended to be written and read from the Python API which binds to this class.

Public Types

enum class  PARSE_FLAGS {
  NONE ,
  VERBOSE_ATTRIBUTES ,
  VERBOSE_REFERENCES
}
 
enum class  QUERY_FLAGS {
  NONE ,
  MATCH_FIRST ,
  MATCH_ALL ,
  SELECT_THIS
}
 

Public Member Functions

enum maxon::nodes::GraphDescription::PARSE_FLAGS MAXON_ENUM_FLAGS_CLASS (PARSE_FLAGS)
 
enum maxon::nodes::GraphDescription::QUERY_FLAGS MAXON_ENUM_FLAGS_CLASS (QUERY_FLAGS)
 

Static Public Member Functions

static MAXON_METHOD String GetDescriptionKey ()
 
static MAXON_METHOD String GetFlagsKey ()
 
static MAXON_METHOD String GetIdKey ()
 
static MAXON_METHOD String GetLanguageKey ()
 
static MAXON_METHOD String GetQueryKey ()
 
static MAXON_METHOD String GetQueryModeKey ()
 
static MAXON_METHOD String GetSpaceKey ()
 
static MAXON_METHOD String GetTypeKey ()
 
static MAXON_METHOD Result< DataDictionary > GenerateDescription (NodesGraphModelRef &graph, DataDictionary description)
 
static MAXON_METHOD Result< DataDictionary > TranslateDescription (DataDictionary description)
 
static MAXON_METHOD Result< DataDictionary > ApplyDescription (NodesGraphModelRef &graph, DataDictionary description)
 
static MAXON_METHOD Result< nodes::NodesGraphModelRef > CreateGraph (BaseList2D *element, Id &nodeSpaceId, const Bool &createEmpty, const String &name)
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (GraphDescription, MAXON_REFERENCE_STATIC, "net.maxon.node.interface.graphdescription")
 

Member Enumeration Documentation

◆ PARSE_FLAGS

enum PARSE_FLAGS
strong

Expresses options when parsing graph descriptions.

Note
Currently unused.
Enumerator
NONE 

Marks a description as having no special flags.

VERBOSE_ATTRIBUTES 

Marks a description as also encoding attributes which hold default values instead of omitting them.

VERBOSE_REFERENCES 

Marks a description as exclusively using identifiers instead of labels to reference nodes and attributes.

◆ QUERY_FLAGS

enum QUERY_FLAGS
strong

Expresses options when querying a graph for nodes.

Enumerator
NONE 

Marks a query as having no special flags.

MATCH_FIRST 

Marks a query to pick the first match when ambiguous. Dominant over MATCH_ALL. When no match flag is set, a query must be unambiguous.

MATCH_ALL 

Marks a query to pick all matches when ambiguous. Suppressed by MATCH_FIRST. When no match flag is set, a query must be unambiguous.

SELECT_THIS 

Marks the to be selected element in a query. When a query does not contain a selection marker, the out most element will be selected.

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( GraphDescription  ,
MAXON_REFERENCE_STATIC  ,
"net.maxon.node.interface.graphdescription"   
)
private

◆ MAXON_ENUM_FLAGS_CLASS() [1/2]

enum maxon::nodes::GraphDescription::PARSE_FLAGS MAXON_ENUM_FLAGS_CLASS ( PARSE_FLAGS  )

◆ MAXON_ENUM_FLAGS_CLASS() [2/2]

enum maxon::nodes::GraphDescription::QUERY_FLAGS MAXON_ENUM_FLAGS_CLASS ( QUERY_FLAGS  )

◆ GetDescriptionKey()

static MAXON_METHOD String GetDescriptionKey ( )
static

Returns the key for a description field in a description. Alias for "$description".

◆ GetFlagsKey()

static MAXON_METHOD String GetFlagsKey ( )
static

Returns the key for a flags field in a description. Alias for "$flags".

◆ GetIdKey()

static MAXON_METHOD String GetIdKey ( )
static

Returns the key for a node ID field in a description. Alias for "$id".

◆ GetLanguageKey()

static MAXON_METHOD String GetLanguageKey ( )
static

Returns the key for a language ID field in a description. Alias for "$language".

◆ GetQueryKey()

static MAXON_METHOD String GetQueryKey ( )
static

Returns the key for a query field in a description. Alias for "$query".

◆ GetQueryModeKey()

static MAXON_METHOD String GetQueryModeKey ( )
static

Returns the key for a query mode field in a description. Alias for "$qmode".

◆ GetSpaceKey()

static MAXON_METHOD String GetSpaceKey ( )
static

Returns the key for a node space ID field in a description. Alias for "$space".

◆ GetTypeKey()

static MAXON_METHOD String GetTypeKey ( )
static

Returns the key for a node type field in a description. Alias for "$type".

◆ GenerateDescription()

static MAXON_METHOD Result<DataDictionary> GenerateDescription ( NodesGraphModelRef &  graph,
DataDictionary  description 
)
static

Not yet implemented.

◆ TranslateDescription()

static MAXON_METHOD Result<DataDictionary> TranslateDescription ( DataDictionary  description)
static

Not yet implemented.

◆ ApplyDescription()

static MAXON_METHOD Result<DataDictionary> ApplyDescription ( NodesGraphModelRef &  graph,
DataDictionary  description 
)
static

Applies the given graph #description to the given nodes #graph.

Parameters
[in]graphThe nodes graph to apply the #description to.
[in]descriptionThe graph description to apply to #graph.
Returns
All nodes in the graph after the description has been read as <String, GraphNode> pairs where the string is the ID of the node. Primarily intended for the Python fronted.

◆ CreateGraph()

static MAXON_METHOD Result<nodes::NodesGraphModelRef> CreateGraph ( BaseList2D element,
Id nodeSpaceId,
const Bool createEmpty,
const String name 
)
static

Returns the nodes graph for the given scene element and #nodeSpaceId.

element can be a BaseDocument (for the document wide scene nodes graph), a BaseObject (for capsules), or a material (for material graphs), or nullptr (to create a material in the active document). When the passed element does not yet have a graph in the requested node space, it will be created.

Parameters
[in]elementThe scene element to get the graph for. Can be nullptr to create a material in the active document.
[in]nodeSpaceIdThe node space to retrieve the graph for. When the empty ID is passed, it will default to the active node space for materials and the neutron node space for everything else.
[in]createEmptyWhen #true, new graphs will be created as an empty graph, when #false the default graph will be created.
[in]nameThe name to give the material which is created when element is the nullptr.
Returns
The retrieved graph.