Community
Maya Forum
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automatically add a window next to the outliner

3 REPLIES 3
Reply
Message 1 of 4
loic.lD4LQU
178 Views, 3 Replies

Automatically add a window next to the outliner

Hello everyone!

I've created a script that opens a dockable window. I'd like it if, when this script is executed, the window would automatically be placed next to the outliner, as you can see in the image.

OutlinerWindow.png

 

Is it possible to do this? It would have to be in python.

At the moment, I can get the window to automatically move to the far left of the screen when it opens, but it really needs to be in the position shown in the screenshot.

Thank you very much for any help you can give me!

3 REPLIES 3
Message 2 of 4
brian.kramer
in reply to: loic.lD4LQU

Hi,

 

Since you have already created your dockable panel you should be able to drag into the Outliner (right beside the Outliner tab). That'll insert it where you want. That location will get saved in your preferences and restore it next time you open Maya.

 

The specific MEL command to place it there is:

workspaceControl -edit -tabToControl Outliner 1 MyWorkspaceControl;

That of course assumes you have a workspaceControl created with the name MyWorkspaceControl.

 

I have created one in my userSetup.mel file with the following:

global proc createMyWorkspaceUI() 
{
menuBarLayout;
menu -label "Edit";
menuItem -label "Cut";
menuItem -label "Copy";
menuItem -label "Paste";
columnLayout;
button -label "Hello World!";
}

if (!`workspaceControl -exists MyWorkspaceControl`) {
workspaceControl
-label "My Workspace"
-retain true
-floating true
-uiScript "createMyWorkspaceUI()"
MyWorkspaceControl;
}

That will make sure it exists when you run Maya.

The first time you run Maya with it, open the Script Editor and enter:

workspaceControl -edit -restore MyWorkspaceControl;

 

You should get your UI in a floating window. You can now drag it anywhere in the main Maya window. Or using the command I mentioned above set it to be a tab beside the Outliner.

 

Hope this helps!

-Brian

 


Brian Kramer
Software Developer
Message 3 of 4
loic.lD4LQU
in reply to: brian.kramer

Hello!
Thank you very much for your reply @brian.kramer .
Indeed, I tried your method and it works. However, I'm not sure how to set it up for my project.

In fact, the script in question that needs to be displayed is a python file located on a server (because there are several of us using it and when someone makes a change to it or adds a new script, everyone needs to have the new version of the tool in maya). To do this, we currently have a button in the classic maya shelf that calls the script in question , which is located on the server.

Based on your principle, do you know how I can display my script window?

Message 4 of 4
brian.kramer
in reply to: loic.lD4LQU

Hi,

The way I have things set up is in userSetup.mel (which is automatically run at Maya startup) I have the following command:

source "/home/user/Documents/myWorkspaceUI.mel";

In myWorkspaceUI.mel I have the commands to create the UI as in my previous reply.

There is an equivalent userSetup.py script that gets automatically run at Maya startup. From there I think you can source your python script (with the full path to file on server) to create your workspace UI.


Brian Kramer
Software Developer

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators