Hello,
I was trying to rename materials with specific characters, but everytime i do that maya will change the letter to an underscore. For example i need to be able to use "materials/mycoolmaterial_01/surf_01", maya will rename it to "materials_mycoolmaterial_01_surf_01".
My way around it is by opening the obj with notepad and changing the names by hand. Which can be tedious and time consuming. So i was wondering if anyone has suggestions. I was considering making a batch command so that after it exports the obj it looks at the obj and renames the stuff properly. But im unsure how to even start that start that, as my scripting abilities only go so far..
Any tips or help is appreciated it!
Replies
Alternatively, I think we could write a regular expression that could replace only the first 2 underscores in a line. I'm not a regexp guru, so I'm not sure how to write a catch-all that could identify which underscore(s) are part of a filename if they are more than two folders deep.
From that, it led me to try out system commands within maya. And man, its open a door of opportunites for me, hehe. However i wanted to use the command "Move" but maya spits out the error "
The system cannot find the path specified"
when i try to do
system("move C:/batchTest/pew.obj C:/batchTest/POW.obj");
I used the same line with a .bat file and it worked fine. Anyone knows why that happens?
http://help.autodesk.com/cloudhelp/2015/CHS/Maya-Tech-Docs/Commands/sysFile.html
so you would use the -rename flag with sysFile - eg:
Anyway, thanks again to everyone! I havent properly finished getting ready the tools for people to use yet, but i thought id post my "exporter script" in case it helps others. Soon i will post the entire thing in my website as there is a seperate app to rename the materials with regex.