View Full Version : changing namespace via mel

08 August 2007, 10:46 PM
How do you change a namespace of a reference via mel. I looked at the docs but it gives me options of moving a namespace but not renaming it with the namespace command.

08 August 2007, 04:43 PM
file -e -namespace newNamespace "path for referenced file";


file -e -namespace myNewNameSpace "C:/nameSpaces/";

08 August 2007, 05:52 PM
thanks but thats not what i'm looking for. I'm trying to RENAME a namespace of a referenced file, not replace.
I spoke too soon, that works. but if i have more than one of the same reference it works only on the first one.
Lets say i have a reference called PLY, i need to ref it in 6 times, and each time, i want to rename PLY to PLY_PP, PLY_OO etc


08 August 2007, 06:04 PM
Care to better explain that one? The only support for replacing/renaming namespaces is by using the `file -e -namespace` (when you rename the namespace from the reference editor you can whatIsh the callback script which will take you to a comment showing which functions are supported using MEL statements to alter the kNameSpace API function). Currently the kNameSpace only supports namespace changes by using the `file -e -namespace` operation unless the reference contains a proxy.


foo:cube - foo is your primary namespace

file -e -namespace bar "C:/dir/";

Result becomes bar:cube

08 August 2007, 06:39 PM
First off ,thanx for the help. let me try and explain myself better.
I have a file called that i need to reference into a scene 6 times.

The first time i reference this file , the namespace is PLY

I need it to come in as PLY for the first time, then i run a bunch of scripts, and then i want to rename it to PLY_QB
Second time i reference it it comes in as PLY again, i do the same, run some scripts and i then want to rename it to PLY_FB
the problem is all these files are pointing to the single
so with your command, it looks only at the first PLY and changes that one to whatever namespace i tell it to change to.
Hope that made sense.

08 August 2007, 05:47 PM
Hey modi,

BoostAbuse forgot to tell you to use the -referenceNode flag to tell the file command which reference node to affect :D

your command should look like this:

file -e -namespace "PLY_QB" -referenceNode "plyRN" "C:/dir/";

That should do the trick. Enjoy,


08 August 2007, 02:29 PM
good catch mate! I swear sometimes I need a debug prompt before posting code in the heat of a post. With that said, that should allow you to do what you need modi. Thanks Russ!


10 October 2007, 02:33 PM
Is there a way to query the namespace of an existing reference?

10 October 2007, 03:34 PM
file -q -namespace "\Filepath\"

Where "\Filepath\" represents the location on disk the referenced file resides, i.e. "C:\prod\models\characters\"

10 October 2007, 09:23 PM
In the docs the flag is not marked as queriable

10 October 2007, 08:56 AM
works great, thank you

CGTalk Moderation
10 October 2007, 08:56 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.