hi,
i'm just getting back to some maya api c++ and am hitting my head on the
following:
i have an input and output array of matrices. for the number of inputs i
want the node to create the number of outputs. but my following code
doesn't seem to work. i based it on some devkit nodes who do something
similar with other data types as outputs. any help?
// initialize
aInputMatrices = mAttr.create("inputMatrices", "inputMatrices");
mAttr.setStorable(false);
mAttr.setConnectable(true);
mAttr.setArray(true);
mAttr.setHidden(true);
mAttr.setUsesArrayDataBuilder(true);
addAttribute(aInputMatrices);
aOutputMatrices = mAttr.create("outputMatrices", "outputMatrices");
mAttr.setStorable(false);
mAttr.setWritable(false);
mAttr.setStorable(false);
mAttr.setArray(true);
mAttr.setUsesArrayDataBuilder(true);
addAttribute(aOutputMatrices);
attributeAffects(aInputMatrices, aOutputMatrices);
// compute method
MStatus status;
MArrayDataHandle hInputMatrices = data.inputArrayValue(aInputMatrices,
&status);
CHECK_MSTATUS_AND_RETURN_IT(status);
cout << "count: " << hInputMatrices.elementCount() << endl;
MArrayDataHandle hOutputMatrices =
data.outputArrayValue(aOutputMatrices, &status);
CHECK_MSTATUS_AND_RETURN_IT(status);
MArrayDataBuilder builder(aOutputMatrices,
hInputMatrices.elementCount(), &status);
CHECK_MSTATUS_AND_RETURN_IT(status);
for (unsigned int listIndex=0; hInputMatrices.elementCount();
listIndex++) {
cout << listIndex << endl;
MDataHandle outHandle = builder.addElement(listIndex);
hInputMatrices.jumpToElement(listIndex);
MMatrix curMat = hInputMatrices.inputValue(&status).asMatrix();
outHandle.setMMatrix(curMat);
}
status = hOutputMatrices.set(builder);
CHECK_MSTATUS_AND_RETURN_IT(status);
status = hOutputMatrices.setAllClean();
CHECK_MSTATUS_AND_RETURN_IT(status);
return status;
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/172e8560-a221-4539-9ea5-57f1e235d4d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.