SplitMeshWithProjectedCurve fails in Maya Standalone

SplitMeshWithProjectedCurve fails in Maya Standalone

Jiloc
Participant Participant
1,150 Views
3 Replies
Message 1 of 4

SplitMeshWithProjectedCurve fails in Maya Standalone

Jiloc
Participant
Participant

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)

 

2017-05-02.png2017-05-02 (1).png

 

0 Likes
1,151 Views
3 Replies
Replies (3)
Message 2 of 4

Jiloc
Participant
Participant

[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.

0 Likes
Message 3 of 4

Anonymous
Not applicable

Hi jiloc

 

I haven't looked into this, but have you tried using PyMel instead of standard maya python?

 

According the the documentation PyMel should be more robust...might be worth a try?

 

http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/PyMel/standalone.html

 

Cheers

 

Mike

0 Likes
Message 4 of 4

Jiloc
Participant
Participant

Hi TechToast. Thank you for the reply.

 

I tried the suggestion but it doesn't work either. 

 

 

Unfortunately it fails at the same place:

 

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

 

Here is the script if someone is curious 

 

from pymel import core

cube = core.modeling.polyCube()[0]

curve = core.modeling.curve(
    degree=1, point=((0, 1, 1), (0, -1, 1)))

projected_curve = core.modeling.polyProjectCurve(cube, curve, direction=(0, 0, -1))

splitted_cube = core.modeling.polySplit(
    cube, projectedCurve=curve, detachEdges=True, adjustEdgeFlow=1,
    smoothingangle=0, insertWithEdgeFlow=False, subdivision=1)[0]

core.modeling.polySeparate(splitted_cube)

core.system.renameFile("test_polySeparate.mb")
core.system.saveFile(save=True, type="mayaAscii")
0 Likes