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

Description

Functions

FORMIT_CORE_EXPORT WSM::ObjectHistoryID FormIt::SketchMaterials::GetWSMMaterialForHistory (size_t historyId, size_t materialId)
 Get the WSM material from the sketch material in the given history. More...
 
FORMIT_CORE_EXPORT size_t FormIt::SketchMaterials::GetSketchMaterialFromWSMMaterial (size_t historyId, size_t wsmMaterialId)
 Get the sketch material from the WSM material. More...
 
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::GetMaterialIDsFromObjects (const 1::vector< WSM::GroupInstancePath > &aObjects, 1::set< size_t > &aMaterials)
 Get the materials that are used by the given vector of objects. More...
 
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::ChangeMaterialOrder (size_t materialID, size_t newPos)
 Give the material a new position in the list. More...
 
FORMIT_CORE_EXPORT bool FormIt::SketchMaterials::AssignMaterialToObjects (size_t materialID, const 1::vector< WSM::GroupInstancePath > &aObjectPaths, const WSM::Transf3d &rUVTransf3d=WSM::Transf3d::kIdentity)
 Assigns the material to the list of objects. More...
 
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::GetDefaultMaterialData (FormIt::Materials::MaterialData &data, bool bBack)
 Get the parameters of the default material. More...
 
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::SetDefaultMaterialData (const FormIt::Materials::MaterialData &data, bool bBack)
 Set the parameters of the default material. More...
 
FORMIT_CORE_EXPORT bool FormIt::SketchMaterials::IsValidObjectForMaterialAssignment (size_t nHistoryId, size_t objectId)
 Check whether the given object is valid for getting a material. More...
 
FORMIT_CORE_EXPORT::vector< WSM::GroupInstancePathFormIt::SketchMaterials::GetAllObjectsUsingMaterials (const 1::vector< size_t > &aMaterialIDs)
 Returns all objects which are using the given materials across all histories. More...
 
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::RemoveMaterialsForHistory (size_t nHistoryId)
 Removes all wsm materials in the sketch materials that are from the given history. More...
 
FORMIT_CORE_EXPORT bool FormIt::SketchMaterials::IsMaterialUsed (size_t materialID)
 Returns true if the material is used by any objects. More...
 
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::UpdateMaterialFromParameters (size_t materialID, const WSM::Color *color, const float *gloss, const float *reflectionDirect, const float *reflectionOblique, const 1::vector< char > *diffuseTexture, const 1::vector< char > *normalTexture, const 1::vector< char > *opacityTexture, const float *uscale, const float *vscale)
 Update the rendering material with the basic parameters. More...
 
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::UpdateMaterialFromData (size_t materialID)
 Update the firefly material from its stored formit material data. More...
 
FORMIT_CORE_EXPORT size_t FormIt::SketchMaterials::GetLastPaintToolMaterial ()
 Get the formit material, that was last used by the paint tool. More...
 
FORMIT_CORE_EXPORT uint32_t FormIt::SketchMaterials::HashValueForMaterialData (const FormIt::Materials::MaterialData &data)
 Get a 32bit hash value for a material data. More...
 
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::RearrangeMaterials (const 1::vector< size_t > &materialIds, size_t materialBeforeOrAfterId, bool insertAfter)
 Rearrange the materials to be put before or after the given other material. More...
 

Function Documentation

FORMIT_CORE_EXPORT bool FormIt::SketchMaterials::AssignMaterialToObjects ( size_t  materialID,
const 1::vector< WSM::GroupInstancePath > &  aObjectPaths,
const WSM::Transf3d rUVTransf3d = WSM::Transf3d::kIdentity 
)

Assigns the material to the list of objects.

If a WSM material with that name does not exist in the history of an object, it is also created. If WSM::INVALID_ID is passed for materialID, any materials assigned to the obejcts are removed. This will result in the display of the default material on the objects. If rUVTransf3d is not the identity, then transforms the uvs on Faces.

Parameters
[in]materialID
[in]aObjectPaths
[in]rUVTransf3d
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::ChangeMaterialOrder ( size_t  materialID,
size_t  newPos 
)

Give the material a new position in the list.

Parameters
[in]materialID
[in]newPos
FORMIT_CORE_EXPORT ::vector<WSM::GroupInstancePath> FormIt::SketchMaterials::GetAllObjectsUsingMaterials ( const 1::vector< size_t > &  aMaterialIDs)

Returns all objects which are using the given materials across all histories.

Parameters
[in]aMaterialIDs
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::GetDefaultMaterialData ( FormIt::Materials::MaterialData data,
bool  bBack 
)

Get the parameters of the default material.

bBack indicates the material for the backside of faces. Otherwise the material for the frontside is returned.

Parameters
[out]data
[in]bBack
FORMIT_CORE_EXPORT size_t FormIt::SketchMaterials::GetLastPaintToolMaterial ( )

Get the formit material, that was last used by the paint tool.

Return the default material, if there is no last material

FORMIT_CORE_EXPORT void FormIt::SketchMaterials::GetMaterialIDsFromObjects ( const 1::vector< WSM::GroupInstancePath > &  aObjects,
1::set< size_t > &  aMaterials 
)

Get the materials that are used by the given vector of objects.

If an object does not use a material, WSM::INVALID_ID is added to the set

Parameters
[in]aObjects
[out]aMaterials
FORMIT_CORE_EXPORT size_t FormIt::SketchMaterials::GetSketchMaterialFromWSMMaterial ( size_t  historyId,
size_t  wsmMaterialId 
)

Get the sketch material from the WSM material.

Parameters
[in]historyId
[in]wsmMaterialId
FORMIT_CORE_EXPORT WSM::ObjectHistoryID FormIt::SketchMaterials::GetWSMMaterialForHistory ( size_t  historyId,
size_t  materialId 
)

Get the WSM material from the sketch material in the given history.

If a WSM material does not exist, create one. If WSM::INVALID_ID is passed for the historyId, the first WSM material in the list is used.

Parameters
[in]historyId
[in]materialId
FORMIT_CORE_EXPORT uint32_t FormIt::SketchMaterials::HashValueForMaterialData ( const FormIt::Materials::MaterialData data)

Get a 32bit hash value for a material data.

Parameters
[in]data
FORMIT_CORE_EXPORT bool FormIt::SketchMaterials::IsMaterialUsed ( size_t  materialID)

Returns true if the material is used by any objects.

Parameters
[in]materialID
FORMIT_CORE_EXPORT bool FormIt::SketchMaterials::IsValidObjectForMaterialAssignment ( size_t  nHistoryId,
size_t  objectId 
)

Check whether the given object is valid for getting a material.

Valid object types are : Body Face Instance Mesh

Parameters
[in]nHistoryIdID of the given History
[in]objectId
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::RearrangeMaterials ( const 1::vector< size_t > &  materialIds,
size_t  materialBeforeOrAfterId,
bool  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]materialIds
[in]materialBeforeOrAfterId
[in]insertAfter
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::RemoveMaterialsForHistory ( size_t  nHistoryId)

Removes all wsm materials in the sketch materials that are from the given history.

Parameters
[in]nHistoryIdID of the given History
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::SetDefaultMaterialData ( const FormIt::Materials::MaterialData data,
bool  bBack 
)

Set the parameters of the default material.

bBack indicates the material for the backside of faces. Otherwise the material for the frontside is used.

Parameters
[in]data
[in]bBack
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::UpdateMaterialFromData ( size_t  materialID)

Update the firefly material from its stored formit material data.

Parameters
[in]materialID
FORMIT_CORE_EXPORT void FormIt::SketchMaterials::UpdateMaterialFromParameters ( size_t  materialID,
const WSM::Color color,
const float *  gloss,
const float *  reflectionDirect,
const float *  reflectionOblique,
const 1::vector< char > *  diffuseTexture,
const 1::vector< char > *  normalTexture,
const 1::vector< char > *  opacityTexture,
const float *  uscale,
const float *  vscale 
)

Update the rendering 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. Each parameter is optional, so that it is possible to only update color, for example. Note that this does not change the formit material. It just re-renders the scene with the material using the given parameters.

Parameters
[in]materialID
[in]color
[in]gloss
[in]reflectionDirect
[in]reflectionOblique
[in]diffuseTexture
[in]normalTexture
[in]opacityTexture
[in]uscale
[in]vscale