Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Custom Window with Symmetry Pivot CmD... Super Noob PYTHON

Custom Window with Symmetry Pivot CmD... Super Noob PYTHON

Anonymous
Not applicable
1,038 Views
5 Replies
Message 1 of 6

Custom Window with Symmetry Pivot CmD... Super Noob PYTHON

Anonymous
Not applicable

The file is in .txt format. I just copy it into the script editor.

 

I am creating a Custom Window using Python.

This is my very first Python Script. I am very new to scripting. I wanted to make an additional window because I would like to be able to choose from the tools and functions I use the most. I would like all of the functions in the same window for quick access. I am not adding or creating anything new.

I may need a lot of help in creating the rest of the Custom Window.

 

 

1. I would like to be able to take the symmetry drop down menu functions (symmetry "tool collection") found in the Select Tool Symmetry Settings and place it on my custom Window where the non-functional button is located. Initially I was just going to create an On / Off button, it would be far more superior to have the the drop down function replacing the button.

 

4. I would like to be able to have a reset pivot point button. I would also like to have a working checkbox for the Pin Pivot and Edit Pivot functions.
In this current state of the Custom Window, the Reset Pivot is not properly working. The check boxes for the Pin Pivot function and the Edit Pivot function exist, yet, I did not know how to link the commands to the checkboxes.

 

Thank you.

Accepted solutions (1)
1,039 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Accepted solution

Hi Cartwrir

 

Sorry I didn't have much time but I managed to quickly hack together an example of putting that menu on your UI. See the attached script.

 

I basically just called the maya standard reflectionProperties setup command which you can find in this file:

 

C:\Program Files\Autodesk\Maya201#\scripts\others\reflectionProperties.mel

 

Hope it helps

 

Mike

Message 3 of 6

Anonymous
Not applicable

Thank you so much. This is great. It is functional. Pushing the entire button and getting the pop-up window is actually BETTER in my opinion. There is more space to select the function.

I will cancel my question on how to use check boxes.

0 Likes
Message 4 of 6

Anonymous
Not applicable

How were you able to figure out which mel script / command to use? Is there a trick or easy way to determine how to turn a Tool Settings window into different buttons and / or pop-up commands? (What is the proper name to use when it comes to adding mel script(s) into python?)

 

I know I would definitely have to study this more to become successful.

 

I was attempting to copy the format on what you did when you called the mel script. 

 

I was testing out a few other functions that I wanted to turn into pop-up windows via buttons.

 

Here are a few example of the attempts that I have made.

 

Example 1. I wanted to take the 1st section of the sculpt brush settings from the Tool Settings and convert it into a pop-up window.

When opening up the .mel file, I can see what the functions are for the particular section. At the moment I am guessing on how to recreate / emulate the style of adding the mel. (I was able to go into the "reflectionProperties.mel" and find the "reflectionBuildMenu" (string $menu) )
I was trying out different methods to what you have done in order to gain a better understanding of using mel commands inside of Python.

0 Likes
Message 5 of 6

Anonymous
Not applicable

Hi again Cartwrir

 

Once again I have to apologise about not having much time to reply, but to quickly explain how I managed to achieve the above script...there are a few things in Maya which are very helpful to somebody learning how to script;

 

1) In the Script Editor window enabling the History > Echo All Commands option. Everything you do in Maya is actually controlled by Maya's own MEL and python scripts (Most still MEL due to legacy). Whn you switch on the Echo All Commands option and perform an operation you can scroll back through the script output and see what commands were called

 

2) There is a very useful command in Maya called whatIs. You can run the whatIs command followed by an command or function and it will tell you what that command or function is and where it can be found. For example if you type;

 

whatIs reflectionProperties;

 

you get the output

 

// Result: Mel procedure found in: C:/Program Files/Autodesk/Maya2016/scripts/others/reflectionProperties.mel //

 

I used this to find out where that code was saved and basically just hacked your script to use it.

 

3) Really the only thing I can suggest is to keep at it and practice. I've been working with Maya for over 10 years and so a lot of this stuff is second nature now, but the more you use it the more you learn

 

Sorry I have to leave it there now. If I get time later this week I will try to look at your newest script.

 

Cheers

 

Mike

0 Likes
Message 6 of 6

Anonymous
Not applicable

Thanks, once again. I appreciate the help. I knew about the echo command. That is how I was able to practice making buttons, although the redo command does not register. I noticed that after I made the Custom Window and tested it, the functions would not respond to the "G" key (redo). I will leave that one alone for now. I am glad I had the experience to write out simple script for creating a custom window. It shouldn't be that complicated to create custom window, yet...

 

 

0 Likes