If you look at the C++ devkit examples (or for that matter the explanation up in the
Public Types section for MNodeMessage) you can see the problem. Namely, the enum values correspond to hexadecimal numbers. If you run hex() on the number, you will see what's going on:
hex(18433) is 0x4801, which means:
- kOtherPlugSet (0x4000)
- kIncomingDirection(0x800)
- kConnectionMade(0x01)
I'm guessing the reason for this paradigm is so you are not sending a separate message for each of these events—otherwise you would have two or three messages sent for each attribute. As you can see in the C++ examples (e.g. nodeMessageCmd.cpp), a simple if-statement does not suffice—you must instead use the bitwise operator:
if ( msg & MNodeMessage::kConnectionMade ) { cout << "Connection made ";
} else if ( msg & MNodeMessage::kConnectionBroken ) { cout << "Connection broken ";
} else { return;
}Thus, the same goes for Python:
if messageId & OM.MNodeMessage.kConnectionMade:
# Do cool stuffIf a particular message code is not included, the if-statement will return 0 (false). If it is included, it will return decimal representation of the hex number for that enum, and thus pass the test.