Quantcast
Channel: mel wiki
Viewing all articles
Browse latest Browse all 610

How can I add a command to the 'Recent Commands' menu?

$
0
0
Maya has a repeatLast command, that appears to be undocumented (as of Maya 2016). Here's the interactive help:
help repeatLast;
// Result: 

Synopsis: repeatLast [flags]
Flags:
   -e -edit
   -q -query
  -ac -addCommand            String
 -acl -addCommandLabel       String
  -cl -commandList           Int
 -cnl -commandNameList       Int
  -hl -historyLimit          Int
   -i -item                  Int
 -nhi -numberOfHistoryItems 

Command Type: Command
 // 
You can pass a string to the addComand flag. However it only parses mel, not Python. To executePython, you need to jump through some hoops:
import pymel.core as pm

def doStuff():
    print "doing stuff"
    
pm.repeatLast(addCommand="python(\"doStuff()\")", addCommandLabel="doStuff")

Viewing all articles
Browse latest Browse all 610

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>