AssetCreationInterface Class Reference

#include <asset_creation.h>

Inheritance diagram for AssetCreationInterface:

Detailed Description

Helper interface for asset creation and drag&drop.

Public Types

using AMEmulationType = decltype(presetargs::AssetSubType)::ValueType
 

Static Public Member Functions

static MAXON_METHOD Result< IdGetNewAssetIdFromIdAndVersion (const String &prefix, const IdAndVersion &idAndVersion)
 
static MAXON_METHOD Result< void > UpdateMetaData (const AssetDescription &asset)
 
static MAXON_METHOD Result< void > UpdateMetaData (BaseDocument *doc, DataDictionary &metaProperties, Bool calcBoundingBox, const Matrix &objectMatrix, const Id &subType)
 
static MAXON_METHOD Result< BoolSaveBaseDocumentAsAsset (BaseDocument *doc, const Filename &c4dRootPath, Filename &saveFileName, AddAssetDepencendyStruct &addDependencyStruct, ResolveAssetDependenciesStruct &resolveAssets, DataDictionary &metaProperties, Bool calcBoundingBox, const Matrix &objectMatrix, const Id &subType)
 
static MAXON_METHOD Result< Tuple< AssetDescription, Bool > > SaveMemFileAsAssetWithCopyAsset (const Url &depResultUrl, const StoreAssetStruct &storeAssetStruct, const InternedId &subType, const HashSet< AssetDependencyStruct > &dependencies, const String &assetName, Bool addAssetsIfNotInThisRepository)
 
static MAXON_METHOD Result< Tuple< AssetDescription, UpdatableAssetRepositoryRef > > SaveMemFileAsAsset (const Url &saveFileName, const Id &parentCategory, const InternedId &subType, Bool calculateMetaData, const DataDictionary &metaProperties, const HashSet< AssetDependencyStruct > &dependencies, const BaseArray< Url > &previews, Float animFps, const String &assetName, const HashMap< Id, String > &localizedNames, const HashMap< Id, String > &localizedAnnotations, const AssetMetaData &copyMetaData)
 
static MAXON_METHOD Result< Tuple< AssetDescription, UpdatableAssetRepositoryRef > > SaveMemFileAsAssetAlone (const Url &saveFileName, const AssetMetaData &copyMetaData)
 
static MAXON_METHOD Result< void > SaveMetaDataForAsset (const AssetDescription &asset, const Id &parentCategory, const InternedId &subType, Bool calculateMetaData, const DataDictionary &metaProperties, const HashSet< AssetDependencyStruct > &dependencies, const BaseArray< Url > &previews, Float animFps, const String &assetName, const HashMap< Id, String > &localizedNames, const HashMap< Id, String > &localizedAnnotations)
 
static MAXON_METHOD Result< AssetDescription > SaveDocumentAsset (BaseDocument *assetDoc, InternedId subType, Id newAssetId, const StoreAssetStruct &storeAssetStruct, const String &assetName, const String &versionString, const Delegate< Result< BaseBitmap * >()> &createPreviewBitmapDelegate, const AssetMetaData &copyMetaData, Bool addAssetsIfNotInThisRepository)
 
static MAXON_METHOD Result< Tuple< AssetDescription, Bool > > SaveTextureAsset (const Url &imageUrl, const String &assetName, const StoreAssetStruct &storeAssetStruct, const HashSet< AssetDependencyStruct > &dependencies, Bool addAssetsIfNotInThisRepository)
 
static MAXON_METHOD Result< void > GenerateImagePreview (const Url &imageUrl, const ValueReceiver< const Url & > &previews, Int32 previewW, Int32 previewH)
 
static MAXON_METHOD Result< void > GenerateScenePreviewImage (BaseDocument *doc, BaseBitmap *preview, GENERATESCENEPREVIEWIMAGEFLAGS flags, Int32 previewW, Int32 previewH)
 
static MAXON_METHOD Result< AssetDescription > CreateMaterialAsset (BaseDocument *activeDoc, BaseMaterial *mat, const StoreAssetStruct &storeAssetStruct, const Id &assetId, const String &assetName, const String &assetVersion, const AssetMetaData &copyMetaData, Bool addAssetsIfNotInThisRepository)
 
static MAXON_METHOD Result< AssetDescription > CreateObjectAsset (BaseObject *op, BaseDocument *activeDoc, const StoreAssetStruct &storeAssetStruct, const Id &assetId, const String &assetName, const String &assetVersion, const AssetMetaData &copyMetaData, Bool addAssetsIfNotInThisRepository)
 
static MAXON_METHOD Result< AssetDescription > CreateSceneAsset (BaseDocument *activeDoc, const StoreAssetStruct &storeAssetStruct, const Id &assetId, const String &assetName, const String &assetVersion, const AssetMetaData &copyMetaData, Bool addAssetsIfNotInThisRepository)
 
static MAXON_METHOD Result< AssetDescription > SaveActiveDocumentAsNewVersion (BaseDocument *activeDoc, Bool addAssetsIfNotInThisRepository)
 
static MAXON_METHOD Result< void > CreateObjectsOnDrag (BaseDocument *doc, const Url &url, const AssetDescription &asset, const String &filterString, Bool allowPreviewCube, Bool overwriteMatrix, const Matrix &overwriteMatrixMg, Float placementScale, BaseObject *parent=nullptr, BaseObject *prev=nullptr)
 
static MAXON_METHOD Result< void > CreateObjectsOnMultiDrag (BaseDocument *doc, const BaseArray< Tuple< Url, AssetDescription, String >> &assets, Bool allowPreviewCube, Bool overwriteMatrix, const Matrix &overwriteMatrixMg, Float placementScale, BaseObject *parent=nullptr, BaseObject *prev=nullptr)
 
static MAXON_METHOD Result< void > CheckObjectsOnDrop (BaseDocument *doc, const Url &url, const AssetDescription &asset, Float placementScale)
 
static MAXON_METHOD Result< BaseArray< BaseMaterial * > > CreateMaterialsOnDrag (BaseDocument *doc, BaseList2D *objectOrTag, const Url &url, Bool allowMultiple, const Id &subType, Bool noManagerUpdate, Bool startUndo)
 
static MAXON_METHOD Result< void > AddPreviewRenderAsset (const Block< AssetDescription > &assetsToPreviewRender)
 
static MAXON_METHOD Result< BoolOpenSaveAssetDialog (OPENSAVEASSETDIALOGFLAGS flags, const String &presetTypeName, Id &id, String &name, String &version, const AssetRepositoryRef &lookupRepository, Id &category, AssetRepositoryRef &selectedRepository, Bool &setAsDefault)
 
static MAXON_METHOD Result< UrlRenderDocumentAsset (BaseDocument *renderDoc, const ProgressRef &progressRef, Int progressIndex, Int polygonCount, Int32 previewW, Int32 previewH, GENERATESCENEPREVIEWIMAGEFLAGS flags)
 
static MAXON_METHOD Result< ResolveAssetDependenciesStruct::ResolveDelegateGetAddDependencyDelegate (const Filename &documentPath, Bool addAssetsIfNotInThisRepository)
 
static MAXON_METHOD Bool GetDefaultSettings (const AssetDescription &asset, Block< const Int32 > &resId, BaseContainer &resData)
 
static MAXON_METHOD BaseList2DGetDefaultObject (const Block< const Int32 > &id, BaseDocument *doc)
 
static MAXON_METHOD BaseList2DGetDefaultObject (const AssetDescription &asset)
 
static MAXON_METHOD Bool SetDefaultObject (const Block< const Int32 > &defaultsType, Bool partial, const BaseContainer &bc, Bool setAsDefault, Bool allowMakeDefault)
 
static MAXON_METHOD Result< void > BrowseDescriptionForDefaults (Description &desc, const Delegate< Result< void >(const DescID &key, DescCompareEntry &&value)> &add, Bool isPartial)
 
static MAXON_METHOD Result< void > SaveDefaultPresetFromObject (GeListNode *l, Bool makeDefault, Bool allowMakeDefault=true)
 
static MAXON_METHOD Result< AssetDescription > SaveBrowserPreset (const BasePresetAssetType &assetType, const PresetSaveArgs &sourceData, const String &presetTypeName, const String &presetNameA, Bool showMakeDefault, Bool setAsDefault, Bool allowSceneRepository)
 
static MAXON_METHOD Tuple< Bool, BoolSupportDefaultPresets (C4DAtomGoal *l)
 
static MAXON_METHOD Result< AssetDescription > SaveDocumentAsset (BaseDocument *assetDoc, InternedId subType, Id newAssetId, const StoreAssetStruct &storeAssetStruct, const String &assetName, const String &versionString, const Delegate< Result< BaseBitmap * >()> &createPreviewBitmapDelegate, const AssetMetaData &copyMetaData, Bool addAssetsIfNotInThisRepository, ResolveAssetDependenciesStruct &resolveAssets)
 
static MAXON_METHOD Result< AssetDescription > CreateObjectAsset (BaseObject *op, BaseDocument *activeDoc, const StoreAssetStruct &storeAssetStruct, const Id &assetId, const String &assetName, const String &assetVersion, const AssetMetaData &copyMetaData, Bool addAssetsIfNotInThisRepository, ResolveAssetDependenciesStruct &resolveAssets)
 
static MAXON_METHOD Result< AssetDescription > CreateMaterialAsset (BaseDocument *activeDoc, BaseMaterial *mat, const StoreAssetStruct &storeAssetStruct, const Id &assetId, const String &assetName, const String &assetVersion, const AssetMetaData &copyMetaData, Bool addAssetsIfNotInThisRepository, ResolveAssetDependenciesStruct &resolveAssets)
 
static MAXON_METHOD BasePresetAssetType GetDefaultsPresetAssetType (BaseList2D *bl)
 
static MAXON_METHOD Result< IdJoinDefaultsPresetSubType (const Block< const Int32 > &blIds)
 
static MAXON_METHOD Result< void > SetEmulationDefaultObject (const AMEmulationType &defaultsType, const BasePresetAssetType &assetType, Bool partial, const String &baseAssetName, const DataDictionary &data, Bool setAsDefault, Bool allowMakeDefault)
 
static MAXON_METHOD Result< AMEmulationTypeGetEmulationDefaultsPresetType (BaseList2D *bl)
 
static MAXON_METHOD Result< IdGetJoinedDefaultsPresetSubType (const AtomArray &blList, const BaseArray< Int32 > &defaultsType)
 

Private Member Functions

 MAXON_INTERFACE (AssetCreationInterface, MAXON_REFERENCE_NORMAL, "net.maxon.mvp.assetcreationinterface")
 

Member Typedef Documentation

◆ AMEmulationType

using AMEmulationType = decltype(presetargs::AssetSubType)::ValueType

List of identifiers that define the type of an AMEmulationNode (i.e. what it emulates). Use as a defaults preset type for all AMEmulationNode related presets. See SetDefaultObject for legacy object's type.

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( AssetCreationInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.mvp.assetcreationinterface"   
)
private

◆ GetNewAssetIdFromIdAndVersion()

static MAXON_METHOD Result<Id> GetNewAssetIdFromIdAndVersion ( const String prefix,
const IdAndVersion idAndVersion 
)
static

GetNewAssetIdFromIdAndVersion generates a standarized id from the given prefix and IdAndVersion for a new asset.

Parameters
[in]prefixPrefix can be used for the type of the asset. e.g. "file" for file assets. preset for "presets".
[in]idAndVersionIdAndVersion of the asset to be created.
Returns
Id on success.

◆ UpdateMetaData() [1/2]

static MAXON_METHOD Result<void> UpdateMetaData ( const AssetDescription &  asset)
static

UpdateMetaData recalculates the asset metadata. For scene files this might be the number of points, polygons. etc. for images the size, bitdepth etc.

Parameters
[in]assetAsset to be evaluated.
Returns
OK on success.

◆ UpdateMetaData() [2/2]

static MAXON_METHOD Result<void> UpdateMetaData ( BaseDocument doc,
DataDictionary &  metaProperties,
Bool  calcBoundingBox,
const Matrix objectMatrix,
const Id subType 
)
static

UpdateMetaData recalculates the asset metadata. For scene files this might be the number of points, polygons. etc. for images the size, bitdepth etc.

Parameters
[in]docBaseDocument to evaluate.
[out]metaPropertiesDataDictionary to store the data.
[in]calcBoundingBoxTrue to calculate the bounding box of the scene.
[in]objectMatrixOptional matrix to add to the object.
[in]subTypeSubType of the asset, e.g. ASSETMETADATA::SubType_ENUM_Object.
Returns
OK on success.

◆ SaveBaseDocumentAsAsset()

static MAXON_METHOD Result<Bool> SaveBaseDocumentAsAsset ( BaseDocument doc,
const Filename c4dRootPath,
Filename saveFileName,
AddAssetDepencendyStruct addDependencyStruct,
ResolveAssetDependenciesStruct resolveAssets,
DataDictionary &  metaProperties,
Bool  calcBoundingBox,
const Matrix objectMatrix,
const Id subType 
)
static

SaveBaseDocumentAsAsset stores the given BaseDocument as a new scene to be saved as an asset. Dependencies will be calculated as well.

Parameters
[in]docBaseDocument to store.
[in]c4dRootPathRoot of the document. This path is used to search textures/dependencies.
[in,out]saveFileNameDestination path where the BaseDocument will be stored (this can be a memory file).
[in,out]addDependencyStructAddAssetDepencendyStruct which is triggered on any dependency found.
[in,out]resolveAssetsResolveAssetDependenciesStruct keeps temporary data to resolve dependencies.
[out]metaPropertiesDataDictionary to store the data.
[in]calcBoundingBoxTrue to calculate the bounding box of the scene.
[in]objectMatrixOptional matrix to add to the object.
[in]subTypeSubType of the asset, e.g. ASSETMETADATA::SubType_ENUM_Object.
Returns
OK on success.

◆ SaveMemFileAsAssetWithCopyAsset()

static MAXON_METHOD Result<Tuple<AssetDescription, Bool> > SaveMemFileAsAssetWithCopyAsset ( const Url depResultUrl,
const StoreAssetStruct storeAssetStruct,
const InternedId subType,
const HashSet< AssetDependencyStruct > &  dependencies,
const String assetName,
Bool  addAssetsIfNotInThisRepository 
)
static

SaveMemFileAsAssetWithCopyAsset stores the given url as a asset.

Parameters
[in]depResultUrlUrl of the asset to store.
[in]storeAssetStructsee StoreAssetStruct.
[in]subTypeSubType of the asset, e.g. ASSETMETADATA::SubType_ENUM_Object.
[in]dependenciesDependencies to store with the assets.
[in]assetNameUser readable name of the asset.
[in]addAssetsIfNotInThisRepositoryTrue to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing.
Returns
Tuple<AssetDescription, Bool> on success. AssetDescription contains the new asset description, Bool is true if the asset is a new asset. False if the asset already existed.

◆ SaveMemFileAsAsset()

static MAXON_METHOD Result<Tuple<AssetDescription, UpdatableAssetRepositoryRef> > SaveMemFileAsAsset ( const Url saveFileName,
const Id parentCategory,
const InternedId subType,
Bool  calculateMetaData,
const DataDictionary &  metaProperties,
const HashSet< AssetDependencyStruct > &  dependencies,
const BaseArray< Url > &  previews,
Float  animFps,
const String assetName,
const HashMap< Id, String > &  localizedNames,
const HashMap< Id, String > &  localizedAnnotations,
const AssetMetaData &  copyMetaData 
)
static

SaveMemFileAsAsset stores the given url as a asset into a temporary repository.

Parameters
[in]saveFileNameUrl of the asset to be stored.
[in]parentCategoryParent category in which the asset should be saved.
[in]subTypeSubType of the asset, e.g. ASSETMETADATA::SubType_ENUM_Object.
[in]calculateMetaDataTrue to automatically calculate meta data when saving.
[in]metaPropertiesAdditional metadata to store.
[in]dependenciesDependencies to store with the asset.
[in]previewsArray images of Previews. If you pass more then one image it will be stored as animated mp4 with the given animFps frame rate.
[in]animFpsIf more than one image was given the preview will be stored as mp4 wih this frame rate.
[in]assetNameUser readable name of the asset.
[in]localizedNamesOptional translated names of the asset in other languages. Id is the languageid from LanguageInterface.
[in]localizedAnnotationsOptional translated descriptions of the asset in other languages. Id is the languageid from LanguageInterface.
[in]copyMetaDataMetadata to copy.
Returns
Tuple<AssetDescription, UpdatableAssetRepositoryRef> on success. AssetDescription of the new asset. UpdatableAssetRepositoryRef is a new temporary repository from which the asset can be moved into the target repository.

◆ SaveMemFileAsAssetAlone()

static MAXON_METHOD Result<Tuple<AssetDescription, UpdatableAssetRepositoryRef> > SaveMemFileAsAssetAlone ( const Url saveFileName,
const AssetMetaData &  copyMetaData 
)
static

SaveMemFileAsAssetAlone stores the plain file into a temporary repository.

Parameters
[in]saveFileNameUrl of the asset to be stored.
[in]copyMetaDataOptional meta data to copy.
Returns
Tuple<AssetDescription, UpdatableAssetRepositoryRef> on success. AssetDescription of the new asset. UpdatableAssetRepositoryRef is a new temporary repository from which the asset can be moved into the target repository.

◆ SaveMetaDataForAsset()

static MAXON_METHOD Result<void> SaveMetaDataForAsset ( const AssetDescription &  asset,
const Id parentCategory,
const InternedId subType,
Bool  calculateMetaData,
const DataDictionary &  metaProperties,
const HashSet< AssetDependencyStruct > &  dependencies,
const BaseArray< Url > &  previews,
Float  animFps,
const String assetName,
const HashMap< Id, String > &  localizedNames,
const HashMap< Id, String > &  localizedAnnotations 
)
static

SaveMetaDataForAsset stores he given values into the asset description.

Parameters
[in]assetAsset to be modified.
[in]parentCategoryOptional value to set the category of the asset.
[in]subTypeOptional value to set the subType of the asset.
[in]calculateMetaDataTrue to automatically calculate the meta data for known sybTypes.
[in]metaPropertiesAdditional metaData to store.
[in]dependenciesDependencies to store along with the asset.
[in]previewsArray images of Previews. If you pass more then one image it will be stored as animated mp4 with the given animFps frame rate.
[in]animFpsIf more than one image was given the preview will be stored as mp4 wih this frame rate.
[in]assetNameUser readable name of the asset.
[in]localizedNamesOptional translated names of the asset in other languages. Id is the languageid from LanguageInterface.
[in]localizedAnnotationsOptional translated descriptions of the asset in other languages. Id is the languageid from LanguageInterface.
Returns
OK on success.

◆ SaveDocumentAsset() [1/2]

static MAXON_METHOD Result<AssetDescription> SaveDocumentAsset ( BaseDocument assetDoc,
InternedId  subType,
Id  newAssetId,
const StoreAssetStruct storeAssetStruct,
const String assetName,
const String versionString,
const Delegate< Result< BaseBitmap * >()> &  createPreviewBitmapDelegate,
const AssetMetaData &  copyMetaData,
Bool  addAssetsIfNotInThisRepository 
)
static

SaveDocumentAsset stores the given BaseDocument into the given repository.

Parameters
[in]assetDocBaseDocument to store.
[in]subTypeOptional value to set the subType of the asset.
[in]newAssetIdOptional asset Id. If empty the system calculates a new asset id.
[in]storeAssetStructSettings where to store the asset.
[in]assetNameUser readable name of the asset.
[in]versionStringUser readable version string.
[in]createPreviewBitmapDelegateOptional delegate to generate a preview preview bitmap when saving the asset.
[in]copyMetaDataOptional meta data to copy from another version.
[in]addAssetsIfNotInThisRepositoryTrue to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing.
Returns
AssetDescription of the new asset on success.

◆ SaveTextureAsset()

static MAXON_METHOD Result<Tuple<AssetDescription, Bool> > SaveTextureAsset ( const Url imageUrl,
const String assetName,
const StoreAssetStruct storeAssetStruct,
const HashSet< AssetDependencyStruct > &  dependencies,
Bool  addAssetsIfNotInThisRepository 
)
static

SaveTextureAsset stores the given image as media asset.

Parameters
[in]imageUrlUrl of the texture to store.
[in]assetNameHuman readable asset name.
[in]storeAssetStructSettings where to store the asset.
[in]dependenciesOptional dependencies to store along with the asset.
[in]addAssetsIfNotInThisRepositoryTrue to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing.
Returns
Tuple<AssetDescription, Bool> on success. AssetDescription of the new asset. Bool is true if the asset was saved. False if it was already in the repository. In that case the AssetDescription is the one of the existing asset.

◆ GenerateImagePreview()

static MAXON_METHOD Result<void> GenerateImagePreview ( const Url imageUrl,
const ValueReceiver< const Url & > &  previews,
Int32  previewW,
Int32  previewH 
)
static

GenerateImagePreview generates a preview image for a given texture.

Parameters
[in]imageUrlUrl of the texture.
[out]previewsValueReceiver which receives the preview.
[in]previewWPreview width.
[in]previewHPreview height.
Returns
OK on success.

◆ GenerateScenePreviewImage()

static MAXON_METHOD Result<void> GenerateScenePreviewImage ( BaseDocument doc,
BaseBitmap preview,
GENERATESCENEPREVIEWIMAGEFLAGS  flags,
Int32  previewW,
Int32  previewH 
)
static

GenerateScenePreviewImage generates the preview image of the given BaseDocument

Parameters
[in]docBaseDocument to preview.
[out]previewBaseBitmap into which the preview should be rendered.
[in]flagssee GENERATESCENEPREVIEWIMAGEFLAGS.
[in]previewWPreview width.
[in]previewHPreview height.
Returns
OK on success.

◆ CreateMaterialAsset() [1/2]

static MAXON_METHOD Result<AssetDescription> CreateMaterialAsset ( BaseDocument activeDoc,
BaseMaterial mat,
const StoreAssetStruct storeAssetStruct,
const Id assetId,
const String assetName,
const String assetVersion,
const AssetMetaData &  copyMetaData,
Bool  addAssetsIfNotInThisRepository 
)
static

CreateMaterialAsset creates a material asset from the given BaseMaterial.

Parameters
[in]activeDocBaseDocument of the material to store. This document will be used to find dependencies.
[in]matBaseMaterial to store.
[in]storeAssetStructSettings where to store the asset.
[in]assetIdOptional asset Id. If empty the system calculates a new asset id.
[in]assetNameHuman readable name of the asset.
[in]assetVersionHuman readable version string.
[in]copyMetaDataOptional meta data to copy from another version.
[in]addAssetsIfNotInThisRepositoryTrue to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing.
Returns
AssetDescription on success.

◆ CreateObjectAsset() [1/2]

static MAXON_METHOD Result<AssetDescription> CreateObjectAsset ( BaseObject op,
BaseDocument activeDoc,
const StoreAssetStruct storeAssetStruct,
const Id assetId,
const String assetName,
const String assetVersion,
const AssetMetaData &  copyMetaData,
Bool  addAssetsIfNotInThisRepository 
)
static

CreateObjectAsset description.

Parameters
[in]opBaseObject to store.
[in]activeDocBaseDocument of the material to store. This document will be used to find dependencies.
[in]storeAssetStructSettings where to store the asset.
[in]assetIdOptional asset Id. If empty the system calculates a new asset id.
[in]assetNameHuman readable name of the asset.
[in]assetVersionHuman readable version string.
[in]copyMetaDataOptional meta data to copy from another version.
[in]addAssetsIfNotInThisRepositoryTrue to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing.
Returns
OK on success.

◆ CreateSceneAsset()

static MAXON_METHOD Result<AssetDescription> CreateSceneAsset ( BaseDocument activeDoc,
const StoreAssetStruct storeAssetStruct,
const Id assetId,
const String assetName,
const String assetVersion,
const AssetMetaData &  copyMetaData,
Bool  addAssetsIfNotInThisRepository 
)
static

CreateSceneAsset description.

Parameters
[in]activeDocBaseDocument to store. This document will be used to find dependencies.
[in]storeAssetStructSettings where to store the asset.
[in]assetIdOptional asset Id. If empty the system calculates a new asset id.
[in]assetNameHuman readable name of the asset.
[in]assetVersionHuman readable version string.
[in]copyMetaDataOptional meta data to copy from another version.
[in]addAssetsIfNotInThisRepositoryTrue to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing.
Returns
OK on success.

◆ SaveActiveDocumentAsNewVersion()

static MAXON_METHOD Result<AssetDescription> SaveActiveDocumentAsNewVersion ( BaseDocument activeDoc,
Bool  addAssetsIfNotInThisRepository 
)
static

SaveActiveDocumentAsNewVersion writes the current BaseDocument as new version with asset dialog.

Parameters
[in]activeDocBasedocument to store.
[in]addAssetsIfNotInThisRepositoryTrue to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing.
Returns
AssetDescription on success.

◆ CreateObjectsOnDrag()

static MAXON_METHOD Result<void> CreateObjectsOnDrag ( BaseDocument doc,
const Url url,
const AssetDescription &  asset,
const String filterString,
Bool  allowPreviewCube,
Bool  overwriteMatrix,
const Matrix overwriteMatrixMg,
Float  placementScale,
BaseObject parent = nullptr,
BaseObject prev = nullptr 
)
static

CreateObjectsOnDrag helper function to create assets when d&d into a scene/viewport.

Parameters
[in]docBaseDocument to insert the asset.
[in]urlUrl of the d&d operation. This is typically an asset url "asset:///..."
[in]assetAssetDescription of the asset.
[in]filterStringFilter string of the d&d operation. This allows to switch the search term e.g. sphere / cube on a modeling node.
[in]allowPreviewCubeTrue to indicate that a preview cube should be inserted instead of the real geometry.
[in]overwriteMatrixTrue to overwrite the overwriteMatrixMg.
[in]overwriteMatrixMgOverwrite the matrix with this value.
[in]placementScaleAdditional scale factor.
[in]parentParent object to insert.
[in]prevPrevious object to insert.
Returns
OK on success.

◆ CreateObjectsOnMultiDrag()

static MAXON_METHOD Result<void> CreateObjectsOnMultiDrag ( BaseDocument doc,
const BaseArray< Tuple< Url, AssetDescription, String >> &  assets,
Bool  allowPreviewCube,
Bool  overwriteMatrix,
const Matrix overwriteMatrixMg,
Float  placementScale,
BaseObject parent = nullptr,
BaseObject prev = nullptr 
)
static

◆ CheckObjectsOnDrop()

static MAXON_METHOD Result<void> CheckObjectsOnDrop ( BaseDocument doc,
const Url url,
const AssetDescription &  asset,
Float  placementScale 
)
static

CheckObjectsOnDrop helper function to add objects into the scene from the asset browser. This functions keeps a list of assets and remembers if they were added already.

Parameters
[in]docBaseDocument to insert the asset.
[in]urlUrl of the d&d operation. This is typically an asset url "asset:///..."
[in]assetAssetDescription of the asset.
[in]placementScaleAdditional scale factor.
Returns
OK on success.

◆ CreateMaterialsOnDrag()

static MAXON_METHOD Result<BaseArray<BaseMaterial*> > CreateMaterialsOnDrag ( BaseDocument doc,
BaseList2D objectOrTag,
const Url url,
Bool  allowMultiple,
const Id subType,
Bool  noManagerUpdate,
Bool  startUndo 
)
static

CreateMaterialsOnDrag description.

Parameters
[in]docBaseDocument to insert the asset.
[in]objectOrTagDrop destination.
[in]urlUrl of the d&d operation. This is typically an asset url "asset:///..."
[in]allowMultipleTrue to insert multiple materials at the same time.
[in]subTypeSubtype of the asset.
[in]noManagerUpdateTrue to prevent attribute manager updates when activating the new objects.
[in]startUndoTrue to call doc->StartUndo() and EndUndo().
Returns
Array with the newly created BaseMaterials on success.

◆ AddPreviewRenderAsset()

static MAXON_METHOD Result<void> AddPreviewRenderAsset ( const Block< AssetDescription > &  assetsToPreviewRender)
static

AddPreviewRenderAsset adds the given assets to the background render queue.

Parameters
[in]assetsToPreviewRenderAssets to add to the render queue.
Returns
OK on success.

◆ OpenSaveAssetDialog()

static MAXON_METHOD Result<Bool> OpenSaveAssetDialog ( OPENSAVEASSETDIALOGFLAGS  flags,
const String presetTypeName,
Id id,
String name,
String version,
const AssetRepositoryRef &  lookupRepository,
Id category,
AssetRepositoryRef &  selectedRepository,
Bool setAsDefault 
)
static

OpenSaveAssetDialog opens the save asset dialog.

Parameters
[in]flagssee OPENSAVEASSETDIALOGFLAGS.
[in]presetTypeNameAsset Type name to create the dialog title.
[in,out]idId of the asset.
[in,out]nameAsset name.
[in,out]versionVersion string.
[in]lookupRepositoryRepository to search for assets.
[in,out]categoryCategory in which the asset should be stored.
[in,out]selectedRepositorySelected repository where the asset should be stored.
[in,out]setAsDefaultTrue to set the preset as default.
Returns
True on success and dialog okay. False if user canceled.

◆ RenderDocumentAsset()

static MAXON_METHOD Result<Url> RenderDocumentAsset ( BaseDocument renderDoc,
const ProgressRef &  progressRef,
Int  progressIndex,
Int  polygonCount,
Int32  previewW,
Int32  previewH,
GENERATESCENEPREVIEWIMAGEFLAGS  flags 
)
static

RenderDocumentAsset helper function to render a BaseDocument for preview rendering.

Parameters
[in]renderDocBaseDocument to render.
[in]progressRefprogress class.
[in]progressIndexprogress index to use.
[in]polygonCountNumber of polygons in the scene. If -1 the count will be calculated. If the count == 0 and the scene has one first object the icon of the object is used as preview.
[in]previewWPreview width.
[in]previewHPreview height.
[in]flagssee GENERATESCENEPREVIEWIMAGEFLAGS.
Returns
OK on success.

◆ GetAddDependencyDelegate()

static MAXON_METHOD Result<ResolveAssetDependenciesStruct::ResolveDelegate> GetAddDependencyDelegate ( const Filename documentPath,
Bool  addAssetsIfNotInThisRepository 
)
static

GetAddDependencyDelegate helepr function to generate the ResolveAssetDependenciesStruct::ResolveDelegate.

Parameters
[in]documentPathRoot Path of the document.
[in]addAssetsIfNotInThisRepositoryTrue to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing.
Returns
ResolveAssetDependenciesStruct::ResolveDelegate on success to be used in functions where it is required.

◆ GetDefaultSettings()

static MAXON_METHOD Bool GetDefaultSettings ( const AssetDescription &  asset,
Block< const Int32 > &  resId,
BaseContainer resData 
)
static

GetDefaultSettings loads the settings for a DefaultsPreset asset type.

Parameters
[in]assetAsset to load.
[out]resIdBaseList Ids of the preset.
[out]resDataSettings container.
Returns
True means a partial preset was loaded.

◆ GetDefaultObject() [1/2]

static MAXON_METHOD BaseList2D* GetDefaultObject ( const Block< const Int32 > &  id,
BaseDocument doc 
)
static

GetDefaultObject returns a new default object for the given preset type.

Parameters
[in]idIds of the BaseObject. e.g. Ocube
[in]docBaseDocument to look for the scene repository.
Returns
New BaseList2D on success.

◆ GetDefaultObject() [2/2]

static MAXON_METHOD BaseList2D* GetDefaultObject ( const AssetDescription &  asset)
static

GetDefaultObject returns a new default object for the given preset.

Parameters
[in]assetAsset to load.
Returns
New BaseList2D on success.

◆ SetDefaultObject()

static MAXON_METHOD Bool SetDefaultObject ( const Block< const Int32 > &  defaultsType,
Bool  partial,
const BaseContainer bc,
Bool  setAsDefault,
Bool  allowMakeDefault 
)
static

Creates a new defaults preset asset (AssetTypes::DefaultsPreset). Preset will be applied to the selected object (i.e. values are already on the object, but presets drop down will reflect the new state).

Parameters
[in]defaultsTypeIdentifier of the BaseList2D. e.g. Ocube
[in]partialTrue to signal that this preset contains only partial settings.
[in]bcBaseContainer with the settings.
[in]setAsDefaultTrue to make this preset the default when creating new objects.
[in]allowMakeDefaultTrue to enable the "Make as default" checkbox in the dialog.
Returns
True on success.

◆ BrowseDescriptionForDefaults()

static MAXON_METHOD Result<void> BrowseDescriptionForDefaults ( Description desc,
const Delegate< Result< void >(const DescID &key, DescCompareEntry &&value)> &  add,
Bool  isPartial 
)
static

BrowseDescriptionForDefaults is a helper function to browse through Descriptions to collect all attributes to be stored in a preset.

Parameters
[in]descDescription to browse.
[in]adddelegate which is triggered for each attribute.
[in]isPartialTrue if this should be a partial preset. In that case DESC_UNIMPORTANTFORDEFAULTS will be ignored.
Returns
OK on success.

◆ SaveDefaultPresetFromObject()

static MAXON_METHOD Result<void> SaveDefaultPresetFromObject ( GeListNode l,
Bool  makeDefault,
Bool  allowMakeDefault = true 
)
static

SaveDefaultPresetFromObject stores the default from the given object into the asset browser.

Parameters
[in]lObject to store.
[in]makeDefaultTrue to make it the default.
[in]allowMakeDefaultTrue to enable the "Make as default" checkbox in the dialog.
Returns
OK on success.

◆ SaveBrowserPreset()

static MAXON_METHOD Result<AssetDescription> SaveBrowserPreset ( const BasePresetAssetType &  assetType,
const PresetSaveArgs sourceData,
const String presetTypeName,
const String presetNameA,
Bool  showMakeDefault,
Bool  setAsDefault,
Bool  allowSceneRepository 
)
static

SaveBrowserPreset stores the given data as preset asset.

Parameters
[in]assetTypePresetType.
[in]sourceDataData to store.
[in]presetTypeNamePresent Type name to generate the dialog title for.
[in]presetNameAName of the Preset.
[in]showMakeDefaultTrue to enable the "Make as default" checkbox in the dialog.
[in]setAsDefaultTrue to make it the default.
[in]allowSceneRepositoryTrue to allow to stor the preset into the scene repository.
Returns
AssetDescription of the newly created asset on success.

◆ SupportDefaultPresets()

static MAXON_METHOD Tuple<Bool, Bool> SupportDefaultPresets ( C4DAtomGoal l)
static

SupportDefaultPresets helper function to find if the given type supports the preset system.

Parameters
[in]lObject to check
Returns
Tuple<Bool, Bool>: first - support presets, second - support set as default

◆ SaveDocumentAsset() [2/2]

static MAXON_METHOD Result<AssetDescription> SaveDocumentAsset ( BaseDocument assetDoc,
InternedId  subType,
Id  newAssetId,
const StoreAssetStruct storeAssetStruct,
const String assetName,
const String versionString,
const Delegate< Result< BaseBitmap * >()> &  createPreviewBitmapDelegate,
const AssetMetaData &  copyMetaData,
Bool  addAssetsIfNotInThisRepository,
ResolveAssetDependenciesStruct resolveAssets 
)
static

SaveDocumentAsset stores the given BaseDocument into the given repository.

Parameters
[in]assetDocBaseDocument to store.
[in]subTypeOptional value to set the subType of the asset.
[in]newAssetIdOptional asset Id. If empty the system calculates a new asset id.
[in]storeAssetStructSettings where to store the asset.
[in]assetNameUser readable name of the asset.
[in]versionStringUser readable version string.
[in]createPreviewBitmapDelegateOptional delegate to generate a preview preview bitmap when saving the asset.
[in]copyMetaDataOptional meta data to copy from another version.
[in]addAssetsIfNotInThisRepositoryTrue to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing.
[in,out]resolveAssetsResolveAssetDependenciesStruct keeps temporary data to resolve dependencies.
Returns
AssetDescription of the new asset on success.

◆ CreateObjectAsset() [2/2]

static MAXON_METHOD Result<AssetDescription> CreateObjectAsset ( BaseObject op,
BaseDocument activeDoc,
const StoreAssetStruct storeAssetStruct,
const Id assetId,
const String assetName,
const String assetVersion,
const AssetMetaData &  copyMetaData,
Bool  addAssetsIfNotInThisRepository,
ResolveAssetDependenciesStruct resolveAssets 
)
static

CreateObjectAsset description.

Parameters
[in]opBaseObject to store.
[in]activeDocBaseDocument of the material to store. This document will be used to find dependencies.
[in]storeAssetStructSettings where to store the asset.
[in]assetIdOptional asset Id. If empty the system calculates a new asset id.
[in]assetNameHuman readable name of the asset.
[in]assetVersionHuman readable version string.
[in]copyMetaDataOptional meta data to copy from another version.
[in]addAssetsIfNotInThisRepositoryTrue to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing.
[in,out]resolveAssetsResolveAssetDependenciesStruct keeps temporary data to resolve dependencies.
Returns
OK on success.

◆ CreateMaterialAsset() [2/2]

static MAXON_METHOD Result<AssetDescription> CreateMaterialAsset ( BaseDocument activeDoc,
BaseMaterial mat,
const StoreAssetStruct storeAssetStruct,
const Id assetId,
const String assetName,
const String assetVersion,
const AssetMetaData &  copyMetaData,
Bool  addAssetsIfNotInThisRepository,
ResolveAssetDependenciesStruct resolveAssets 
)
static

CreateMaterialAsset creates a material asset from the given BaseMaterial.

Parameters
[in]activeDocBaseDocument of the material to store. This document will be used to find dependencies.
[in]matBaseMaterial to store.
[in]storeAssetStructSettings where to store the asset.
[in]assetIdOptional asset Id. If empty the system calculates a new asset id.
[in]assetNameHuman readable name of the asset.
[in]assetVersionHuman readable version string.
[in]copyMetaDataOptional meta data to copy from another version.
[in]addAssetsIfNotInThisRepositoryTrue to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing.
[in,out]resolveAssetsResolveAssetDependenciesStruct keeps temporary data to resolve dependencies.
Returns
AssetDescription on success.

◆ GetDefaultsPresetAssetType()

static MAXON_METHOD BasePresetAssetType GetDefaultsPresetAssetType ( BaseList2D bl)
static

Returns the preset asset type for a given object. Result could be either AssetTypes::DefaultsPreset, AssetTypes::NodeDefaultsPreset, or a preset asset type from some other AMEmulationNode wrapped object.

Parameters
[in]blThe node for which to read the asset type.
Returns
The asset type. Empty if defaults presets are not supported.

◆ JoinDefaultsPresetSubType()

static MAXON_METHOD Result<Id> JoinDefaultsPresetSubType ( const Block< const Int32 > &  blIds)
static

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

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

◆ SetEmulationDefaultObject()

static MAXON_METHOD Result<void> SetEmulationDefaultObject ( const AMEmulationType defaultsType,
const BasePresetAssetType &  assetType,
Bool  partial,
const String baseAssetName,
const DataDictionary &  data,
Bool  setAsDefault,
Bool  allowMakeDefault 
)
static

Creates a new defaults preset asset (asset type depends on #defaultsType). Preset will be applied to the selected object (i.e. values are already on the object, but presets drop down will reflect the new state). Supports only XnodeEmulation type objects. For more custom emulation defaults preset implementation, call AssetCreationInterface::SaveBrowserPreset directly.

See also
SetDefaultObject.
Parameters
[in]defaultsTypeIdentifiers of the emulation object. Will serve in creation of ASSETMETADATA::SubType. For instance AMEmulationObject identifier at [0] and node identifier at [1] for a GraphNode emulated object.
[in]assetTypeThis is the type of the asset to be saved, see AssetTypes (since multiple kinds of objects can be emulated).
[in]partialTrue to signal that this preset contains only partial settings.
[in]baseAssetNameString that will be suggested as asset name. User can append to it or change it completely on the dialog.
[in]dataDataDictionary with the default values to save and apply.
[in]setAsDefaultTrue to make this preset the default when creating new objects.
[in]allowMakeDefaultTrue to enable the "Make as default" checkbox in the dialog.
Returns
OK on success.

◆ GetEmulationDefaultsPresetType()

static MAXON_METHOD Result<AMEmulationType> GetEmulationDefaultsPresetType ( BaseList2D bl)
static

Builds a type identifier array to be used for creating and using emulation defaults presets.

Parameters
[in]blThe AMEmulationNode from which to extract the type. Capsules supported as well, in this case #bl is not of type XnodeEmulation.
Returns
Filled defaults type array on success.

◆ GetJoinedDefaultsPresetSubType()

static MAXON_METHOD Result<Id> GetJoinedDefaultsPresetSubType ( const AtomArray blList,
const BaseArray< Int32 > &  defaultsType 
)
static

Builds the joined sub type identifier for the defaults preset appropriate for #blList. Supports classic object use cases and also emulated objects (nodes, capsules, etc.).

Parameters
[in]blListThe list of selected objects.
[in]defaultsTypeLegacy type identifier. For nodes, the identifier should be [XnodeEmulation]. For capsules, the identifier should be an object type derived from [neutron::CAPSULE_BASE_ID]. Will create the proper sub type depending on the source objects (emulated or not).
Returns
The sub type identifier on success. IllegalArgumentError if #blList are not all of corresponding type/sub type.