FormIt C++ API  v23.0.0 (2023.0.0)
FormIt::MaterialProvider API

Description

Functions

FORMIT_CORE_EXPORT size_t FormIt::MaterialProvider::CreateMaterial (FormIt::LibraryType aType, const FormIt::Materials::MaterialData &data)
 Creates a new material from the given data. More...
 
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::GetMaterialData (FormIt::LibraryType aType, size_t materialId, FormIt::Materials::MaterialData &data, bool excludeTextureData=false)
 Get the data for this material. More...
 
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::SetMaterialData (FormIt::LibraryType aType, size_t materialId, const FormIt::Materials::MaterialData &data, bool excludeTextureData=false)
 Sets the material data If the optional excludeTextureData is true, no texture data will be changed and thus can be omitted in the data argument. More...
 
FORMIT_CORE_EXPORT::vector< size_t > FormIt::MaterialProvider::GetMaterials (FormIt::LibraryType aType)
 Returns all the available materials. More...
 
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::DeleteMaterials (FormIt::LibraryType aType, const 1::vector< size_t > &aIDs)
 Deletes a list of material. More...
 
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::IsValidMaterialName (FormIt::LibraryType aType, size_t aID, const 1::string &newName, 1::string &errorMsg)
 Check if the given name is valid for a material. More...
 
FORMIT_CORE_EXPORT::string FormIt::MaterialProvider::GetNewMaterialName (FormIt::LibraryType aType, const 1::string &baseName="")
 Returns a material name that is guaranteed not to exist. More...
 
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::IsValidMaterial (FormIt::LibraryType aType, size_t aID)
 Check whether the material with the given id exists. More...
 
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::CanModify (FormIt::LibraryType aType, size_t aID)
 Returns if a given material is modifiable (in some cases a material is marked as ReadOnly) More...
 
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::GetMaterialPreviewImage (FormIt::LibraryType aType, size_t materialID, 1::vector< unsigned char > &previewImage, size_t &res)
 Get the preview image for the material. More...
 
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::GetMaterialName (FormIt::LibraryType aType, size_t materialID, 1::string &materialName)
 Get the name of the material Returns true if the operation was successful. More...
 

Function Documentation

FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::CanModify ( FormIt::LibraryType  aType,
size_t  aID 
)

Returns if a given material is modifiable (in some cases a material is marked as ReadOnly)

Parameters
[in]aType
[in]aID
FORMIT_CORE_EXPORT size_t FormIt::MaterialProvider::CreateMaterial ( FormIt::LibraryType  aType,
const FormIt::Materials::MaterialData data 
)

Creates a new material from the given data.

Returns the id of the material is succesfull or WSM::INVALID_ID if not

Parameters
[in]aType
[in]data
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::DeleteMaterials ( FormIt::LibraryType  aType,
const 1::vector< size_t > &  aIDs 
)

Deletes a list of material.

Returns true if the operation was successful

Parameters
[in]aType
[in]aIDs
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::GetMaterialData ( FormIt::LibraryType  aType,
size_t  materialId,
FormIt::Materials::MaterialData data,
bool  excludeTextureData = false 
)

Get the data for this material.

If the optional excludeTextureData is true, no texture data is returned This will speed up the call, if texture data is not needed. Returns true if the operation was successful

FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::GetMaterialName ( FormIt::LibraryType  aType,
size_t  materialID,
1::string &  materialName 
)

Get the name of the material Returns true if the operation was successful.

Parameters
[in]aType
[in]materialID
[out]materialName
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::GetMaterialPreviewImage ( FormIt::LibraryType  aType,
size_t  materialID,
1::vector< unsigned char > &  previewImage,
size_t &  res 
)

Get the preview image for the material.

The returned vector contains png formatted rgb pixel values. The preview image is square with a resolution of res.

Parameters
[in]aType
[in]materialID
[out]previewImage
[out]res
FORMIT_CORE_EXPORT ::vector<size_t> FormIt::MaterialProvider::GetMaterials ( FormIt::LibraryType  aType)

Returns all the available materials.

Parameters
[in]aType
FORMIT_CORE_EXPORT ::string FormIt::MaterialProvider::GetNewMaterialName ( FormIt::LibraryType  aType,
const 1::string &  baseName = "" 
)

Returns a material name that is guaranteed not to exist.

Can be used to create a new material without having to check for materials with the same name. If the base name is passed in, it is used to create the unique new name. Otherwise some generic name is the base (such as "Material").

Parameters
[in]aType
[in]baseName
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::IsValidMaterial ( FormIt::LibraryType  aType,
size_t  aID 
)

Check whether the material with the given id exists.

Parameters
[in]aType
[in]aID
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::IsValidMaterialName ( FormIt::LibraryType  aType,
size_t  aID,
const 1::string &  newName,
1::string &  errorMsg 
)

Check if the given name is valid for a material.

Returns success. Also returns an error string that can be posted in the UI, if the name is not valid. If the id passed in is WSM::INVALID_ID, the new name is checked against all existing materials. If the id is of a valid material, the new name is checked against all materials except that one.

Parameters
[in]aType
[in]aID
[in]newName
[out]errorMsg
FORMIT_CORE_EXPORT bool FormIt::MaterialProvider::SetMaterialData ( FormIt::LibraryType  aType,
size_t  materialId,
const FormIt::Materials::MaterialData data,
bool  excludeTextureData = false 
)

Sets the material data If the optional excludeTextureData is true, no texture data will be changed and thus can be omitted in the data argument.

This will speed up the call, if texture data is not needed. returns true if the operation was successful

Parameters
[in]aType
[in]materialId
[in]data
[in]excludeTextureData