#include <asset_creation.h>
Helper interface for asset creation and drag&drop.
Static Public Member Functions | |
static MAXON_METHOD Result< Id > | GetNewAssetIdFromIdAndVersion (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< Bool > | SaveBaseDocumentAsAsset (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 ©MetaData) |
static MAXON_METHOD Result< Tuple< AssetDescription, UpdatableAssetRepositoryRef > > | SaveMemFileAsAssetAlone (const Url &saveFileName, const AssetMetaData ©MetaData) |
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 ©MetaData, 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 ©MetaData, 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 ©MetaData, Bool addAssetsIfNotInThisRepository) |
static MAXON_METHOD Result< AssetDescription > | CreateSceneAsset (BaseDocument *activeDoc, const StoreAssetStruct &storeAssetStruct, const Id &assetId, const String &assetName, const String &assetVersion, const AssetMetaData ©MetaData, 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 > | 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< Bool > | OpenSaveAssetDialog (OPENSAVEASSETDIALOGFLAGS flags, const String &presetTypeName, Id &id, String &name, String &version, const AssetRepositoryRef &lookupRepository, Id &category, AssetRepositoryRef &selectedRepository, Bool &setAsDefault) |
static MAXON_METHOD Result< Url > | RenderDocumentAsset (BaseDocument *renderDoc, const ProgressRef &progressRef, Int progressIndex, Int polygonCount, Int32 previewW, Int32 previewH, GENERATESCENEPREVIEWIMAGEFLAGS flags) |
static MAXON_METHOD Result< ResolveAssetDependenciesStruct::ResolveDelegate > | GetAddDependencyDelegate (const Filename &documentPath, Bool addAssetsIfNotInThisRepository) |
static MAXON_METHOD Bool | GetDefaultSettings (const AssetDescription &asset, Block< const Int32 > &resId, BaseContainer &resData) |
static MAXON_METHOD BaseList2D * | GetDefaultObject (const Block< const Int32 > &id, BaseDocument *doc) |
static MAXON_METHOD BaseList2D * | GetDefaultObject (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, Bool > | SupportDefaultPresets (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 ©MetaData, 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 ©MetaData, 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 ©MetaData, Bool addAssetsIfNotInThisRepository, ResolveAssetDependenciesStruct &resolveAssets) |
Private Member Functions | |
MAXON_INTERFACE (AssetCreationInterface, MAXON_REFERENCE_NORMAL, "net.maxon.mvp.assetcreationinterface") | |
|
private |
|
static |
GetNewAssetIdFromIdAndVersion generates a standarized id from the given prefix and IdAndVersion for a new asset.
[in] | prefix | Prefix can be used for the type of the asset. e.g. "file" for file assets. preset for "presets". |
[in] | idAndVersion | IdAndVersion of the asset to be created. |
|
static |
UpdateMetaData recalculates the asset metadata. For scene files this might be the number of points, polygons. etc. for images the size, bitdepth etc.
[in] | asset | Asset to be evaluated. |
|
static |
UpdateMetaData recalculates the asset metadata. For scene files this might be the number of points, polygons. etc. for images the size, bitdepth etc.
[in] | doc | BaseDocument to evaluate. |
[out] | metaProperties | DataDictionary to store the data. |
[in] | calcBoundingBox | True to calculate the bounding box of the scene. |
[in] | objectMatrix | Optional matrix to add to the object. |
[in] | subType | SubType of the asset, e.g. ASSETMETADATA::SubType_ENUM_Object. |
|
static |
SaveBaseDocumentAsAsset stores the given BaseDocument as a new scene to be saved as an asset. Dependencies will be calculated as well.
[in] | doc | BaseDocument to store. |
[in] | c4dRootPath | Root of the document. This path is used to search textures/dependencies. |
[in,out] | saveFileName | Destination path where the BaseDocument will be stored (this can be a memory file). |
[in,out] | addDependencyStruct | AddAssetDepencendyStruct which is triggered on any dependency found. |
[in,out] | resolveAssets | ResolveAssetDependenciesStruct keeps temporary data to resolve dependencies. |
[out] | metaProperties | DataDictionary to store the data. |
[in] | calcBoundingBox | True to calculate the bounding box of the scene. |
[in] | objectMatrix | Optional matrix to add to the object. |
[in] | subType | SubType of the asset, e.g. ASSETMETADATA::SubType_ENUM_Object. |
|
static |
SaveMemFileAsAssetWithCopyAsset stores the given url as a asset.
[in] | depResultUrl | Url of the asset to store. |
[in] | storeAssetStruct | see StoreAssetStruct. |
[in] | subType | SubType of the asset, e.g. ASSETMETADATA::SubType_ENUM_Object. |
[in] | dependencies | Dependencies to store with the assets. |
[in] | assetName | User readable name of the asset. |
[in] | addAssetsIfNotInThisRepository | True to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing. |
|
static |
SaveMemFileAsAsset stores the given url as a asset into a temporary repository.
[in] | saveFileName | Url of the asset to be stored. |
[in] | parentCategory | Parent category in which the asset should be saved. |
[in] | subType | SubType of the asset, e.g. ASSETMETADATA::SubType_ENUM_Object. |
[in] | calculateMetaData | True to automatically calculate meta data when saving. |
[in] | metaProperties | Additional metadata to store. |
[in] | dependencies | Dependencies to store with the asset. |
[in] | previews | Array images of Previews. If you pass more then one image it will be stored as animated mp4 with the given animFps frame rate. |
[in] | animFps | If more than one image was given the preview will be stored as mp4 wih this frame rate. |
[in] | assetName | User readable name of the asset. |
[in] | localizedNames | Optional translated names of the asset in other languages. Id is the languageid from LanguageInterface. |
[in] | localizedAnnotations | Optional translated descriptions of the asset in other languages. Id is the languageid from LanguageInterface. |
[in] | copyMetaData | Metadata to copy. |
|
static |
SaveMemFileAsAssetAlone stores the plain file into a temporary repository.
[in] | saveFileName | Url of the asset to be stored. |
[in] | copyMetaData | Optional meta data to copy. |
|
static |
SaveMetaDataForAsset stores he given values into the asset description.
[in] | asset | Asset to be modified. |
[in] | parentCategory | Optional value to set the category of the asset. |
[in] | subType | Optional value to set the subType of the asset. |
[in] | calculateMetaData | True to automatically calculate the meta data for known sybTypes. |
[in] | metaProperties | Additional metaData to store. |
[in] | dependencies | Dependencies to store along with the asset. |
[in] | previews | Array images of Previews. If you pass more then one image it will be stored as animated mp4 with the given animFps frame rate. |
[in] | animFps | If more than one image was given the preview will be stored as mp4 wih this frame rate. |
[in] | assetName | User readable name of the asset. |
[in] | localizedNames | Optional translated names of the asset in other languages. Id is the languageid from LanguageInterface. |
[in] | localizedAnnotations | Optional translated descriptions of the asset in other languages. Id is the languageid from LanguageInterface. |
|
static |
SaveDocumentAsset stores the given BaseDocument into the given repository.
[in] | assetDoc | BaseDocument to store. |
[in] | subType | Optional value to set the subType of the asset. |
[in] | newAssetId | Optional asset Id. If empty the system calculates a new asset id. |
[in] | storeAssetStruct | Settings where to store the asset. |
[in] | assetName | User readable name of the asset. |
[in] | versionString | User readable version string. |
[in] | createPreviewBitmapDelegate | Optional delegate to generate a preview preview bitmap when saving the asset. |
[in] | copyMetaData | Optional meta data to copy from another version. |
[in] | addAssetsIfNotInThisRepository | True to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing. |
|
static |
SaveTextureAsset stores the given image as media asset.
[in] | imageUrl | Url of the texture to store. |
[in] | assetName | Human readable asset name. |
[in] | storeAssetStruct | Settings where to store the asset. |
[in] | dependencies | Optional dependencies to store along with the asset. |
[in] | addAssetsIfNotInThisRepository | True to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing. |
|
static |
GenerateImagePreview generates a preview image for a given texture.
[in] | imageUrl | Url of the texture. |
[out] | previews | ValueReceiver which receives the preview. |
[in] | previewW | Preview width. |
[in] | previewH | Preview height. |
|
static |
GenerateScenePreviewImage generates the preview image of the given BaseDocument
[in] | doc | BaseDocument to preview. |
[out] | preview | BaseBitmap into which the preview should be rendered. |
[in] | flags | see GENERATESCENEPREVIEWIMAGEFLAGS. |
[in] | previewW | Preview width. |
[in] | previewH | Preview height. |
|
static |
CreateMaterialAsset creates a material asset from the given BaseMaterial.
[in] | activeDoc | BaseDocument of the material to store. This document will be used to find dependencies. |
[in] | mat | BaseMaterial to store. |
[in] | storeAssetStruct | Settings where to store the asset. |
[in] | assetId | Optional asset Id. If empty the system calculates a new asset id. |
[in] | assetName | Human readable name of the asset. |
[in] | assetVersion | Human readable version string. |
[in] | copyMetaData | Optional meta data to copy from another version. |
[in] | addAssetsIfNotInThisRepository | True to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing. |
|
static |
CreateObjectAsset description.
[in] | op | BaseObject to store. |
[in] | activeDoc | BaseDocument of the material to store. This document will be used to find dependencies. |
[in] | storeAssetStruct | Settings where to store the asset. |
[in] | assetId | Optional asset Id. If empty the system calculates a new asset id. |
[in] | assetName | Human readable name of the asset. |
[in] | assetVersion | Human readable version string. |
[in] | copyMetaData | Optional meta data to copy from another version. |
[in] | addAssetsIfNotInThisRepository | True to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing. |
|
static |
CreateSceneAsset description.
[in] | activeDoc | BaseDocument to store. This document will be used to find dependencies. |
[in] | storeAssetStruct | Settings where to store the asset. |
[in] | assetId | Optional asset Id. If empty the system calculates a new asset id. |
[in] | assetName | Human readable name of the asset. |
[in] | assetVersion | Human readable version string. |
[in] | copyMetaData | Optional meta data to copy from another version. |
[in] | addAssetsIfNotInThisRepository | True to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing. |
|
static |
SaveActiveDocumentAsNewVersion writes the current BaseDocument as new version with asset dialog.
[in] | activeDoc | Basedocument to store. |
[in] | addAssetsIfNotInThisRepository | True to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing. |
|
static |
CreateObjectsOnDrag helper function to create assets when d&d into a scene/viewport.
[in] | doc | BaseDocument to insert the asset. |
[in] | url | Url of the d&d operation. This is typically an asset url "asset:///..." |
[in] | asset | AssetDescription of the asset. |
[in] | filterString | Filter string of the d&d operation. This allows to switch the search term e.g. sphere / cube on a modeling node. |
[in] | allowPreviewCube | True to indicate that a preview cube should be inserted instead of the real geometry. |
[in] | overwriteMatrix | True to overwrite the overwriteMatrixMg. |
[in] | overwriteMatrixMg | Overwrite the matrix with this value. |
[in] | placementScale | Additional scale factor. |
[in] | parent | Parent object to insert. |
[in] | prev | Previous object to insert. |
|
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.
[in] | doc | BaseDocument to insert the asset. |
[in] | url | Url of the d&d operation. This is typically an asset url "asset:///..." |
[in] | asset | AssetDescription of the asset. |
[in] | placementScale | Additional scale factor. |
|
static |
CreateMaterialsOnDrag description.
[in] | doc | BaseDocument to insert the asset. |
[in] | objectOrTag | Drop destination. |
[in] | url | Url of the d&d operation. This is typically an asset url "asset:///..." |
[in] | allowMultiple | True to insert multiple materials at the same time. |
[in] | subType | Subtype of the asset. |
[in] | noManagerUpdate | True to prevent attribute manager updates when activating the new objects. |
[in] | startUndo | True to call doc->StartUndo() and EndUndo(). |
|
static |
AddPreviewRenderAsset adds the given assets to the background render queue.
[in] | assetsToPreviewRender | Assets to add to the render queue. |
|
static |
OpenSaveAssetDialog opens the save asset dialog.
[in] | flags | see OPENSAVEASSETDIALOGFLAGS. |
[in] | presetTypeName | Asset Type name to create the dialog title. |
[in,out] | id | Id of the asset. |
[in,out] | name | Asset name. |
[in,out] | version | Version string. |
[in] | lookupRepository | Repository to search for assets. |
[in,out] | category | Category in which the asset should be stored. |
[in,out] | selectedRepository | Selected repository where the asset should be stored. |
[in,out] | setAsDefault | True to set the preset as default. |
|
static |
RenderDocumentAsset helper function to render a BaseDocument for preview rendering.
[in] | renderDoc | BaseDocument to render. |
[in] | progressRef | progress class. |
[in] | progressIndex | progress index to use. |
[in] | polygonCount | Number 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] | previewW | Preview width. |
[in] | previewH | Preview height. |
[in] | flags | see GENERATESCENEPREVIEWIMAGEFLAGS. |
|
static |
GetAddDependencyDelegate helepr function to generate the ResolveAssetDependenciesStruct::ResolveDelegate.
[in] | documentPath | Root Path of the document. |
[in] | addAssetsIfNotInThisRepository | True to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing. |
|
static |
|
static |
GetDefaultObject returns a new default object for the given preset type.
[in] | id | Ids of the BaseObject. e.g. Ocube |
[in] | doc | BaseDocument to look for the scene repository. |
|
static |
GetDefaultObject returns a new default object for the given preset.
[in] | asset | Asset to load. |
|
static |
SetDefaultObject description.
[in] | defaultsType | Ids of the BaseObject. e.g. Ocube |
[in] | partial | True to signal that this preset contains only partial settings. |
[in] | bc | BaseContainer with the settings. |
[in] | setAsDefault | True to make this preset the default when creating new objects. |
[in] | allowMakeDefault | True to enable the "Make as default" checkbox in the dialog. |
|
static |
BrowseDescriptionForDefaults is a helper function to browse through Descriptions to collect all attributes to be stored in a preset.
[in] | desc | Description to browse. |
[in] | add | delegate which is triggered for each attribute. |
[in] | isPartial | True if this should be a partial preset. In that case DESC_UNIMPORTANTFORDEFAULTS will be ignored. |
|
static |
SaveDefaultPresetFromObject stores the default from the given object into the asset browser.
[in] | l | Object to store. |
[in] | makeDefault | True to make it the default. |
[in] | allowMakeDefault | True to enable the "Make as default" checkbox in the dialog. |
|
static |
SaveBrowserPreset stores the given data as preset asset.
[in] | assetType | PresetType. |
[in] | sourceData | Data to store. |
[in] | presetTypeName | Present Type name to generate the dialog title for. |
[in] | presetNameA | Name of the Preset. |
[in] | showMakeDefault | True to enable the "Make as default" checkbox in the dialog. |
[in] | setAsDefault | True to make it the default. |
[in] | allowSceneRepository | True to allow to stor the preset into the scene repository. |
|
static |
SupportDefaultPresets helper function to find if the given type supports the preset system.
[in] | l | Object to check |
|
static |
SaveDocumentAsset stores the given BaseDocument into the given repository.
[in] | assetDoc | BaseDocument to store. |
[in] | subType | Optional value to set the subType of the asset. |
[in] | newAssetId | Optional asset Id. If empty the system calculates a new asset id. |
[in] | storeAssetStruct | Settings where to store the asset. |
[in] | assetName | User readable name of the asset. |
[in] | versionString | User readable version string. |
[in] | createPreviewBitmapDelegate | Optional delegate to generate a preview preview bitmap when saving the asset. |
[in] | copyMetaData | Optional meta data to copy from another version. |
[in] | addAssetsIfNotInThisRepository | True to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing. |
[in,out] | resolveAssets | ResolveAssetDependenciesStruct keeps temporary data to resolve dependencies. |
|
static |
CreateObjectAsset description.
[in] | op | BaseObject to store. |
[in] | activeDoc | BaseDocument of the material to store. This document will be used to find dependencies. |
[in] | storeAssetStruct | Settings where to store the asset. |
[in] | assetId | Optional asset Id. If empty the system calculates a new asset id. |
[in] | assetName | Human readable name of the asset. |
[in] | assetVersion | Human readable version string. |
[in] | copyMetaData | Optional meta data to copy from another version. |
[in] | addAssetsIfNotInThisRepository | True to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing. |
[in,out] | resolveAssets | ResolveAssetDependenciesStruct keeps temporary data to resolve dependencies. |
|
static |
CreateMaterialAsset creates a material asset from the given BaseMaterial.
[in] | activeDoc | BaseDocument of the material to store. This document will be used to find dependencies. |
[in] | mat | BaseMaterial to store. |
[in] | storeAssetStruct | Settings where to store the asset. |
[in] | assetId | Optional asset Id. If empty the system calculates a new asset id. |
[in] | assetName | Human readable name of the asset. |
[in] | assetVersion | Human readable version string. |
[in] | copyMetaData | Optional meta data to copy from another version. |
[in] | addAssetsIfNotInThisRepository | True to store the asset in the given saveRepository even if it's already in any other repository. False would skip the writing. |
[in,out] | resolveAssets | ResolveAssetDependenciesStruct keeps temporary data to resolve dependencies. |