PDA

View Full Version : attribute not saved with scene


juke3d
11-19-2010, 12:13 AM
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!

whisperwing
11-23-2010, 06:57 PM
did you save the scene into a maya ascii file and make sure the attribute is not in the file ?

CGTalk Moderation
11-23-2010, 06:57 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.