Xmesh, maxscript and visibility



we made a tool to export Xmesh files, it works just fine but I can’t figure out how to set the option “When Visibility Less Than 1” to “DO NOT save” through maxscript. Is there a method or an option for that ? Or maybe at least the ability to save and load some presets ?

We are exporting using Max 2018 / Xmesh 1.5.0 (only way we found to get visibility out of Alembic in Max), and it is meant to be read in Max 2016 / Xmesh 1.3.3



Hey guys,

little bump on that one, since it’s big problem for us I would love to know about a turn around to do that.



Thanks for the bump! I’ll see if Bobo has some ideas


The Visibility support is not part of the XMesh Saver plugin itself, but of the XMeshSaver.mcr MAXScript UI.
So if you have implemented your own MAXScript saver that calls the XMeshSaverUtils methods, but you are not using the actual XMeshSaver script we ship, then you would be lacking that capability.

On the other hand, if you are using the shipping script, then the property XMeshSaver_Settings.ObjectVisibilityMode set to 3 would enable the “Do Not Save” if Visibility is less than 1.

You could copy and paste the code to support this behavior from our script into yours. Basically what we do is

  • On each frame, filter the array of the meshes to save based on the visibility mode:
    • if the mode is not 2 or 3, we just use the original array
    • if the mode is 2, we filter for visibility == 0 (in fact we collect if visibility is > 0.0)
    • if the mode is 3, we filter for visibility < 1 (we collect if visibility is >= 1.0)
  • Then we pass the resulting filtered array to the saving function

Note that the filter function for visibility was recently updated to support correct visibility inheritance from parent objects, but we have not released that update yet. I have attached the updated version of the script, search for the function getInheritedVisibility to see how it is defined and where we are using it to filter the list of meshes to save…