If you use MPxDrawOverride class to override the draw of your custom locator class, you will have to register the draw override as below:
static MString drawdb("drawdb/geometry/light/customLight"); static MString sDrawRegistrantId("customLightDraw"); plugin.registerNode("customLight", customLightNode::m_id, customLightNode::creator, customLightNode::initialize, MPxNode::kLocatorNode, &drawdb); MHWRender::MDrawRegistry::registerDrawOverrideCreator(drawdb, sDrawRegistrantId, MCustomLightDrawOverride::Creator);
However, if you want your locator to be classified as light with the same drawdb as above, Maya won't treat your locator as light, because the above drawdb string is applicable only for geometry override not for light. The node will be treated as light only after changing the classification string to “light/customLight” without “geometry” (e.g. static MString drawdb("light/customLight");) However in this case you can’t receive any draw call back for Viewport 2.0 becasue you didn't include “geometry” in the drawdb string.
So, how to treat your node as light and make it receive the draw callback for Viewport 2.0?.
You should define your drawdb as below.
static MString drawdb("light:drawdb/light/directionalLight:drawdb/geometry/light/directionalLightCustom");
This classification allows for the usage of the internal light and UI (geometry drawing) VP2 evaluators to be used. Note that there is no explicit VP2 override class used as the internal VP2 geometry evaluator will handle drawing. Attributes which control the light are created to match names on a Maya lights so that they will be picked up when DG evaluation occurs.
Please refer the “apiDirectionalLightShape” devkit sample for complete information.
Comments
You can follow this conversation by subscribing to the comment feed for this post.