MPXNode::legalConnection does not get called for a connection with dynamic attribute


#1

For dynamic attributes MPXNode::legalConnection does not get called
when I try to connect the attribute in the node editor.

The attributes properties are set to


Cached = false;
Writable = true;
Readable = true;
Connectable = true;
Keyable = true;
Storable = true;



I even added an additional call to accepts when creating the attribute:

MFnAttribute::accepts


AttrFn.accepts(MyMPxData::s_TypeID, &stat);



Again different layers of engineering make the Maya API unnecessarily complicated. XD

So how do I get an dynamic attribute (added with MDGModifier or MFnDependencyNode) to take a connection?

What do I have to do to have legalConnection called?

Or is there another layer of engineering and there is some callback or something?

I’m out of ideas,
Kai


#2

So, make sure to have the source node of the connection set isLegal=true in isLegalConnection()
if you want your destination node to have isLegalConnection() called and be able to decide if the connection is made…

Makes sense, just easy to forget in the clutter. :wink:

Best,
Kai