MUIDrawManager 在鼠标移动时被清理

MUIDrawManager gets cleaned when mouse moves

我尝试在Maya中开发一个基于控制点绘制曲线的插件(基本上我想复制默认的曲线工具)。

我正在创建一个基本的 Context 并接收 doPress 事件以绘制一条简单的线:

MStatus flowNodeOnly::doPress( MEvent& event, MHWRender::MUIDrawManager &drawManager, const MHWRender::MFrameContext &context)
{
    short x,y;

    event.getPosition(x,y);
    context.viewportToWorld(x,y,pos,far);
    linePlaneIntersection(contact,MVector(far-pos),pos,MVector(0,1,0),MVector(0,0,0));

    drawManager.beginDrawable();
    drawManager.setColor( MColor(1.0f, 1.0f, 0.0f) );
    drawManager.line( MPoint( 0, 0,0), MPoint(contact.x,0, contact.z) );
    drawManager.endDrawable();
}

线条在Maya Viewport 2.0 中画得很好,但是当我移动鼠标时,线条就消失了。如何让我的线路持久化?

好的,找到了,画下我的线条

MStatus drawFeedback ( MHWRender::MUIDrawManager& drawMgr, const MHWRender::MFrameContext& context );

使其持久。