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 ,
  ALWAYS_VALIDATE_PATHS ,
  RAW_COLORS
}
 
enum class  QUERY_FLAGS {
  NONE ,
  MATCH_FIRST ,
  MATCH_ALL ,
  MATCH_MAYBE ,
  MATCH_MAYBE_FIRST ,
  MATCH_MAYBE_ALL ,
  SELECT_THIS ,
  RAW_URLS ,
  RAW_COLORS ,
  DEBUG
}
 

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 String GetCommandsKey ()
 
static MAXON_METHOD String GetQueryCompositionKey ()
 
static MAXON_METHOD String GetQueryValueKey ()
 
static MAXON_METHOD String GetQueryOpKey ()
 
static MAXON_METHOD String GetQueryMaxErrorKey ()
 
static MAXON_METHOD String GetQuerySelectPortsKey ()
 
static MAXON_METHOD String GetQueryFlagsKey ()
 
static MAXON_METHOD String GetInputGroupKey ()
 
static MAXON_METHOD String GetPortsKey ()
 
static MAXON_METHOD String GetEnumKey ()
 
static MAXON_METHOD String GetDefaultKey ()
 
static MAXON_METHOD String GetMinKey ()
 
static MAXON_METHOD String GetMaxKey ()
 
static MAXON_METHOD String GetStepKey ()
 
static MAXON_METHOD String GetChildrenKey ()
 
static MAXON_METHOD String GetFloatType ()
 
static MAXON_METHOD String GetIntType ()
 
static MAXON_METHOD String GetBoolType ()
 
static MAXON_METHOD String GetStringType ()
 
static MAXON_METHOD String GetUrlType ()
 
static MAXON_METHOD String GetIdType ()
 
static MAXON_METHOD String GetInternedIdType ()
 
static MAXON_METHOD String GetVectorType ()
 
static MAXON_METHOD String GetColorType ()
 
static MAXON_METHOD String GetColorAType ()
 
static MAXON_METHOD String GetQueryOpEqualKey ()
 
static MAXON_METHOD String GetQueryOpNotEqualKey ()
 
static MAXON_METHOD String GetQueryOpLessKey ()
 
static MAXON_METHOD String GetQueryOpLessEqualKey ()
 
static MAXON_METHOD String GetQueryOpGreaterKey ()
 
static MAXON_METHOD String GetQueryOpGreaterEqualKey ()
 
static MAXON_METHOD String GetQueryOpAndKey ()
 
static MAXON_METHOD String GetQueryOpOrKey ()
 
static MAXON_METHOD String GetQueryOpRegexSearchKey ()
 
static MAXON_METHOD String GetQueryOpRegexMatchKey ()
 
static MAXON_METHOD String GetUnGroupCommandKey ()
 
static MAXON_METHOD String GetRecursiveUnGroupCommandKey ()
 
static MAXON_METHOD String GetRemoveNodeCommandKey ()
 
static MAXON_METHOD String GetDefaultNodeCommandKey ()
 
static MAXON_METHOD String GetDisconnectCommandKey ()
 
static MAXON_METHOD String GetSetPortCountCommandKey ()
 
static MAXON_METHOD String GetShowPortsCommandKey ()
 
static MAXON_METHOD String GetHidePortsCommandKey ()
 
static MAXON_METHOD String GetStartNodeCommandKey ()
 
static MAXON_METHOD String GetSoloNodeCommandKey ()
 
static MAXON_METHOD String GetClearStartNodeCommandKey ()
 
static MAXON_METHOD String GetClearSoloNodeCommandKey ()
 
static MAXON_METHOD Result< DataDictionary > GenerateDescription (NodesGraphModelRef &graph, DataDictionary description)
 
static MAXON_METHOD Result< DataDictionary > TranslateDescription (DataDictionary description)
 
static MAXON_METHOD Result< BaseArray< GraphNode > > EvaluateQuery (nodes::NodesGraphModelRef &graph, DataDictionary query)
 
static MAXON_METHOD Result< DataDictionary > ApplyDescription (NodesGraphModelRef &graph, DataDictionary description)
 
static MAXON_METHOD Result< nodes::NodesGraphModelRef > CreateGraph (cinema::BaseList2D *element, Id &nodeSpaceId, const Bool createEmpty, const String &name)
 
static MAXON_METHOD Result< nodes::NodesGraphModelRef > GetGraph (cinema::BaseList2D *element, Id &nodeSpaceId, const Bool createEmpty, const String &name)
 
static MAXON_METHOD Result< BaseArray< nodes::NodesGraphModelRef > > GetMaterialGraphs (const cinema::BaseDocument *const doc, const Id &nodeSpaceId)
 

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.

ALWAYS_VALIDATE_PATHS 

Marks a description as always validating absolute node paths with the underlying graph description cache.

RAW_COLORS 

Marks a description as using raw color values instead of their sRGB representation. This is only relevant for OCIO color managed documents.

◆ 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.

MATCH_MAYBE 

Marks a query to match lazily, instead of raising an error, a non-matching sub-graph will simply not be executed.

MATCH_MAYBE_FIRST 

Marks a query to lazily pick the first match when ambiguous. This is equal to MATCH_FIRST | MATCH_MAYBE.

MATCH_MAYBE_ALL 

Marks a query to lazily pick all matches when ambiguous. This is equal to MATCH_ALL | MATCH_MAYBE.

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.

RAW_URLS 

Marks a query to compare stored raw URL values instead of their UI representation.

RAW_COLORS 

Marks a query to compare stored raw color values, instead of their sRGB representation. This is only relevant for OCIO color managed documents.

DEBUG 

Marks a query to print debug information about the query evaluation to the Python logger.

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".

◆ GetCommandsKey()

static MAXON_METHOD String GetCommandsKey ( )
static

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

◆ GetQueryCompositionKey()

static MAXON_METHOD String GetQueryCompositionKey ( )
static

Returns the key for a query composition field. Alias for "$qcomp".

◆ GetQueryValueKey()

static MAXON_METHOD String GetQueryValueKey ( )
static

Returns the key for a comparison value field. Alias for "$qvalue".

◆ GetQueryOpKey()

static MAXON_METHOD String GetQueryOpKey ( )
static

Returns the key for a comparison operator field. Alias for "$qop".

◆ GetQueryMaxErrorKey()

static MAXON_METHOD String GetQueryMaxErrorKey ( )
static

Returns the key for a query tolerance field. Defaults to 1E-6 when not set. Alias for "$qmaxer".

◆ GetQuerySelectPortsKey()

static MAXON_METHOD String GetQuerySelectPortsKey ( )
static

Returns the key for a query select ports field. Alias for "$qselports".

◆ GetQueryFlagsKey()

static MAXON_METHOD String GetQueryFlagsKey ( )
static

Returns the key for query flags. Alias for "$queryflags".

◆ GetInputGroupKey()

static MAXON_METHOD String GetInputGroupKey ( )
static

Returns the key for an input-group scope. Alias for "$inputgroup".

◆ GetPortsKey()

static MAXON_METHOD String GetPortsKey ( )
static

Returns the key for input-group ports. Alias for "$ports".

◆ GetEnumKey()

static MAXON_METHOD String GetEnumKey ( )
static

Returns the key for input-group enumerations. Alias for "$enum".

◆ GetDefaultKey()

static MAXON_METHOD String GetDefaultKey ( )
static

Returns the key for an input-group default value. Alias for "$default".

◆ GetMinKey()

static MAXON_METHOD String GetMinKey ( )
static

Returns the key for an input-group minimum value. Alias for "$min".

◆ GetMaxKey()

static MAXON_METHOD String GetMaxKey ( )
static

Returns the key for an input-group maximum value. Alias for "$max".

◆ GetStepKey()

static MAXON_METHOD String GetStepKey ( )
static

Returns the key for an input-group step value. Alias for "$step".

◆ GetChildrenKey()

static MAXON_METHOD String GetChildrenKey ( )
static

Returns the key for group children. Alias for "$children".

◆ GetFloatType()

static MAXON_METHOD String GetFloatType ( )
static

Returns the input-group type string for float values. Returns "float".

◆ GetIntType()

static MAXON_METHOD String GetIntType ( )
static

Returns the input-group type string for integer values. Returns "int".

◆ GetBoolType()

static MAXON_METHOD String GetBoolType ( )
static

Returns the input-group type string for boolean values. Returns "bool".

◆ GetStringType()

static MAXON_METHOD String GetStringType ( )
static

Returns the input-group type string for string values. Returns "string".

◆ GetUrlType()

static MAXON_METHOD String GetUrlType ( )
static

Returns the input-group type string for URL values. Returns "url".

◆ GetIdType()

static MAXON_METHOD String GetIdType ( )
static

Returns the input-group type string for ID values. Returns "id".

◆ GetInternedIdType()

static MAXON_METHOD String GetInternedIdType ( )
static

Returns the input-group type string for interned ID values. Returns "internedid".

◆ GetVectorType()

static MAXON_METHOD String GetVectorType ( )
static

Returns the input-group type string for vector values. Returns "vector".

◆ GetColorType()

static MAXON_METHOD String GetColorType ( )
static

Returns the input-group type string for color values. Returns "color".

◆ GetColorAType()

static MAXON_METHOD String GetColorAType ( )
static

Returns the input-group type string for alpha color values. Returns "colora".

◆ GetQueryOpEqualKey()

static MAXON_METHOD String GetQueryOpEqualKey ( )
static

Returns the equality operator. Alias for "==".

◆ GetQueryOpNotEqualKey()

static MAXON_METHOD String GetQueryOpNotEqualKey ( )
static

Returns the inequality operator. Alias for "!=".

◆ GetQueryOpLessKey()

static MAXON_METHOD String GetQueryOpLessKey ( )
static

Returns the less-than operator. Alias for "<".

◆ GetQueryOpLessEqualKey()

static MAXON_METHOD String GetQueryOpLessEqualKey ( )
static

Returns the less-than-or-equal operator. Alias for "<=".

◆ GetQueryOpGreaterKey()

static MAXON_METHOD String GetQueryOpGreaterKey ( )
static

Returns the greater-than operator. Alias for ">".

◆ GetQueryOpGreaterEqualKey()

static MAXON_METHOD String GetQueryOpGreaterEqualKey ( )
static

Returns the greater-than-or-equal operator. Alias for ">=".

◆ GetQueryOpAndKey()

static MAXON_METHOD String GetQueryOpAndKey ( )
static

Returns the logical-and operator. Alias for "and".

◆ GetQueryOpOrKey()

static MAXON_METHOD String GetQueryOpOrKey ( )
static

Returns the logical-or operator. Alias for "or".

◆ GetQueryOpRegexSearchKey()

static MAXON_METHOD String GetQueryOpRegexSearchKey ( )
static

Returns the regular expression search operator. Alias for "regex".

◆ GetQueryOpRegexMatchKey()

static MAXON_METHOD String GetQueryOpRegexMatchKey ( )
static

Returns the regular expression match operator. Alias for "regex_match".

◆ GetUnGroupCommandKey()

static MAXON_METHOD String GetUnGroupCommandKey ( )
static

Returns the command key for ungrouping a node. Alias for "$cmd_ungroup".

◆ GetRecursiveUnGroupCommandKey()

static MAXON_METHOD String GetRecursiveUnGroupCommandKey ( )
static

Returns the command key for recursively ungrouping a node. Alias for "$cmd_rec_ungroup".

◆ GetRemoveNodeCommandKey()

static MAXON_METHOD String GetRemoveNodeCommandKey ( )
static

Returns the command key for a removing a node. Alias for "$cmd_remove".

◆ GetDefaultNodeCommandKey()

static MAXON_METHOD String GetDefaultNodeCommandKey ( )
static

Returns the command key for setting a node to its defaults. Alias for "$cmd_default".

◆ GetDisconnectCommandKey()

static MAXON_METHOD String GetDisconnectCommandKey ( )
static

Returns the command key for removing all wires from a node. Alias for "$cmd_disconnect".

◆ GetSetPortCountCommandKey()

static MAXON_METHOD String GetSetPortCountCommandKey ( )
static

Returns the command key for changing the number of variadic children of the variadic ports of a node. Alias for "$cmd_count_ports".

◆ GetShowPortsCommandKey()

static MAXON_METHOD String GetShowPortsCommandKey ( )
static

Returns the command key for showing the ports of a node. Alias for "$cmd_show_ports".

◆ GetHidePortsCommandKey()

static MAXON_METHOD String GetHidePortsCommandKey ( )
static

Returns the command key for hiding the ports of a node. Alias for "$cmd_hide_ports".

◆ GetStartNodeCommandKey()

static MAXON_METHOD String GetStartNodeCommandKey ( )
static

Returns the command key for making a node the start node. Alias for "$cmd_set_start".

◆ GetSoloNodeCommandKey()

static MAXON_METHOD String GetSoloNodeCommandKey ( )
static

Returns the command key for making a node the solo node. Alias for "$cmd_set_solo".

◆ GetClearStartNodeCommandKey()

static MAXON_METHOD String GetClearStartNodeCommandKey ( )
static

Returns the command key for clearing the start node. Alias for "$cmd_clear_start".

◆ GetClearSoloNodeCommandKey()

static MAXON_METHOD String GetClearSoloNodeCommandKey ( )
static

Returns the command key for clearing the solo node. Alias for "$cmd_clear_solo".

◆ 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.

◆ EvaluateQuery()

static MAXON_METHOD Result<BaseArray<GraphNode> > EvaluateQuery ( nodes::NodesGraphModelRef &  graph,
DataDictionary  query 
)
static

Evaluates the given query for the given graph and returns the matching nodes.

◆ 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 ( cinema::BaseList2D *  element,
Id &  nodeSpaceId,
const Bool  createEmpty,
const String &  name 
)
static
Note
Deprecated in favour of GetGraph.

◆ GetGraph()

static MAXON_METHOD Result<nodes::NodesGraphModelRef> GetGraph ( cinema::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.

◆ GetMaterialGraphs()

static MAXON_METHOD Result<BaseArray<nodes::NodesGraphModelRef> > GetMaterialGraphs ( const cinema::BaseDocument *const  doc,
const Id &  nodeSpaceId 
)
static

Returns all material graphs in the given scene #doc which are in the given #nodeSpaceId.

Parameters
[in]docThe document to get the material graphs from.
[in]nodeSpaceIdThe node space to retrieve the graphs for. Cannot be the empty ID.
Returns
All material graphs in the given scene #doc which are of the given #nodeSpaceId.