Getter functions are functions that return a value, have no arguments, and that have no observable effect on the state of the application. Getter function names start with the prefix get, is, has, or can; or are qualified as a “const” function in the C++ header files. Setter functions are void functions that have a single argument, start with the prefix set, and that have the same root name as a getter function. Getter functions with a corresponding setter function (same root name) are mapped to read-write properties; otherwise, they are mapped to read-only properties. Properties have the same name as the getter function but with the prefix removed.
In certain cases, the names of the properties had to be changed because the new property name conflicted with an existing method name. The word Property was added to the new property name. For example, index() became indexProperty.
For the MSceneMessage class, each message identified by a value of the enum Message now has an independent event handler; therefore, the enum is no longer meaningful. For instance, do MSceneMessage.SceneUpdate += callback instead of MSceneMessage::addCallback( MSceneMessage::kSceneUpdate, callback ).
For callbacks related to an instance of an object (MDagPath, MPlug, and so forth), the event handler can be found directly in the class of that object. For instance, do obj.NodeAddedToModel += callback (with obj of type MObject) instead of MModelMessage::addNodeAddedToModelCallback(obj, callback).
To avoid memory leaks, you must deregister your callbacks (by removing them from the corresponding event handler) when the callbacks are no longer needed. A new mechanism has been added to automatically deregister the callbacks when the plug-in is unloaded from Maya.
To see how events are used, refer to the pluginCallbacks example in the <...>\devkit\dotnet\examples folder. For more information on C# events see C# events in MSDN.
Usage of IEnumerable<T> – Iterators support IEnumerable<T>, which facilitates the usage of LINQ. For more information on IEnumerable, see and IEnumerable Interface in MSDN.
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License