Maya2Babylon.ScriptToBabylon.doIt runtime error

I was trying to convert the MEL script to python but I keep getting this error on ScriptToBabylon?
I have little experience with either MEL/Python or Maya, so not sure what it’s trying to tell me here.


parameters = [None] * 32
parameters[0] = output_path #DESTINATION PATH 
parameters[1] = "glb" #EXPORT FORMAT
parameters[2] = "" #TEXTURES FOLDER
parameters[3] = "1" #SCALE FACTOR
parameters[4] = "True" #WRITE TEXTURES
parameters[5] = "True" #OVERWRITE TEXTURES
parameters[6] = "False" #EXPORT HIDDEN OBJECTS
parameters[7] = "True" #EXPORT MATERIALS
parameters[8] = "False" #EXPORT ONLY SELECTED
parameters[9] = "False" #BAKE ANIMATION FRAMES
parameters[10] = "True" #OPTIMIZE ANIMATION
parameters[11] = "True" #OPTIMIZE VERTICES
parameters[12] = "False" #ANIMATION GROUP NON EXPORTED
parameters[13] = "False" #GENERATE MANIFEST
parameters[14] = "False" #AUTO SAVE SCENE FILE
parameters[15] = "True" #EXPORT TANGENTS
parameters[16] = "True" #EXPORT SKINS
parameters[17] = "True" #EXPORT MORPH TARGET
parameters[18] = "True" #EXPORT MORPH NORMALS
parameters[19] = "100" #TEXTURE QUALITY
parameters[20] = "True" #MERGE AO WITH MR
parameters[21] = "False" #DRACO COMPRESSION
parameters[22] = "False" #ENABLE KHR LIGHTS PUNCTUAL
parameters[23] = "False" #ENABLE KHR TEXTURE TRANSFORM
parameters[24] = "False" #ENABLE KHR MATERIALS UNLIT
parameters[25] = "False" #PBR FULL
parameters[26] = "False" #PBR NO LIGHT
parameters[27] = "False" #CREATE DEFAULT SKYBOX
parameters[28] = "" #PBR ENVIRONMENT
parameters[29] = "True" #EXPORT ANIMATIONS
parameters[30] = "False" #EXPORT ANIMATIONS ONLY
parameters[31] = "True" #EXPORT TEXTURES



# Error: RuntimeError: file <string> line 2: Exception found: 
Message --- (kFailure): Unexpected Internal Failure
Source --- openmayacs
StackTrace ---    at Autodesk.Maya.OpenMaya.MArgList.asStringArray(UInt32& index)
   at Maya2Babylon.ScriptToBabylon.doIt(MArgList argl)
   at Autodesk.Maya.OpenMaya.MPxCommand.SwigDirectordoIt(IntPtr args)
TargetSite --- Autodesk.Maya.OpenMaya.MStringArray asStringArray(UInt32 ByRef) #

Maybe @Drigax would know, I am sorry I am so stupid with MEL

Not sure, we don’t officially support Python->MEL invocation, maya may very well be tripping over the python string[\] you’re passing in as an argument (judging from the stack trace), but I wouldn’t know how to fix that.

Can you try invoke the exporter via MEL command string literals, similar to how we invoke it in our sample script?

Alright it works when use the MEL script, I just call it with python like this

mel.eval('source "babylon-exporter.mel"')

1 Like