[Maya-Python] Remove namespace from object

2014-09-03 Thread Stefan Andersson
Hi All, I'm having a brain lock down... I'm trying to removed namespaces (both nested and not nested) from shaders. But can't for the world in me figure out how to check the namespace of the selected object, or query a node to return the namespaces I need to get a string back of all the names

Re: [Maya-Python] Remove namespace from object

2014-09-03 Thread Marcus Ottosson
Hi Stefan, The namespace is in the name, so renaming a node to a name without namespace will effectively remove its namespace. cmds.rename('namespace:my_node', 'my_node') So if you’ve got many shaders you’d like to remove namespaces from, simply rename them all. for shader in cmds.ls(type='shad

Re: [Maya-Python] Remove namespace from object

2014-09-03 Thread Stefan Andersson
Hello Marcus! Well, that only renames the node. So child nodes will still have the namespace intact. So right now I have this which moves the namespace eventually into the root oSel = cmds.ls(sl=True)[0].split(":") if len(oSel) >1: for i in range(len(oSel)-1): cmds.namespace(mv=(oSel

Re: [Maya-Python] Remove namespace from object

2014-09-04 Thread Marcus Ottosson
Hello Marcus! Well, that only renames the node. So child nodes will still have the namespace intact. Yes it does. A namespace in Maya is actually nothing more than some additional character in its name. The cmds.namespace() is really just a fancy cmds.rename if all you’re using it for is renaming

Re: [Maya-Python] Remove namespace from object

2014-09-04 Thread Marcus Ottosson
As a shot in the dark, if the origin of your namespaces is from importing a scene, you have the option of merging names as opposed to storing it all within a namespace. Namespaces are originally for dealing with name clashes. >From the docs: Namespaces are primarily used to resolve name-clash iss

Re: [Maya-Python] Remove namespace from object

2014-09-04 Thread Stefan Andersson
Hey Marcus! Thanks for the code, all code helps so I appreciate you sharing that. I'm trying to trap what other artists are doing... sometimes they have stolen shaders from other scenes or just duplicated networks, there are 1000's of ways they are doing it. But I would like to do a bit of cleanup

Re: [Maya-Python] Remove namespace from object

2014-09-04 Thread Marcus Ottosson
any thoughts on shader publishing? Actually, yes. Me and a few Pipeline TDs here and on GitHub have been working on exactly this for the past month; i.e. ensuring quality before sharing work, including shaders. You are welcome to join; odds are we’d be able to create something better together tha

Re: [Maya-Python] Remove namespace from object

2014-09-04 Thread Gyurma
Hi Stefan, I've gone through this pain (admittedly not a namespace fan) the problems encountered: non unique nodes under groups (creating path "|"), renaming does not remove the namespace info from the scene file but keeps the empty namespaces (if you go to the namespace editor you will still find

Re: [Maya-Python] Remove namespace from object

2014-09-04 Thread David Martinez
I agree with Marcus here, I think that the more people we can get involved the better. It is important that we see the kind of problems that we are facing in production in order to try and find something that will be useful for all of us. :-) -- David Martinez - Technical Animator Email: david

Re: [Maya-Python] Remove namespace from object

2014-09-04 Thread Stefan Andersson
Thanks guys for the encouraging words about your pain... and that we all share the same pain we should have secret meetings under bridges. :) Namespaces and all of that is horrible, but also useful. It does prevent users from having non-unique names, and when used properly it's actually a nice

Re: [Maya-Python] Remove namespace from object

2014-09-04 Thread Mark Jackson
one of the problems with namespaces is what happens when you're running them in conjunction to referencing, it all becomes a hell of a lot more complex. I keep meaning to add a load of namespace and reference utils in Red9 just haven't had the time. Marcus, that sounds an interesting project, I'll

Re: [Maya-Python] Remove namespace from object

2014-09-04 Thread Marcus Ottosson
Marcus, that sounds an interesting project, I’ll take a look at that Hey Mark, thanks for the kind words. It’d be my pleasure to have you with us. Let me know if you want any help getting set up. ​ On 4 September 2014 16:52, Mark Jackson wrote: > one of the problems with namespaces is what hap