PDA

View Full Version : Invalid Strings In MEL


pliang
06-10-2009, 02:28 PM
Hey guys,

I'm working in a pipeline in which I'm looking to "keep" unique characters in my 3d objects which Maya automatically purges or automatically assigns a number whenever I have characters such as # or have objects with the same instance name (i.e Cube, Cube1, Cube2)

I know Max doesn't have a problem with having unique characters/duplicate instance name for objects in the scene.

Does anyone know of a script which it may be able to allow me to name 3d objects to say
"#2GearSector" and be able to keep the unique characters?

Thanks

Chadrik
06-10-2009, 03:53 PM
what do you mean by unique character? do you mean two objects with the same name, or are you referring to non-alpha-numeric characters? two objects can have the same name in maya as long as they are not in the same group or both at the root:

>>> p = cmds.sphere(name='this')[0]
>>> g = cmds.group(p)
>>> p1 = cmds.sphere(name='this')[0]

you now have two objects named 'this':

|group1|this
|this

maybe this is because i don't know max, but i don't quite follow what you mean by renaming to "#2GearSector" . is the # a wild card for renaming or is that a character you want in the name?


-chad

pliang
06-10-2009, 04:40 PM
Hi Chad,

Yes, I'm trying to put non-alpha-numeric characters in front of the name as a part of the name and Maya doesn't seem to tolerate it as it removes it when I try to rename an object. (#Cube - _Cube)

I'll give it a try with the instance objects.

djtomservo
06-10-2009, 05:05 PM
Yeah if you're talking about MAX style naming where you can have all manner of crazy characters in a name, it's a no fly in Maya. That's a practice I would try to avoid anyway, we had a ton of problems going between Max and Maya back when we used to use weird max names to dictate in game attributes for objects.

Chadrik
06-10-2009, 05:13 PM
yup, these characters only

a-zA-Z0-9_ :

(the colon is a special case for referenced objects so you should never manually rename an object to have a colon)

and you cannot start a name with a number.

pliang
06-10-2009, 07:06 PM
Right...in that case, anyone heard of a script or a method in which I can tinker with in MEL?

Not a very experienced script person myself.

CGTalk Moderation
06-10-2009, 07:06 PM
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.