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

Description

Functions

json FormIt.SketchMaterials.GetWSMMaterialForHistory (historyId, materialId)
 
json FormIt.SketchMaterials.GetSketchMaterialFromWSMMaterial (historyId, wsmMaterialId)
 Get the sketch material id from the WSM material. More...
 
json FormIt.SketchMaterials.GetMaterialIDsFromObjects (aObjects)
 Get the materials used by the given vector of objects. More...
 
json FormIt.SketchMaterials.AssignMaterialToObjects (materialId, aObjects, uvTransf3d)
 Assigns the material to the list of objects and sets uvs when the given Transf3d is non-identity. More...
 
json FormIt.SketchMaterials.ChangeMaterialOrder (materialId, newPos)
 Give the material a new position in the list. More...
 
json FormIt.SketchMaterials.IsMaterialUsed (materialId)
 Return true if a sketch material id is in use. More...
 
json FormIt.SketchMaterials.GetDefaultMaterialData (bBack)
 Return the material data of the default sketch material. More...
 
json FormIt.SketchMaterials.SetDefaultMaterialData (materialData, bBack)
 
json FormIt.SketchMaterials.GetMaterialDataAttribute (materialData, attributeType)
 Return the attribute of a material data. More...
 
json FormIt.SketchMaterials.SetMaterialDataAttribute (materialData, attributeType, value)
 Set the attribute of a material data. More...
 
json FormIt.SketchMaterials.GetMaterialDataMap (materialData, mapType)
 Return the map of a material data. More...
 
json FormIt.SketchMaterials.SetMaterialDataMap (materialData, mapType, map)
 Set the map of a material data. More...
 
json FormIt.SketchMaterials.GetAllObjectsUsingMaterials (materialIds)
 Return all objects that are used by the given vector of materials. More...
 
json FormIt.SketchMaterials.UpdateMaterialFromParameters (materialID, parameters)
 Update the firefly material with the basic parameters. More...
 
json FormIt.SketchMaterials.RearrangeMaterials (materialIds, materialBeforeOrAfterId, insertAfter)
 Rearrange the materials to be put before or after the given other material. More...
 

Function Documentation

json FormIt.SketchMaterials.AssignMaterialToObjects ( materialId  ,
aObjects  ,
uvTransf3d   
)

Assigns the material to the list of objects and sets uvs when the given Transf3d is non-identity.

If a WSM material with that name does not exist in the history of an object, it is also created.

Parameters
[in]materialIdint
[in]aObjectsarray of WSM.GroupInstancePath
[in]uvTransf3dis the optional transform applied to uvs.
Returns
bool Success
json FormIt.SketchMaterials.ChangeMaterialOrder ( materialId  ,
newPos   
)

Give the material a new position in the list.

Parameters
[in]materialIdint
[in]newPosint
Returns
JSON_UNDEFINED
json FormIt.SketchMaterials.GetAllObjectsUsingMaterials ( materialIds  )

Return all objects that are used by the given vector of materials.

Parameters
[in]materialIdsArray of material ids.
Returns
Array of objects (WSM.GroupInstancePath)
json FormIt.SketchMaterials.GetDefaultMaterialData ( bBack  )

Return the material data of the default sketch material.

Parameters
[in]bBackbool true for the back face material
Returns
material data
json FormIt.SketchMaterials.GetMaterialDataAttribute ( materialData  ,
attributeType   
)

Return the attribute of a material data.

Parameters
[in]materialDataFormIt.Materials.MaterialData
[in]attributeTypeFormIt.Materials.AttributeType "FormIt.MaterialAttributeType.kGloss" "FormIt.MaterialAttributeType.kReflectionDirect" "FormIt.MaterialAttributeType.kReflectionOblique"
Returns
float attribute value
json FormIt.SketchMaterials.GetMaterialDataMap ( materialData  ,
mapType   
)

Return the map of a material data.

Parameters
[in]materialDataFormIt.Materials.MaterialData
[in]mapTypeFormIt.Materials.MapType "FormIt.MaterialMapType.kNormalMap" "FormIt.MaterialMapType.kOpacityMap"
Returns
Array of char, representing png or jpg texture.
json FormIt.SketchMaterials.GetMaterialIDsFromObjects ( aObjects  )

Get the materials used by the given vector of objects.

Parameters
[in]aObjectsarray of WSM.GroupInstancePath
Returns
Array of Sketch material ids
json FormIt.SketchMaterials.GetSketchMaterialFromWSMMaterial ( historyId  ,
wsmMaterialId   
)

Get the sketch material id from the WSM material.

Parameters
[in]historyIdint
[in]wsmMaterialIdint
Returns
Sketch material id Return WSM.INVALID_ID if it does not exist
json FormIt.SketchMaterials.GetWSMMaterialForHistory ( historyId  ,
materialId   
)
json FormIt.SketchMaterials.IsMaterialUsed ( materialId  )

Return true if a sketch material id is in use.

Parameters
[in]materialIdint
Returns
true, if used
json FormIt.SketchMaterials.RearrangeMaterials ( materialIds  ,
materialBeforeOrAfterId  ,
insertAfter   
)

Rearrange the materials to be put before or after the given other material.

If the other material is WSM.INVALID_ID, the materials are placed at the end

Parameters
[in]materialIdsArray of material ids.
[in]materialBeforeOrAfterIdId of material before or after which to insert, or WSM.INVALID_ID.
[in]insertAftertrue if inserting after materialBeforeOrAfterId.
Returns
JSON_UNDEFINED
json FormIt.SketchMaterials.SetDefaultMaterialData ( materialData  ,
bBack   
)
json FormIt.SketchMaterials.SetMaterialDataAttribute ( materialData  ,
attributeType  ,
value   
)

Set the attribute of a material data.

Parameters
[in]materialDataFormIt.Materials.MaterialData
[in]attributeTypeFormIt.Materials.AttributeType
[in]valuefloat
Returns
new material data with the changed attribute
json FormIt.SketchMaterials.SetMaterialDataMap ( materialData  ,
mapType  ,
map   
)

Set the map of a material data.

Parameters
[in]materialDataFormIt.Materials.MaterialData
[in]mapTypeFormIt.Materials.MapType
[in]mapArray of char, representing png or jpg texture
Returns
New material data with the changed map
json FormIt.SketchMaterials.UpdateMaterialFromParameters ( materialID  ,
parameters   
)

Update the firefly material with the basic parameters.

This method is used by the UI so that we can dynamically update the scene when the user drags sliders for those parameters.

Parameters
[in]materialIdint
[in]parametersJSON formatted string with the parameters to update
[in]materialIDint
Returns
JSON_UNDEFINED