Message 1 of 2
Calling MDataHandle.data() causes crash

Not applicable
12-08-2017
08:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I'm writing a node that takes a worldMatrix as an input and I need to get the world transform from that matrix.
Here's part of my compute function:
# returns MDataHandle inMatrixHandle = dataBlock.inputValue(ConeReaderNode.inMatrix) # crashes here mFnMatrix = om.MFnMatrixData(inMatrixHandle.data()) mXformMatrix = mFnMatrix.transformation() inVector = mXformMatrix.getTranslation()
The docs for MDataHandle.data() mentions "This method is not valid for simple numeric types" , so I'm not sure if that's what is causing the issue.
Also, I tried this and it returned the 0 vector as a result. Not sure if I indexed the matrix correctly.
# returns an MMatrix
inMatrixHandle = dataBlock.inputValue(ConeReaderNode.inMatrix).asMatrix()
# access the translation values directly from our MMatrix. Also doesn't work. Returns the 0 vector.
inVector = om.MVector(inMatrixHandle(3,0),inMatrixHandle(3,1),inMatrixHandle(3,2))
Any ideas? I was able to get my node working by taking a regular k3Double input, but as this is a cone reader node I needed a fast way to get its absolute position in world space.
Still new to the API. Trying to make sense out of it all...
- Ben