AssetCreationHelper Class Reference

#include <asset_creation_helper.h>

Detailed Description

Helper interface for asset creation and drag&drop. All maxon API based asset creation code should be here. Any asset creation with C4D legacy API ties should be in AssetCreationInterface.

Public Types

using DefaultsPresetSubType = Array< Id >
 

Static Public Member Functions

static MAXON_METHOD Result< BoolGetDefaultSettings (const AssetDescription &asset, DefaultsPresetSubType &outSubType, DataDictionary &outDefaultValues)
 
static MAXON_METHOD Result< IdJoinDefaultsPresetSubType (const DefaultsPresetSubType &ids)
 
static MAXON_METHOD Result< IdJoinDefaultsPresetSubType (const Block< const DefaultsPresetSubType::ValueType > &ids)
 
static MAXON_METHOD Result< IdGetJoinedDefaultsPresetSubType (const BasePresetAssetType &assetType, const Block< const DefaultsPresetSubType::ValueType > &ids)
 
static MAXON_METHOD Result< IdGetNodeTemplateIdFromDefaultsPreset (const AssetDescription &asset)
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (AssetCreationHelper, MAXON_REFERENCE_STATIC, "net.maxon.assets.assetcreationhelper")
 

Member Typedef Documentation

◆ DefaultsPresetSubType

List of identifiers that define a defaults preset type (will become the asset's ASSETMETADATA::SubType).

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( AssetCreationHelper  ,
MAXON_REFERENCE_STATIC  ,
"net.maxon.assets.assetcreationhelper"   
)
private

◆ GetDefaultSettings()

static MAXON_METHOD Result<Bool> GetDefaultSettings ( const AssetDescription &  asset,
DefaultsPresetSubType outSubType,
DataDictionary &  outDefaultValues 
)
static

GetDefaultSettings loads the settings for all maxon API defaults asset types. All XnodeEmulation and capsule type objects are supported here.

Parameters
[in]assetDefaults preset asset to load.
[out]outSubTypeIdentifier of the defaults preset asset type.
[out]outDefaultValuesSetting dictionary. One entry for each attribute to receive a default value. Key: AMEmulationDefaultsKey (i.e. ~ PathBlock), Value: Data (contains DESCRIPTION::DATA::BASE::DEFAULTVALUE).
Returns
True means a partial preset was loaded. False for a full preset. Error on failure.

◆ JoinDefaultsPresetSubType() [1/2]

static MAXON_METHOD Result<Id> JoinDefaultsPresetSubType ( const DefaultsPresetSubType ids)
static

Merges all identifiers in a single formatted Id. Format will be C4DSUBTYPEPREFIX + ("_" + Id) ... where each identifier will be appended to the prefix with a "_" separator.

Parameters
[in]idsThe identifiers to merge.
Returns
The merged identifier.

◆ JoinDefaultsPresetSubType() [2/2]

static MAXON_METHOD Result<Id> JoinDefaultsPresetSubType ( const Block< const DefaultsPresetSubType::ValueType > &  ids)
static

Merges all identifiers in a single formatted Id. Format will be C4DSUBTYPEPREFIX + ("_" + Id) ... Where each identifier will be appended to the prefix with a "_" separator.

Parameters
[in]idsThe identifiers to merge.
Returns
The merged identifier.

◆ GetJoinedDefaultsPresetSubType()

static MAXON_METHOD Result<Id> GetJoinedDefaultsPresetSubType ( const BasePresetAssetType &  assetType,
const Block< const DefaultsPresetSubType::ValueType > &  ids 
)
static

Merges all identifiers in a single formatted Id. Format will be C4DSUBTYPEPREFIX + ("_" + assetTypePrefix) + ("_" + ids[0])...

See also
JoinDefaultsPresetSubType.
Parameters
[in]idsThe identifiers to merge.
Returns
The merged identifier. An IllegalArgumentError if the #assetType is not handled by function.

◆ GetNodeTemplateIdFromDefaultsPreset()

static MAXON_METHOD Result<Id> GetNodeTemplateIdFromDefaultsPreset ( const AssetDescription &  asset)
static

Finds the NodeTemplate asset id that was used to create the AssetTypes::NodeDefaultsPreset #asset.

Parameters
[in]assetAn asset of type AssetTypes::NodeDefaultsPreset.
Returns
The NodeTemplate identifier to use for creating a node or capsule. Error if no identifier found.