ok so a little update, I've managed to get this code to set the hardwareColor bu it doesn't update unless i reload the file
def compute(self, pPlug, pDataBlock):
if (( pPlug == appleseed_material.outColorAttribute ) or ( pPlug == appleseed_material.hardwareColorAttribute )):
# Get the data handles corresponding to your attributes among the values in the data block.
surfacePointDataHandle = pDataBlock.inputValue( appleseed_material.surfacePointAttribute )
BSDFDataHandle = pDataBlock.inputValue( appleseed_material.BSDFAttribute )
# Obtain the (x,y,z) location of the currently rendered point in camera coordinates.
surfacePoint = surfacePointDataHandle.asFloatVector()
# Get the BSDF and hardware Color values.
BSDFValue = BSDFDataHandle.asFloatVector()
outColor = OpenMaya.MFloatVector(0, 0, 0)
hardwareColor = OpenMaya.MFloatVector(0, 0, 0)
outColor.x = BSDFValue.x
outColor.y = BSDFValue.y
outColor.z = BSDFValue.z
hardwareColor.x = BSDFValue.x
hardwareColor.y = BSDFValue.y
hardwareColor.z = BSDFValue.z
# Write to the output data.
outColorDataHandle = pDataBlock.outputValue( appleseed_material.outColorAttribute )
outColorDataHandle.setMFloatVector( outColor )
outColorDataHandle.setClean()
hardwareColorDataHandle = pDataBlock.outputValue( appleseed_material.hardwareColorAttribute )
hardwareColorDataHandle.setMFloatVector( hardwareColor )
hardwareColorDataHandle.setClean()
# cmds.setAttr(+'.hardwareColor', 1,0,0)
else:
return OpenMaya.kUnknownParameter
I have set the correct attributeAffects relationships as far as i can see
appleseed_material.attributeAffects( appleseed_material.BSDFAttribute, appleseed_material.outColorAttribute )
appleseed_material.attributeAffects( appleseed_material.BSDFAttribute, appleseed_material.hardwareColorAttribute )
Any idea what i need to do here
jt