Export of geometry with modifiers.


I’m trying to export geometry through my visualization plugin (c++). Geometry is exported, but visibility modes of viewport / renderer for modifiers do not work. Separate values ​​of smoothing iterations do not work (for example, for viewport = 0 iteration, for renderer = 2) in the meshsmooth modifier. That is, geometry always gets what is seen in the viewport.
The documentation says that this is done via GetRenderMesh(). For a spline this works - i can get a different view for the viewport and render. But for geometry there is not. I will be grateful for any help.
Here’s what’s happening here:

if (os.obj->SuperClassID() == SHAPE_CLASS_ID)
ShapeObject* shape = static_cast<ShapeObject*>(os.obj);
shape->GenerateMesh(t, GENMESH_RENDER, mesh);
mesh = shape->GetRenderMesh(t, node, theView, delMesh);
tri = GetTriObjectFromNode(node, t, needDel);
if (tri == nullptr) return false;
mesh = tri->GetRenderMesh(t, node, theView, delMesh);

GetTriObjectFromNode(INode *node, TimeValue t, int &deleteIt)
deleteIt = FALSE;
Object *obj = node->EvalWorldState(t).obj;

if (obj->CanConvertToType(Class_ID(TRIOBJ_CLASS_ID, 0)))
TriObject *tri = (TriObject *) obj->ConvertToType(t, Class_ID(TRIOBJ_CLASS_ID, 0));
// Note that the TriObject should only be deleted
// if the pointer to it is not equal to the object
// pointer that called ConvertToType()
if (obj != tri) deleteIt = TRUE;
return tri;
else return nullptr;