MEL scripts


hi guys…excuse me if this question ( or script ) as been answered before, but I got tired of reading some many posts…lol.

I’m looking for a script that would randomize translation, rotation and scale selected objects…with the ability to set given values…ex:: to make the object move between -1 , 1.5 or rotate in X, Y or Z or ( all axises ) or scale…I’m sure you guys know what I’m trying to say…can anyone direct me to where I can find such a script…thx!!


Are you still looking for script :slight_smile:


Here is FaoGen.Mel 1.0 ::Download::

It has all the settings that the stand alone FaoGen offers. To use it is simple:

[li]Select the object.[/li][li]Type the name in the top box.[/li][li]Hit the export button.[/li][li]Make settings to your needs.[/li][li]Finally, hit the render button.[/li][/ol]The *.PNG file will spit out to your project directory (The name of the image is NameOfObjectInMaya.png). **You will need FaoGen ( to use this mel, and please install in the default directory, or the mel will not work.

Future updates will be to have multiple objects for rendering, the calculations for iterations and image importing.


I updated the script to set up a batch if you want. So now you can calculate objects individually in succession.

You can export with multiple objects selected and they will calculate and spit out individual textures for them.


I posted this in a separate thread but I figured I’d put it here as well…

Select either 1 or 2 edges on an edge loop/ring/border.
If you had 1 edge selected it will select the entire edge loop/ring/border
If you had 2 edges selected it will select the edge loop/ring/border between the two.

 global proc polySelectBetween(string $method)
 	string $edges[] = `getEdges`;
 	int $size = `size $edges`;
 	if ($size == 1)
 		string $buffer[];
 		tokenize $edges[0] "[]" $buffer;
 		string $cmd = "polySelect -";
 		$cmd += $method;
 		$cmd += " ";
 		$cmd += $buffer[1];
 	else if ($size > 1)
 		string $buffer[];
 		$method = $method + "Path";
 		tokenize $edges[0] "[]" $buffer;
 		string $cmd = "polySelect -";
 		$cmd += $method;
 		$cmd += " ";
 		$cmd += $buffer[1];
 		tokenize $edges[1] "[]" $buffer;
 		$cmd += " ";
 		$cmd += $buffer[1];

To call it, use the correct one of these depending on what kind of selection you want:



thanks for this useful script:

just a question

polySelectBetween(“edgeBorder”); does not functioning.

the other works as a charm. but edgeborder I couldnt achive.

may you tell where I am wrong ?
thanks much


Are the edges you have selected actually border edges?


thanks for answer.I understood.and a screenshot I sent about how to.


maybe will handy for some1
setAttr “FurFeedback.visibility” (!getAttr "FurFeedback.visibility");


hotkeys to toggle the AE window and the AE docked tag.

bind this to ctrl+a to toggle the AE window:

 	if (`window -ex AEWindow` && `window -q -vis AEWindow`==1)
 		window -e -vis 0 AEWindow;
 	else openAEWindow;

and this to ctrl+shift+a to toggle the AE window docking (main window / separate window):

if (`optionVar -q aeInMainWindow` == 1)
 	optionVar -iv aeInMainWindow 0;
 	print "AE: Separate Window";
 	optionVar -iv aeInMainWindow 1;
 	print "AE: Main Maya Window";

just in case someone finds these usefull :slight_smile:


source removeWebButton.mel;//add this line to userSetup.mel


a weird refresh bug in XP fixed.

little code, but it clears one of your annoyance in maya Interface;

source toggleDblShelf.mel;//add mel in scripts path.add this line to maya.


this is a way for debugging to mel scripters//easy print variables without writing dirty //print blabla codes.
works in 8.5
not before

global proc ktPrintSelected()
global string $gCommandExecuterTabs;
string $array[] = `tabLayout -q -ca $gCommandExecuterTabs`;
int $selTabIdx = `tabLayout -q -selectTabIndex $gCommandExecuterTabs` - 1;
string $curFormLayout = $array[$selTabIdx];
string $tabChldrn[] = `formLayout -q -ca $curFormLayout`;
string $curExecuter = $tabChldrn[0];
string $ktPrintSel=`cmdScrollFieldExecuter -q -slt $curExecuter`;
eval ("print " + $ktPrintSel);


if a few a description is a need:
useful if you assign a hotkey.or as a shelf button.

when you need to select similar objects as your current selected nodes.
(ie. select a subd in scene.this tinycode will select all subds in scene.)


proc j3dExpandTopNodeAndFrameInHyperGraph(string $nodes[], string $hyperPanel)
	for ($node in $nodes ) {
		string $cur = `firstParentOf($node)`;
		string $next = $cur;
		while($cur != "") {
			if (j3dNodeHasConnection($cur, "hyperGraphLayout")) {
				$next = `firstParentOf($cur)`;
				if (`size($next)`) {
					if (j3dNodeHasConnection($next, "hyperGraphLayout")) {
						$cur = $next;
			$cur = `firstParentOf($cur)`;
		if ($cur != "") {
		 select $cur;
		 hyperGraph -e -ua $hyperPanel;
	select $nodes;
	hyperGraph -e -fr $hyperPanel;
global proc int j3dNodeHasConnection(string $node, string $connection)
	string $cons[] = `listConnections $node`;
	string $cat = `j3dConcatenateStringArray($cons)`;
	if ( size(`match $connection $cat`) )
	 return 1;
	 return 0;
global proc string j3dConcatenateStringArray(string $arr[])
	string $ret;
	for ($entry in $arr) {
		$ret = $ret + $entry + " ";
	return $ret;
global proc j3dFrameSelected()
	string $panel = `getPanel -underPointer`;
	if ( size(`match hyperGraphPanel $panel`) ) {
		$panel += "HyperGraphEd";
	 string $sel[] = `ls -sl`;
	 j3dExpandTopNodeAndFrameInHyperGraph($sel, $panel);
	fitPanel -selected;
global proc j3dUtils()
	nameCommand -annotation "j3d Frame Selected" -command "j3dFrameSelected();" j3dFrameSelectedCommand;
	hotkey -k "f" -name "j3dFrameSelectedCommand";
// proc cookie recipe
// this is a recipe for delicious chocolate chip cookies
//	Soft Chocolate Chip Cookies
//	Ingredients:
//	3/4 cup unsalted butter;
//	2/3 cup dark brown sugar;
//	2/3 cup granulated sugar;
//	2 tbsps light corn syrup;
//	1 tbsp cider vinegar or white vinegar;
//	2 large eggs;
//	1 tbsp vanilla;
//	1/2 tsp salt;
//	1/2 tsp baking powder;
//	1/4 tsp baking soda;
//	2-1/4 cup flour;
//	3 cups semisweet choc chips.
//	Preheat oven to 375
//	Grease baking sheets
//	Cream together butter, sugars, corn syrup & vinegar, and then beat in the eggs.
//	Beat in vanilla, salt, baking powder & baking soda.
//	Stir in flour & chocolate chips.
//	Drop dough by tablespoon-full on sheets.
//	Cook for 10 minutes, so centers look underdone.
//	Note: I usually make the cookies bigger.


changes selected object’s materials sequentially
assign this code to a hotkey ( I use Ctrl + (+) )

source ktAssignNextShader;



Description:Adds some extra useful buttons to Display Layer

update #1@25.03.2007~16:04pm (select layer by object button added)


man … ktUIDispayLayer.mel is wonderfull …

***** :thumbsup:


hi…I’m looking for a spinEdge script…not the spinQuad one where you have to select twoQuads…but the one where you only need to select the edge that’s shared by the twoQuads…anyHelp?

one that would spinAround faces that are “not” 4Sided would be nice too…does anyone know where I can find something like that?

I did a search for it already, but the links that suppose to lead to them all seem to be broken…



auto lookat selection .mimics as modo or zbrush style.

when you auto mode:
you will autofocus to selected can be anything.
it will speed up usage of maya sometimes.

because you are free to press ’ f ’ button next to zoom scene.

toggle_ktCurViewLookAt for on / off auto look at selection mode.