I don't think you can do this, but why not just add an argument to your
script that drives it's different modes, then use that when adding it to
the respective menu? This makes it a lot more flexible to be used in
other code as well.
e.g.:
def myFunc( mode ):
if mode == 'modeA':
...
elif mode == 'modeB':L
...
etc...
nuke.menu('Nuke').addCommand( 'my function', lambda: myFunc( 'modeA' ) )
nuke.menu('Nodes').addCommand( 'my function', lambda: myFunc( 'modeB' ) )
etc...
On 3/06/12 6:15 AM, andi wrote:
Hi, i got python function() which is can be called from dag(nodes) or
from custom menu or from panel or from script editor. How can i check
if the script is called from that location? i want to create a
function which can respons correctly depends on where the script has
been called.
So far i can handle this but not a 'nice' way. For example i'll check
with putting 'nuke.thisNode()' in the script so if this returns True ,
it means it's called from dag , if returns false , it means it's
called from script editor or custom panel or custom menu..... then i
do another check for the rest bla bla... is there a better way to
check . not sure but let's see if anyone has a better solution.
Thanx
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python