Three.js: Maya 2016 Export All: # RuntimeError: (kInvalidParameter): Object is incompatible with this method //

Created on 20 Oct 2016  Â·  6Comments  Â·  Source: mrdoob/three.js

Description of the problem
  • I'm unable to export an animated bound mesh from within Maya 2016.
  • I'm using "Export All" and selecting all the options.
  • I can "Export All" the scene just fine when the mesh isn't bound.
  • This is happening in Dev and Master branches.

It looks like the getWeights method isn't passing a proper argument on line 381 in _exportSkins: for weights in skin.getWeights(mesh.vtx):. There seems to be a None value getting passed into the function, I can't find where it's coming from though. Using a Try: statement prevents the passing of the None. I haven't been able to verify if the JSON file output animates correctly in a browser, but the output file seems to look fine.

Here's the error:

// Error: line 0: (kInvalidParameter): Object is incompatible with this method
Traceback (most recent call last):
File "S:/path/to/threeJsFileTranslator.py", line 422, in writer
writer.write(path, optionString, accessMode)
File "S:/path/to/threeJsFileTranslator.py", line 63, in write
self._exportSkins()
File "S:/path/to/threeJsFileTranslator.py", line 381, in _exportSkins
for weights in skin.getWeights(mesh.vtx):
File "C:\Program Files\Autodesk\Maya2016\Python\lib\site-packages\pymel\core\nodetypes.py", line 3570, in getWeights
self.__apimfn__().getWeights(geometry.apimdagpath(), components, weights, index())
File "S:\Maya_2016_DI\build\Release\runTime\Python\Lib\site-packages\maya\OpenMayaAnim.py", line 1415, in getWeights
RuntimeError: (kInvalidParameter): Object is incompatible with this method //
// Error: line 0: Could not save file "S:/STUDIO_TEAMSPACE/Episodes/Mike_Bourbeau/Maya/Production/RandomTest/ColorVertexBasedOnJointInfluence/Maya/assets/testing.json". //

Full log here:
export_error_log.txt

Three.js version
  • [x] Dev
  • [ ] r81
  • [ ] ...

    Browser
  • [x] All of them

  • [ ] Chrome
  • [ ] Firefox
  • [ ] Internet Explorer

    OS
  • [x] All of them

  • [ ] Windows
  • [ ] Linux
  • [ ] Android
  • [ ] IOS
    Hardware Requirements (graphics card, VR Device, ...)
Bug

All 6 comments

@mikebourbeauart Any news on this?

I'm running into the same error trying to export a weighted skin in Maya 2016 using the latest exporter. Any ideas for workarounds? trying to get a skinned mesh to export for three.js

@colinfizgig I don't have Maya, so could not look into that, but ended up requesting fbx from the 3d department and import it to Blender as that exporter worked fine(r). Tricky with rotations though. Not a solution, but at least a last way out if you are on a tight schedule. One good thing with the Blender exporter is to export the animations as separate files. Good if there is lots of animations that need selective loading per character.

This is happening in Maya 2017 as well :(

still happaned in my maya2016, OpenMayaAnim.py line 1415: (kInvalidParameter):

I ran into this problem with Maya 2018 and figured out a quick fix -- Maya is creating an intermediate mesh when it binds the skin. This mesh is getting scooped up by threeJsFileTranslator.py which is causing the error with skin.getWeights(mesh.vtx). It's also adding unnecessary vertices, faces, etc.

To fix this, you'll need to change the filter on line 105 to not grab intermediate objects.

self.__allMeshes = filter(lambda m: len(m.listConnections()) > 0 and m.isIntermediate() == False, ls(type='mesh'))

Another issue is that the bones are not being generated. On lines 299, 300 and 329, 330 the list of joints is being grabbed by looking at listHistory with the future flag set true and then by looking at the connections. If we grab the default listHistory (without the future flag) we can filter out the joints.

joints = filter(lambda o: o.type() == "joint", listHistory( self._allMeshes() ))

The script needs more work but these changes should allow you to export animated bound meshes.. just make sure your model is in the bind pose!

Was this page helpful?
0 / 5 - 0 ratings