Need help with python/marking menu

by IrisHeart posted 290 days ago | 1 comment

I followed this guide on marking menus, https://bindpose.com/custom-marking-menus-maya-editors/ its work great for the most part, but not with one of my python scripts. The script is a simple UI with buttons that works on my shelf but when I open it with my custom marking menu it opens the UI but the buttons do not work its says "NameError: name 'foo' is not defined " when I click the button.

The only work around I've found is creating a mel script or runtime command that opens my script then running that with the marking menu. Is there a better more correct way to open python scripts with UI's in a marking menu without having this issue?

by macky posted 237 days ago

I took a slightly different approach with this. I have been messing around recently trying to look at what it would take to wrap up the nodeEditorMenus.customInclusiveNodeItemMenuCallbacks into a tool I can leverage to make life a bit easier at home when adding tools to nodes in the nodeEditor as manhandling that list all the time was getting painful! You won't get a menu on a clean click over an empty space in the nodeEditor, but I wasn't after that result. I wanted to setup actions that related to specific nodes (and selections) for speeding up prototyping.

My WIP stuff is here; https://jamesbdunlop.github.io/om2/2019/02/15/nodeEditorCmds.html

Might give you a different approach to play with? Might not :) Note: I still have to flesh out the code with some more docStrings etc (it's a WIP when I get around to messing with it :)) And you should prob consider it WIP / not production tested for now :)