talk.bindpose.com has been shut down on the 6th of March 2021. You can read a bit more about it here.

You are currently reading an archived copy of the latest content, with all the usernames deleted.

Need help with python/marking menu

by user82 posted 28-12-2018 | 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 user137 posted 18-02-2019

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 :)