accessXRiteMaterial

snippets/accessXRiteMaterial.py
 1# © 2024 Autodesk, Inc. All rights reserved.
 2
 3def getMeasuredMatFromXRite(xriteMat):
 4    childIndex = xriteMat.getChoice()
 5    children = xriteMat.getMaterials()
 6    if len(children) > childIndex:
 7        return children[childIndex]
 8    return vrdMaterial()
 9
10# load xrite material
11mat = loadMaterialAssetByName("X-Rite Leather Suede Brown")
12xriteMat = vrdXRiteMeasuredMaterial(vrdMaterial(mat))
13
14# get its active measurement and modify its exposure
15measuredMat = getMeasuredMatFromXRite(xriteMat)
16measuredMat.setExposure(2.0)
17
18# modify its color correction
19colorCorrection = measuredMat.getColorCorrection()
20colorCorrection.setHueShift(0.4)
21colorCorrection.setSaturation(1.2)
22colorCorrection.setContrast(0.8)