void AttributeParser::parseMatrixAttribute(MFnDependencyNode & node, MObject & attribute) { MStatus status; MFnMatrixAttribute fnMatrixAttribute(attribute, &status); if (!status) return; MPlug plug = node.findPlug(attribute, &status); if (!status) return; MPlugArray plugArray; bool hasConnection = plug.connectedTo(plugArray, true, false, &status); if (!status) return; if (hasConnection) { MPlug externalPlug = plugArray[0]; bool externalPlugNull = externalPlug.isNull(&status); if (!status) return; if (!externalPlugNull) { MFnAttribute fnAttribute(attribute, &status); if (!status) return; MString name = fnAttribute.name(&status); if (!status) return; //MObject pluggedObject = externalPlug.node(&status); //if (!status) return; // TODO pass matrix to callback? onMatrix(...) instead of onConnection(...)? onConnection(plug, name, externalPlug); } } }
MPlug FxInternal::GetValuePlug(MPlug& plug) { MFnDependencyNode depNode(GetSite()); MObject oAttribute = plug.attribute(); MFnAttribute fnAttribute(oAttribute); MString name = fnAttribute.name() + MString("Value"); oAttribute= depNode.attribute(name); return plug.child(oAttribute); }