I have to import assets whose names begin with numbers, but maya strips them out on import:
// Warning: The namespace name ‘191_LifeVest’ contains illegal characters. Truncating to ‘_LifeVest’. //
I’d like to read and store the correct name, with the number, for later exporting and saving.
any ideas?
First off, you learn to avoid numbers in names as much as possible when dealing with Maya. This is just one of many areas that will get your in trouble. (Is it mesh1Shape, or meshShape1?)
I would suggest prepending a known character or string to the namespace on import, then stripping it where needed. For example, explicitly specify the namespace as ns_191_LifeVest, then you know that you can strip off the “ns_” where needed.
Names can contain numbers, just not in the first character. If you need to maintain the number, you’ll have to prepend a character of sorts, such as “_”
For each import rename the imported asset since you know what you imported from, or open the scene in batch fetch the node names and rename after import?
Alternatively/additionally, add an attribute to the imported root nodes with the sources name, and a bool id for rapid node searches. This is assuming your avoiding using namespaces? Else use namespaces.
Remember you can pickle data into string attrs on nodes and sets etc, all sorts of fun can be had to track and monitor and find data in scenes.