Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from maya import cmds
- def main():
- input = cmds.promptDialog(
- title='MEL >>> Python',
- message='Insert MEL command:',
- button=['Print', 'Cancel'],
- defaultButton='Print',
- cancelButton='Cancel',
- dismissString='Cancel')
- if input == 'Print':
- cmd = cmds.promptDialog(query=True, text=True)
- components = cmd.split('-')[1:]
- formatted=[]
- for n in components:
- thing = n.split()[0]
- value = n.split()[1:]
- if len(value)>1:
- value = '(%s)' % ','.join(value)
- else:
- value = value[0]
- if value == 'none':
- value = None
- continue
- if value.isalpha():
- value = '"%s"' % value
- formatted.append('%s=%s' %(thing,value))
- print "cmds.%s(%s)"%(cmd.split('-')[0].strip(),', '.join(formatted))
- main()
Advertisement
Add Comment
Please, Sign In to add comment