About Me

Friday, September 10, 2010

Relative Namespaces in Maya2011

I just wanted to add a quick pointer to the namespace -rel flag in Maya 2011 and how it can make managing namespaces a whole lot easier. By default this is set to false, meaning that all namespaces are treated from the root space (":") When you look in the Reference editor what you see as the namespace is the actual ns that the file was imported into.

Lets say you had imported a file 3 times on itself, so ended up with nested namespaces:


Now if you look in the ref editor you'll see the namespace as ATEST. If you try and change it it'll say the namespace doesn't exist. This is because your by default in root (":") space. This is where the rel flag can really help, it makes the namespace handling RELATIVE to the current space your in.

So mel:
namespace -set "THIS:IS";
namespace -rel true;
file -e -ns "FIXED" "C:/Test_Rig.ma";
namespace -rel false; 
namespace -set ":";

So here were setting ourself into the namespace THIS:IS, making all namespace actions relative to this, setting the new namespace to FIXED and then returning ourselves to root sapce and tuirning off the rel falg. The result is you've now changed the namespace that it said couldn't be changed, ending up with