MPxNode::legalConnection from plug to typed attribute


#1

To verify a connection is legal, I want to compare MTypeIds for plugs of typed attributes.
I struggle to get the MTypeId, getting “kInvalid” from the call to attrType() (MFnTypedAttribute).
As a minimal sample, I try to get the MTypeId directly after the attributes creation:

Listing 1: creating the attribute and asking directly for its MTypeId
//------------------------------------------------------------------------------------------------------------------------------

MStatus stat;
MFnTypedAttribute typedAttrFn;
MObject newTypedAttrObject;

//type (MTypeId) is what I want to match and here it is in our developer id range

newTypedAttrObject = typedAttrFn.create(“fullName”, “shortName”, type, MObject::kNullObj, &stat);

MFnData::Type attrDataFn = typedAttrFn.attrType(&stat); // gives me kinvalid, not kplugin

//------------------------------------------------------------------------------------------------------------------------------

Do I miss something, I have to do so MTypeId works?

Thanks in advance,
Kai