[Maya-Python] Converting MEL to Python

2021-11-09 Thread Nirmal Kumar
Hi all, I've been only scripting in Python for a while and I'm completely new to MEL .Currently I'm attempting to convert an Open source MEL script to Python. How can I start off with the conversion .? Will literal conversion of the MEL commands to Python do the job , keeping the logic to be the

Re: [Maya-Python] converting mel to python

2014-12-23 Thread yann19
Hi Gerard, Thanks for the info, I am also not a power programmer as well. Just started on basic scripting.. Correct me if I am wrong, but even without the use of try/except statement that you mentioned, it should works as well right? Probably from a good programmer POV, try/except is a better co

Re: [Maya-Python] converting mel to python

2014-12-23 Thread yann19
Hi Joe, I have tried out your code, pardon me, but I am not seeing much of a difference, other than the removal of brackets in the first if statement... Even so, I am getting no dialog popup should for the second part of the confirmDialog... On Wednesday, December 24, 2014 12:32:24 AM UTC+8, J

Re: [Maya-Python] converting mel to python

2014-12-23 Thread Gerard Gmail
I'm no power programmer but I would try to economise on repeating similar queries such as checking for the existence of optionVar recentList before querying the recentLst. I *think* that you could use a try: / except: approach to just query the recentFile (don't check for its existence - the try

Re: [Maya-Python] converting mel to python

2014-12-23 Thread Joe Weidenbach
Hi again, So, given this code, The only mistake I see is indeed the parentheses. Here's the code that works: http://pastebin.com/raw.php?i=i2N9JPAW A note, I added a call to reloadScene() at the end just to make it functional as a button. Joe On 12/23/2014 2:34 AM, yann19 wrote: This is m

[Maya-Python] converting mel to python

2014-12-23 Thread yann19
This is my first attempt at converting mel code into python - http://pastebin.com/raw.php?i=JwEtGJV6 This is the code that I have done: import maya.cmds as cmds def reloadScene(): recentFiles = [] curFile = cmds.file(query = True, location = True) if (curFile == "unknown")