FormIt Plugin API v25.0.0 (2025.0.0)
Loading...
Searching...
No Matches
FormIt.MaterialProvider API

Description

Functions

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

Function Documentation

◆ CanModify()

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

◆ CreateMaterial()

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

◆ DeleteMaterials()

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

◆ GetMaterialData()

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 }

◆ GetMaterialName()

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 }

◆ GetMaterialPreviewImage()

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 }

◆ GetMaterials()

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

◆ GetNewMaterialName()

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

◆ IsValidMaterial()

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

◆ IsValidMaterialName()

json FormIt.MaterialProvider.IsValidMaterialName ( libraryType  ,
materialId  ,
newName  ,
errorMsg   
)

◆ MaterialData()

json FormIt.MaterialProvider.MaterialData ( color  ,
textureData  ,
scale  ,
useAlpha  ,
materialName  ,
materialIdentifier  ,
textureName  ,
aAdditionalRenderData  ,
aAdditionalTextures   
)

Constructor for the MaterialData class.

Parameters
[in]color(OPTIONAL, default = WSM.Color(1.0, 1.0, 1.0, 1.0)) WSM.Color
[in]textureData(OPTIONAL) Array of char
[in]scale(OPTIONAL, default = WSM.Vector2d(1.0, 1.0)) WSM.Vector2d
[in]useAlpha(OPTIONAL, default = false) bool
[in]materialName(OPTIONAL) String
[in]materialIdentifier(OPTIONAL) String
[in]textureName(OPTIONAL) String
[in]aAdditionalRenderData(OPTIONAL) vectorAdditionalAttributes
[in]aAdditionalTextures(OPTIONAL) vectorAdditionalTextures
Returns
An initialized FormIt.Materials.MaterialData

◆ SetMaterialData()

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