Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Turtle: Mel to Pymel Issue

Turtle: Mel to Pymel Issue

George.Xyooj
Participant Participant
820 Views
1 Reply
Message 1 of 2

Turtle: Mel to Pymel Issue

George.Xyooj
Participant
Participant

This sounds like it should be something simple but it has me stumped.  I'm using turtle to bake vertex lighting onto an object and I want to do this using python.  

 

When I manually do the process, maya spits out this mel line.

 

 

ilrVertexBakeCmd -target "pCubeShape1" -frontRange 0 -backRange 200 -frontBias 0 -backBias -100 -transferSpace 1 -selectionMode 0 -mismatchMode 0 -envelopeMode 0 -ignoreInconsistentNormals 1 -considerTransparency 0 -transparencyThreshold 0.001000000047 -camera "persp" -normalDirection 0 -shadows 1 -alpha 1 -viewDependent 0 -orthoRefl 1 -backgroundColor 0 0 0 -frame 1 -bakeLayer TurtleDefaultBakeLayer -samplingMode 0 -vertexBias 0.001000000047 -camera "persp" -frame 1 -shadows 1 -orthoRefl 1 -alpha 1 -normalDirection 0 -viewDependent 0 -useBlending 1 -rgbBlend 0 -alphaBlend 0 -rgbScale 1 -alphaScale 1 -saveToColorSet 1 -colorSet "baked_$p" -overwriteColorSet 1 -saveToFile 0 -layer defaultRenderLayer

Copying, pasting and excuting that line: everything works just fine.  

 

 

I converted it to pymel as follow:

 

ilrVertexBakeCmd(target="pCubeShape1", frontRange=0, backRange=200, frontBias=0, backBias=-10, transferSpace=1, selectionMode=0, mismatchMode=0, envelopeMode=0, ignoreInconsistentNormals=1, considerTransparency=0, transparencyThreshold=0.001000000047, camera="persp", normalDirection=0, shadows=1, alpha=1, viewDependent=0, orthoRefl=1, backgroundColor=(0, 0, 0), frame=1, bakeLayer="TurtleDefaultBakeLayer", samplingMode=0, vertexBias=0.001000000047, camera="persp", frame=1, shadows=1, orthoRefl=1, alpha=1, normalDirection=0, viewDependent=0, useBlending=1, rgbBlend=0, alphaBlend=0, rgbScale=1, alphaScale=1, saveToColorSet=1, colorSet="baked_$p", overwriteColorSet=1, saveToFile=0, layer="defaultRenderLayer")

This is what I'm excuting:

 

 

import pymel.core as pm

pm.setAttr('defaultRenderGlobals.ren', 'turtle', type='string') # sets turtle as renderer
pm.setAttr('TurtleRenderOptions.renderer', 1) # sets render type to bake instead of rendering
pm.setAttr('TurtleDefaultBakeLayer.renderType', 2) # sets bake to vertex instead of texture
pm.ilrVertexBakeCmd(target="pCubeShape1", frontRange=0, backRange=200, frontBias=0, backBias=-10, transferSpace=1, selectionMode=0, mismatchMode=0, envelopeMode=0, ignoreInconsistentNormals=1, considerTransparency=0, transparencyThreshold=0.001000000047, camera="persp", normalDirection=0, shadows=1, alpha=1, viewDependent=0, orthoRefl=1, backgroundColor=(0, 0, 0), frame=1, bakeLayer="TurtleDefaultBakeLayer", samplingMode=0, vertexBias=0.001000000047, camera="persp", frame=1, shadows=1, orthoRefl=1, alpha=1, normalDirection=0, viewDependent=0, useBlending=1, rgbBlend=0, alphaBlend=0, rgbScale=1, alphaScale=1, saveToColorSet=1, colorSet="baked_$p", overwriteColorSet=1, saveToFile=0, layer="defaultRenderLayer")

 

This error gets thrown:  # Error: keyword argument repeated # 

These are the culprits

 

 

camera "persp" 
normalDirection 0 
shadows 1 
alpha 1 
viewDependent 0 
orthoRefl 1
frame=1, 

 

 

I remove those: # Error: RuntimeError: file <string> line 2: No surfaces given, use -target "surfaceName" # 

 

I have tried the following and I still get that error.

 

import pymel.core as pm

pm.setAttr('defaultRenderGlobals.ren', 'turtle', type='string') # sets turtle as renderer
pm.setAttr('TurtleRenderOptions.renderer', 1) # sets render type to bake instead of rendering
pm.setAttr('TurtleDefaultBakeLayer.renderType', 2) # sets bake to vertex instead of texture
pm.ilrVertexBakeCmd(target="pCubeShape1")

 

Any help would be great!

 

Thanks

 

0 Likes
821 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

I have the exact same problem, it seems that the "target" flag it is not parsed correctly. My only workaround was to write that in MEL