Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BUG: ls command flag "excludeType (ext)" is broken

2 REPLIES 2
Reply
Message 1 of 3
Kahylan
179 Views, 2 Replies

BUG: ls command flag "excludeType (ext)" is broken

Hi!

 

I'm working on a script where I need a list of everything in the selection except joints. While doing that, I saw that the ls command has the flag "excludeType (ext)" which sounded exacly what I would have needed. But I realised while using this flag, that it was giving me the exact same result then when I used the "type (typ)" flag or the "exactType(et)" flag.

 

Now I know that I can just get what I need by creating two lists and removing one from the other.

 

MEL:

string $notJoints[] = stringArrayRemove(`ls -sl -typ "joint"`, `ls -sl`);

Python:

notJoints = [o for o in mc.ls(sl= True) if o not in mc.ls(sl= True, et= 'joint')]

 

But still, this would be more elegant:

notJoints = mc.ls(sl=True, ext ='joint')

 

Also, if this issue doesn't get fixed, it would atleast be nice if this flag was mentioned as obsolete in the docs, so people like me don't spend 20 minutes trying to figure why the command is not giving the expected result.

 

Have a nice day 🙂

 

PS.: If I did something wrong and the flag is working, just not as I expected. I would be delighted to hear how it is done correctly.

2 REPLIES 2
Message 2 of 3
rflannery
in reply to: Kahylan

I tried this out on Maya 2022, and it is not working, just like you said.  Here's the interesting thing.  I tried it out with different combinations of flags, and the results are not consistent at all.  Here are some examples.

  • cmds.ls(sl=True, excludeType='joint') - Result contains only selected joints
  • cmds.ls(dag=True, excludeType='joint') - Result contains only joints
  • cmds.ls(geometry=True, excludeType='joint') - Result contains all nodes in the scene, except for joints and geometry nodes like "mesh" and "nurbsSurface".  When I say all nodes, I mean all DG nodes, including transforms, shaders, hardwareRenderGlobals, etc.
  • cmds.ls(modified=True, excludeType='joint') - This actually works!  The results are exactly the same as the results from "cmds.ls(modified=True)" except with the joints removed.

 

Message 3 of 3
Kahylan
in reply to: rflannery

That is interesting. So the flag does something in combination with other flags. But as you mentioned, there doesn't seem to be much consistency to it...

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report