MEL - Maya UI Building

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

REPLY TO THREAD
 
Thread Tools Search this Thread Display Modes
Old 09 September 2014   #361
Talking You're welcome

Originally Posted by Venator11387: Awesome, that did it! Thanks!

You're welcome
:-)
 
Old 10 October 2014   #362
So I'm trying to set the vector direction of a uniform field by a value queried from a FieldGrp. However, when I try using the method below I get the following error:

# Set FieldGrp  
frontUniDir = cmds.floatFieldGrp(numberOfFields = 3, label = 'Front Wind Dir', value = ( -1.0, 0, 0, 0 ) )

# Query FieldGrp vector values
frtUniDirVal = cmds.floatFieldGrp( frontUniDir , query = True, value = True )

# Set Uniform Field Direction
cmds.setAttr( 'snowUniformField_Front.direction', frtUniDirVal )

# Error: setAttr: Error reading data element number 1: [-1.0, 0.0, 0.0]
# Traceback (most recent call last):
# File "<maya console>", line 38, in editCreate
# File "<maya console>", line 116, in editSnow
# RuntimeError: setAttr: Error reading data element number 1: [-1.0, 0.0, 0.0]
 
Old 10 October 2014   #363
Originally Posted by Venator11387: So I'm trying to set the vector direction of a uniform field by a value queried from a FieldGrp. However, when I try using the method below I get the following error:

# Set FieldGrp  
frontUniDir = cmds.floatFieldGrp(numberOfFields = 3, label = 'Front Wind Dir', value = ( -1.0, 0, 0, 0 ) )

# Query FieldGrp vector values
frtUniDirVal = cmds.floatFieldGrp( frontUniDir , query = True, value = True )

# Set Uniform Field Direction
cmds.setAttr( 'snowUniformField_Front.direction', frtUniDirVal )

Try adding this to the setAttr -row:
type=float3
__________________
Nightshade UV Editor (script for Maya) - Extends Maya's default UV Texture Editor with additional tools.
 
Old 10 October 2014   #364
Try adding this to the setAttr -row:
type=float3


Tried it and I got the same error. I also tried the code below, but once again the same error.

    cmds.setAttr( 'snowUniformField_Front.direction', frontUniDir[0], frontUniDir[1], frontUniDir[2], type = 'float3' )
 
Old 12 December 2015   #365
guys, pardon for this absurd question, Im very newbie to MEL. I wanted to create a simple UI window with only 1 floating number input to modify stepsnap value.

I have followed some simple tutorial to create window with floating input =

// the name of the float field
global string $floatFieldName="";

global proc floatValueChanged() {
global string $floatFieldName;

// query the value from the float field
$value = `floatField -query -value $floatFieldName`;

// print value
print("newValue="+ $value +"\n");
}

// window creation scoped to prevent unesseccary
// globals being defined
{
string $window = `window`;
columnLayout;
floatField;

showWindow $window;
}


now I dont know how to connect that with the Mel command =

manipMoveContext -e -snapValue 10 Move;


Im very newbie so pardon for this simple question. Id appreciate any help.
Thank you
 
Old 12 December 2015   #366
Hi, you could borrow some of my code for this if you want;


 global proc stepSize_move(){
 	
 	int $mayaver = `about -v`;
 	string $window = "stepSizeWindow";
 	int $moveStepQ = `manipMoveContext -q -sv Move`;
 	
 	if (`window -ex $window `)
 		{ deleteUI $window;}
 		
 	window -title "Adjust Step Size" -width 200 -height 100 -rtf 1 $window;
 	
 	manipMoveContext -e -snap true Move;
 	manipMoveContext -e -snapRelative true Move;
 	columnLayout -adjustableColumn true;
 	
 	if ($mayaver <= 2015)
 	{
 		floatFieldGrp -nf 1 -pre 2
 			-label ("Move (mm) "+(uiRes("m_manipMoveProperties.kStepSize")))  
 			-v1 ($moveStepQ * 1)
 			-cc ("manipMoveContext -e -snapValue (#1/10) Move;")
 			manipMoveSnapValue;	
 	}
 	if ($mayaver >= 2016)
 	{
 		floatFieldGrp -nf 1 -pre 2
 			-label "Move (mm)"
 			-v1 ($moveStepQ * 1)
 			-cc ("manipMoveContext -e -snapValue (#1/10) Move;")
 			manipMoveSnapValue;	
 	}
 	
 	button -label "Close" -command ("deleteUI -window " + $window +"; manipMoveContext -e -snapValue 1 Move;");
 	
 	setParent ..;
 	showWindow $window;
 }


I never bothered making it more efficient as it is a hack job, but it works really well.
 
Old 12 December 2015   #367
Hi, Hamburger, thanks for the quick reply.
I tried to use ur code but nothing happened?

I am using Maya 2016 btw
 
Old 12 December 2015   #368
Well what I posted is a script.

However it is a procedure which is slightly different to what you were doing. With a script what you were typing, Maya can run it every time but that's not the most effecient way to run code so instead we can tell Maya what the script is through what's called a procedure. Basically a little shortcut so Maya knows which script to use instead of typing it all out.

We can just run it everytime with this command;

stepSize_move

and Maya will recall the entire script itself. If you want to do it the other way you can just remove this line; global proc stepSize_move(){

and the very last line; }

So save that "procedure" as a mel file (stepSize_move.mel) and put in in your My Documents\maya\2016\scripts. Start Maya and just type in (or save) stepSize_move and Maya will know which mel file to use. That's the basics, hope it helps.
 
Old 12 December 2015   #369
Thank you sirrr, you helped me alottttttt

it works perfectly now
 
Old 03 March 2016   #370
Visual MEL Gui builder

HI,
I was searching for a visual way to build the Mel gui. As i'm not a coding guy it's really hard to build the ideal Gui i want.

I googled a lot about it but unfortunately found nothing. Although whatever i've found is way too old and not that much useful.

So if there's anyone know any tool like this please help me.please urgently.
__________________
www.cgcraft.in
 
Old 03 March 2016   #371
attachposition vs attachconttrol attribute ? (formlayout)

formlayout have attachform/attachposition/attachcontrol properties.
attachform : attaches inner controls relevant to formlayout its ok.
attachposition: attach an inner control to another innercontrol.

but what is attachcontrol is ? isnt it acts same as attachform ?
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:53 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.