33th...@gmail.com
unread,Mar 10, 2017, 1:04:59 PM3/10/17Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Python Programming for Autodesk Maya
Hi there,
I'm having some problems implementing the read/write ASCII methods for MPxData. Writing it doesn't seem to be a problem, but reading the arglist within the readASCII method is proving to be rather confusing.
I'm trying to create an MDoubleArray using MArgList::get() or MArglist::asDoubleArray. but give me the same results. However, when I just loop over the length of the array, and fill each value individually from the arglist, it works.
void ProxyData::readArrayFromASCII(MDoubleArray &array, const MArgList &args, unsigned &lastParsedElement){
unsigned int len = (unsigned) args.asInt(lastParsedElement++);
if (!len)
return;
// this works
array.setLength(len);
for (int i = 0; i < len; ++i)
args.get(lastParsedElement++, array[i]);
// // I dont know why this doesnt work
// MStatus stat;
// stat = args.get(lastParsedElement, array);
// CHECK_MSTATUS(stat);
}
From the docs, it states the index argument should point to the int number of items in the array, and the array should follow. So in my ascii, I have something like: 5 0.21 0.35 0.78 0.89 1.2
also, setting the size of the array first, doesn't seem to help.
Any ideas?
Thanks!