Doing some work on the menu system, and I've just isolated a bug to
this. Basically, when you add a menu object to the nodes toolbar (or any
other one..) you get back a menu object - but when you try fetch it
again you get a MenuItem object. You can change the return values if you
stuff the menu with something.

Not a major issue, but thought people might want to know.

(Nuke 9.0v7/linux)


# Repro/demo
node_menu = nuke.menu("Nodes")

turkey = node_menu.addMenu("Turkey")
print turkey.name(), turkey  # it's a menu, dammit.

# both menu.items() and findItem calls probably have the same root
# and will give you MenuItems
for x in node_menu.items():
    if x.name() == "Turkey":
        print x.name(), x

found_turkey = node_menu.findItem("Turkey")
print found_turkey.name(), found_turkey

# you can't do found_turkey.addCommand, because it lacks the method.
# this was the original problem as I was doing a dynamic menu build and 
# assuming that I could always clear the menu, rather than have to test.
turkey.addCommand("Stuffing")

# now stuffed, the Turkey menu reports correctly as a menu.
for x in node_menu.items():
    if x.name() == "Turkey":
        print x.name(), x

found_turkey = node_menu.findItem("Turkey")
print found_turkey.name(), found_turkey
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to