eek
10-06-2011, 02:22 AM
Trying to get the hang of using matrices in the API with Python.
For the initialize method i have something like this:
mAttr = OpenMaya.MFnMatrixAttribute()
nAttr = OpenMaya.MFnNumericAttribute()
plugin.input = mAttr.create('input', 'in')
mAttr.setKeyable(True)
mAttr.setStorable(True)
plugin.output = nAttr.create('output','out', OpenMaya.MFnNumericData.k3Double)
For the compute i have something like this:
inputHandle = dataBlock.inputValue(plugin.input)
outputHandle = dataBlock.outputValue(plugin.output)
result = inputHandle.asMatrix()
outputHandle.set3Double(result(3,0), result(3,1), result(3,2))
datablock.setClean(plug)
Anyone know why this wouldnt work?, i did a simple test plugging in a locators.m (matrix) attribute into the input. And the output to another locators.translate property.
Wondering if i have to specify the attribute type, something like this? eg.
mAttr.create('input', 'in', OpenMaya.MFnMatrixData.kDouble)
Any help is much appreciated
For the initialize method i have something like this:
mAttr = OpenMaya.MFnMatrixAttribute()
nAttr = OpenMaya.MFnNumericAttribute()
plugin.input = mAttr.create('input', 'in')
mAttr.setKeyable(True)
mAttr.setStorable(True)
plugin.output = nAttr.create('output','out', OpenMaya.MFnNumericData.k3Double)
For the compute i have something like this:
inputHandle = dataBlock.inputValue(plugin.input)
outputHandle = dataBlock.outputValue(plugin.output)
result = inputHandle.asMatrix()
outputHandle.set3Double(result(3,0), result(3,1), result(3,2))
datablock.setClean(plug)
Anyone know why this wouldnt work?, i did a simple test plugging in a locators.m (matrix) attribute into the input. And the output to another locators.translate property.
Wondering if i have to specify the attribute type, something like this? eg.
mAttr.create('input', 'in', OpenMaya.MFnMatrixData.kDouble)
Any help is much appreciated
