MEL - Maya UI Building


#341

hi guys!

who can tell me how to use the <-defineTemplayte -useTemplate -docTag >??
thanks a lot!


#342

Hello Guys!
I have some problem with build UI. I use MEL for it.
When I run comands from script editor, All is ok, brilliance.
But, if i use userSutup.mel , it does not work.

{
	setParent -menu mainPolygonsEditUVsMenu; 
	menuItem -l "_test_menu_" ;
}

#343

How would one build this in MEL?

I’ve almost finished an asset manager but want a better system to browse through folders like the one above?


#344

kidultor : Hi, i use to do this in python nowadays but take a look at this topic :

http://forums.cgsociety.org/showthread.php?t=732647

It’s a problem about your UI refreshing too fast and overriding your custom menu. We had one similar here too.

Hamburger : I’m really not sure you can do this in MEL. This is pure Qt widget.
To do simalr things i think you will have no choice than use textScrollList, good luck!!!


#345

How can I make a pane size “stick” in place?
The paneLayout -command only has a flag for defining a % value. I want one pane to be exactly X pixels in width and I have no clue how to do that.
Even if I set the pane widths to 1 and 99 (pane 1 and 2) pane 1 gets much larger than the child elements it contains!!

EDIT:
NVM - found the staticWidthPane -flag


#346

is their any way we can put tabs upside down just like in this example picture…
click image for different example


#347

QTTabWidget.setPosition(‘South’) would make the tabs appear on the bottom. North, West and East are also valid options.

/Christian


#348

Hi all,
I trying to add new button to the Status line:

global proc toggleMyToolsButton() {
     
     	global string $gStatusLine;
     	global string $gStatusLineForm;
     
     	$statusLine = `formLayout -parent $gStatusLineForm`;
     	$gStatusLine = `flowLayout`;
     
     	setParent $statusLine;
     	$buttonForm = `formLayout`;
     
     	// Just a button 
     	global string $gMyToolsButton;
     
     	$gMyToolsButton = `iconTextCheckBox -image1 "bullet_selectSolverNode.png"	// test
     		-annotation ("My tools")
     		-changeCommand ("ToggleChannelBox") channelBoxButton`;	// test
     
     		///
     		// Set up the attachments.
     		//
     		formLayout -edit
     			-attachForm	$gMyToolsButton  top	1
     			//-attachControl $gMyToolsButton  left   0 $gLayerEditorButton	// Why this don't working?
     			-attachNone	$gMyToolsButton  bottom
     			-attachNone	$gMyToolsButton  right
     			$buttonForm;
     
     }
     
     toggleMyToolsButton();
But I don't alighn new button to other button like a "Show/hide Attribute editor/Layer editor/Channel box, etc.":


#349

Hi. I’m back to studying Python.
Now reading up on classes and how to utilize it with UI:s.

I’m having some problems figuring out how to get exactly what I want though and so I turn to you.
I’m using the book “Maya Python for Games and Film”. They are distributing a base window class found here:
http://maya-python.com/files/optwin.py

I then created another class which inherits from the base class, here:

import optwin
reload(optwin)

from optwin import AR_OptionsWindow


class newWin(AR_OptionsWindow):
    def __init__(self):
        AR_OptionsWindow.__init__(self)
        self.title = 'Dag\'s window'
        self.window = 'dag\'s window'
        self.actionName = 'Huey'
     

    def displayOptions(self):
        mc.setParent(self.optionsForm)
        self.btnA = mc.button(
                        label = "button A")


        mc.formLayout(self.optionsForm, edit=True,
                      attachForm=(
                      [self.btnA, 'left', 0],
                      [self.btnA, 'right', 0],
                      [self.btnA, 'top', 0],
                      [self.btnA, 'bottom', 0],

                      ),
                      
                      attachPosition=(
                      [self.btnA, 'right', 0, 50],
                      )               
        )

        
newWin.showUI()

It’s really simple. However I really can’t figure out how to align the button in the formlayout which is parented to the tab layout so it will scale with the window =/
Tried parenting the button to the mainForm instead and sure, that works, but I want it to be attached under the tab layout.

Thank you for reading!


#350

Ok, I figured this one out. However I still don’t get it… :banghead:

By editing the base class, the elements resize according to the formLayout settings.
on line 42 I changed:
scrollable=True to scrollable=False

However I really wouldn’t want to go in and edit the class, but it seems nothing else work. :rolleyes:

I tried to edit this in my inherited class:

    def displayOptions(self):

        mc.tabLayout(
                    self.optionsBorder,
                    e=True,
                    scrollable=False,
                    tabsVisible=True,
                    tli = (1, 'tab 1')
            	    )

This works for the tabVisible and tab label, but does nothing for the scrollable function. :argh:

Anyone could shed some light on this?

I’m posting both the edited class and my full inherited one for you to try.

https://dl.dropboxusercontent.com/u/16029672/3D/Script/optwin.py
https://dl.dropboxusercontent.com/u/16029672/3D/Script/optwin_derived_class.py


#351

I am completely stumped with this. I’m trying to build a character control GUI with a background image and buttons or some other clickable object laid over the top but I can’t get it working. The buttons are not clickable and behind the image and I have no idea why. I’ve basically pieced this code together from other character gui’s so I’m at a loss. Any help would be appreciated.

string $title = "Control Window";
 	int $width = 640;
 	int $height = 700;
 	
 	//create window
 	if(`window -q -exists UIWin`){
 		deleteUI UIWin;
 		}
  
 	 string $win = `window -title $title -widthHeight $width $height`;
 
 	// create tablayout
 	string $tabs = `tabLayout -innerMarginWidth 5 -innerMarginHeight 5`;
 
 //Body Tab
 		string $tab_cl1 = `columnLayout -w $width -h $height -adj 0 Body`;	
 		
 		// create a formLayout
 		string $form= `formLayout -numberOfDivisions 640`;
 		
 		
 		
 		//createButton
 		string $bodyButton =`button -w 70 -h 20 -label "Body" -ann "Select body control" -c print "body select"` ;
 		string $chestButton =`button -w 70 -h 20 -label "chest" -ann "Select chest control" -c print "chest select"` ;
 
 		
 		//creat image
 		string $BodyPage = `image -image "guiTail.png"`;
 
 		// FormLayout edit
 		formLayout -edit	  
 			  
 		-attachForm $bodyButton "top" 300
 		-attachForm $bodyButton "left" 200
 		
 		-attachForm $chestButton "top" 40
 		-attachForm $chestButton "left" 400
 
 		   
 		-attachForm $BodyPage "top" 0
 		-attachForm $BodyPage "left" 0
 $form;
 
 setParent..;
 setParent..;  
   
   
 //Show Window
 showWindow $win;

#352

Try creating the buttons after the image.

David


#353

Thanks, but I still can’t figure it out. I did as you suggested but the buttons are still behind the image. It seems that no matter what order I put the buttons and the image, the image is always in front. Is there anything else I could be missing?

Edit: Curiously if I instead use a symbolButton for the background image but have “-enable 0” so it cannot be clicked the control buttons are placed in front and work fine. The problem with this is “-enable 0” makes the image black and white.


#354

This might be a useful reference for people trying to understand how to hook up callbacks in Maya python:

http://techartsurvival.blogspot.com/2014/04/maya-callbacks-cheat-sheet.html


#355

hello. im Gabriela and i would like your help to have a job that could help me. work is autodesk maya mel proxy.
my work consists of the following

Create a script that allows me to create the proxy of a helicopter (model of a helicopter in
very low poly)
 must include a general controller type Nurbs Circle function as father of all
hierarchy.
 must create an expression that allows me to assess:
 If the helicopter is on the ground not moving propellers.
 If the helicopter rises must turn the propellers.

appreciate a reply thanks. :sad:


#356

We are not going to do your homework for you. Post code so we can see what you are struggling with.


#357

Maya gui trivia: somebody knows how to hide the x button in a widget so users cannot close them? Or make hitting that button crash save?
Thanks


#358

I’m learning to use Python in Maya and I’ve got a simple question. I’m creating a UI window code where I’m setting the pivot = of a .nurbsCube(). I created this Float Field Group that has 3 value fields.

pivotSet = cmds.floatFieldGrp(numberOfFields= 3, label= 'Pivot', value1= 3 ,value2= 1,value3= 1)

I’m trying to set the values of this field in another function that will use that pivotSet for the pivot =:

pivotSet = cmds.floatFieldGrp(pivotSet, query= True, value1= True ,value2= True, value3= True)

However, when I do this the function only returns a single float (value1) instead of all three values, so how can I fix this?


#359

Venator11387,
To ‘set’ the value you need to ‘edit’ the floatFieldGrp, ‘Query’ returns the existing values.

 cmds.floatFieldGrp(pivotSet, edit= True, value1= 1,value2= 2, value3= 3)

or

 cmds.floatFieldGrp(pivotSet, edit= True, value= (1, 2, 3)

Hope that helps :slight_smile:
Craig


#360

Awesome, that did it! Thanks!