Script help needed - Installing, syntax error and MORE!

Script help needed - Installing, syntax error and MORE!

Anonymous
Not applicable
842 Views
3 Replies
Message 1 of 4

Script help needed - Installing, syntax error and MORE!

Anonymous
Not applicable

Disclaimer : I know nothing of programming.

 

Maya version : 2015

OS : Windows 8.1

 

 

 

 

 

So, I saw this video here of this guy :

 

https://www.youtube.com/watch?v=gfQx3g--zF4&list=PLdWAXsK4r5zdn8wavhp_-5SrghZW7GCo8&index=19

 

And one of the ways he use to mirror during modeling is pretty great, fast and nice, so I thought "Hey! I wanna use that! Huh? What's a script?"

 

Then, I've been having trouble since then to ****ing install the **** script -.-'

 

Question is : how the **** am I suposed to install this script?

 

He said : 

 

"place the script in your maya2015x64/scripts folder in your preferences directory, restart maya and then map the following .mel code to a shelf or user hotkey.

source mirrorMe.mel;
mirrorMeRead;

The UI can be accessed with 

source mirrorMe.mel;
mirrorMeUI;"

 

Which folder, exactly, should I put this on? How do I perform the install? What do these two commands mean and how/where to use them?

 

Please, help me... This question is making me miserable and awful on the inside...

 

Script text below.

0 Likes
843 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Link and credits for the dude who made the script - named mirrorMe - 

 

http://www.cedric3d.com/dl/MirrorMe.mel

 

*/

//************************************************************************************************************
//************************************************************************************************************
//main Proc
global proc mirrorMe (string $axis, float $tolerance, int $mustMerge, int $mirrorUV, int $delHistory)
{

	global int $mirrorMe_onlySelect;

	string $nameSym;
	string $list[];

	int $cpCount;

	int $cpLinkZeroCount = 0;
	int $cpLinkPosCount = 0;
	int $cpLinkNegCount = 0;
	int $cpLinksZero[];
	int $cpLinksPositive[];
	int $cpLinksNegative[];
	string $cpNamePositive[];
	string $cpNameNegative[];
	string $cpNameZero[];
	int $Buf;

	float $cpSym[3];
	float $cpBuf[3];
	float $cpDef[3];

	int $xAsist = 0;
	int $yAsist = 1;
	int $zAsist = 2;

	int $xSign = -1;
	int $ySign = 1;
	int $zSign = 1;

	int $xZero = 0;
	int $yZero = 1;
	int $zZero = 1;
	
	int $xVector = 0;
	int $yVector = 0;
	int $zVector = 0;

	string $absAxis;

	string $singleCpLinksNegative;
	string $selGoodCV;
	string $tempUV[];

	if (($axis == "+x") || ($axis == "-x") || ($axis == "x"))
	{
		$absAxis = "x";
	}

	if (($axis == "+y") || ($axis == "-y") || ($axis == "y"))
	{
		$xAsist = 1;	$xSign = 1;		$xZero = 1;
		$yAsist = 0;	$ySign = -1;	$yZero = 0;
		$zAsist = 2;	$zSign = 1;		$zZero = 1;
		$absAxis = "y";
	}

	if (($axis == "+z") || ($axis == "-z") || ($axis == "z"))
	{
		$xAsist = 2;	$xSign = 1;		$xZero = 1;
		$yAsist = 1;	$ySign = 1;		$yZero = 1;
		$zAsist = 0;	$zSign = -1;	$zZero = 0;
		$absAxis = "z";
	}
	
	//
	if ($axis == "+x") $xVector = 1;
	if ($axis == "-x") $xVector = -1;
	if ($axis == "+y") $yVector = 1;
	if ($axis == "-y") $yVector = -1;
	if ($axis == "+z") $zVector = 1;
	if ($axis == "-z") $zVector = -1;
	

	$list = `filterExpand -sm 10 -sm 12`;
	if (`size $list` != 1)
	{
		error("No one geometry objects selected");
		return;
	}

	$nameSym = $list[0];

	
	print "//----------------------------- mirrorMe 1.1 ---------------------- \n";

	//place les vertex autour de 0, sur 0
	string $middleVtxSet = ( $nameSym + "_middleVtx" );
	string $selsList[];
		
	//dabord utiliser middleVtx set....
	//print "//OP : move point neat to 0\n";
	if (`objExists $middleVtxSet`)
	{
		//verification de lintegrite du middleVtx
		
		$bad = `verifiyIntegrity $nameSym`;
		
		////////////////////////////////////////////
		
		
		if ($bad == 1)
		{
			mirrorMeMessageWin "the middleVtx set for this object is not valid!!\nMay be you have duplicate this object before...\n\nPLEASE use 'clean' option...";
			error "pas bon!! \n";
		}
		
		select -r $middleVtxSet;
		move ("-" + $absAxis) 0;
		print "//middleVtx set used     ";		
	}

	//il nexiste pas, methode manuelle...
	else
	{
		select -cl;

		for ( $singleCpLinksZero in $cpLinksZero )
		{
			string $selGoodCV = ( $nameSym + ".vtx[" + $singleCpLinksZero + "]" );
			select -add $selGoodCV;
		}
		move ( "-" + $absAxis ) 0;
		print "//move point near to 0... (middleVtx doesnt exist!)    ";
	}
	
	print "\n";

	
	////////////////////////////////////////////////
	// Sort points

	//print "//OP : sort points (negative and poitive)\n";
	$cpCount = `getAttr -size ($nameSym + ".cp")`;
	
	for ($currentPoint = 0; $currentPoint < $cpCount; $currentPoint++)
	{
		$cpSym = `xform -q -t -ws ($nameSym + ".cp[" + $currentPoint +"]")`;
		if (abs($cpSym[$xAsist]) < $tolerance) 
		{
			$cpLinksZero[$cpLinkZeroCount] = $currentPoint;
			$cpLinkZeroCount++;

		}
		else
		{
			if ($cpSym[$xAsist] > 0) 
			{
				$cpNamePositive[$cpLinkPosCount] = ( $nameSym + ".vtx[" + $currentPoint + "]" );
				$cpLinkPosCount++;

			}
			else	
			{
				$cpNameNegative[$cpLinkNegCount] = ( $nameSym + ".vtx[" + $currentPoint + "]" );
				$cpLinkNegCount++; 
			} 
		}

	}

	/////////////////////////////////////////
	/////////////////////////////////////////

	//la variable $mirrorMe_onlySelect permet de selectionner seulement. 1 : side faces, 2 : middle points

	//on a besoin des faces
	if ($mirrorMe_onlySelect != 2)
	{
	
		//selectionne les vertex a effacer

		//print "//OP : select del vtx \n";
		select -cl;	
		
		//	
		if ( ($axis == "-x") || ($axis == "-y") || ($axis == "-z") )
		{
			select -r $cpNameNegative;
		}
		
		//
		if ( ($axis == "+x") || ($axis == "+y") || ($axis == "+z") )
		{
			select -r $cpNamePositive;
		}
		
		//
		
		//print "//OP : convert to face and del \n";
		//error;																							//debug
		//face...
		ConvertSelectionToFaces;hilite;
		selectType -ocm -alc false;
		selectType -ocm -polymeshFace true;
	}
	//ou pas pour les middle points
	else
	{
		$cpLinkZeroCount = 0;
		$cpCount = `getAttr -size ($nameSym + ".cp")`;

		for ($currentPoint = 0; $currentPoint < $cpCount; $currentPoint++)
		{
			$cpSym = `xform -q -t -ws ($nameSym + ".cp[" + $currentPoint +"]")`;
			if (abs($cpSym[$xAsist]) < $tolerance) 
			{
				$cpNameZero[$cpLinkZeroCount] = ( $nameSym + ".vtx[" + $currentPoint + "]" );
				$cpLinkZeroCount++;

			}
		}

		//et merge les points a 0 (operation sans risque : ils viennent detre placer a 0...)
		select -r $cpNameZero;
	}


	//si on veut simmetriser
	if ($mirrorMe_onlySelect == 0)
	{
	
		//error;																				//debug
		//effacer...
		delete;

		//print "//OP : symmetrise \n";
		//et symmetriser
		select -r $nameSym;

		//memorise la selection UV pour la symmetriser aussi
		if (($mirrorUV == 2) || ($mirrorUV == 3))
		{
			PolySelectConvert 4;
			$tempUV = `ls -sl`;
		}
		//print $tempUV;
		
		select -r $nameSym;
		
		//error;
		
		//mirror selection + UV
		polyMirror $xVector $yVector $zVector $mustMerge;
		if ($mirrorUV == 2)
		{
			select -r $tempUV[0];
			invertSelection;
			polyEditUV -pivotU 0.5 -scaleU -1;
		}
		if ($mirrorUV == 3)
		{
			select -r $tempUV[0];
			invertSelection;
			polyEditUV -pivotV 0.5 -scaleV -1;
		}
		
		//error;
		//print "//OP : merge point near to 0\n";
		//repasse lobjet et reclasse les vrtx
		$cpLinkZeroCount = 0;
		$cpCount = `getAttr -size ($nameSym + ".cp")`;

		for ($currentPoint = 0; $currentPoint < $cpCount; $currentPoint++)
		{
			$cpSym = `xform -q -t -ws ($nameSym + ".cp[" + $currentPoint +"]")`;
			if (abs($cpSym[$xAsist]) < $tolerance) 
			{
				$cpNameZero[$cpLinkZeroCount] = ( $nameSym + ".vtx[" + $currentPoint + "]" );
				$cpLinkZeroCount++;

			}
		}

		//et merge les points a 0 (operation sans risque : ils viennent detre placer a 0...)
		select -r $cpNameZero;
		
		//merge or not
		if ($mustMerge == 1 ) 
		{	
			polyMergeVertex -d $tolerance;
		}

		//fin...
		select -r $nameSym;
		//print "//OP : fin \n";

		if ($delHistory == 1) DeleteHistory;
		
	}



	//par secu...
	if ($mirrorMe_onlySelect != 0)
	{
		$mirrorMe_onlySelect = 0;
	}

}	

//************************************************************************************************************
//************************************************************************************************************
global proc mirrorMeMessageWin(string $phrase)
{
    confirmDialog
        -t "MirrorMe :"
        -m $phrase
        -b "Ok, ok..."
        -db "ok...";

} 


//************************************************************************************************************
//************************************************************************************************************
global proc MiddleSetOp ( string $operation )
{
	//var for create
	string $selsList[] = `ls -sl`;	
	string $simpleName;
	string $secondName;
	string $finalName;
	string $buffer[];
	int $numTokens;
	//int $CNsize =`size $selsList`;

	//var for clean
	int $CNsize;
	int $CNsizeName;
	int $cond;
	int $bad;
	int $i;
	string $CNsubstring;
	string $thing;
	string $middleVtxSet;
	
		
	switch ($operation)
	{
	
		//
		case "autoSelect":
			
		
		break;
		
		
		//
		case "create":
			$numTokens = `tokenize $selsList[0] "." $buffer`;
			$simpleName = $buffer[0];
			$secondName = `substring $buffer[1] 1 3`;
		
			if ( ($secondName != "vtx") || ($numTokens != 2))
				{
					error "selection MUST be vertices";
				}
			
			$finalName = $simpleName + "_middleVtx";
			
			if (`objExists $finalName`)
			{
				mirrorMeMessageWin "the middle set for this object already exist";
				error "the middle set for this object already exist";
			}
			
			sets -text "gCharacterSet" -name $finalName;
			
			//
			$bad = `verifiyIntegrity $simpleName`; 
			if ($bad == 1)
			{
				mirrorMeMessageWin "Le set middleVtx de l'objet n'est pas valide!!!";
				error "pas bon!! \n";
			}
			
			string $mess = "You have recorded middle points:\n";
			$mess+= "Now you can mirror your object without be sure that these points are on the origin axis.\n\n";
			$mess+= "Be carefull when you duplicate or rename (use 'clean' option)!";
			mirrorMeMessageWin $mess;
					
		break;
		
		//
		case "clean":

			$CNsize =`size $selsList`;	
			$nameSym = $selsList[0];
			$middleVtxSet = ( $nameSym + "_middleVtx" );
			
			//test
			if (($CNsize == 0) || ($CNsize > 1))
			{
				mirrorMeMessageWin "please select only ONE object to clean";
				error "please select only ONE object to clean";	
			}
		
			if (`objExists $middleVtxSet` == 0)
			{
				mirrorMeMessageWin "there is no middlesetVtx for the current object ";
				error "there is no middlesetVtx for the current object ";
			}	
			
			//
			select -r $middleVtxSet;
			$selsList = `ls -sl`;
			
			
			$CNsizeName =`size $nameSym`;
			$cond = 0;
			$bad = 0;
			$i = 0;
	
			do
			{
					
					$thing = $selsList[$i];
										
					//print ( "thing : " + $thing + " \n" );print ( "nameS : " + $nameSym + " \n" );print ( "i     : " + $i + " \n" );print ( "sub   : " + $CNsubstring + " \n" ); 
										
					print ($selsList[$i] + "  -- thing \n" );
					
					if ( $thing == "" )
					{
						//print "thing vide \n";
						$cond = 1;
					}
					else $CNsubstring = `substring $thing 1 $CNsizeName`;
					
					if ( ( $CNsubstring != $nameSym ) && ( $thing != "" ))
					{
						print ($middleVtxSet + "    " + $thing );
						sets -rm $middleVtxSet $thing;
						print "bad!!! \n";
					}
					
					$i++;
					
			} while ($cond == 0);	
			
			select -r $middleVtxSet;
		
		break;
		
		//
		case "delete":

			$CNsize =`size $selsList`;	
			$nameSym = $selsList[0];
			$middleVtxSet = ( $nameSym + "_middleVtx" );
			
			//test
			if (($CNsize == 0) || ($CNsize > 1))
			{
				mirrorMeMessageWin "please select only ONE object to clean";
				error "please select only ONE object to clean";	
			}
		
			if (`objExists $middleVtxSet` == 0)
			{
				mirrorMeMessageWin "there is no middlesetVtx for the current object ";
				error "there is no middlesetVtx for the current object ";
			}
			
			select -ne -r $middleVtxSet;
			delete;			
			//
			
		break;	
		
		//
		case "show":

			$CNsize =`size $selsList`;	
			$nameSym = $selsList[0];
			$middleVtxSet = ( $nameSym + "_middleVtx" );
			
			//test
			if (($CNsize == 0) || ($CNsize > 1))
			{
				mirrorMeMessageWin "please select only ONE object to clean";
				error "please select only ONE object to clean";	
			}
		
			if (`objExists $middleVtxSet` == 0)
			{
				mirrorMeMessageWin "there is no middlesetVtx for the current object ";
				error "there is no middlesetVtx for the current object ";
			}
			
			select -r $middleVtxSet;
						
			//
			
		break;			
		
		//
		case "show":

			$CNsize =`size $selsList`;	
			$nameSym = $selsList[0];
			$middleVtxSet = ( $nameSym + "_middleVtx" );
			
			//test
			if (($CNsize == 0) || ($CNsize > 1))
			{
				mirrorMeMessageWin "please select only ONE object to clean";
				error "please select only ONE object to clean";	
			}
		
			if (`objExists $middleVtxSet` == 0)
			{
				mirrorMeMessageWin "there is no middlesetVtx for the current object ";
				error "there is no middlesetVtx for the current object ";
			}
			
			select -r $middleVtxSet;
						
			//
			
		break;	
		
		case "addPoint":
			$numTokens = `tokenize $selsList[0] "." $buffer`;
			$simpleName = $buffer[0];
			$secondName = `substring $buffer[1] 1 3`;
			
			if ( ($secondName != "vtx") || ($numTokens != 2))
				{
					error "selection MUST be vertices";
				}
			
			$finalName = $simpleName + "_middleVtx";

			print $finalName;
			for ($selList in $selsList)
  			{
   				sets -e -in $finalName $selList;
  			}			
			
			//
			$bad = `verifiyIntegrity $simpleName`; 
			if ($bad == 1)
			{
			mirrorMeMessageWin "Le set middleVtx de l'objet n'est pas valide!!!";
			error "pas bon!! \n";
			}
		break;	
				
		case "remPoint":
			$numTokens = `tokenize $selsList[0] "." $buffer`;
			$simpleName = $buffer[0];
			$secondName = `substring $buffer[1] 1 3`;
			
			if ( ($secondName != "vtx") || ($numTokens != 2))
				{
					error "selection MUST be vertices";
				}
			
			$finalName = $simpleName + "_middleVtx";

			print $finalName;
			for ($selList in $selsList)
  			{
   				sets -e -rm $finalName $selList;
  			}			
			
			//
			$bad = `verifiyIntegrity $simpleName`; 
			if ($bad == 1)
			{
			mirrorMeMessageWin "Le set middleVtx de l'objet n'est pas valide!!!";
			error "pas bon!! \n";
			}
		break;
		
	}
	
	
	
}



//************************************************************************************************************
//************************************************************************************************************
//verify integrity of the specified middleSet
global proc int verifiyIntegrity ( string $nameSym )
{
	
	string $middleVtxSet = ( $nameSym + "_middleVtx" );
	select -r $middleVtxSet;
	$selsList = `ls -sl`;
	
	int $CNsize =`size $selsList`;
	int $CNsizeName =`size $nameSym`;
	int $cond = 0;
	int $bad = 0;
	int $i = 0;
	string $CNsubstring;
	string $thing;
	

	
		//print $CNvtxInSet;
	
	do
		{
			
			$thing = $selsList[$i];
		
			//print ( "thing : " + $thing + " \n" );print ( "nameS : " + $nameSym + " \n" );print ( "i     : " + $i + " \n" );print ( "sub   : " + $CNsubstring + " \n" ); 
					
			if ( $thing == "" )
			{
				//print "thing vide \n";
				$cond = 1;
			}
			else $CNsubstring = `substring $thing 1 $CNsizeName`;
			
			if ( ( $CNsubstring != $nameSym ) && ( $thing != "" ) )
			{
				print "bad!!! \n";
				$cond = 1;
				$bad = 1;
			}
			
			$i++;
			//print ( "bad   : " + $bad + " \n" );
			
		} while ($cond == 0);
		
		
		return $bad;
}

//************************************************************************************************************
//************************************************************************************************************
//main proc to create UI...
global proc mirrorMeUI ()
{

	global int $mirrorMe_onlySelect = 0;
	
	if ((`window -ex mirMe`) == true) deleteUI mirMe;
        window -t "mMe" -h 220 -width 160 -resizeToFitChildren true mirMe ;
	
	columnLayout -adjustableColumn true;
	
 	rowLayout -numberOfColumns 2 -columnWidth2 160 15;
	text -ann "mirrorMe1.1 by Ced - http://grain.s.free.fr" -align "center" -l "                 mirrorMe 1.1";
	button -h 18 -l "?" -c "mirrorMe_Help;";
	setParent ..;

	separator -h 10 ;
	

	string $form = `formLayout`;
 	string $tabs = `tabLayout -innerMarginWidth 2 -innerMarginHeight 2 -w 50`;
 	formLayout -edit
 		-attachForm $tabs "top"    0
  		-attachForm $tabs "left"   0
  		-attachForm $tabs "bottom" 0
  		-attachForm $tabs "right"  0
		$form;
	
	string $child1 = `columnLayout -adjustableColumn true`;

	
		string $rg1 = `radioButtonGrp -numberOfRadioButtons 2 -cw3 30 40 40 -ann "Enter here the direction of the mirror (World space)" -label "Axis" -labelArray2 "-x" "+x" -select 1 mmui_rg1`;
		string $rg2 = `radioButtonGrp -numberOfRadioButtons 2 -cw3 30 40 40 -ann "Enter here the direction of the mirror (World space)" -label "" -labelArray2 "-y" "+y" -shareCollection $rg1 mmui_rg2`;
		string $rg3 = `radioButtonGrp -numberOfRadioButtons 2 -cw3 30 40 40 -ann "Enter here the direction of the mirror (World space)" -label "" -labelArray2 "-z" "+z" -shareCollection $rg1 mmui_rg3`;
		
		separator -h 10 ;

		floatFieldGrp -numberOfFields 1 -cw2 60 50 -ann "tolerance to merge points in the middle" -label "tolerance" -precision 4 -value1 0.001 tolField;
		checkBoxGrp -numberOfCheckBoxes 1 -cw2 60 50 -ann "Do you want to merge the points in the middle after the mirror?" -label "merge" -value1 true mergeCeck;
		checkBoxGrp -numberOfCheckBoxes 1 -cw2 60 50 -ann "Do you want to delete history after the merge process?" -label "del History" -value1 false historyCheck;
		radioButtonGrp -numberOfRadioButtons 3 -cw4 60 40 30 30 -ann "Do you want to mirror UV too? (in U or V)" -label "mirror UV" -labelArray3 "No" "U" "V" -select 1 UVCheck;


/* pour la 1.2
		optionMenu -label "Mirror UV    " UVcheck2;
			menuItem -label "No";
			menuItem -label "+U";
			menuItem -label "-U";
			menuItem -label "+V";
			menuItem -label "-V";

pour interroger : int $test2 = `optionMenu -q -sl UVcheck2`;

*/
		separator -h 20;
		
		text -align "center" -l "--action:--";
		button -l "save" -ann "save current setting to call with the mirrorMeRead procedure/button" -c "mirrorMeSave";
		button -l "apply (doesnt save)" -ann "Apply current setting without save (test it!)" -c "mirrorMeApply";
		text -align "center" -l "\n'Save' for using these settings\nwith 'mirrorMeRead' command...";
//		setParent ..;
		
		setParent ..;

		
//		separator -h 20;

	string $child2 = `columnLayout -adjustableColumn true`;

//		text -align "center" -l "Auto mid-points centering";
		text -align "center" -l "Auto center middle-vertices\n even if they get offset";
		
		separator -h 20;

		text -align "center" -l "--auto-Select--";

		rowLayout -numberOfColumns 2 -columnWidth2 80 80;
		button -w 80 -l "Side faces" -ann "select faces on the side of the model" -c "$mirrorMe_onlySelect = 1 ; mirrorMeApply;";
		button -w 80 -l "Zero points" -ann "Select points in the right axis" -c "$mirrorMe_onlySelect = 2 ; mirrorMeApply;";
		setParent ..;

		separator -h 20;
		
		text -align "center" -l "--middle vertices--";

		rowLayout -numberOfColumns 1 -columnWidth1 160;
		button -bgc 0.9 0.5 0.5 -w 160 -l "record" -ann "Record points that will be always at the origin... No need to be carefull if you move it after or not..." -c "MiddleSetOp create";
		setParent ..;

		rowLayout -numberOfColumns 1 -columnWidth1 160;
		button -w 160 -l "delete set" -ann "Delete set of middle points and return to the auto detection of the Zero points" -c "MiddleSetOp delete";
		setParent ..;

		rowLayout -numberOfColumns 2 -columnWidth2 80 80;
		button -w 80 -l "show" -ann "Show middle pointsthat you record..." -c "MiddleSetOp show";
		button -w 80 -l "clean" -ann "Clean middle points (eg. if you have do a duplicate)" -c "MiddleSetOp clean";
		setParent ..;
		
		separator -h 10;

		rowLayout -numberOfColumns 2 -columnWidth2 80 80;
		button -w 80 -l "add vertices" -ann "Add vertices to the middle points Set" -c "MiddleSetOp addPoint";
		button -w 80 -l "del vertices" -ann "remove vertices from the middle points Set" -c "MiddleSetOp remPoint";
		setParent ..;
		
		setParent ..;


	tabLayout -edit
		-tabLabel $child1 "Mirror" -tabLabel $child2 "Mid-points"
		$tabs;


	showWindow mirMe;

}

//************************************************************************************************************
//************************************************************************************************************
//save prefs from UI
global proc mirrorMeSave ()
{
	string $finAxis;

	int $Xaxis = `radioButtonGrp -q -select mmui_rg1`;
	int $Yaxis = `radioButtonGrp -q -select mmui_rg2`;
	int $Zaxis = `radioButtonGrp -q -select mmui_rg3`;

	float $tol = `floatFieldGrp -q -value1 tolField`;
	int $mergeOrNot = `checkBoxGrp -q -value1 mergeCeck`;
	int $mirrorUV = `radioButtonGrp -q -select UVCheck`;
	int $delHistory = `checkBoxGrp -q -value1 historyCheck`;
	
	if ($Xaxis == 1) $finAxis = "-x";
	if ($Xaxis == 2) $finAxis = "+x";
	if ($Yaxis == 1) $finAxis = "-y";
	if ($Yaxis == 2) $finAxis = "+y";
	if ($Zaxis == 1) $finAxis = "-z";
	if ($Zaxis == 2) $finAxis = "+z";

	optionVar -stringValue "mirMe_axis" $finAxis;
	optionVar -intValue "mirMe_merge" $mergeOrNot;
	optionVar -floatValue "mirMe_tol" $tol;
	optionVar -intValue "mirMe_UV" $mirrorUV;
	optionVar -intValue "mirMe_history" $delHistory;
	   
	print( "//set prefs to : " + $finAxis + "  " + $tol + "   " + $mergeOrNot + "   " + $mirrorUV + "   " + $delHistory + " ... \n");
	print "//----- Use now the 'mirrorMeRead' command to call these settings in one clic! (shelf/hotkey) ----\n";
	
}

//************************************************************************************************************
//************************************************************************************************************
//apply settings from window
global proc mirrorMeApply ()
{
	string $finAxis;

	int $Xaxis = `radioButtonGrp -q -select mmui_rg1`;
	int $Yaxis = `radioButtonGrp -q -select mmui_rg2`;
	int $Zaxis = `radioButtonGrp -q -select mmui_rg3`;

	float $tol = `floatFieldGrp -q -value1 tolField`;
	int $mergeOrNot = `checkBoxGrp -q -value1 mergeCeck`;
	int $mirrorUV = `radioButtonGrp -q -select UVCheck`;
	int $delHistory = `checkBoxGrp -q -value1 historyCheck`;

	if ($Xaxis == 1) $finAxis = "-x";
	if ($Xaxis == 2) $finAxis = "+x";
	if ($Yaxis == 1) $finAxis = "-y";
	if ($Yaxis == 2) $finAxis = "+y";
	if ($Zaxis == 1) $finAxis = "-z";
	if ($Zaxis == 2) $finAxis = "+z";

	
	mirrorMe ($finAxis , $tol , $mergeOrNot, $mirrorUV, $delHistory);
	
}

//************************************************************************************************************
//************************************************************************************************************
//read settings from optionVar
global proc mirrorMeRead ()
{
	string $finAxis = `optionVar -q "mirMe_axis"`;
	int $mergeOrNot = `optionVar -q "mirMe_merge"`;
	float $tol = `optionVar -q "mirMe_tol"`;
	int $mirrorUV = `optionVar -q "mirMe_UV"`;
	int $delHistory = `optionVar -q "mirMe_history"`;
	
	if ( ( $finAxis == 0 ) && ( $mergeOrNot == 0 ) && ( $tol == 0 ) )
	{
		mirrorMeMessageWin "please lunch the mirrorMeUI and save some settings before!!";
		error "//MirrorMe Error : please lunch the mirrorMeUI and save some settings before!!";
	}
		
	print( "//lunch mirrorMe with this settings : " + $finAxis + "  " + $tol + "   " + $mergeOrNot + "   " + $mirrorUV +  "   " + $delHistory +" ... \n");
	mirrorMe ($finAxis , $tol , $mergeOrNot, $mirrorUV, $delHistory);

}

//
	

//************************************************************************************************************
//************************************************************************************************************
// help window....
global proc mirrorMe_Help()
{
   if ((`window -ex mm_helpWindow`) == true) deleteUI mm_helpWindow;
   window                             //Create a window
           -title "mirrorMe Help" //Label on the title bar
           -iconName "Help"           //Icon name when window is minimized
           -sizeable true             //Let user resize the window
           -resizeToFitChildren true  //Resize to fit the things inside of it
   mm_helpWindow;			//Name of the window

   scrollLayout;

   columnLayout                          //Column Layout
                -adjustableColumn true   //Make the columns adjustable
                -columnAlign "left"      //Align left
   layoutOne;                            //Layout Name

   text -l "";
   text -al "center" -l "mirrorMe 1.1 by Ced";
   button -al "center" -ann "goto URL" -w 25 -l "visit the grain.s project : http://grain.s.free.fr" -c "gotoUrl;";
   text -l "thanks to ## Haider Alghifary ## for feddback and improvements ideas...:)";

   text -l "";
   text -l "  -- Symmetrise your polygon model in one clic! --";
   text -l "";
   text -l " -type 'mirrorMeUI' to lunch the UI";
   text -l "  Make your settings 'axes, tolerance, etc...'";
   text -l "  Test with APPLY";
   text -l "  When you are Ok, clic on SAVE";
   text -l "  \nNow you can : \n";
   text -l " -type mirrorMeRead to call in one clic your settings";
   text -l "  Usually, put this command in shelf or horkey";
   text -l " \n\nWHAT IS MIDDLE POINTS?";
   text -l " Middle points are a set of vertices that you record. This points will be";
   text -l "  your vertices who are in the middle of your polygon model and who will be merged after the symmetry.";
   text -l "  If you create this set and move this points, mirrorMe will automaticly put this points in the middle...";
   text -l "     that you see in this time throught cameraCut. ";
   text -l " \nHOW USE IT?";
   text -l " -select your middle vertices (you can use the autoSelect button)";
   text -l " -clic on RECORD";
   text -l " -A new set have been create. This points will be always put in the middle, even you move it!";
   text -l "  No need to be carefull, you are free now!!";


   showWindow;
}


		
	
//end of file
0 Likes
Message 3 of 4

RFlannery1
Collaborator
Collaborator

The folder you are looking for is in your documents folder.  So if your username was "myusername", then the folder would be "C:\Users\myusername\Documents\maya\2015-x64\scripts".

 

As for those two lines of code, you can type them in the Script Editor and then run them.  (See the Maya help docs if you don't know how to get to the Script Editor or how to use it.)

 

When he talks about mapping the code to a shelf, here's what you can do:

  1. Find or create a custom user shelf.  (If you see a shelf called "Custom", you can use that one.)
  2. Highlight the two lines of code that you put in the Script Editor earlier.
  3. Using the middle-mouse button, drag the highlighted lines up to your custom shelf.
  4. You should see a new icon appear on your shelf.  From this point on, you can click this icon to run the script.
0 Likes
Message 4 of 4

Anonymous
Not applicable

THanks, it worked!

0 Likes