FormIt Plugin API  v23.0.0 (2023.0.0)
FormIt.MaterialProvider API

Description

Functions

json FormIt.MaterialProvider.MaterialData (color, textureData, scale, useAlpha, materialName, materialIdentifier, textureName, aAdditionalRenderData, aAdditionalTextures)
 
json FormIt.MaterialProvider.CreateMaterial (libraryType, materialData)
 Creates a new material from the given data. More...
 
json FormIt.MaterialProvider.GetMaterialData (libraryType, materialId, excludeTextureData)
 Get the material data for the given material id. More...
 
json FormIt.MaterialProvider.SetMaterialData (libraryType, materialId, materialData, excludeTextureData)
 Sets the material data. More...
 
json FormIt.MaterialProvider.GetMaterialName (libraryType, materialId)
 Get the material name for the given material id. More...
 
json FormIt.MaterialProvider.GetMaterials (libraryType)
 GetMaterials returns all the available materials. More...
 
json FormIt.MaterialProvider.DeleteMaterials (libraryType, materialIds)
 Deletes a list of given materials. More...
 
json FormIt.MaterialProvider.GetMaterialPreviewImage (libraryType, materialId)
 Get the preview image for the material. More...
 
json FormIt.MaterialProvider.IsValidMaterialName (libraryType, materialId, newName, errorMsg)
 
json FormIt.MaterialProvider.GetNewMaterialName (libraryType, baseName)
 Returns a material name that is guaranteed not to exist. More...
 
json FormIt.MaterialProvider.IsValidMaterial (libraryType, materialId)
 Check whether the material with the given id exists. More...
 
json FormIt.MaterialProvider.CanModify (libraryType, materialId)
 Returns if a given material is modifiable (in some cases a material is marked as ReadOnly). More...
 

Function Documentation

json FormIt.MaterialProvider.CanModify ( libraryType  ,
materialId   
)

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

Parameters
[in]libraryTypeFormIt.LibraryType FormIt.LibraryType.SKETCH FormIt.LibraryType.APPLICATION
[in]materialIdint
Returns
bool Can be modified
json FormIt.MaterialProvider.CreateMaterial ( libraryType  ,
materialData   
)

Creates a new material from the given data.

Parameters
[in]libraryTypeFormIt.LibraryType
FormIt.LibraryType.SKETCH
FormIt.LibraryType.APPLICATION
[in]materialDataFormIt.Materials.MaterialData
Returns
The id of the material is succesfull or WSM.INVALID_ID if not
json FormIt.MaterialProvider.DeleteMaterials ( libraryType  ,
materialIds   
)

Deletes a list of given materials.

Parameters
[in]libraryTypeFormIt.LibraryType
FormIt.LibraryType.SKETCH
FormIt.LibraryType.APPLICATION
[in]materialIdsArray of material ids
Returns
bool Success
json FormIt.MaterialProvider.GetMaterialData ( libraryType  ,
materialId  ,
excludeTextureData   
)

Get the material data for the given material id.

Parameters
[in]libraryTypeFormIt.LibraryType
FormIt.LibraryType.SKETCH
FormIt.LibraryType.APPLICATION
[in]materialId
[in]excludeTextureDataIf true, no texture data is returned. This will speed up the call, if texture data is not needed.
Returns
{ "Result", Success , "Data", FormIt.Materials.MaterialData }
json FormIt.MaterialProvider.GetMaterialName ( libraryType  ,
materialId   
)

Get the material name for the given material id.

Parameters
[in]libraryTypeFormIt.LibraryType
FormIt.LibraryType.SKETCH
FormIt.LibraryType.APPLICATION
[in]materialId
Returns
{ "Result", success , "Name", name }
json FormIt.MaterialProvider.GetMaterialPreviewImage ( libraryType  ,
materialId   
)

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]libraryTypeFormIt.LibraryType
FormIt.LibraryType.SKETCH
FormIt.LibraryType.APPLICATION
[in]materialId
Returns
{ "Result", success , "Image", previewImage, "Resolution", res }
json FormIt.MaterialProvider.GetMaterials ( libraryType  )

GetMaterials returns all the available materials.

Parameters
[in]libraryTypeFormIt.LibraryType
FormIt.LibraryType.SKETCH
FormIt.LibraryType.APPLICATION
Returns
Array of material ids
json FormIt.MaterialProvider.GetNewMaterialName ( libraryType  ,
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]libraryTypeFormIt.LibraryType FormIt.LibraryType.SKETCH FormIt.LibraryType.APPLICATION
[in]baseNameString
Returns
New material name
json FormIt.MaterialProvider.IsValidMaterial ( libraryType  ,
materialId   
)

Check whether the material with the given id exists.

Parameters
[in]libraryTypeFormIt.LibraryType FormIt.LibraryType.SKETCH FormIt.LibraryType.APPLICATION
[in]materialIdint
Returns
bool Valid
json FormIt.MaterialProvider.IsValidMaterialName ( libraryType  ,
materialId  ,
newName  ,
errorMsg   
)
json FormIt.MaterialProvider.MaterialData ( color  ,
textureData  ,
scale  ,
useAlpha  ,
materialName  ,
materialIdentifier  ,
textureName  ,
aAdditionalRenderData  ,
aAdditionalTextures   
)
json FormIt.MaterialProvider.SetMaterialData ( libraryType  ,
materialId  ,
materialData  ,
excludeTextureData   
)

Sets the material data.

Parameters
[in]libraryTypeFormIt.LibraryType
FormIt.LibraryType.SKETCH
FormIt.LibraryType.APPLICATION
[in]materialId
[in]materialDataFormIt.Materials.MaterialData
[in]excludeTextureDataIf true, no texture data will be changed and thus can be omitted in the data argument.
Returns
bool Success