juke3d
11-18-2010, 11:13 PM
I have created and attribute on a deformer node, just to store an array of doubles, these doubles are set by a command inside the plugin itself, and the attribute is never connected to any other node, itīs just supposed to store these values. The problem is that when I save the scene, close maya and open it again, the values are gone... hereīs the code:
In the deformer initialize method:
MFnTypedAttribute tAttr;
myAttr = tAttr.create("testAttribute", "tAtt", MFnData::kDoubleArray, MObject::kNullObj, &status);
tAttr.setHidden(true);
tAttr.setStorable(true);
status = addAttribute(myAttr);
In the function where I set the values:
MDoubleArray myArray(100, 0.0);
MFnDoubleArrayData myArrayData;
MObject myArrayObj = myArrayData.create(myArray);
MPlug myPlug( thisMObject(), myAttr );
myPlug.setValue(myArrayObj );
In the deform method where I retrieve the values:
MDataHandle myDataHandle = block.inputValue(myAttr );
MFnDoubleArrayData myData(myDataHandle .data());
MDoubleArray myArray = myData.array(&status);
Everything works fine while maya is open, but when I save the scene, close and reopen maya, the array is gone...
Thanks for any help!
In the deformer initialize method:
MFnTypedAttribute tAttr;
myAttr = tAttr.create("testAttribute", "tAtt", MFnData::kDoubleArray, MObject::kNullObj, &status);
tAttr.setHidden(true);
tAttr.setStorable(true);
status = addAttribute(myAttr);
In the function where I set the values:
MDoubleArray myArray(100, 0.0);
MFnDoubleArrayData myArrayData;
MObject myArrayObj = myArrayData.create(myArray);
MPlug myPlug( thisMObject(), myAttr );
myPlug.setValue(myArrayObj );
In the deform method where I retrieve the values:
MDataHandle myDataHandle = block.inputValue(myAttr );
MFnDoubleArrayData myData(myDataHandle .data());
MDoubleArray myArray = myData.array(&status);
Everything works fine while maya is open, but when I save the scene, close and reopen maya, the array is gone...
Thanks for any help!
