SplitMeshWithProjectedCurve fails in Maya Standalone


#1

I am working on a plugin that should work with maya standalone.

Unfortunately I just realized that SplitMeshWithProjectedCurve doesn’t work in the standalone mode.

If I run the same commands within Maya, instead, it works flawlessly.

Here is a simple example that shows the problem


import maya.standalone maya.standalone.initialize("Python") 
from maya import cmds 

cube = cmds.polyCube()[0]
curve = cmds.curve(degree=1, point=((0, 1, 1), (0, -1, 1))) 
projected_curve = cmds.polyProjectCurve(cube, curve, direction=(0, 0, -1)) 

cmds.select(cube, projected_curve) 
cmds.SplitMeshWithProjectedCurve() 
try: 
    cmds.polySeparate("pCube2") 
except Exception as e: 
    print(e) 

cmds.file(rename="test_polyseparate.mb") 
cmds.file(save=True, type="mayaAscii")

Note: Of course the firsts 2 lines are required in the standalone only and not inside maya. Also the last 2 lines are required just to save the standalone result.

While the script inside maya works, the standalone will fail on the cmds.polySeparate line because the last function didn’t split the mesh (you can check that from the saved file. It will be saved inside C:/Users/YOURUSER/Documents/maya/projects/default/scenes/ ).

Can someone tell me if this is normal? Or a workaround?

I can tell that it’s like this, at least, since maya 2016, don’t know if it worked before that.

Here you can see the screen taken from both executions: (the first one is from the standalone)


from standalone


from maya


#2

[Update] I tried to avoid cmds.SplitMeshWithProjectedCurve to directly use cmds.polySplit.

Again, it works in normal maya and fails in standalone applications. At least this time it didn’t fail silently and returned:

Warning: Can’t perform polySplit1 on selection
Error: file: C:/Program Files/Autodesk/Maya2017/scripts/others/makeCurveSplitConnections.mel line 83: Cannot convert data of type int to type string[].
Error: -projectedCurve flag used but curve not connected to mesh through polyProjectCurve node

First I checked (and at least it looked like) the polyProjectCurve node is actually connected.

Debugging makeCurveSplitConnections.mel however I found out that the command “stringArrayIntersector” used in the MEL script fails to run in standalone mode. It returns 0 instead of the string expected (and that is returned in maya).

Surfing the net I found only this file from autodesk maya 2010 http://images.autodesk.com/adsk/files/maya2010releasenotes00.pdf which states that “stringArrayIntersector” doesn’t work in bach mode…

If someone could suggest me how to avoid the polySplit command, also low level suggestions using OpenMaya or whatever you could image, it would be a huge help.