我可以使用MProgressWindow
内部MPxNode::compute
方法吗?MProgressWindow
即使没有被另一个进程使用,我的插件实现也不会保留。
MStatus Node::compute(const MPlug & plug, MDataBlock & data) {
if (!MProgressWindow::reserve())
return MS::kFailure;
MProgressWindow::setTitle(this->typeName);
MProgressWindow::setInterruptable(true);
MProgressWindow::setProgressRange(0, 100);
MProgressWindow::setProgressStatus("Initializing: 0%");
MProgressWindow::setProgress(0);
MProgressWindow::startProgress();
// Some expensive operation.
// If the user presses ESC key, this ends the progress window and returns failure.
MProgressWindow::endProgress();
return MS::kSuccess;
}
注意:当节点被删除时,MProgressWindow
会显示(奇怪的行为)。
我很感激任何帮助。