PDA

View Full Version : Namespaces: what are they?


superduper10000
03-15-2008, 12:03 AM
I am trying to understand how namespaces are handled in Maya.

I understand the commands... (listing, moving, setting, etc) -- but what I don't understand is where maya is tracking this info. Are there namespace nodes in my scene independent from any objects? When you do something like



namespaceInfo -lon


... what exactly are those items in the sense of "type"? I know you can delete them --- but what am I deleting? Is it a node somewhere in the scene? If I delete a namespace, what happens to objects that are "in" that namespace? Is it safe to delete namespaces that have objects in them?


And sometimes I will find that there are other nodes (transforms, it seems) in namespaces, but these nodes are not visible in my outliner. How do they get there? How can I avoid them?

Mostly this happens when artists merge in (by references or imports) other files and then try to clean those merged files out of the scene. Is there a clean way of segregating imports / references so namespaces are not created and populated "invisibly" as I describe? Maybe other people do not see this problem like I do -- im mostly just curious on problems / issues or observations users have on managing namespaces in 8.5.

superduper10000
03-19-2008, 11:15 PM
so nobody can shed light on what goes on behind the scenes with namespaces?

strarup
03-19-2008, 11:57 PM
hi,

this might be a stupid question... but have you looked into the helpfiles of Maya?


haven't played that much with namespaces lately... so not so sure that I can cast any further light
on the subject beside what it says in the helpfiles... :)

however as I recall you might be able to get rid of the namespace if it's emthy... if it's not
you can try unreference the object that's referenced... can't remember if there's some other ways to do it...
properly are.. just can't come up with them at the moment... about 3 years ago I played with namespaces and referencing...

however if you are in a production unreferencing stuff is ussually not a good Idea...
can f*** up the pipeline pretty good... and the R&D department will likely wanna toast your butt... :D
(atleast if they haven't build in some stuff to handle it)

kind regards

Strarup

mhovland
03-20-2008, 12:24 PM
As to where and what namespaces are, nodes vs. internal hidden super magic, I don't really know. I do know that working with namespaces can be a pain in the ass. The main way I have seen namespaces getting created, is when the settings on the import options are set to use namespaces, instead of renaming clashing nodes.

In my playing with namespaces, I have found....You can't remove an existing namespace, unless it is empty. To empty a namespace,you have to move all the objects in the namespace to the default namespace. The pain in the ass comes from the fact that you have to switch namespaces to check the membership of the namespace. So you esentially have to query all the existing namespaces,then switch to them to find if they have any objects in them, if they do,move all the objects to the default namespace, then delete the empty namespaces. This was a huge pain, and I don't even remember if I ever got it working correctly. :banghead:

Enjoy your trip down namespace highway :) I'll try to help if I can.

Mark-J
03-20-2008, 01:32 PM
Namespaces are actually extremely useful, if handled carefully. They mainly come into play when referencing during which they can be the making, or breaking of a good pipeline. I always think of them as partitions in which objects or references live.

The reason for them is to maintain clean connections between multiple nodes. Specifically if you have multiple versions of the same rig/file referenced into the scene. The node names remain the same, so L_Wrist is still L_Wrist in both spaces, but the namespace appened stops the clashes. The key is that the nodes remain the same names internally, so when you swicth rigs, everything remains hooked up correctly.

mhovland
03-20-2008, 10:01 PM
I agree namespaces serve a purpose, especially when working with a referencing pipeline.

My problems come when artists don't understand what is going to happen when they import objects into namespaces. Parts of our pipeline rely on object names being consistent, and not containing special characters ( : ). When they blindly import objects into namespaces it will reek havoc with the rest of the pipeline, and then the scenes come to me to look at. And that makes me sad.

refract
03-24-2008, 06:13 AM
cometRename works great for removing the namespace info on all objects quite nice btw...

Mark-J
03-25-2008, 09:31 AM
I know the feeling mhovland, when we started switching the whole pipeline to use referencing the amount of tools that needed updating to cope with namespaces!. But it's been well worth worth. Also if you do have name specific tools/procs you can always just tokenize the namespaces off, or use the -r 1 flag of the ls command to step into the namespaces instead.

isoparmB
03-27-2008, 11:12 AM
http://www.highend3d.com/maya/downloads/mel_scripts/utility_external/misc/nameSpaceRemover-3730.html

Just in case anyone wants to remove namespaces on non-referenced objects.

Namespaces prevent you from losing connections when you have two instances of the same source file referenced into a scene, like in the case of keyframes. Try animating two references of the same kind of character in one scene without namespaces, and one will lose it's animation.

In general it's always good to use namespace in conjunction with referencing, but not for importation.

With regards to the scripting, you can get around the different names thing using a trick.

Let's say your script operates on a curve object named "Main_Ctrl". Now this control will have a different name in another scene because of namespaces. If you want your script to detect all instances of objects named like that, you would do:

string $list[] = `ls "*Main_Ctrl" "*:*Main_Ctrl" "*:*:*Main_Ctrl" "*:*:*:*Main_Ctrl" "*:*:*:*:*Main_Ctrl"`;

That would get all objects with the name in an array for your script to operate on, irregardless of what the prefix or namespace would be. Take note though that you have to do the *:* thing for the most number of times you think a namespace can appear in a single name.

Mark-J
03-31-2008, 08:27 AM
Easier way to return them is use the:

ls -r 1 "Main_Ctrl"

that recursively goes through all namespaces to find match

CGTalk Moderation
03-31-2008, 08:28 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.