UiConversionInterface Class Reference

#include <uiconversions.h>

Inheritance diagram for UiConversionInterface:

Public Member Functions

MAXON_METHOD Result< void > QuerySupportedDataTypes (BaseArray< DataType > &dataTypes) const
 
MAXON_METHOD Result< void > CreateC4DDescription (const DataType &dataType, Description &c4dDescription, const LanguageRef &language, const DataDictionary &dataEntry, const DataDictionary &guiEntry, const DataDescription &mainDataDescription, const DataDescription &stringDescription, const DescID &mainId, const DescID &groupId, const PatchC4DDescriptionEntryDelegate &patchEntryFunc, DescTranslation &translateIds, const BaseArray< InternedId > &parentIds, const DescID &parentFoldId, const GetDataCallbackType &getDataCallback, const GetExtraDataCallbackType &getExtraDataDelegate, BaseDocument *doc) const
 
MAXON_METHOD Result< void > ConvertToC4D (GeData &output, const DataType &dataType, const Data &data, const DescID &descIdSuffix, const DataDictionary &dataEntry, const DataDictionary &guiEntry, const GetExtraDataCallbackType &extraDataDelegate, BaseDocument *doc) const
 
MAXON_METHOD Result< Tuple< Data, Bool > > ConvertToCore (const DataType &dataType, const GeData &data, const DescID &descIdSuffix, const DataDictionary &dataEntry, const DataDictionary &guiEntry, const Data &oldData, const GetExtraDataCallbackType &extraDataDelegate, BaseDocument *doc) const
 

Static Public Member Functions

static MAXON_METHOD Result< void > AddDefaultConversion (const DataType &dataType, const Id &guiId)
 
static MAXON_METHOD Result< UiConversion > GetGuiConversionEntry (const Id &dataTypeId, const Id &guiTypeId, Id *resGuiTypeId)
 
static MAXON_METHOD Result< BaseArray< Id > > GetCompatibleUIs (const DataType &dataType)
 
static MAXON_METHOD Result< DataConvertData (const Data &data, const DataType &dstDataType)
 
static MAXON_METHOD Result< DataConvertData (Data &&data, const DataType &dstDataType)
 

Private Member Functions

 MAXON_INTERFACE (UiConversionInterface, MAXON_REFERENCE_CONST, "net.maxon.interface.uiconversion")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( UiConversionInterface  ,
MAXON_REFERENCE_CONST  ,
"net.maxon.interface.uiconversion"   
)
private

◆ QuerySupportedDataTypes()

MAXON_METHOD Result<void> QuerySupportedDataTypes ( BaseArray< DataType > &  dataTypes) const

Returns the supported data types of the implemented ui.

Parameters
[out]dataTypesList of compatible types.
Returns
OK on success.

◆ CreateC4DDescription()

MAXON_METHOD Result<void> CreateC4DDescription ( const DataType dataType,
Description c4dDescription,
const LanguageRef &  language,
const DataDictionary &  dataEntry,
const DataDictionary &  guiEntry,
const DataDescription &  mainDataDescription,
const DataDescription &  stringDescription,
const DescID mainId,
const DescID groupId,
const PatchC4DDescriptionEntryDelegate patchEntryFunc,
DescTranslation translateIds,
const BaseArray< InternedId > &  parentIds,
const DescID parentFoldId,
const GetDataCallbackType getDataCallback,
const GetExtraDataCallbackType getExtraDataDelegate,
BaseDocument doc 
) const

CreateC4DDescription generates the description for the given description entry.

Parameters
[in]dataTypeData type of the entry.
[in,out]c4dDescriptionC4D description to fill.
[in]languageLanguage to use.
[in]dataEntryData description for the given entry.
[in]guiEntryUI description for the given entry.
[in]mainDataDescriptionMain data description.
[in]stringDescriptionString description for the given entry and current language.
[in]mainIdDescID to use for this id.
[in]groupIdGroup id to use for this entry.
[in]patchEntryFunccall back which is called for each generated c4d description entry. This allows to patch several parameters from outside before adding to c4dDescription.
[in]translateIdsTranslation table for all ids.
[in]parentIdsParent ids to concatenate.
[in]parentFoldIdParent fold id.
[in]getDataCallbackGetDataCallback in case the data is needed to create the ui.
[in]getExtraDataDelegateCallback to query extra data (e.g. GetRepositoryMessage).
[in]docDocument context for the description.
Returns
OK on success.

◆ ConvertToC4D()

MAXON_METHOD Result<void> ConvertToC4D ( GeData output,
const DataType dataType,
const Data data,
const DescID descIdSuffix,
const DataDictionary &  dataEntry,
const DataDictionary &  guiEntry,
const GetExtraDataCallbackType extraDataDelegate,
BaseDocument doc 
) const

ConvertToC4D implements the data type conversion from Data to GeData for all supported types returned by QuerySupportedDataTypes().

Parameters
[out]outputThe converted value.
[in]dataTypeData type to convert.
[in]dataData to convert.
[in]descIdSuffixDescId suffix which indicates the sub entry for UIs which generated multiple DescID attributes in the c4d description.
[in]dataEntryData description entry of the given value.
[in]guiEntryUI description entry of the given value.
[in]extraDataDelegateExtra delegate to retrieve additional data from parent objects.
[in]docDocument context for the conversion.
Returns
OK on success.

◆ ConvertToCore()

MAXON_METHOD Result<Tuple<Data, Bool> > ConvertToCore ( const DataType dataType,
const GeData data,
const DescID descIdSuffix,
const DataDictionary &  dataEntry,
const DataDictionary &  guiEntry,
const Data oldData,
const GetExtraDataCallbackType extraDataDelegate,
BaseDocument doc 
) const

ConvertToCore implements the data type conversion from GeData to Data for all supported types returned by QuerySupportedDataTypes().

Parameters
[in]dataTypeData type to convert.
[in]dataGeData to convert.
[in]descIdSuffixDescId suffix which indicates the sub entry for UIs which generated multiple DescID attributes in the c4d description.
[in]dataEntryData description entry of the given value.
[in]guiEntryUI description entry of the given value.
[in]oldDataPrevious old data.
[in]extraDataDelegateExtra delegate to retrieve additional data from parent objects.
[in]docDocument context for the conversion.
Returns
Converted Data on success. Bool: false is the default, true overrites the return value in the port with the ui type (e.g. psrmatrix)

◆ AddDefaultConversion()

static MAXON_METHOD Result<void> AddDefaultConversion ( const DataType dataType,
const Id guiId 
)
static

AddDefaultConversion allows to add a new default conversion for a given data type.

UiConversionInterface::AddDefaultConversion(GetDataType<Bool>(), UiConversions::UiBool.GetId()) iferr_return;
static MAXON_METHOD Result< void > AddDefaultConversion(const DataType &dataType, const Id &guiId)
#define iferr_return
Definition: resultbase.h:1519
Parameters
[in]dataTypeData type to add.
[in]guiIdUI id to add to the table.
Returns
OK on success.

◆ GetGuiConversionEntry()

static MAXON_METHOD Result<UiConversion> GetGuiConversionEntry ( const Id dataTypeId,
const Id guiTypeId,
Id resGuiTypeId 
)
static

GetGuiConversionEntry returns the UiConversion object for the given datatype and ui id.

Parameters
[in]dataTypeIdData type to use as fallback.
[in]guiTypeIdUI to find in the UiConversions registry. If not found the fallback will check the datatype id with the registered default UIs.
[out]resGuiTypeIdOptional: if not nullptr it will return the detected UI id.
Returns
UiConversion on success.

◆ GetCompatibleUIs()

static MAXON_METHOD Result<BaseArray<Id> > GetCompatibleUIs ( const DataType dataType)
static

Returns a array with all compatible ui types for the given datatype.

Parameters
[in]dataTypeData type for which all ids should be returned.
Returns
Array with ids on success.

◆ ConvertData() [1/2]

static MAXON_METHOD Result<Data> ConvertData ( const Data data,
const DataType dstDataType 
)
static

ConvertData converts the given data to any compatible type. If no valid conversion is found an error is returns.

Parameters
[in]dataData to convert.
[in]dstDataTypeDestination data type.
Returns
Converted data on success.

◆ ConvertData() [2/2]

static MAXON_METHOD Result<Data> ConvertData ( Data &&  data,
const DataType dstDataType 
)
static

ConvertData converts the given data to any compatible type. If no valid conversion is found an error is returns.

Parameters
[in]dataData to convert.
[in]dstDataTypeDestination data type.
Returns
Converted data on success.