I have a custom node that has a (dynamic) matrix attribute created with MFnMatrixAttribute::create(). Now I want to set a value on that attribute, but looking at the documentation for MPlug, there is no setValue() method that takes a MMatrix or MFloatMatrix as input (whereas MDataHandle has such a method, but I’m outside the compute() method, so I can’t use that one, right?). So how can I set the value?
What I’m actually trying to do is set the default value for the matrix. I noticed that when I set it using MFnMatrixAttribute::setDefault(), the new value is actually used but Maya doesn’t store it when saving the scene. This means when I store a node that still has (my own) default value, Maya won’t store the value (as it’s the default one). But as it doesn’t store the default value, the matrix will be the identity matrix when I load the scene again and not my actual default value. This is why I wanted to set my default value as a real value and not as an attribute default value.
- Matthias -