NodeDescriptionAssetInterface Class Reference

#include <nodedescription_asset.h>

Inheritance diagram for NodeDescriptionAssetInterface:

Detailed Description

A description asset allows easy reuse of partial or complete descriptions. Asset can be used to create new nodes or to add some component to existing nodes and groups.

Public Member Functions

 MAXON_ATTRIBUTE_CLASS (Bool, OverwriteAllAttributes, "net.maxon.node.assettype.context.overwriteall", RESOURCE_DEFAULT(false))
 
 MAXON_ATTRIBUTE_CLASS (Id, DefaultPortClassification, "net.maxon.node.assettype.context.defaultportclass")
 
MAXON_METHOD Result< void > Apply (const GraphNode &node, const DataDictionary &context)
 
MAXON_METHOD Result< void > MergeDescriptions (const DataDescriptionDefinitionWithUIAndLanguageStrings &desc)
 
MAXON_METHOD Result< DataDescriptionDefinition > GetDataDescriptionDefinition (const Id &category) const
 
MAXON_METHOD Result< void > SetDataDescriptionDefinition (const Id &category, const DataDescriptionDefinition &desc)
 
MAXON_METHOD Result< const DataDescriptionDefinitionWithUIAndLanguageStrings & > GetCompleteDescription () const
 
MAXON_METHOD Result< void > SetCompleteDescription (const DataDescriptionDefinitionWithUIAndLanguageStrings &desc)
 
MAXON_METHOD Result< DataDescriptionDefinitionWithUIAndLanguageStringsCreateFinalDefinition (const DataDescriptionDefinitionWithUIAndLanguageStrings &compareDefinition, const DataDictionary &context)
 

Static Public Member Functions

static MAXON_METHOD Result< NodeDescriptionAsset > Create ()
 

Private Member Functions

 MAXON_INTERFACE (NodeDescriptionAssetInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.node.interface.asset.nodedescription")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( NodeDescriptionAssetInterface  ,
MAXON_REFERENCE_COPY_ON_WRITE  ,
"net.maxon.node.interface.asset.nodedescription"   
)
private

◆ MAXON_ATTRIBUTE_CLASS() [1/2]

MAXON_ATTRIBUTE_CLASS ( Bool  ,
OverwriteAllAttributes  ,
"net.maxon.node.assettype.context.overwriteall"  ,
RESOURCE_DEFAULT(false)   
)

Allows to overwrite node description attributes instead of creating unique port entries. Set to true to overwrite all attributes, i.e. the same asset dropped multiple times on a node will create ports on first drop, subsequent drops would update the description so it matches the dropped description. Set to false to allow same asset dropped multiple times on a node to create new unique ports each time. Port identifiers will be appended with an increasing number (1, 2, 3, ....). This only applies to ports. Include commands, groups and separators will only get updated, not created with unique identifiers. False by default.

◆ MAXON_ATTRIBUTE_CLASS() [2/2]

MAXON_ATTRIBUTE_CLASS ( Id  ,
DefaultPortClassification  ,
"net.maxon.node.assettype.context.defaultportclass"   
)

Defines the default classification to assign to an attribute which has DESCRIPTION::DATA::BASE::CLASSIFICATION not set. Providing this allow to use a basic NodeDescriptionAsset both as input or output.

See also
DESCRIPTION::DATA::BASE::CLASSIFICATION.

◆ Create()

static MAXON_METHOD Result<NodeDescriptionAsset> Create ( )
static

Creates a new NodeDescriptionAsset. Asset will be empty and should be stored in a repository with AssetRepositoryInterface::StoreAsset to save it's content.

Returns
The new empty NodeDescriptionAsset.

◆ Apply()

MAXON_METHOD Result<void> Apply ( const GraphNode node,
const DataDictionary &  context 
)

Uses the NodeDescriptionAsset's definition to update the the target node with any additional entries or changes it contains.

Parameters
[in]nodeThe group node where to apply the description changes.
[in]contextAdditional arguments for the node definition update.
Returns
OK on success.

◆ MergeDescriptions()

MAXON_METHOD Result<void> MergeDescriptions ( const DataDescriptionDefinitionWithUIAndLanguageStrings desc)

Merges the given DataDescriptionDefinition desc with the current asset's content.

Parameters
[in]descThe descriptions to add or merge to the current asset.
Returns
OK on success.

◆ GetDataDescriptionDefinition()

MAXON_METHOD Result<DataDescriptionDefinition> GetDataDescriptionDefinition ( const Id category) const

Reads the description from the requested category.

Parameters
[in]categoryEither DATADESCRIPTION_CATEGORY_DATA, DATADESCRIPTION_CATEGORY_UI or a language identifier.
Returns
The description on success, will be empty if the category was empty or missing.

◆ SetDataDescriptionDefinition()

MAXON_METHOD Result<void> SetDataDescriptionDefinition ( const Id category,
const DataDescriptionDefinition &  desc 
)

Writes the description for the requested category. Asset should be stored to repository for changes to be permanent.

Parameters
[in]categoryEither DATADESCRIPTION_CATEGORY_DATA, DATADESCRIPTION_CATEGORY_UI or a language identifier.
[in]descThe new description (no merge will occur).
Returns
OK on success.

◆ GetCompleteDescription()

MAXON_METHOD Result<const DataDescriptionDefinitionWithUIAndLanguageStrings&> GetCompleteDescription ( ) const

Reads all description categories.

Returns
The description on success, can be empty.

◆ SetCompleteDescription()

MAXON_METHOD Result<void> SetCompleteDescription ( const DataDescriptionDefinitionWithUIAndLanguageStrings desc)

Writes the all description categories. Asset should be stored to repository for changes to be permanent.

Parameters
[in]descThe new description (no merge will occur).
Returns
OK on success.

◆ CreateFinalDefinition()

MAXON_METHOD Result<DataDescriptionDefinitionWithUIAndLanguageStrings> CreateFinalDefinition ( const DataDescriptionDefinitionWithUIAndLanguageStrings compareDefinition,
const DataDictionary &  context 
)

Uses the NodeDescriptionAsset's definition to create a new one ready to be used in the given context. Attributes could be skipped, removed or receive a new identifier based on the content of context. I.e. #compareDefinition will be compared with the asset's definition and a final adjusted result will be returned.

Parameters
[in]compareDefinitionThe definition categories to which add the NodeDescriptionAsset's content.
[in]contextAdditional arguments for the definition comparison.
Returns
A full definition ready to be used as per the requested context.