So, a few months back I was looking into clean ways of scripting a custom shelf in Maya, that can be easily shared, and I was surprised that there were not many resources on how to go about it. Therefore, I thought I would share the way that I am maintaining my shelf. Scripting your own custom shelf in Maya is much easier than you would think, or at least than I thought. For some odd reason, I always assumed that it would involve a lot of messing about with MEL, which I would really rather not.
If that is what you thought as well, you will be pleasantly surprised. Since, we want to keep the code as modular and versatile as possible, I wrote the main functionality in a base class which needs to be extended for each shelf you want to build.
The code for the base class with a little example is on github. Now we will go through it to make see how it works, so it can be extended and modified to include more functionalities. The name argument is going to be the name of the shelf. It is important to note that if a shelf with this name already exists it will be replaced with this one. The iconPath argument can be used to define a directory from which to get images to be used as icons of the shelf buttons and commands in the popup menus.
Additionally there are the labelBackground and labelColour variables which can be seen in the following image. The reason I have hardcoded them in the base class is because I think for the sake of consistency all our shelves should have the same style, but if you want to change them, obviously feel free to do it.
And lastly, there is that mc. Otherwise, we might end up with buttons breaking the other layouts. Essentially, we are checking if our shelf already exists by using the mc. If it does we go through all children of the shelf which we get from mc.
That makes sure we start our build method with a fresh clean shelf. If the shelf does not exist though, we simply create it, passing "ShelfLayout" as parent, because that is the parent layout of all the shelves in maya. So, knowing that CurvesSurfaces is a name of a shelf, we can deduce that the ShelfLayout is the parent of all shelves. Very simply, this is the method that creates the main buttons in the shelf.
Essentially, we just need to pass it a label which is the name of our button, an optional icon and an optional command and doubleCommand which refer to single click and double click. The command is optional, because we might want buttons that just have popup menus. We will look at those in a sec. The reason I have that command is that if you pass None to the mc.
It is important to note that when we pass a command we are not using the brackets after the namebecause that would call the command instead of passing it. This method is very similar to the add button one, but instead of adding a button to the shelf, this one adds a menuItem to an existing popupMenu passed as the parent argument. So, a quick example of how that works is. This snippet if added inside the build method will attach a popupMenu with one menuItem to the popup button.
Now, I realize that sub menus inside a popup on a shelf button is getting a bit too deep, as the whole point of a shelf is to streamline everything, but I thought I would add it, as even I have used it on a couple of my buttons. What this method does is, it creates a menuItem which is a menu in itself, attached to an existing popupMenu which is passed as the parent.
You know how some of the shelves have separating lines between the buttons. You can achieve that with the mc. I usually set the style flag to "none" as I rather having blank space than having lines, but have a look at the docs page for the separator command for more info. As the docstring says, this is an empty method that needs to be defined in each shelf we build.You have been detected as being from. Where applicable, you can see country-specific product information, offers, and pricing.
From dragons to sweeping landscapes and explosive battle sequences, Maya is a top choice for creating believable characters and the worlds around them. A new visual programming environment using dynamic solvers makes it quick and easy to create blockbuster-worthy effects procedurally.
From snow to dust storms, create great-looking effects right out-of-the-box with prebuilt graphs. Learn more. Generate realistic clumping effects in hair and fur for more natural-looking hair.
Simulate high-level details just where you need them with the new adaptive solver for Bifrost liquids. Faster animation playback in Viewport 2. Make high-level animation edits with a nondestructive, clip-based, nonlinear editor. Get quicker playback and manipulate faster with the integrated performance profiler.
The new Butterworth and Key Reducer filters help you refine animation curves, particularly when using motion capture data.
Arnold improvements make the Viewport 2. Use Arnold RenderView to view scene changes in real time, including lighting, materials, and camera. Efficient library enables faster, more consistent Boolean operations on polygon geometry. UV editor workflow, look, and feel. The MASH toolset gives you new nodes curve, signal, world, placer, and moreas well as updates to existing nodes.
Create branding, flying logos, title sequences, and other projects that require text. Create, customize, and integrate Maya into complex production pipelines more easily. Create large, complex worlds more easily, and manage production assets as discrete elements. Download free trial. Learn more about the collection. Talk to a sales representative See subscription benefits Includes support and more. Are you a student or educator? Get Maya now.
Compare to Maya LT. See system requirements. Turn off all active applications, including virus checking software. Get more tips for successful downloading. Students, teachers, and academic institutions worldwide are eligible for free access to Autodesk software.Released: Jan 6, View statistics for this project via Libraries.
Datetimes are very frustrating to work with in Python, especially when dealing with different locales on different systems. This library exists to make the simple things much easier, while admitting that time is an illusion timezones doubly so. Maya is mostly built around the headaches and use-cases around parsing datetime data from websites. Your support helps tremendously with sustainability of motivation, as Open Source is no longer part of my day job.
In addition to timestamps, Maya also includes a wonderfully powerful MayaInterval class, which represents a range of time e. With this class, you can perform a multitude of advanced calendar calculations with finesse and ease.
From here, there are a number of methods available to you, which you can use to compare this event to another event. All these projects complement each other, and are friends. Maya does do exactly what I need. I think these projects complement each-other, personally. Maya is great for parsing websites, and dealing with calendar events!
The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.
I've been following This Tutorial on using a. UI file from QT designer in a Maya plugin. It states that, in order to query the value of a QtextEdit field after the UI has been loaded into Maya, I need to do the following:. So now when we load our QT Ui inside of maya we can query the text of our line edit every time we want to by using the following line of code:.
No issues there, when I try cmds. I've tried two different approaches:. The tutorial has 'pm. From your code it is not visible at which time you try to execute the textField cmd. This code below works fine for me. The test. Querying the text field only works if the window is visible. If you close the window and try to query the text field, you get the "object not found" error.
Learn more. Asked 2 years, 3 months ago. Active 2 years, 3 months ago. Viewed times. It states that, in order to query the value of a QtextEdit field after the UI has been loaded into Maya, I need to do the following: So now when we load our QT Ui inside of maya we can query the text of our line edit every time we want to by using the following line of code: pm.
I'm loading the UI as follows: Load our window and put it into a variable. I've tried two different approaches: approach A: Connect Functions to the buttons.
If anyone could point me in the right direction here, it would be greatly appreciated. Design Runner Design Runner 37 7 7 bronze badges. Active Oldest Votes. Showing the window first fixed my issue. Thank you! Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The Overflow Blog. Featured on Meta. Community and Moderator guidelines for escalating issues via new response…. Feedback on Q2 Community Roadmap. Technical site integration observational experiment live on Stack Overflow.
Dark Mode Beta - help us root out low-contrast and un-converted bits.Python scripting can be used for many tasks in Maya, from running simple commands to developing plug-ins, and several different Maya-related libraries are available targeting different tasks.
The following is a brief overview of the Python libraries shipped with Maya:. The implementation of Python scripting in Maya provides the same access to native Maya commands as is provided through MEL.
That is, all of the built-in Maya commands, such as spherelsand so on, are accessible through Python. PySide version 2. It is built with Python 2. Python comes with a wide variety of standard modules that provide similar functionality. Refer to Python documentation for information on what is available and how to use these functions in your Python scripts. For instructions on how to build a copy of the PyQt modules, see the PyQt section under autodesk.
There is a Python command reference similar to the MEL command reference. For details on all Python commands, refer to the Python command reference documentation in Maya Help. Maya installs Python with your Maya installation.
Maya uses Python version 2. The standalone Python shell for Maya is named mayapy. For information about getting started with Python, including reference material and resources, see:. Maya runs any Python commands in the userSetup. You can use this file to set up your working environment or execute commonly used Python commands such as importing the maya.
The userSetup. You can use maya. For more information, see maya. Make sure you save the file with the right extension. To add items to your path in Python, do one of the following:. Here is an example of appending sys.
If you have a MEL script in your path, you do not need to source it before accessing any single global procedure it contains with the same name. However, Python requires you to import a script explicitly before accessing any classes or functions it contains; for example:. The following is a brief overview of the Python libraries shipped with Maya: maya.
It is shipped with Maya, but not supported by Autodesk. It organizes commands differently, and takes an object-oriented approach compared to the procedural approach of maya. It is suitable for developing plug-ins, and other tasks that require functionality not exposed by MEL. It is also a newer API, and is still under development, so not all classes exposed in 1.
Open the maya help inside of Maya the F1 key in windows or go to the online documentation that link goes to the maya docs, your copy of Maya should have the right URL for your version. Learn more. Maya Python modules complete documentation? Ask Question.Python For Maya Artists - Volume 1
Asked 5 years ago. Active 3 years, 10 months ago. Viewed 5k times. Augier Augier 1 1 silver badge 12 12 bronze badges. For the record, anything I've ever used from maya. Maybe some advanced functions that are rarely used may not be compatible between the two, but if you're just doing general stuff, pymel should be fine. OpenMaya is the API - download. Thank you for the quick answer. Active Oldest Votes. Thank you. I admit I didn't even looked at that Technical documentation section.
Do they provide the same functions or are they complementary? Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.
Email Required, but never shown. The Overflow Blog. Featured on Meta. Community and Moderator guidelines for escalating issues via new response…. Feedback on Q2 Community Roadmap.
Technical site integration observational experiment live on Stack Overflow.
Dark Mode Beta - help us root out low-contrast and un-converted bits. Linked 0. Related Hot Network Questions.You have been detected as being from. Where applicable, you can see country-specific product information, offers, and pricing. Work faster and more efficiently by using the Autodesk Maya Keyboard Shortcuts below. Below, you'll find the Maya one-key shortcuts. Click on the image for a larger view. The following commands change based on specific editor pane you are actively using. Download a free day trial and try it out.
Purchase options include flexible subscription terms to fit your needs. Autodesk is a leader in 3D design, engineering and entertainment software. All rights reserved. Worldwide Sites You have been detected as being from. Autodesk Maya Keyboard Shortcuts. Jump to a section. Subscribe now. Try it now. Free for 30 days. One-key shortcuts. Shortcut commands by category.
Below, you'll find an abbreviated list of commands that can be used in Maya. Pane specific commands. Get it now. Download free trial. Animation Operations.
Display Settings. Displaying Objects Show, Hide. Edit Operations. Hotbox Display. Modeling Operations. Moving Selected Objects. Painting Operations.