Grabbing the namespace as displayed in namespace editor

45 views
Skip to first unread message

yann19

unread,
Mar 12, 2015, 6:21:45 AM3/12/15
to python_in...@googlegroups.com
I am trying to get this particular namespace - ANIMAL1APE01 under "root" (see attached screenshot) but I am unable to.
I tried this maya command - cmds.namespaceInfo but I am getting a whole big chunk of list as the result.

The reason I had wanted to grab it from NamespaceEditor is so that it is grabbing the correct "information" as compared to selecting the item in the scene, in the event where you can easily change the naming without knowing.

Are there perhaps better way in doing so, the pythonic way if possible?

yann19

unread,
Mar 12, 2015, 6:32:39 AM3/12/15
to python_in...@googlegroups.com

Here's the image

Paul Molodowitch

unread,
Mar 12, 2015, 1:55:11 PM3/12/15
to python_inside_maya
What do you mean by "get" the namespace?

Do you mean you want to query what is currently selected in that namespace editor window?

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/b367c63e-dfb1-4728-921b-1e041173051b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Joe Weidenbach

unread,
Mar 12, 2015, 4:45:06 PM3/12/15
to python_in...@googlegroups.com
If what you're looking for is to get the objects listed in the namespace, try the following:

cmds.namespaceInfo(":ANIMAL1APE01", listNamespace=True)

This will return a list of objects in the ANIMAL1APE01 namespace.

For a listing of the namespaces that maya knows about, try this:

cmds.namespaceInfo(":", listOnlyNamespaces=True)

Other than that, we really need to know exactly what you're trying to do--namespaces have lots of tricky options, and due to Maya's less-than-pythonic string-based implementation, very few of them are pretty.  The few things I can point out, without knowing exactly what you're trying to do, is that you have to specify namespaces explicitly--that is, you must preface the name of the namespace with ":" to indicate that it is relative to the root namespace.  You should also ensure that you're currently in the root namespace--Maya keeps track of the "current" namespace, and if you don't use absolute addressing, it will search relative to the current.  So, if you didn't use the colon (":") at the beginning of the namespace, and ANIMAL1APE01 was the current namespace, then it would be looking for a child namespace of ANIMAL1APE01, which would actually be a child of ANIMAL1APE01.  The absolute addressing would solve this issue.

Hope that helps, if you can clarify your needs, I can probably help get something more useful together.

Joe

Reply all
Reply to author
Forward
0 new messages