Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding
Announcements
We are currently migrating data within this board to improve the community. During this process, posting, replying, editing and other features are temporarily disabled. We sincerely apologize for any inconvenience caused and appreciate your understanding. Thank you for your patience and support.

Collecting names from "SHOW" dropdown menu

bandrzejewski
Participant Participant
519 Views
6 Replies
Message 1 of 7

Collecting names from "SHOW" dropdown menu

bandrzejewski
Participant
Participant

Dear ones!
Do any of you know how to collect the names of nodes that are displayed in the "SHOW" window dropped down in the viewport menu by  mel or pymel?

bandrzejewski_0-1612813824332.png

Thanx for help 🙂

Reply
Reply
0 Likes
Accepted solutions (2)
520 Views
6 Replies
Replies (6)
Message 2 of 7

hamsterHamster
Advisor
Advisor

Under the Select>AllByType you can see the type listing, and with EchoAllCommands you can get the mel analogue which can be injected into py.

SelectAllNURBSSurfaces;
select -r `listTransforms "-type nurbsSurface"`;
ls -selection -type "transform";
// Result: nurbsSphere1 nurbsSphere3 nurbsSphere2 nurbsSphere4 //


,,,_°(O__O)°_,,,
Maya2019.1 @ Windows10 & GeForce GTX1080Ti

If the post was helpful, click the
 ACCEPT SOLUTION  button, so others might find it much more easily.

Reply
Reply
Message 3 of 7

bandrzejewski
Participant
Participant

Thank you for your answer!
Maybe my English is not perfect, but I don't want to list objects of a given type from the scene, but just to list the types of objects that appear in the SHOW menu.

I can ask the nurbsCurves checkbox state by
modelEditor -q -nurbsCurves modelPanel4;
// Result: 1 //


but how to ask - which of the types in the list have status 1 to have Result e.g:
nurbsCurves, nCloths, motionTrails, greasePencils ...
...and so on

Reply
Reply
0 Likes
Message 4 of 7

hamsterHamster
Advisor
Advisor

You might be looking for

modelEditor -q -nurbsSurfaces modelPanel4;
modelEditor -e -nurbsSurfaces false modelPanel4;
modelEditor -q -nurbsSurfaces modelPanel4;

Look up into command reference for modelEditor, there's also Py version.


,,,_°(O__O)°_,,,
Maya2019.1 @ Windows10 & GeForce GTX1080Ti

If the post was helpful, click the
 ACCEPT SOLUTION  button, so others might find it much more easily.

Reply
Reply
0 Likes
Message 5 of 7

bandrzejewski
Participant
Participant

Nope, because it returns me the state of "nurbsSurfaces" checkbox , not the name of its flag.

Believe me, if it were so easy, I wouldn't ask 🙂 I am currently analyzing the core Maya scripts to find .mel which builds the viewport menus 🙂
Thanks anyway 🙂

Reply
Reply
0 Likes
Message 6 of 7

hamsterHamster
Advisor
Advisor
Accepted solution

well.. for my perspView

popupMenu -q -ia MainPane|viewPanes|modelPanel4|modelPanel4|menu26
// Result: menuItem3550 menuItem3551 showAllItem showNoneItem menuItem3552 showControllersItem showNurbsCurvesItem showNurbsSurfacesItem showNurbsCVsItem showNurbsHullsItem showPolymeshesItem showSubdivSurfacesItem showPlanesItem showLightsItem showCamerasItem showImagePlaneItem showJointsItem showIkHandlesItem showDeformersItem showDynamicsItem showParticleInstancersItem showFluidsItem showHairSystemsItem showFolliclesItem showNClothsItem showNParticlesItem showNRigidsItem showDynamicConstraintsItem showLocatorsItem showDimensionsItem showPivotsItem showHandlesItem showTexturesItem showStrokesItem showMotionTrailsItem showPluginShapesItem showClipGhostsItem showGreasePencilsItem showPluginObjectsItem_gpuCacheDisplayFilter menuItem3553 showManipulatorsItem showGridItem showHUDItem showHoldOutsItem showSelectionItem menuItem3554 menuItem3555 // 

 Turn on echo all commands to find the panel you need. Command reference is your friend there.


,,,_°(O__O)°_,,,
Maya2019.1 @ Windows10 & GeForce GTX1080Ti

If the post was helpful, click the
 ACCEPT SOLUTION  button, so others might find it much more easily.

Reply
Reply
0 Likes
Message 7 of 7

bandrzejewski
Participant
Participant
Accepted solution

oh ... and it looks promising 🙂

import maya.cmds as cmds
list = cmds.popupMenu("MainPane|viewPanes|modelPanel1|menu14",q=1,ia=1) # name of window
for obj in list:
    if 'show' in obj:
        if 'All' in obj or 'None' in obj:pass
        else:print obj[4].lower()+obj[5:-4]

 It works FINE !!!! 
GREAT!!!

Reply
Reply