Hi,
Is it possible to highlight custom menu items with those green brackets?
Hi,
Is it possible to highlight custom menu items with those green brackets?
Yes, you can get QMenu items and dump them for inspection. Did some to custom color menu items in the node editor fiddling around with it. The dump will however be a huge trove of âQMenuItems##â and so on so to find the correct one might be a pain using the same method I used. If you add the menu items yourself with Qt you should however know how to access your items.
Damn.
I was hoping to do that without QT as I donât have any experience with that.
Anyway, Thank you!
Found the python tab I had the code in when I looked into this, maybe it could help.
import pymel.core as pm
def recursive_children(qt_object, level=0):
print ' ' * level + type(qt_object).__name__
children = qt_object.children()
for child in children:
recursive_children(child, level)
level += 1
def widget_parser(widget):
""" Recursive listing of a widgets structure, """
children = widget.children()
for child in children:
print type(child).__name__
# Get the node editor as a Qt object,
node_editor = pm.getPanel(scriptType='nodeEditorPanel')[0]
node_editor_qt = node_editor.asQtObject()
widget_parser(node_editor_qt)
recursive_children(node_editor_qt)
Probably the easiest way to do this is just use the version
flag on cmds.menuItem
, if the version value == the current running version of Maya, it will highlight. Otherwise it wonât.
If youâre using mel, and maya LT, you need to use ltVersion
instead.
wow. appreciate the code. iâll look into this. it is due to get some basic qt knowledge at least.
Well, thatâs embarrasing. Iâve tried using this flag before. Must have done something wrong it seems.
Thank you!!
@cur10us you should mark Bobâs answer as the âsolutionâ so future lurkers know thereâs a definitive answerâŚ
sorry for late response. i canât seem to find how to mark an answer as the solution
OK, I did it. Looks like there was a plugin setting that changed a version ago, hiding the option.