![maya python setattr with wildcard maya python setattr with wildcard](https://i.imgur.com/Ox8Ck6N.gif)
They can be inserted into a userSetup.py file. Setting these units are fairly easy with currentUnit(). Some workstations may have differing set-ups, so its important to make sure in any team production that one machine doesn't throw things out by having a user animating at different frame rates or operating at the wrong scales. Setting up Maya units, frame rates and resolutions LogPath = cmds.workspace( q=True, rd=True ) + 'data' You could of course set up your own custom folder as well if preferred. I specified the path using something like this. I found that the default data folder that is created is ideal for this. I used this when writing log files for a project. WorkspaceFolder = cmds.workspace( q=True, rd=True ) If you want to retrieve the root location of the current project set up in Maya, you can grab it relatively easy. Raise Exception ("Project aRandomWorkspace doesn't exist!") # Change Maya to use a workspace(if exists)Ĭmds.workspace('aRandomWorkspace',openWorkspace=True) ListWS = cmds.workspace(listWorkspaces = True)
![maya python setattr with wildcard maya python setattr with wildcard](http://www.john-player.com/wp-content/uploads/2019/02/shelf-2-1024x835.png)
# Get a list of the workspaces (projects) Print cmds.internalVar(userWorkspaceDir=True) # Get the root folder where maya projects reside The root folder for workspaces is usually the documents/maya/projects folder, but obviously some IT departments like to configure things their own way. Here's a few snippets for you to play with. To access and set these up, you can utilise Maya's workspace commands. The project folders for Maya are termed workspaces. You can read more about Maya python and userSetup (and more) options here. If you find you're sick of adding the import maya.cmds line at the start of all your scripts, you can add this to your userSetup.py to do it when Maya starts. This makes it relatively easy to force the project folders and Maya configuration changes to be applied, as well as automatically copy files, etc that may be required (such as updates to scripts or projects).Īnother use is to import any modules you plan on using. You can have Maya execute a python script as it starts by simply naming it userSetup.py (make sure the spelling is correct) and placing it into the workstations scripts folder. Print cmds.internalVar(userBitmapsDir=True) Print cmds.internalVar(userScriptDir=True) # Get the root documents-maya folder location The internalVarcommand lets us query this info. If you find you ever need to locate project or maya folders on a machine (noting that it may be different if the machine has multiple users, or the IT department has customised the configuration of the workstations). I mention this primarily because so many people will through the scripts into the documents/maya/scripts folder and then wonder why Maya won't launch them when they try to access them using the script editor.
![maya python setattr with wildcard maya python setattr with wildcard](https://miro.medium.com/max/2000/1*5KVvBU0jHTUIYFjmWzmMmg.png)
In particular, the two sub-folders icons and shelves allow us to add custom tools to Maya's shelf. The other folders we can also consider are found under the documents/maya/2014-圆4/prefs. (For other versions of Maya, the '2014-圆4' may of course be completely different) All scripts and files should be copied to the documents/maya/2014-圆4/scripts folder.
![maya python setattr with wildcard maya python setattr with wildcard](https://robonobodojo.files.wordpress.com/2020/08/aligning-pivots-to-face-normals.png)
Its important to understand where all of these tools sit where we can call them up from Maya. However if you have additional handy tid-bits you'd love to share, please do post them to the comments below for all to benefit from.Īs I go through the year, I'll post up various other bits of advice and code. Obviously for the more experienced TD's, these are likely to be nothing new. I picked up a lot of things for scripting Maya that I felt were just worth sharing here. I've seen all of the common issues that come up - mostly from just not following the protocols they were told to use when working within a team project, and just bad file management in general.Īs part of a group project last year for my class, I decided to take a lot of these problems out of their hands and automate them with tools specifically designed to manage parts of the pipeline and work flow. Over the last 2-3 years, I've been involved in Maya based team projects with students.