PDA

View Full Version : MEL scripts


Pages : [1] 2

sigma
07-14-2002, 04:13 AM
After asking a few of you here I've decided to start off a thread entirely for MEL script submissions. Similar to the Tutorial thread below but entirely focused on Maya's Embedded Language.

Hopefully overtime more and more people will add to this thread building up a nice collection of usefull MEL scripts for both novice and advanced users. Im still learning about MEL and its capabilities, I just started reading the manual. Some of you have more experience with MEL and I hope you can share some tips with the rest of us. To start things off I'll add the MEL script I posted in a previous message so everyone can see it.

Heres a little script for creating a box from curves ( by Chris Clay )


curve -d 1 -p 9.26493 1.180816 1.180816 -p 9.26493 1.180816 -1.180816 -p 6.903298 1.180816 -1.180816 -p 6.903298 1.180816 1.180816 -p 9.26493 1.180816 1.180816 -p 9.26493 -1.180816 1.180816 -p 6.903298 -1.180816 1.180816 -p 6.903298 1.180816 1.180816 -p 6.903298 1.180816 -1.180816 -p 6.903298 -1.180816 -1.180816 -p 6.903298 -1.180816 1.180816 -p 9.26493 -1.180816 1.180816 -p 9.26493 -1.180816 -1.180816 -p 6.903298 -1.180816 -1.180816 -p 6.903298 1.180816 -1.180816 -p 9.26493 1.180816 -1.180816 -p 9.26493 -1.180816 -1.180816 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 ; xform -cp;


You can take this script and place it in the Script Editor, then drag & drop it into your Shelf. Now you have a button to create a curve box.

I'll add more soon.

stunndman
07-14-2002, 06:55 AM
- a great site dedicated to MEL with an introduction to MEL - http://www.ewertb.com/maya/mel_intro.html

- the manual - there are two parts in the manual - one is a general description of MEL - and the other one is the MEL Command Reference which documents both the intrinsic MEL commands (like print, match, ...) and procedures that are related to the functionality of Maya (like selecting objects in scenes, creating particles, creating cubes, ...) - their purpose, syntax and semantics

- a great place to learn from are the collected MEL scripts on http://www.highend3d.com/maya/mel/


* a script to scatter objects within bounds and the possibility to apply a random rotation to every duplicate *


proc scatterObject(int $numOfDuplicates,
float $withinMinX,
float $withinMinY,
float $withinMinZ,
float $withinMaxX,
float $withinMaxY,
float $withinMaxZ,
float $rotateMinX,
float $rotateMinY,
float $rotateMinZ,
float $rotateMaxX,
float $rotateMaxY,
float $rotateMaxZ) {

vector $newpos;
vector $newrot;
int $numOfDuplicates = $numOfDuplicates;
int $i = 0;
string $selectedSurface[] = `ls -sl`;
string $newSurface[];
float $x;
float $y;
float $z;

//print("Scatter object(s): " + $selectedSurface + "\n");
for($i = 0; $i < $numOfDuplicates;$i++) {
$newpos = `rand <<$withinMinX,$withinMinY,$withinMinZ>> <<$withinMaxX,$withinMaxY,$withinMaxZ>>`;
$newrot = `rand <<$rotateMinX,$rotateMinY,$rotateMinZ>> <<$rotateMaxX,$rotateMaxY,$rotateMaxZ>>`;
$newSurface = `duplicate $selectedSurface`;
print("New duplicates position: " + $newpos.x + ":" + $newpos.y + ":" + $newpos.z + "\n");
$x = $newpos.x;
$y = $newpos.y;
$z = $newpos.z;
move -a $x $y $z $newSurface;
$x = $newrot.x;
$y = $newrot.y;
$z = $newrot.z;
rotate $x $y $z $newSurface;
}
}

// e.g. 100 duplicates (of selected object) within a 10 by 10 by 10 cube
// all duplicates are rotated randomly within -45 to +45 on all axis
scatterObject(100, 0, 0, 0, 10, 10, 10, -45, -45, -45, 45, 45, 45);




* animated snapshot puts every duplicated object in it's on transformation group which is kind of a pain if you want to make animated snapshots of grouped objects (maybe i missing something here - but it didn't take much to write my own thing)

this quickie will duplicate or instance the selected objects along it's animation


// animated duplicate/instance script
proc animatedDuplication(int $rangeStart, int $rangeEnd, int $numOfDuplicates, int $duplicateOrInstance) {

int $range_start = $rangeStart;
int $range_end = $rangeEnd;
int $num_of_duplicates = $numOfDuplicates;
int $step_size = ($range_end - $range_start) / $num_of_duplicates;
int $i = 0;
int $temp;

currentTime $range_start; // set to range start
string $selectedObjects[]; // to store selected objects to duplicate or instance
$selectedObjects = `ls -sl`; // store selected objects
select $selectedObjects;

while($i <= $num_of_duplicates) {
$temp = $range_start + ($step_size * $i);
currentTime ($temp);
// seleced the objects to duplicate or instance
select $selectedObjects;
if($duplicateOrInstance == 0)
{
// dulicate
duplicate;
}
else
{
// instance
instance;
}
$i++;
}
}
// e.g. duplicate the current selection 5 times - evenly distributed between frame 1 and 240
animatedDuplication(1, 240, 5, 0);

stunndman
07-14-2002, 09:09 AM
anyone ever written a game for Maya with MEL - like tetris or some shooter?

another snapshot - this script puts every rigid object that matches the selection into it's distinct collission layer

i'm posting this because it's easy to adapt for any other purpose - like setting any other attribute on a selection of objects


proc putRigidBodiesInDistinctCollissionLayers(string $theSelection, int $theFirstLayer)
{
string $rigids[] = `ls -sl -dag -leaf -type "rigidBody" $theSelection`;
int $cLayer = $theFirstLayer;
string $standIn = "cube";
for ($r in $rigids) {
//setAttr ($r+".collisions") true;
//setAttr ($r+".standIn") 1;
setAttr ($r+".cl") $cLayer ;
$cLayer ++;
}
}
// e.g. put every rigid object that matches the selection "shard*"
// in it's own collission layer - starting with collission layer 1
putRigidBodiesInDistinctCollissionLayers("shard*", 1);

graphiouz
07-14-2002, 12:32 PM
Dudes and dudetts!
I have to say that this is a freaking awesome place!
Keep it up.

.

InnerVortex
07-14-2002, 01:36 PM
great stuff dud:)
now for some REALLY n00b stuff.. well.. im noob so..
this will make a light to blink with time, well is an expression i think it can be aplied here.. as for this is for n00bs im gonna explain it all.. (as i wished some one did it to me, anyways rtfm)

1 Create a point light(doesnt need to be point.. but do that for now:p)

2 in the channel box click intensity right click and click expressions...

3 in the Expression Editor write
code:

pointLightShape1.intensity = rand ( 0.4 , 0.6 );

yes.. one line.. pretty simple, then hit creat and play, the light will blink, this line is pretty self explanatory, the right atrr to use apears in the Selected Obj & Attr line in the Expression Editor, so just play with it.
well.. ill not post any more thing like that.. or ill be killed by some pro:D this is just for really n00b ones.. dont sue me!

ACFred
07-14-2002, 11:58 PM
InnerVortex, don't be afraid to post what you learn along the way. There will definitely be people just starting out who would love to know the simple tricks to make their lives easier. I'll definitely post some when I have time.
This list should is for the pro and novice alike, so keep the posts coming!

alexx
07-15-2002, 04:45 PM
cool idea with the thread..

just to get it started:
here a small script that deals with particles. i found it quite hard to get into scripting them, since the references are quite rare.

here a script that takes a system of existing particles and a 3D texture node (like crater e.g.) and it assigns the particles the color from the 3d texture node. even in hardware buffer :)


the image shows the idea. but careful! it is not the fastest one, since the color gets rendered (!)

cheers

alexx


//********************************************
// color particles 3D
//
// author: alexx (bigott@gmx.de)
//
// date: 25.10.2001
// last change: 25.10.2001
//
// description:
// make it possible to have particles get the color from 3D textures
//
//
// usage:
// create a particle system and a 3D texture
// select the particles first and then the 3D shader node.
// run the script and see the colors :)
//
// tip:
// The particles MUST have the rgbPP attribute


// to see in the script editor how many particles have been processed.
// feedback after value
int $feedbackCount = 100;

int $i;
int $partCount;
int $selSize;

string $part;
string $part3D;
float $color[3];
float $partPos[3];

string $sel[];

//select particle Shape node (! not really user proof !)
$sel = `ls -sl -dag -s`;
$part = $sel[0];

//select 3D Shader
$sel = `ls -sl`;
$selSize = size($sel);
$part3D = $sel[1];

print($sel);

//allow only one Particle Object
if ($selSize != 2)
{
error("Select ONE particle Object first and THEN a 3D shader Node");
}

//make sure the selection tool is active before selecting single particles
// (otherwise a warning will be displayed for each particle)
global string $gSelect; setToolTo $gSelect;


//get Number of particles in system
$partCount = `getAttr ($part+".count")`;


for ($i = 0; $i <$partCount ; $i++)
{
//select each particle and get its world position
select ($part+".pt["+$i+"]");
$partPos = `getParticleAttr -at wps`;

//give the world position to the 3d shader and evaluater the color at the given position
setAttr ($part3D+".rpc") ($partPos[0]) ($partPos[1]) ($partPos[2]);
$color = `getAttr ($part3D+".outColor")`;

// now color the particle with the result
setParticleAttr -at rgbPP -vv ($color[0]) ($color[1]) ($color[2]);


// visual feedback for process
if (($i % $feedbackCount) == 0)
{
print("\n"+$i+" particles of "+$partCount+" processed");
}
}

select -clear;
print("\n\n----- Particles colored.\n");

//**************************************************

stunndman
07-15-2002, 05:58 PM
i think we should paste mel scripts - links are prone to die

that's just a proposal - there are so many threads i've been searching up with so many dead links (mostly to pictures) - that's a pitty

[edited]
there's a vB tag especially for posting code - it will use a smaller monospaced font that makes it easy to read code - enclose your code with the ubb tags

[ code ]
your code goes here
[ /code ]

remove the spaces within the brackets - i don't know how to escape vB tags properly

svenip
07-15-2002, 06:08 PM
most of the scripts will be way to big to post them directly here i guess. sigma, is there a place on cgtalk we can upload the scripts. so it can stay foreever ????

stunndman
07-15-2002, 06:12 PM
wouldn't that defeat the purpose? - paste them and comment them - if anyone wants to publish a script they can do it at highend3d anyway and link there

but where's the sex then?


just my 2 €cent :thumbsup:

svenip
07-15-2002, 06:16 PM
yes sure :) but the most of them will be really to big for posting here and comment, because of the character limit. :hmm:

stunndman
07-15-2002, 06:20 PM
word! if they exceed the limit

here's a link for the german speaking audience - a li'l tutorial on MEL basics

http://216.40.198.154/content/mayaforum/9054

alexx
07-15-2002, 06:21 PM
hey stuundman,

thanx a lot for the editing tip.. really missed that button :)

i am with you concerning the posting style but i think when it comes to some bigger scripts, i think svenip is right.. a structured script is fast over some hundred lines and that will spoil the complete thread besides the fact we cant post too many lines.

but asking for a place to put them here on the server might be a good idea.

so far

alexx

sigma
07-15-2002, 07:15 PM
If scripts get too big you can always copy the text to a text file ( notepad ) and attach the file to your message. You can also attach zip files. The links wont go dead that way.

alexx
07-15-2002, 08:10 PM
Originally posted by InnerVortex
well.. ill not post any more thing like that.. or ill be killed by some pro:D this is just for really n00b ones.. dont sue me! [/B]

hell.. i wished i had examples like that in the beginning.
this is far from something that you should not post.. a lot mel starters dont know any good point to start from. and this definitely is one. keep it coming!

alexx
07-15-2002, 08:18 PM
one of the coolest places for tips and tricks for mel.
such a lot of useful explanations and tips.. this really helped me over some sleepless nights :)

http://www.ewertb.com/maya/

stunndman
07-15-2002, 08:30 PM
a handy one, maybe someone can add a read out for the value data types this one doesn't print out


// list all readable attributes for the named node, if showExtendedInfo is set to true (anything except 0) the attribute's type and value (if possible) will be appended
proc lsAttributesForNode(string $theNodeName, int $showExtendedInfo) {
string $eachParameter;
string $NodeName = $theNodeName;
string $NodeAttributes[] = `listAttr -read $NodeName`;
string $NodeAttributeType;

for ($eachParameter in $NodeAttributes) {
// query attribute's type
$NodeAttributeType = `getAttr -type ($NodeName + "." + $eachParameter)`;
print($NodeName + "." + $eachParameter + " ");
if($showExtendedInfo)
{
switch ($NodeAttributeType)
{
case "byte":
// pass on
case "long":
// pass on
case "enum":
// pass on
case "enum":
// pass on
case "bool":
// pass on
case "float":
// pass on
case "string":
print("[value = \"" + `getAttr ($NodeName + "." + $eachParameter)` + "\"]");
break;
default:
print("[value = i'm not yet smart enough to handle this one]");
break;
}
print(",[type = \"" + $NodeAttributeType + "\"]");
}
print("\n"); // line feed
}
}
// e.g. list all attributes, values and types from the default lambert1 shader node
lsAttributesForNode("lambert1", 1);

alexx
07-15-2002, 08:39 PM
doesnt the DG node reference in the manuals derive this one obsolete?

stunndman
07-15-2002, 08:43 PM
Originally posted by alexx
doesnt the DG node reference in the manuals derive this one obsolete?

hmm, i have no clue what you are referring to

maybe it is - are you referring to a MEL command that already does this job?

alexx
07-15-2002, 08:47 PM
nope.

in the online docs to maya there is a thing calle "DG nodes reference" which holds all the information to a specific node and all its attributes.
e.g. you want to change the values in the render globals from a mel script: you wont get any helpfull feedback in the script editor. but al can be found there under "defaultRendergloabsl"..

have a look. there is even some info in, that is not in the regular manuals. very handy!

cheers

alexx

stunndman
07-15-2002, 08:47 PM
ahh, got it - well, my manual doesn't show me the current (live) values of the node's attribute yet :) - would be nice though if someone could make a link to the html documentation showing the documentation of the currently selected node and it's active values

...
let me add - i'm using this one primarily for developing scripts - selecting nodes and looking up attributes in the attribute editor (opening the panes) can be tedious if i want to quickly verify conditions

alexx
07-15-2002, 08:52 PM
in the hypershade that is already there..
right click on the bottom of a node and the DG node help will pop up when you select the "help" line at the very bottom

alexx
07-17-2002, 04:15 PM
here are some really handy ones:

fromNativePath (windows to unix path string conversion)

toNativePath (windows to unix path string conversion)

filterExpand (expand selections like .cv[1:12][2:13] to single occurances)

encodeString (encode a string to escape characters like \ " )

baseName (get base name from a path string)
dirName (get the directory from a path string)

cmdFileOutput (writes output to a file)

flushUndo (clear the undo buffer: very handy in scripts that change a lot during execution to prevent overflow)

hope you found one, that you did not already know :)

cheers

alexx

svenip
07-17-2002, 04:22 PM
öäähmm yes some :)

mel is such a wonderfull thing in maya and it makes the real power. wrote a few nice scripts for good old stevie (you know who i mean :) ) but i definitly need to spend more on this :)

svenip
07-18-2002, 04:10 PM
so here's one script i wrote the night long.

then i wanna weight a character and i use the paint weights tool it's difficult to select a joint and rotate him a bit to get another position and look how the skin mooves. i have to leave the paint tool select the joint and rotate it. (i know that there is a way with attrCollection, but attrCollection you first have to set all up)

this script is very easy to handle. there are two ways. you can load in only selected joints or the whole hirarchie of the selected joint. after that you can see your joints in the top window. if you select one you will see all the bound (to this joint) geometry.

the sliders on bottom (X-Axis;Y-Axis;Z-Axis) you can handle the rotations. there are also input fields for the min, max and current. if an attribute is locked, the fields and slider will also be locked.

now you can select a geometry from the list and hit paint. you'll be still able to rotate via the slider then the paint window is open.


i'm still not finished with commenting all out.

comments are very warm welcome :)

svenip

--==edit==--

updated with a more commented file

Mikkel Jans
07-19-2002, 05:42 PM
Don't know if this allready exsist..
Just a little handy script if you are tired of deleting nodes from the Hypergraph.
Select a Node in the Channelbox, execute the script and the node is deleted:


string $Object[] = `ls -sl -tr -s`;
select -d $Object;
delete;
select $Object;

HADES
07-19-2002, 08:24 PM
your script is good svenip but you can simply animate the bone where you working on and when you want to check the result you use your time slider and you can keep paint the weight

svenip
07-19-2002, 09:10 PM
yeah i know HADES :) it lacks a bit of usefullness because there are more ways (as i said via the attrCollection or your way) but it's just a start, i wll add more functions i'm always searching for then i do skinning :)

HADES
07-21-2002, 12:42 AM
cool svenip keep it up...........as l said your script is good but my way of skinnig is with lattice and flexor l got better result in no time with soft skin this take more time to get the same result if you got a tipm for smooth skin or a good tutorail tell me l will try it ...l m working in a 3d bisnees and l lways use this way....maybe if lget a better result in smooth that will be great..........keep it up

bigfatMELon
07-23-2002, 12:09 AM
Here's one of several name handling tools I've knocked out recently. Select any source object with left or right in its name and then a target object. The target will be renamed to that of the source with the opposite side.

For instance. If you select left_ulna and then select another joint and run the script the target joint will become right_ulna.

-----snip-----
proc int itemNthString (string $item, string $array[])
{
int $x;
int $theIndex = -1;

for ($x=0; $x<size($array); $x++)
{
if ($array[$x] == $item)
{
$theIndex = $x;
break;
}
}

return ($theIndex);
}

proc int stringWordPosition (string $item, string $matchString, string $wordChar){
string $tokenList[];
int $position;

tokenize $item $wordChar $tokenList;
$position = (`itemNthString $matchString $tokenList` + 1);

return $position;
}

proc int stringContains (string $theString, string $item){
string $matchString = ($item + "+");
int $returnInt = 0;

if (`match $matchString $theString` == $item){
$returnInt = 1;
}

return $returnInt;
}


global proc string stringReplaceNthWord (string $item, string $replace, int $position, string $wordChar){
string $tokenList[];
string $returnString;
int $x, $y;

tokenize $item $wordChar $tokenList;
$y = size($tokenList);

for ($x=0; $x<$y; $x++){
if ($x != ($position -1)){ //is this replace or copy?
if ($x != ($y-1)) //is this the last word?
{$returnString += ($tokenList[$x] + $wordChar);} //if not, then it's x + a wordChar
else
{$returnString += $tokenList[$x];} //else, it's just x
}
else{ //replace
if ($x != ($y-1))
{$returnString += ($replace + $wordChar);}
else
{$returnString += $replace;}
}

}

return $returnString;
}


global proc liftNflopName (){
string $sel[] = `ls-sl`;
string $side;
string $flopName;

int $position;

if (`stringContains $sel[0] "left"` == 1){
$side = "left";
$position = `stringWordPosition $sel[0] $side "_"`;
$flopName = `stringReplaceNthWord $sel[0] "right" $position "_"`;
}

if (`stringContains $sel[0] "right"` == 1){
$side = "right";
$position = `stringWordPosition $sel[0] $side "_"`;
$flopName = `stringReplaceNthWord $sel[0] "left" $position "_"`;
}

rename $sel[1] $flopName;
}

-jl

iC4
07-23-2002, 02:09 AM
didn't test it yet, but that sounds great bigfatMELon :thumbsup:

-wT-
07-23-2002, 04:20 PM
Originally posted by alexx
...
filterExpand (expand selections like .cv[1:12][2:13] to single occurances)
...

You mean... with filterExpand, I can convert the line .cv[1:12] to .cv[1,2,3,4,5,6,7,8,9,10,11,12]? (Ok can't remember how it was in MEL exactly, but you get the point)

:eek:
Holy *beep* alexx! You're my hero now! :beer:

Warpcat
07-23-2002, 07:06 PM
Since this is the mel thread, here's a little window I map to a hotkey that will bring up a text field to let you search for mel commands. I get tired of slumming through the online reference. Works on w2k, havn't tested it on other platforms... could get hairy the way it sources the paths...

/////////////////////////
//
// UI_melCmdFinder.mel
// Author: Warpcat
// Description
// A little window that opens the help documentation.
//
///////////////////////////

global proc UI_melCmdFinder()
{
if ( `window -exists UI_melCmdFinder` )
deleteUI UI_melCmdFinder;

window -t "MEL Command Finder Window" -rtf 1 UI_melCmdFinder;
columnLayout -adj 1;
textFieldGrp -l "Mel Command Search:" -cc EP_showMelHelp helpField;
button -l "Mel Command Reference Library" -c EP_showMelLibrary;
button -l "Node and Attribute Refernce Library" -c EP_showNodeLibrary;
showWindow;
}

global proc EP_showMelHelp()
{
string $helpCommand = `textFieldGrp -q -tx helpField`;
help -doc $helpCommand;
}

global proc EP_showMelLibrary()
{
showHelp -docs "Commands\\Index\\index.html";
}

global proc EP_showNodeLibrary()
{
showHelp -docs "Nodes\\Index\\indexAlpha.html";
}

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

svenip
07-23-2002, 08:45 PM
that's a really helpfull script warpcat. thank you, it speeds up the process :thumbsup:

:wavey:

ACFred
07-23-2002, 09:01 PM
Hey folks,
Here's a script I wrote yesterday before work. It's based on a lighting TD tool they used to use (may still) at ILM called "solo render". This is for those scenes where you have a ton of lights but just want to see the effect of one or two of them on the scene without having to hide lights or create a bunch of weird layers.
With this, you just click any lights you want to use in the render (though the outliner, viewport, or whatever way you want) and then run soloRender. I have it bound to ALT-r so it's super fast.

I have a few things I'd like to add to it, but here it is. It seems to work well:


// soloRender()
// by Alec Fredericks

global proc soloRender()
{
string $arrayLights[];
string $itemLight;

int $arrayStart = 0;

string $arrayLightVis[];
string $arrayLightVisVal[];
int $visState;

string $pickedLights[] = `ls -sl`;
$arrayLights = `ls -lights`;
for ($itemLight in $arrayLights)
{
$visState = eval("getAttr " + $itemLight + ".visibility");
$arrayLightVis[$arrayStart] = $itemLight;
$arrayLightVisVal[$arrayStart] = $visState;
if (stringArrayCount($itemLight,`listRelatives -s $pickedLights`) > 0)
eval("setAttr " + $itemLight + ".visibility 1");
else
eval("setAttr " + $itemLight + ".visibility 0");
$arrayStart = $arrayStart + 1;
}

renderIntoNewWindow render;

int $sizeArray = size($arrayLightVis);
int $x;
for ($x=0;$x<$sizeArray;$x++)
{
if ($arrayLightVisVal[$x] == 1)
eval("setAttr " + $arrayLightVis[$x] + ".visibility " + $arrayLightVisVal[$x]);
}


clear($arrayLightVis);
clear($arrayLightVisVal);
clear($arrayLights);

} // end proc


Let me know if any of you use this and have problems with it.
I'll probably rewrite this using a matrix instead of two arrays and the coding is a bit sloppy, but...oh, well.
Alec

alexx
07-31-2002, 07:55 PM
Originally posted by -wT-


You mean... with filterExpand, I can convert the line .cv[1:12] to .cv[1,2,3,4,5,6,7,8,9,10,11,12]? (Ok can't remember how it was in MEL exactly, but you get the point)

:eek:
Holy *beep* alexx! You're my hero now! :beer:

yep

a selection like: .cv[1:3]
gets converted and returned to:
.cv[1] .cv[2] .cv[3]

as i said.. i wrote my own script to do that for all occasions before i found the mel command myself..
bit myself in the *beep* ;)

btw.. if there is any need for it i can post a newer version of my "fakeDepth" script that includes particles now as well (since 4.0 does not render particles with z-channel in sw render anymore.. hell knows why)

cheers

alexx

-wT-
08-01-2002, 10:38 AM
Originally posted by alexx


yep

a selection like: .cv[1:3]
gets converted and returned to:
.cv[1] .cv[2] .cv[3]

as i said.. i wrote my own script to do that for all occasions before i found the mel command myself..
bit myself in the *beep* ;)

btw.. if there is any need for it i can post a newer version of my "fakeDepth" script that includes particles now as well (since 4.0 does not render particles with z-channel in sw render anymore.. hell knows why)

cheers

alexx

Yeah, tried it as soon as you posted that, and it worked :)
And yes, I was doing just the same thing, converting them myself with two to three lines of extra code everytime, I think the speed of the script increased around 300% :D
Thanks again ;)

Waboflex
08-07-2002, 05:57 PM
Hey, -wT- and alexx, don't forget the 'flatten' (or -fl) flag, it works like filterExpand but can be used as part of the list command, so the line:

string $templist[] = `ls -fl -sl`;

will put each selected item into its own array entry. Just like filterExpand but even less typing :)

This is a little script I wrote for working with blendshapes, it will transfer the current component selection from one target to another (as long as the topology is the same). It's just two or three loops and a bit of string manipulation, but it's been incredibly useful for the way I work.

(BTW rename to transferSelection.mel to use it).

Wabo.

-wT-
08-07-2002, 06:22 PM
Originally posted by Waboflex
Hey, -wT- and alexx, don't forget the 'flatten' (or -fl) flag, it works like filterExpand but can be used as part of the list command, so the line:

string $templist[] = `ls -fl -sl`;

will put each selected item into its own array entry. Just like filterExpand but even less typing :)

This is a little script I wrote for working with blendshapes, it will transfer the current component selection from one target to another (as long as the topology is the same). It's just two or three loops and a bit of string manipulation, but it's been incredibly useful for the way I work.

(BTW rename to transferSelection.mel to use it).

Wabo.

Yup, that works, and I use the -fl flag all the time, but it's not available when converting from selection to another (Which is crucial in my script), and then you have two choices, either convert the selection from i.e. face to verticles, select all the verts and use the "ls -sl -fl" (Like I did, but is horribly slow), or the much faster way, convert the selection from i.e. face to verticles and the filterExpand the list.
Clever :)

Rudity
08-11-2002, 04:10 AM
I dunno if this one has been posted yet but i use it all the time with paint effects.

This darkens the stroke you have selected, hit it a couple times and if its still not dark enough hit it again. :)

scaleBrushBrightness 0.95 0 ;

turns the brightness down 5 percent everytime, but you can go ahead and change the number to whatever you like. Did i need to tell you pro's that, lol probaly not.

yup this one is alot simpler than everyone elses i read up here. But hey its the only one i know right now.
later guys
Rudity

dmcgrath
08-23-2002, 11:44 PM
then i wanna weight a character and i use the paint weights tool it's difficult to select a joint and rotate him a bit to get another position and look how the skin mooves. i have to leave the paint tool select the joint and rotate it. (i know that there is a way with attrCollection, but attrCollection you first have to set all up) This is from svenip


As a side note (not MEL related) the animation while painting weights. Do something for yourself that is alot more simple.
When painting, animate the joint you are working on first. Just back and forth bending or twisting animation, about 10 to 20 frames. Then you never have to unselect the (paint weights) tool, you only have to move the animaition slider back and forth a little bit and the paint, move the slider, and paint, move the slider, and paint, its much faster try it. You dont have to setup up much animation for this at all. When you finish with the selected joint, dont forget to delete the 2 keyframes and then move to another joint. I think you'll find this much faster...


-dan

HADES
08-25-2002, 08:32 PM
if you check higher in the thread you ll see l already said that check the thread before to put a post

dmcgrath
08-25-2002, 10:53 PM
RELAX HADES

I didnt mean to steal your thunder man, I missed your post, thats all ...

HADES
08-26-2002, 03:15 PM
you better not my thunder can hurt a lot hahaha..............

dannyngan
09-12-2002, 10:01 AM
Hey all! This is my first post to these forums. Been a lurker for a while, and finally got the courage to contribute.

Here is a script (dannyHelper) that I wrote to help with my character rigs. It simulates John Burnett's NullHelper, a 3ds max plugin that I used to use a lot. Basically, it creates a bunch of NURBS shapes that can be used as non-rendering animation controls. Since they're just NURBS curves, they can be easily edited to suit your needs.

I've also included a script that adds a submenu to the Create menu in case you don't want to use shelf items.

It's nothing fancy, but I just felt like sharing this. Please let me know if anyone finds it useful.

TRi-14
10-19-2002, 07:53 AM
MEL rocks! its a must with Maya and can make any effects imaginable!


:bounce: :drool: :thumbsup: :drool: :bounce:

Firas
10-20-2002, 08:05 PM
hi all,

i wanna to share my mell with u,

www.geocities.com/firas3d/smartvtx

danyrey
11-14-2002, 01:44 PM
Ok here are three scripts of mine. They are addressed to workflow issues.
Have a look:



/*
** cameraList.mel
**
** (c) Daniel Rezek 2002
**
** This file comes as is. Use at your own risk.
** If you find any bugs, feel free to email me: danyrey@gmx.net
**
** Decription: dumb window with a list of cameras which you can switch to
**
** Requirements: a PC, Maya ... :)
**
*/

global proc cameraList()
{
window -width 150 -t "Camera List";

string $cameras[] = `listCameras`;

int $i;

scrollLayout;
columnLayout -adjustableColumn true;
radioCollection;

for ($i = 0; $i < size($cameras); $i++) {
string $command = "lookThru " + $cameras[$i];
radioButton -label $cameras[$i] -onc $command;
}

showWindow;
}



/*
** previsHUD.mel
**
** (c) Daniel Rezek 2002
**
** This file comes as is. Use at your own risk.
** If you find any bugs, feel free to email me: danyrey@gmx.net
**
** Description: A HUD for Playblasts, shows a userdefined label and a framecounter
**
** Requirenments: havent found any yet ;) if you have any other "additional" HUDs they might take the same
** same space as mine so change the block and section positioning
**
** Limitations: It not elegant, but works 99%: it does a HUD refresh everytime the view refreshes --> when
** when you playblast a completely still scene, nothing will refresh. Something has to move.
**
*/

global proc previsHUD()
{
if(eval("headsUpDisplay -exists HUD_PrevisDisplay1") || eval("headsUpDisplay -exists HUD_PrevisDisplay2"))
{
print("Deleting PrevisHUD!\n");//debug

headsUpDisplay -rem HUD_PrevisDisplay1;
headsUpDisplay -rem HUD_PrevisDisplay2;
}
else
{
print("Turning PrevisHUD on!\n"); //debug

string $label1;

string $result = `promptDialog
-title "PreVis Hud - Label"
-message "Enter the HUD Label: "
-text "Sxx_Exx" //Szene xx Einstellung xx
-button "OK"
-button "Cancel"
-defaultButton "OK"
-cancelButton "Cancel"
-dismissString "Cancel"`;

if ( $result == "OK" )
{
$label1 = `promptDialog -q`;
}
else
{
string $filelist[] = eval("file -q -list");
$label1 = $filelist[0];
}

headsUpDisplay -section 7
-block 2
-blockAlignment "center"
-label $label1
-labelFontSize "large"
-dataFontSize "large"
HUD_PrevisDisplay1;
headsUpDisplay -section 7
-block 1
-blockAlignment "center"
-label "Frame:"
-labelFontSize "large"
-dataFontSize "large"
-command "currentTime -q"
-atr
HUD_PrevisDisplay2;

}
}




/*
** refEditor.mel V0.1
**
** (c) Daniel Rezek 2002
**
** This file comes as is. Use at your own risk.
** If you find any bugs, feel free to email me: danyrey@gmx.net
**
** Decription: This script is a simple and easy to use Scenefile reference editor.
** It uses the same terminology of Maya in a different way.
** "Replace" means deleting the old reference and adding the new reference.
** "Reload" deletes the reference and loads it again - a real reload.
** "Delete" deletes the reference
** "Save New Revision and Close Window" saves a new revision of this file and deletes the window
** "Add Ref" adds a new reference
**
** Requirements: "plusSave.mel" from Big Idea Productions(download it from highend3d.com)
** http://www.highend3d.com/maya/mel/?section=utilities#1205
**
*/
global proc refEdReplace(string $file)
{
string $newFile = `fileDialog`;
if($newFile == "") return;
file -rr $file;
file -r $newFile;
}

global proc refEdAdd()
{
string $newFile = `fileDialog`;
if($newFile == "") return;
file -r $newFile;
}

proc createRefWindow()
{
string $refs[] = `file -q -r`;
int $count = `size $refs`;
int $i = 0;
if((`window -exists refWin_UI`) == true)
deleteUI refWin_UI;

window -title "Reference File Maker"
-iconName "RefFileMaker"
-widthHeight 200 55
refWin_UI;

rowColumnLayout -numberOfColumns 4
-columnWidth 1 400
-columnWidth 2 50
-columnWidth 3 50
-columnWidth 4 50;
for($i = 0; $i<$count; $i++)
{
text -label $refs[$i] ;
button -label "Replace" -command ("refEdReplace(\"" + $refs[$i] + "\"); refEditor;");
button -label "Delete" -command ("file -rr \"" + $refs[$i] + "\"; refEditor;");
button -label "Reload" -command ("file -rr\"" + $refs[$i] + "\";file -r \"" + $refs[$i] + "\"; refEditor;");
}
setParent ..;

//button -label "Save File and Close Window" -command "file -s; deleteUI refWin_UI;";
button -label "Save New Revision and Close Window" -command "plusSave(0); deleteUI refWin_UI;";
button -label "Add Ref" -command "refEdAdd; refEditor;";
button -label "Refresh" -command "refEditor";

showWindow refWin_UI;
}

global proc refEditor()
{
createRefWindow();
}

ACFred
11-15-2002, 12:42 PM
OK, gotta update the script. Someone just let me know that my other version didn't work....
here's the latest version of soloRender.....


// Name: soloRender()
// By: Alec Fredericks
// Last edited: 10/22/2002

// Description: Inspired by an old lighting TD tool used at ILM. This script allows
// the user to click any light in the scene and render a test with just that light
// affecting the scene. No more turning off lights, hiding them or layering them.
// This script is especially useful if you bind it to a hotkey, such as ALT-r.

// Useage: select any number of lights in your scene and type soloRender into the command line.
// That's it! Attach it to a hotkey and it's even easier.

global proc soloRender()
{
string $arrayLights[];
string $itemLight;
string $lightParent[];

int $arrayCount = 0;

string $arrayLightVis[];
string $arrayLightVisVal[];
int $visState;

string $pickedLights[] = `ls -sl`;
$arrayLights = eval("listRelatives -p (`ls -lights`)");

for ($itemLight in $arrayLights)
{
$visState = `getAttr ($itemLight + ".visibility")`;
$arrayLightVis[$arrayCount] = $itemLight;
$arrayLightVisVal[$arrayCount] = $visState;
if (stringArrayCount($itemLight,$pickedLights) > 0)
setAttr ($itemLight + ".visibility ") 1;
else
setAttr ($itemLight + ".visibility ") 0;

$arrayCount = $arrayCount + 1;
}

renderIntoNewWindow render;

int $sizeArray = size($arrayLightVis);
int $x;
for ($x=0;$x<$sizeArray;$x++)
if ($arrayLightVisVal[$x] == 1)
setAttr ($arrayLightVis[$x] + ".visibility") 1;
else
setAttr ($arrayLightVis[$x] + ".visibility") 0;


clear($arrayLightVis);
clear($arrayLightVisVal);
clear($arrayLights);

} // end proc




go to http://www.community3d.com/scripts/ for more info.

Alec

InnerVortex
11-23-2002, 01:17 PM
hey ACFred this works fine, what about a script to render only selected objects(with all lights or selected lights only)? just an idea cose i cant really code it.

ACFred
11-23-2002, 06:24 PM
hey, that's a good idea! I'll whip that up. It still won't be IPR or batch render capable, but may fit the bill temporarily.

Alec

stunndman
11-28-2002, 12:55 AM
i thought i pass this on

"...

This script detects and removes mRay for Maya nodes from your scene.

Copy the lines below in a text file and save it as mrayNodesCleanup.mel in
your scripts folder.
Start maya, load the scene and type mrayNodesCleanup in the command line.
A dialog should appear.

Hope this helps!

M-

Start from the next line >>>>>>>>>>>>


global proc mrayNodesCleanup()
{
int $numNodes;
string $action;
string $dialog;
string $mrayNodeList[] = `ls -typ mentalrayOptions
-typ mentalrayFramebuffer
-typ mentalrayGlobals
-typ mentalrayItemsList
-typ mentalraySubdivApprox
-typ mentalrayCurveApprox
-typ mentalraySurfaceApprox
-typ mentalrayDisplaceApprox
-typ mentalrayShader
-typ mentalrayText`;

$numNodes = `size ($mrayNodeList)`;

if ($numNodes)
{
$dialog = ("confirmDialog -title \"Confirm\" -message \"" + $numNodes +
" Mental Ray nodes found\" -button \"Delete\" -button \"Cancel\"
-defaultButton \"Cancel\" -cancelButton \"Cancel\" -dismissString
\"Cancel\"");
}else
{
$dialog = "confirmDialog -message \"No Mental Ray nodes found\" -button
\"Close\"";
}

$action = `eval $dialog`;

if ($action == "Delete") delete $mrayNodeList;

}


..."

hom
12-16-2002, 02:33 PM
Hey all, thought I would put up a mel script I was working on here.

Im not a scripting guru so Ive got a few things left to do on it but it should work at the moment. It is a script to help in the maintenance of instances in your scenes.

Hope it works for you.

- John



// --------------------------------------------------------------------------------------------------- //
// Instance Manager 2003 V2.0 J.Lomax
//
// ChangeLOG:
// Fixed Bad UI
//
// Things left to do:
// Tokenize the instanced node, and not display the full dag path.
// Do not make all the parent nodes in the instance path unique.
//
// Usage: place into your scripts directory, and type "jl_instance_manager" in the maya command line
//
// If you have suggestions or comments or fixes for me then please email me: john.lomax@totalise.co.uk
// --------------------------------------------------------------------------------------------------- //

global proc jl_instance_manager()
{
if ( `window -exists jl_window` )
deleteUI -window jl_window;

if (`windowPref -exists jl_window`) windowPref -remove jl_window;

window -width 400 -height 420 -title "JL Instance Manager V 2.0 - John Lomax 2003"
-menuBar true -rtf 0 jl_window;

menu -label "Edit";
menuItem -label "Refresh All"
-enableCommandRepeat false
-command "jl_refresh_windows";
menuItem -label "About"
-enableCommandRepeat false
-command "jl_about_window";
menuItem -label "Exit"
-enableCommandRepeat false
-command "deleteUI -window jl_window";

string $form = `formLayout`;
textScrollList -sc ("jl_update_parent_window; jl_update_button_window") jl_instance_window;
textScrollList -ams false -sc ("textScrollList -e -da jl_instance_window") jl_textscroll2_window;
textScrollList -ams false -sc ("textScrollList -e -da jl_instance_window") jl_textscroll3_window;
setParent $form;

button -label "Make Unique" -align "center" -command "makeunique" jl_apply_button;
button -label "Close" -align "center" -command ("deleteUI -window jl_window") jl_close_button;

formLayout -edit
-af jl_instance_window "top" 5
-af jl_instance_window "left" 5
-ap jl_instance_window "right" 1 50
-ac jl_instance_window "bottom" 5 jl_textscroll3_window

-af jl_textscroll2_window "top" 5
-ap jl_textscroll2_window "left" 1 50
-af jl_textscroll2_window "right" 5
-ac jl_textscroll2_window "bottom" 5 jl_textscroll3_window

-af jl_textscroll3_window "left" 5
-af jl_textscroll3_window "right" 5
-ac jl_textscroll3_window "bottom" 5 jl_apply_button

-af jl_apply_button "bottom" 5
-af jl_apply_button "left" 5
-ap jl_apply_button "right" 1 50

-af jl_close_button "bottom" 5
-ap jl_close_button "left" 1 50
-af jl_close_button "right" 5
$form;

showWindow;
jl_update_instance_window;
}

global proc jl_update_instance_window()
{
textScrollList -e -ra jl_instance_window;
string $object_list[] = jl_find_instance();
string $object;
for ($object in $object_list)
{
string $object_path[] = `ls -allPaths $object`;
$no_of_instances = size($object_path)-1;
$returned_nodetype = `nodeType $object`;
textScrollList -e -append $object jl_instance_window;
// print ($object + " is a " + $returned_nodetype + " Instance" + " and has (" + $no_of_instances + ") Instances \n");
}
}

global proc jl_update_parent_window()
{
textScrollList -e -ra jl_textscroll2_window;
string $object;
string $selected_object[] = `textScrollList -q -selectItem jl_instance_window`;
string $parent_node[] = `jl_find_parent($selected_object)`;
textScrollList -e -ra jl_textscroll2_window;
for ($object in $parent_node)
{
textScrollList -e -ann "hello" -append $object jl_textscroll2_window;
}
}

global proc string[] jl_find_instance()
{
string $all_objects[] = `ls`;
string $object;
string $object_path[];
string $list_of_instances[];
int $counter = 0;

for ($object in $all_objects)
{
string $object_path[] = `ls -allPaths $object`;
if (size($object_path) > 1)
{
$list_of_instances[$counter] = $object;
$counter++;
}
}
return $list_of_instances;
}

global proc string[] jl_find_parent(string $object[])
{
string $parents[] = `listRelatives -ap -f $object`;
return $parents;
}

global proc jl_update_button_window ()
{
textScrollList -e -ra jl_textscroll3_window;
string $selected_nodetype = `jl_selected_nodetype`;
int $no_of_instances = `jl_no_of_instances`;
textScrollList -e -a ("Number Of Instances: " + $no_of_instances) jl_textscroll3_window;
textScrollList -e -a ("Selected Object Nodetype: " + $selected_nodetype) jl_textscroll3_window;
}

global proc string jl_selected_nodetype()
{
string $selected_object[] = `textScrollList -q -selectItem jl_instance_window`;
string $selected_nodetype = `nodeType $selected_object`;
return $selected_nodetype;
}

global proc int jl_no_of_instances()
{
string $selected_object[] = `textScrollList -q -selectItem jl_instance_window`;
string $object_path[] = `ls -allPaths $selected_object`;
int $no_of_instances = `size($object_path)`;
return $no_of_instances;
}

global proc jl_refresh_windows()
{
jl_update_instance_window;
jl_update_parent_window;
textScrollList -e -ra jl_textscroll3_window;
}

// --------------------------------------------------------------------------------------------------- //
// This procedure simply takes any instances and forces duplicates //
// them. Making any instances to non-instanced //
// nodes. This code is based off of Soren 'kurgan' Jacobsen script //
// also callled makeunique. Changed by John Lomax to fit this Script
// I ran into a few problems with the renaming of the instances so I removed
// those bits for now.
// ---------------------------------------------------------------------------------------------------//
global proc makeunique()
{
string $selectedObjects[]= `textScrollList -q -selectItem jl_textscroll2_window`;
print $selectedObjects;

for ($current in $selectedObjects)
{
select $current;
duplicate -un;
delete$current;
} // end of for loop //

jl_refresh_windows();

} // end of procedure makeunique //

global proc jl_about_window()
{
if ( `window -exists jla_window` ) deleteUI -window jla_window;

window -width 250 -height 140 -s 0 -title "About" -rtf 1 jla_window;
columnLayout -adj 1;
text -label "" -align "center";
text -label "JL Instance Manager V2.0" -align "center";
separator -style "none";
text -label "By John Lomax" -align "center";
separator -style "none";
text -label "For Updates Goto: www.johnlomax.com" -align "center";
text -label "" -align "center";
separator -style "none";
showWindow;
}

Giandani
12-19-2002, 05:28 PM
Hiya! :wavey:
I'm quite new to MEL so I'm searching help for a script I need.
I'm searching for something that controls the optical FX attributes (glow, lens flare, halo, etc.) of multiple point lights... (i've got 27 of them and doing the manipulation manually is quite foolish :cry: )
Pleeeeese!!!

Sanctuary
12-25-2002, 11:14 PM
string $currPanel = `getPanel -withFocus`;
if ("" != $currPanel && ("modelPanel" == `getPanel -to $currPanel`))
{
int $isolate_onoff = `isolateSelect -q -state $currPanel`;
switch ($isolate_onoff)
{
case 0:
enableIsolateSelect $currPanel 1;
isolateSelect -state 1 $currPanel;
break;
case 1:
enableIsolateSelect $currPanel 0;
isolateSelect -state 0 $currPanel;
break;
default: break;
}
$isolate_onoff = `isolateSelect -q -state $currPanel`;
print("IsolateView: " + $isolate_onoff + "\n");
} else {
error "No modeling panel selected or invalid.";
}

Sanctuary
12-25-2002, 11:25 PM
string $currPanel = `getPanel -withFocus`;
if ("" != $currPanel && ("modelPanel" == `getPanel -to $currPanel`))
{
int $xrayonoff = `modelEditor -q -xray $currPanel`;
switch ($xrayonoff)
{
case 0: modelEditor -e -xray true $currPanel;
break;
case 1: modelEditor -e -xray false $currPanel;
break;
default: break;
}
$xrayonoff = `modelEditor -q -xray $currPanel`;
print("X-Ray: "+$xrayonoff+"\n");
} else {
error "No modeling panel selected or invalid.";
}

Sanctuary
12-25-2002, 11:26 PM
string $currPanel = `getPanel -withFocus`;
if ("" != $currPanel && ("modelPanel" == `getPanel -to $currPanel`))
{
int $xrayonoff = `modelEditor -q -wos $currPanel`;
switch ($xrayonoff)
{
case 0: modelEditor -e -wos true $currPanel;
break;
case 1: modelEditor -e -wos false $currPanel;
break;
default: break;
}
$wosonoff = `modelEditor -q -wos $currPanel`;
print("WireframeOnShaded: "+$wosonoff+"\n");
} else {
error "No modeling panel selected or invalid.";
}

Sanctuary
12-25-2002, 11:27 PM
string $currPanel = `getPanel -withFocus`;
if ("" != $currPanel && ("modelPanel" == `getPanel -to $currPanel`))
{
int $swf_onoff = `modelEditor -q -swf $currPanel`;
switch ($swf_onoff)
{
case 0: modelEditor -e -swf true $currPanel;
break;
case 1: modelEditor -e -swf false $currPanel;
break;
default: break;
}
$swf_onoff = `modelEditor -q -swf $currPanel`;
print("Smooth Wire: " + $swf_onoff +"\n");
} else {
error "No modeling panel selected or invalid.";
}

dmcgrath
12-27-2002, 08:26 AM
Its another fast way to make a NEATO curve. Run the script and you'll see what it is. I use it as a handle for animation controls. It is now yours to use.
Just a small download off of my w/s

http://www.spatiallight.net/images/curve.mel
or here is the code:
createNode nurbsCurve -n "translateCurve" ;
setAttr -k off ".v";
setAttr ".ove" yes;
setAttr ".cc" -type "nurbsCurve"
3 64 0 no 3
69 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 13.9 14 14.1 15 16 17 18 19
20 21 22 23 24 25 26 27 27.899999999999999 28 28.100000000000001 29 30 31
32 33 34 35 36 37 38 39 40 41 41.900000000000006 42 42.100000000000001 43
44 45 46 47 48 49 50 51 52 53 54 55 56 57 59 59 59
67
-0.17138668534175089 1.6126005155970113 -0.00096101241248183755
-0.17138668534175089 1.6126005155970113 -0.00096101241248183755
-0.17138668534175089 1.6126005155970113 -0.00096101241248183755
-0.17138668534175089 1.6126005155970113 -0.00096101241248183755
-0.70082711498611849 1.6146091563006852 1.4322330726512789e-005
-0.70082711498611849 1.6146091563006852 1.4322330726512789e-005
-0.70082711498611849 1.6146091563006852 1.4322330726512789e-005
0.0059651028543911688 2.6708252186226624 -0.0021292957539785773
0.0059651028543911688 2.6708252186226624 -0.0021292957539785773
0.73759704680752913 1.6091519279540178 -0.0026355415291416384
0.73759704680752913 1.6091519279540178 -0.0026355415291416384
0.73759704680752913 1.6091519279540178 -0.0026355415291416384
0.20815661716316122 1.611160568657692 -0.001660206785933321
0.20815661716316122 1.611160568657692 -0.001660206785933321
0.20815661716316122 1.611160568657692 -0.001660206785933321
0.20815661716316122 1.611160568657692 -0.001660206785933321
-0.00040459662680628907 0.00074813416623790996 4.5195837723251191e-006

1.6176115115058005 0.20082004206818094 -0.0031400756034705157
1.6176115115058005 0.20082004206818105 -0.0031400756034705157
1.6176115115058005 0.20082004206818094 -0.0031400756034705157
1.6176115115058005 0.20082004206818094 -0.0031400756034705157
1.6196193730032542 0.73026120288275487 -0.0035645574927064549
1.6196193730032542 0.73026120288275487 -0.0035645574927064549
1.6196193730032542 0.73026120288275487 -0.0035645574927064549
2.6757103459450997 -0.0094047614200925 -0.0049254172592876344
2.6757103459450997 -0.0094047614200925 -0.0049254172592876344
1.6141642616635092 -0.70816494540990549 -0.0024112927030663922
1.6141642616635092 -0.70816494540990549 -0.0024112927030663922
1.6141642616635092 -0.70816494540990549 -0.0024112927030663922
1.6161721231609629 -0.1787237845953317 -0.0028357745923023314
1.6161721231609629 -0.1787237845953317 -0.0028357745923023314
1.6161721231609629 -0.1787237845953317 -0.0028357745923023314
-0.00040459662680628983 0.00074813416623776435 4.5195837723302148e-006

0.19592705458328433 -1.6135806880255124 0.00092524436944672883
0.19592705458328433 -1.6135806880255124 0.00092524436944672883
0.19592705458328433 -1.6135806880255124 0.00092524436944672883
0.19592705458328433 -1.6135806880255124 0.00092524436944672883
0.7253674842276524 -1.6155893287291867 -5.0090373761579876e-005
0.7253674842276524 -1.6155893287291867 -5.0090373761579876e-005
0.7253674842276524 -1.6155893287291867 -5.0090373761579876e-005
-0.014295905715300344 -2.6716806813188385 0.0021540829583450022
-0.014295905715300344 -2.6716806813188385 0.0021540829583450022
-0.71305667756599544 -1.6101321003825191 0.0025997734861065436
-0.71305667756599544 -1.6101321003825191 0.0025997734861065436
-0.71305667756599544 -1.6101321003825191 0.0025997734861065436
-0.18361624792162776 -1.6121407410861932 0.0016244387428982193
-0.18361624792162776 -1.6121407410861932 0.0016244387428982193
-0.18361624792162776 -1.6121407410861932 0.0016244387428982193
-0.00040459662680628842 0.00074813416623812886 4.5195837723300116e-006

-1.6123534014755181 -0.16647510198907053 0.0031118125906938188
-1.6123534014755181 -0.16647510198907053 0.0031118125906938188
-1.6123534014755181 -0.16647510198907053 0.0031118125906938188
-1.614361262972972 -0.69591626280364427 0.0035362944799297025
-1.614361262972972 -0.69591626280364427 0.0035362944799297025
-1.614361262972972 -0.69591626280364427 0.0035362944799297025
-2.6705768972688526 0.01087848400086594 0.0049235088965418061
-2.6705768972688526 0.01087848400086594 0.0049235088965418061
-1.6089061516332259 0.74250988548901575 0.0023830296902896952
-1.6089061516332259 0.74250988548901575 0.0023830296902896952
-1.6089061516332259 0.74250988548901575 0.0023830296902896952
-1.6109140131306801 0.21306872467444199 0.0028075115795255234
-1.6109140131306801 0.21306872467444199 0.0028075115795255234
-1.6109140131306801 0.21306872467444199 0.0028075115795255234
-1.6109140131306796 0.21306872467444204 0.0028075115795256345
0.089466553479113614 0.032006850390466274 -0.00018615503659995605
0.037030108256880495 -0.033201044697502055 -3.757413389573333e-005
-0.17138668534175083 1.6126005155970111 -0.00096101241248185143
;

toce
12-27-2002, 04:02 PM
those are really usefull; thank you all and keep em coming! :)

pauldryzen
12-28-2002, 06:41 PM
Hi all,

here is my small Script for creating different nurbs control objects.




//-------------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------------//
// SCRIPT: nControlMaker.mel
// AUTHOR: Paul Dreisen
// pauldryzen@web.de
// DATE: December 28, 2002
//
// DESCRIPTION: This script can be used to create controlobjects, which are build out of nurbscurves.
//------------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------------//


// start of script

global proc nControlMaker ()
{
// delete existing window

if ( `window -exists nCtrl` )
deleteUI -window nCtrl;

// create window and layout

window -title "nCtrl" -w 154 -sizeable 0 nCtrl;
columnLayout;

// create buttons

button -l "Box" -c nBox -w 145;
button -l "Box2" -c nBox2 -w 145;
button -l "Locator" -c nLoc -w 145 ;
button -l "Sphere" -c nSphere -w 145 ;
button -l "CLOSE" -c "deleteUI nCtrl" -w 145;

showWindow nCtrl;
}

//-------------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------------//


// creation process for the nurbsLocator

global proc nLoc()

{
createNode nurbsCurve;
setAttr -k off ".v";
setAttr ".cc" -type "nurbsCurve"
1 9 0 no 3
10 0 1 2 3 4 5 6 7 8 9
10
0 1 0
0 0 0
-1 0 0
0 0 0
0 0 -1
0 0 1
0 0 0
1 0 0
0 0 0
0 -1 0
;
pickWalk -d up;
}
//-------------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------------//


// creation process for the nurbsBox2

global proc nBox2()
{
createNode nurbsCurve;
setAttr -k off ".v";
setAttr ".cc" -type "nurbsCurve"
1 13 0 no 3
14 0 1 2 3 4 5 6 7 8 9 10 11 12 13
14
0 1.0504534244537354 0
-0.5 0 0.5
0 -1.0504534244537354 0
-0.5 0 -0.5
0 1.0504534244537354 0
0.5 0 -0.5
0 -1.0504534244537354 0
0.5 0 0.5
0 1.0504534244537354 0
0.5 0 -0.5
0.5 0 0.5
-0.5 0 0.5
-0.5 0 -0.5
0.5 0 -0.5
;
pickWalk -d up;
}

//-------------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------------//


// creation process for the nurbsBox

global proc nBox()

{
createNode nurbsCurve;
setAttr -k off ".v";
setAttr ".cc" -type "nurbsCurve"
1 15 0 no 3
16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16
-0.5 0.5 -0.5
0.5 0.5 -0.5
0.5 0.5 0.5
-0.5 0.5 0.5
-0.5 0.5 -0.5
-0.5 -0.5 -0.5
-0.5 -0.5 0.5
-0.5 0.5 0.5
-0.5 -0.5 0.5
0.5 -0.5 0.5
0.5 0.5 0.5
0.5 -0.5 0.5
0.5 -0.5 -0.5
0.5 0.5 -0.5
0.5 -0.5 -0.5
-0.5 -0.5 -0.5
;
pickWalk -d up;
}

//-------------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------------//


// creation process for the nurbsSphere

global proc nSphere()

{
createNode nurbsCurve;
setAttr -k off ".v";
setAttr ".cc" -type "nurbsCurve"
1 48 0 no 3
49 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
49
0 1 0
2.8102721927325547e-008 0.92387950420379639 -0.3826833963394165
5.1927056432532481e-008 0.70710676908493042 -0.70710670948028564
6.7845967066659796e-008 0.38268342614173889 -0.92387938499450684
7.3435948877431656e-008 0 -0.99999988079071045
6.7845967066659796e-008 -0.38268342614173889 -0.92387938499450684
5.1927056432532481e-008 -0.70710676908493042 -0.70710670948028564
2.8102721927325547e-008 -0.92387950420379639 -0.3826833963394165
0 -1 0
-9.8768948575411741e-009 -0.92387950420379639 0.38268342614173889
-1.8250119637741591e-008 -0.70710676908493042 0.70710670948028564
-2.384493136275978e-008 -0.38268342614173889 0.92387944459915161
-2.5809567816281742e-008 0 0.99999994039535522
-2.384493136275978e-008 0.38268342614173889 0.92387944459915161
-1.8250119637741591e-008 0.70710676908493042 0.70710670948028564
-9.8768948575411741e-009 0.92387950420379639 0.38268342614173889
0 1 0
0.38268345594406128 0.92387950420379639 0
0.70710676908493042 0.70710676908493042 0
0.92387950420379639 0.38268342614173889 0
1 0 0
0.92387950420379639 -0.38268342614173889 0
0.70710676908493042 -0.70710676908493042 0
0.38268345594406128 -0.92387950420379639 0
0 -1 0
-0.3826833963394165 -0.92387950420379639 -1.8225827957962792e-008
-0.70710670948028564 -0.70710676908493042 -3.367693679479089e-008
-0.92387938499450684 -0.38268342614173889 -4.4001033927543176e-008
-0.99999988079071045 0 -4.7626379284793074e-008
-0.92387938499450684 0.38268342614173889 -4.4001033927543176e-008
-0.70710670948028564 0.70710676908493042 -3.367693679479089e-008
-0.3826833963394165 0.92387950420379639 -1.8225827957962792e-008
0 1 0
2.8102721927325547e-008 0.92387950420379639 -0.3826833963394165
5.1927056432532481e-008 0.70710676908493042 -0.70710670948028564
6.7845967066659796e-008 0.38268342614173889 -0.92387938499450684
7.3435948877431656e-008 0 -0.99999988079071045
0.5 0 -0.86602526903152466
0.86602532863616943 0 -0.49999988079071045
1 0 0
0.86602538824081421 0 0.5
0.49999997019767761 0 0.86602538824081421
-2.5809567816281742e-008 0 0.99999994039535522
-0.5 0 0.86602532863616943
-0.86602532863616943 0 0.49999991059303284
-0.99999988079071045 0 -4.7626379284793074e-008
-0.86602526903152466 0 -0.49999997019767761
-0.49999988079071045 0 -0.86602532863616943
7.3435948877431656e-008 0 -0.99999988079071045
;
pickWalk -d up;

}


// end of script

//-------------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------------//
// Copyright Paul Dreisen 2002
//-------------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------------//

Sanctuary
12-28-2002, 09:17 PM
here is an update for UI_melCmdFinder.mel by Warpcat

paste the code in the Script Editor input field, select it and MMB-drag to shelf and you are ready to search :D



/////////////////////////////////////////////////////////////////////////////////
// UI_melCmdFinder.mel
// Author: Warpcat
//
// update by Alin Sfetcu (Sanctuary) on 28-dec-2002
// snct@mymail.ro
// http://www.sanctuary.ro (temp closed)
//
// Description
// ----------------------
// A little window that opens/search the help documentation.
//
// Usage:
// ----------------------
// Type the mel command you want to find in the text box and use the Enter key.
//
// Know BUGS:
// ----------------------
// - to do a second search of the same keyword in the same session you must
// refresh then textbox content. I`ve try to fix this using mel without success,
// seems that the "boolean change state" of the text box is changed only on user
// input, not script input.
//
// solution 1 - add an space and delete it
// solution 2 - close the script and open it again
//
// Updates:
// ----------------------
// - fixed the two buttons commands;
// - added a feedback field;
// (user get a visual notification when keyword is not found);
/////////////////////////////////////////////////////////////////////////////////

global proc UI_melCmdFinder()
{
if ( `window -exists UI_melCmdFinder` ) { deleteUI UI_melCmdFinder; }

window -t "MEL Command Finder Window" -rtf 1 UI_melCmdFinder;

columnLayout -adj 1;
textFieldGrp
-l "Mel Command Search:"
-cc EP_showMelHelp
-ann "Type the MEL command press the Enter key."
helpField;
separator -h 10;
text -l "" feedback;
separator -h 10;
button -l "Open Mel Command Reference Library" -c EP_showMelLibrary;
button -l "Open Node and Attribute Refernce Library" -c EP_showNodeLibrary;
showWindow;
}

global proc EP_showMelHelp()
{
string $helpCommand = `textFieldGrp -q -tx helpField`;

if ( !(catch (`help -doc $helpCommand`)) ) {
text -edit -label "" feedback;
} else {
text -edit -label ( "\"" + $helpCommand + "\" - command not found in Help files !") feedback;
}
}

global proc EP_showMelLibrary()
{
showHelp -docs "Commands/index_letters.html";
}

global proc EP_showNodeLibrary()
{
showHelp -docs "Nodes/index_letters.html";
}

UI_melCmdFinder;




hope you enjoy it, and tkx Warpcat for the ideea, hope you will not be offended by this update

Sanctuary
12-28-2002, 09:30 PM
nice script pauldryzen


btw i`ve release a new update for camSwitcher v4.6 (http://www.highend3d.com/maya/mel/?section=interface#1263) (hosted on highend3d), the script is way to big to put it in here, give it a try

tkx

pauldryzen
12-29-2002, 05:37 PM
Here is another script I made.

Have fun :-)

//-------------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------------//
// SCRIPT: attrMaker
// AUTHOR: Paul Dreisen
// pauldryzen@web.de
// DATE: December 29, 2002
//
// DESCRIPTION: This script can be used to add extra attributes to all selected objects.
// Just put the whole Script into the shelf
//------------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------------//

// start of script

window -title "attribute Maker" -wh 320 104 -sizeable 0 attrMaker;$form = `formLayout -nd 100`;

$col = `columnLayout -adj true`;
textFieldGrp -label "Enter attribute name here" -cw 2 160 attrName; floatFieldGrp -nf 2 -label "Enter Min/Max here" -v1 -5 -v2 10 attrMinMax;
setParent $form;
$b1 = `button -label "Go" -command "addAttrCallback"`;
$b2 = `button -label "Close" -command "deleteUI attrMaker"`;

formLayout -edit
-attachForm $col "top" 5
-attachForm $col "left" 5
-attachForm $col "right" 5
-attachNone $col "bottom"

-attachNone $b1 "top"
-attachForm $b1 "left" 5
-attachPosition $b1 "right" 2 50
-attachForm $b1 "bottom" 5

-attachNone $b2 "top"
-attachPosition $b2 "left" 2 50
-attachForm $b2 "right" 5
-attachForm $b2 "bottom" 5
$form;

showWindow attrMaker;

global proc addAttrCallback() { string $attr = `textFieldGrp -q -text attrName`; float $min = `floatFieldGrp -q -v1 attrMinMax`; float $max = `floatFieldGrp -q -v2 attrMinMax`;

if (size(`ls -sl`))
{ string $sel[] = `ls -sl`;
for ($obj in $sel)
{ addAttr -ln $attr -at double -dv 0 -min $min -max $max -keyable true $obj;
}
}
else
{
warning "no object selected, please select one";
} }

// end of script

//-------------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------------//
// Copyright Paul Dreisen 2002
//-------------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------------//

Byron
01-03-2003, 11:12 PM
Byron's Automatic Unwrap Tools

I made a script that allows to automatically unwrap a polygonal object.

You define the cuts, and/or create special Zones to control the Flow of the UVMesh und click a Button ... et voilà .

You can download it here because its to big to post it:

http://www.highend3d.com/maya/mel/?section=polygon#2075

Bests
Sebastian

svenip
01-08-2003, 03:49 PM
my pointconstraint. let the object stays where it was. just select all targets, shift select the object, run the script.

dwPointConst (http://www2.fh-harz.de/~u13837/dwPointConst.zip)

MrHyde
01-14-2003, 09:32 AM
Hi,
This script will allow you to generate, from your base mesh, a "smoothed" object with "smoothed out" uvs.
It's a beta version because there are limitations. please refer to the readme.txt

French web page:

http://perso.wanadoo.fr/coyhot/Code_SmoothUV.htm

Direct download links ( readme.txt in english )

SmoothUV v.0.9b for Maya 4.0 (http://perso.wanadoo.fr/coyhot/Plugs/Smooth_UV__Maya__4_0.rar)


SmoothUV v.0.9b for Maya 4.5 (http://perso.wanadoo.fr/coyhot/Plugs/Smooth_UV__Maya__4_5.rar)

playmesumch00ns
01-17-2003, 12:49 PM
a couple of useful tools for doing belnd shapes for character animation:

http://www.cgtalk.com/showthread.php?s=&threadid=37993

shashi
01-25-2003, 08:40 AM
hey guys
just wondering if anybody can help me out with this i am looking for a script called --jsOrientJointUI.mel-- i cant find it anywhere
the script helps in aligning the joint orientation during character setup
thanks in advance
code_z3@yahoo.com

shashi
01-25-2003, 08:42 AM
for any body interested in facial animation

http://www.supersnail.com/port/faces/2index.html

tropistic
01-25-2003, 03:07 PM
You can get the script here:

www-viz.tamu.edu/students/gavin/617/jointPage4.htm

although, the site seems down at the moment. Good article too...

Jay

shashi
01-26-2003, 12:54 AM
thankx jay
but dude that site has been down for ages
does any body know any more sites whr i can get this script from




Disce quasi semper victurus; vive quasi cras moriturus"
[Learn as if you were going to live forever; live as if you were going to die tomorrow.]

tropistic
01-26-2003, 05:26 AM
nope, not ages, and matter of fact, it seems to be back up now. give it another try...

Jay

loked
01-26-2003, 06:03 PM
Hey,

I just have a question concerning MEL.

I would like to make a mel script that executes when I select an object. So basically when I select a locator, it executes a script. How would I go about doing this? Is it possible?

Please help!! Thanks.

loked

Byron
01-26-2003, 06:45 PM
There is an MEL-Command which creates a "scriptJob". Everytime a certain event occours, your script will be executed.

I think, the "selection changed" event will be fine for you.

Please refer to the manual for further information :) .

Bests
Byron

loked
01-26-2003, 09:09 PM
Thats exactly what I was looking for. Thanks ALOT:bounce:

stzaske
01-28-2003, 07:40 AM
Okay, DUMB question:

Where is the SCRIPTS directory? I ask because I have the following scripts folders:

C:\Documents and Settings\Steve\My Documents\maya\4.5\scripts
C:\Documents and Settings\Steve\My Documents\maya\scripts
C:\Program Files\AliasWavefront\Maya4.5\scripts
C:\Program Files\AliasWavefront\mental ray for Maya 1.5\scripts


I assume the first folder is the one you are referring to, but why does AW keep reusing this directory name? Makes it confusing.

-=STZ=-

clarix
01-28-2003, 04:36 PM
Originally posted by stunndman
i thought i pass this on

"...

This script detects and removes mRay for Maya nodes from your scene.

Copy the lines below in a text file and save it as mrayNodesCleanup.mel in
your scripts folder.
Start maya, load the scene and type mrayNodesCleanup in the command line.
A dialog should appear.

Hope this helps!

M-

Start from the next line >>>>>>>>>>>>




Hi Stunndman

I tried to delete the MR nodes from my files, but it aint working for me. I get this >>>>// Error: Cannot find procedure "mrayNodesCleanup". //

I put the .mel file in the G:/applications/aliaswavefront/maya 4.5/scripts

Thanks in advance

clarix

stunndman
01-29-2003, 02:29 AM
due to request i have looked up the original thread and packaged the latest version of the script which was posted by Michele Borghi - i will post it on highend3d.com but meanwhile you can get it from http://alienbit.com/shared/GOARemoveMentalRayNodes.mel

// Description: Removes Mental Ray for Maya 1.5 nodes from the loaded scene. The MR 1.5 for Maya (Mayatomr.mll) plugin has be loaded.
// Usage: Open your scene and run GOARemoveMentalRayNodes in your script editor. Save your scene - et voilà.

clarix
01-29-2003, 04:23 AM
[QUOTE]Originally posted by stzaske
Okay, DUMB question:

Where is the SCRIPTS directory? I ask because I have the following scripts folders:

C:\Documents and Settings\Steve\My Documents\maya\4.5\scripts
C:\Documents and Settings\Steve\My Documents\maya\scripts
C:\Program Files\AliasWavefront\Maya4.5\scripts
C:\Program Files\AliasWavefront\mental ray for Maya 1.5\scripts


I assume the first folder is the one you are referring to, but why does AW keep reusing this directory name? Makes it confusing.

-=STZ=- [/QUOTE

I kinda gave up, is not workin for me] :thumbsdow

danyrey
01-29-2003, 03:03 PM
Originally posted by clarix
[QUOTE]Originally posted by stzaske
Okay, DUMB question:

Where is the SCRIPTS directory? I ask because I have the following scripts folders:

C:\Documents and Settings\Steve\My Documents\maya\4.5\scripts <<<<<<<<<<
C:\Documents and Settings\Steve\My Documents\maya\scripts
C:\Program Files\AliasWavefront\Maya4.5\scripts
C:\Program Files\AliasWavefront\mental ray for Maya 1.5\scripts


I assume the first folder is the one you are referring to, but why does AW keep reusing this directory name? Makes it confusing.

-=STZ=- [/QUOTE

I kinda gave up, is not workin for me] :thumbsdow

Have you tried to place the script in the marked(<<<) directory?
If yes either restart Maya so it reads all the scripts in that directory or you go to the script editor, go to the menu and select "Source Script..." and select the script(s).

HTH

danyrey
01-29-2003, 03:12 PM
Here a script for placing objects onto a curve.
Works like "Attach to Motion Path" with 2 differences:
1. Adds an Attribute to the attached object called uValue, which is controlling the uValue of the Motionpath.
2. In case of multiple Objects every object gets his own motionPath Node.

>>>>>>>>>>> Click Here To Download <<<<<<<<<<<< (http://www.fh-furtwangen.de/~rezek/cgtalk/scripts/drAttachObjectsToCurve.mel)

clarix
01-29-2003, 06:54 PM
Originally posted by danyrey
Have you tried to place the script in the marked(<<<) directory?
If yes either restart Maya so it reads all the scripts in that directory or you go to the script editor, go to the menu and select "Source Script..." and select the script(s).

HTH

well since I installed maya on G Drive, I put the script in

G:/ application/aliaswavefront/Maya4.5/scripts

Ok My concern is I can open all my files but since my files have broken MR nodes, MR is not loading properly. When I open an old file I get this message in the script editor:

// Error: line 1: Plug-in, "Mayatomr.mll", was not found on MAYA_PLUG_IN_PATH. //
// Warning: line 1: Unrecognized node type for node 'mentalrayItemsList'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'mentalrayGlobals'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'Draft'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'DraftMotionBlur'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'Preview'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'PreviewMotionblur'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'PreviewCaustics'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'PreviewGlobalIllum'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'PreviewFinalgather'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'Production'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'ProductionMotionblur'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'Window'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'NTSC'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'PAL'; preserving node information during this session. //
// Warning: line 1: Unrecognized node type for node 'mentalrayOptions1'; preserving node information during this session. //
// File read in 3 seconds.



and when I try to excute the script I get this message:

// Error: Unknown object type: mentalrayFramebuffer //

danyrey
01-30-2003, 12:55 PM
hi,
my opinion: i think it better to install scripts to that "My documents/..." folder if you are a single user of that computer, as an administrator i would place it the same spot you are now. When you want to save all your customizations you made on maya, in case of a OS-Reinstall or what ever, you simply backup your maya folders at "My Documents" instead of making a backup of all Mel scripts + downloaded Mel scripts.

Your first error shows that it cant find the plugin. So in the further process of loading the file, Maya can't handle the MR nodes because of the not loaded plugin. Make sure that "Mayatomr.mll" lies in this directory >> g:\application\aliaswavefront\Maya4.5\bin\plug-ins.

-daniel

PS: use Melcomand getenv "MAYA_PLUG_IN_PATH"; to view your plugin Path

clarix
01-30-2003, 04:32 PM
Originally posted by danyrey
hi,
my opinion: i think it better to install scripts to that "My documents/..." folder if you are a single user of that computer, as an administrator i would place it the same spot you are now. When you want to save all your customizations you made on maya, in case of a OS-Reinstall or what ever, you simply backup your maya folders at "My Documents" instead of making a backup of all Mel scripts + downloaded Mel scripts.

Your first error shows that it cant find the plugin. So in the further process of loading the file, Maya can't handle the MR nodes because of the not loaded plugin. Make sure that "Mayatomr.mll" lies in this directory >> g:\application\aliaswavefront\Maya4.5\bin\plug-ins.

-daniel

PS: use Melcomand getenv "MAYA_PLUG_IN_PATH"; to view your plugin Path




sorry danyrey I tried to put it in the g:\application\aliaswavefront\Maya4.5\bin\plug-ins folder, but now I get this error

// Error: (Mayatomr) : couldn't register mrAddAttr //
// Error: No plug-ins loaded - "initializePlugin function failed". //

s|i>3
02-16-2003, 09:42 AM
hey all, im new to mel scripting and just completed my first script. its a global illumination scrip that handles color sampling and what not. id love to get some feed back on it. i set up a page for it at http://www.null3d.net/domeGI

Machismo
02-16-2003, 02:13 PM
Hey a total newbie here and i need help from some of you veterans.

can someone give me a scipt that renames a material to have the same name as the 2d file associated with the color channel. eg. i connect a 2d texture called mef_bricks to a lambert material in the color channel and i want the lambert materials name to be mef_bricks. any help appreciated. thanx
:bounce:

ACFred
02-19-2003, 08:47 PM
string $expList[] = `ls -et "expression"`;
string $exp;
for ($exp in $expList)
if (`match "polySplit[0-9]" $exp` != "")
delete $exp;


After deleting history on a polygon object that has been MJPolyTooled, there are lingering expressions. The code above will get rid of them. I've integrated this into my MJPolyTools dropdown menu to speed up access and you can do that, too.

Alec

ACFred
02-21-2003, 08:07 AM
curve -n "square" -d 1 -p 1 0 1 -p 1 0 -1 -p -1 0 -1 -p -1 0 1 -p 1 0 1;


This simple guy creates a NURBS square made up of contiguous lines instead of Maya's default which is made up of unconnected lines positioned to look like a square. I think this one litte thing is my least favorite thing about Maya. I may need to add the "-knot" flag to it, but it seems to work fine without it.

Sorry if someone already posted this sort of thing.

Alec

jonathan161
02-23-2003, 01:41 AM
Hey
I was wondering if anyone could tell me how to change the particle count in a particleShape after it has been created using a mel command??
Thanks in advance

jonny :)

fango
02-23-2003, 07:32 PM
i m kinda crap with mel, but here s something to assign to one hotkey (thanks to mikkeljans), i use ctrl+e myself . it will extrude an edge if you have an edge selected, a face if a face is selected and a vertex (together) if a vert is selected (and if you have Mj poly tools installed)


if ( size(`filterExpand -sm 32`) > 0 )
{
performPolyChipOff 0 4;
}
if ( size(`filterExpand -sm 34`) > 0 )
{
performPolyChipOff 0 2;
};

if ( size(`filterExpand -sm 31`) > 0 )
{
extrudeVertexTo;
};

Lewi
02-23-2003, 10:44 PM
Hi,does anyone know agood MEL script to mirror a characters pose ? Ive been looking on Highend but cant find one.Just a name of an old one would be a start.Cheers

shimra
02-28-2003, 07:33 AM
man i am just getting into mel and this thread is very helpful. thanks alot. :applause:

wrend
03-07-2003, 09:49 AM
page of my scripts (http://www.users.on.net/neilandbron)

includes scripts like:
animationStreamBlender, railSnap, local pviot Reorient,
kFrame render, targetWeld, Outliner listing modification,
cvWrldLocator, selctionRestrict, stickySelection, nurbs crv-surface intersection tools.

hom
03-16-2003, 09:53 PM
Hi all. This script was inspired by the "Remove mental ray nodes " script. So Id like to give some credit to that author. This script provides a UI to enable you to delete other nodetypes from your scene which can build up over time (Importing etc) and can become a nuisance. These are: Audio, Brush, Script and Mental Ray (Ive included that script into this one). It can help to reduce file size and clutter.

Other nodetypes can be easily added into the script.

Copy the contents into a text editor and save as jl_NodeClean.mel

Hope it works for you.

- John



////////////////////////////////////////////////////////
/* jl_NodeClean (John Lomax 2003) */
/* */
/* Removes specified nodes from the maya */
/* scene. Can be usefull for optimizing scene */
/* sizes and providing "clean" scenes. */
/* */
/* Idea came from the remove mental ray node script */
/* So Id give credit to that author. */
/* */
/* USAGE: */
/* Place in your maya scripts folder. Execute by */
/* typing "jl_NodeClean" in your command line. */
/* */
////////////////////////////////////////////////////////

//////////////////////////////////////////////////
/* Procedure creates the NodeClean UI */
/* */
/* Modify at your own risk - John Lomax */
//////////////////////////////////////////////////

global proc jl_NodeClean()
{
if ( `window -exists jl_window` )
deleteUI -window jl_window;

window -width 400 -height 400 -title "JL_NodeClean"
-menuBar true -rtf 1 jl_window;

menu -label "Edit";
menuItem -label "Exit"
-enableCommandRepeat false
-command "deleteUI -window jl_window";

string $form = `formLayout`;
frameLayout -label "Remove" -bv false NodeFrame;
columnLayout -cat "left" 130;
text -l "" -h 10;
checkBox -label "Mental Ray Nodes" -align "left" jl_mental_ray_button;
checkBox -label "Animation Script Nodes" -align "left" jl_animation_script_button;
checkBox -label "Brush Nodes" -align "left" jl_brush_button;
checkBox -label "Audio Nodes" -align "left" jl_audio_button;
setParent $form;

button -label "Remove" -align "center" -command "jl_checkbox" jl_remove_button;
button -label "Close" -align "center" -command ("deleteUI -window jl_window") jl_close_button;

formLayout -edit
-af jl_remove_button "bottom" 5
-af jl_remove_button "left" 5
-ap jl_remove_button "right" 1 50

-af jl_close_button "bottom" 5
-ap jl_close_button "left" 1 50
-af jl_close_button "right" 5
$form;

showWindow;
}

//////////////////////////////////////////////
/* Procedure peforms the setup of checkboxs */
/* */
/* Modify at your own risk - John Lomax */
//////////////////////////////////////////////

global proc jl_checkbox()
{
string $jl_mental_ray_button = `checkBox -q -v jl_mental_ray_button`;
string $jl_animation_script_button = `checkBox -q -v jl_animation_script_button`;
string $jl_brush_button = `checkBox -q -v jl_brush_button`;
string $jl_audio_button = `checkBox -q -v jl_audio_button`;

if ($jl_mental_ray_button == 1)
mrayNodesCleanup;

if ($jl_animation_script_button == 1)
jl_optimize("script");

if ($jl_brush_button == 1)
jl_optimize("brush");

if ($jl_audio_button == 1)
jl_optimize("audio");
}

/////////////////////////////////////////////
/* Procedure peforms the deleting of nodes */
/* */
/* Modify at your own risk - John Lomax */
/////////////////////////////////////////////

global proc jl_optimize (string $Nodetype)
{
string $action;
string $dialog;
string $Nodes[] = `ls -type $Nodetype`;
string $No_of_Nodes = `size ($Nodes)`;

if ($No_of_Nodes)
{
$dialog = ("confirmDialog -title \"Confirm\" -message \"" + $No_of_Nodes + " " + $Nodetype + " nodes found\"
-button \"Delete\" -button \"Cancel\"
-defaultButton \"Cancel\" -cancelButton \"Cancel\" -dismissString \"Cancel\"");
}
else
{
$dialog = "confirmDialog -message \"No " + $Nodetype + " nodes found\" -button \"Close\"";
}

$action = `eval $dialog`;

if ($action == "Delete") delete $Nodes;
}


//////////////////////////////////////////////
/* Procedure Removes Mental Ray Nodes */
/* Author stunndman */
/* */
/* Modify at your own risk - John Lomax */
//////////////////////////////////////////////

global proc mrayNodesCleanup()

{
int $numNodes;
string $action;
string $dialog;
string $mrayNodeList[] = `ls -typ mentalrayOptions
-typ mentalrayFramebuffer
-typ mentalrayGlobals
-typ mentalrayItemsList
-typ mentalraySubdivApprox
-typ mentalrayCurveApprox
-typ mentalraySurfaceApprox
-typ mentalrayDisplaceApprox
-typ mentalrayShader
-typ mentalrayText`;

$numNodes = `size ($mrayNodeList)`;

if ($numNodes)
{
$dialog = ("confirmDialog -title \"Confirm\" -message \"" + $numNodes +
" Mental Ray nodes found\" -button \"Delete\" -button \"Cancel\"
-defaultButton \"Cancel\" -cancelButton \"Cancel\" -dismissString
\"Cancel\"");
}else
{
$dialog = "confirmDialog -message \"No Mental Ray nodes found\" -button
\"Close\"";
}
$action = `eval $dialog`;

if ($action == "Delete") delete $mrayNodeList;
}

rollmops
03-20-2003, 10:01 AM
I just tried to use your script.
It works good with audio and brush nodes but not with mentalRay.
I got this message: // Error: Unknown object type: mentalrayOptions //
Do I have to install MR?

X-Tender
03-20-2003, 10:08 AM
Yes you Have ;)

MosaFacku
03-20-2003, 07:35 PM
i just wrote a script that automates the set driven key process for fingers. you click the wrist, then the hand controller, and it'll add the finger attribs to the hand controller and then traverse down the hierarchy of the hand, and perform the set driven keys. the script is a bit long to post in this thread, so here's a link.

www.3dpirate.com/scripts/MSautoHands.mel

let me know what you guys think :)

X-Tender
04-02-2003, 09:46 AM
Ho, i dont know it you know this MELScript .. but i found it last night .. it fix the HTML doc of Maya 4.5 .. (remove all the double items and make the tables correct.. e.g. in the MEL command section)

http://www.comet-cartoons.com/toons/melscript.cfm

it works great .. ;)...

-XT

BadKarma
04-10-2003, 07:21 PM
innervortex mate, im more of a newbie then u lol

and i loved your flickering light mel (pointLightShape1.intensity = rand ( 0.4 , 0.6 ); ) - but i was wondering if you knew (or neone else knows) how to slow it down... coz its slighty fast for my dark ally scene...

nehelp will be perfect.

cheers

BadKarma
:beer:

mark_wilkins
04-10-2003, 07:48 PM
BadKarma: look up "noise" instead of "rand." "rand" produces a random number each time it's called, while "noise" will produce numbers that vary randomly but smoothly over a parameter like time.

-- Mark

BadKarma
04-10-2003, 08:22 PM
ahhh alrite man cheers, so im looking up noise, kewl kewl

ohhh ur an author, neva meet one of u people b4 lol

cheers again man.

BadKarma

Sanctuary
04-14-2003, 10:57 PM
Originally posted by rollmops
I just tried to use your script.
It works good with audio and brush nodes but not with mentalRay.
I got this message: // Error: Unknown object type: mentalrayOptions //
Do I have to install MR?


try this :)

delMR v1.0

http://www.highend3d.com/maya/mel/?section=project#2229

Sanctuary
04-14-2003, 11:06 PM
Originally posted by jonathan161
Hey
I was wondering if anyone could tell me how to change the particle count in a particleShape after it has been created using a mel command??
Thanks in advance

jonny :)


you can change particle count only if you emit or kill particles

ajk48n
04-21-2003, 07:47 PM
This is a simple script to match translation and rotation of multiple objects. This could be native to Maya, but I've never found it.

The last selected object will be the one that all objects move and rotate to. You have a choice of translation or rotation.

/************************************************************************************
Match Translation and Rotation

The last selected object will be what the rest of the objects will be matched to.

You have a choice of translation or rotation.

Author: Adam Katz

Modify as much as you want.

Made for Maya 4.5, should work in 4.

**************************************************************************************/




if (`window -exists matchTransWindow`)
{
deleteUI matchTransWindow;
}

int $transSwitch = 0;
int $rotSwitch = 0;

string $matchTranslation = `window -t matchTransWindow`;
columnLayout;

$transOn = `checkBox -l "Translation" -onc "$transSwitch = 1" -ofc "$transSwitch = 0"`;
$rotOn = `checkBox -l "Rotation" -onc "$rotSwitch = 1" -ofc "$rotSwitch = 0"`;


$goNowButton = `button -l "GO NOW"
-c
"MatchTranslation($transSwitch, $rotSwitch);
deleteUI $matchTranslation;"`;



showWindow $matchTranslation;

proc int MatchTranslation(int $matchTransOn, int $matchRotOn)
{

int $tOn = $matchTransOn;
int $rOn = $matchRotOn;

string $selectedObjects[] = `ls -sl`;

if (size($selectedObjects) == 0)
{
print "ERROR - There must be something selected";
return 0;
}


int $lastObject = (size($selectedObjects) - 1);
int $currentObject;

float $trans[] = `xform -worldSpace -q -translation $selectedObjects[$lastObject]`;
float $rot[] = `xform -worldSpace -q -rotation $selectedObjects[$lastObject]`;


for ($currentObject = 0; $currentObject < $lastObject; $currentObject++)
{
if ($tOn)
xform -worldSpace -translation $trans[0] $trans[1] $trans[2] $selectedObjects[$currentObject];
if ($rOn)
xform -worldSpace -rotation $rot[0] $rot[1] $rot[2] $selectedObjects[$currentObject];
}

return 0;

}

playmesumch00ns
05-08-2003, 01:22 PM
This little script was written in response to Lightwavers constantly moaning about their Tab key. Closest thing you can get in Maya, methinks?

//////////////////////////////////////////////////////////////////
// s w i t c h S m o o t h . m e l //
// -- //
// Anders Langlands 2003 //
// //
// Written in ten minutes to shut those goddamn lightwavers up! //
// //
// Usage: select your mesh object and run alSwitchSmooth to //
// toggle between smoothed/non-smoothed versions. Bind //
// to a hotkey (not tab!). To change the level of //
// smoothing, change the value of $alSsNumDivisions, //
// below. //
// //
// Known Issues: Does funny stuff when used on components, but //
// shouldn't cause any errors. If it does, e-mail me //
//////////////////////////////////////////////////////////////////

global int $alSsNumDivisions = 2;


proc alSmoothStuff(string $shp)
{
global int $alSsNumDivisions;
if (`attributeExists "iAmSmoothed" $shp`)
{
// Object has been swicthsmoothed before
int $isSmoothed = `getAttr ($shp+".iAmSmoothed")`;
if ($isSmoothed)
{
// Object is already smoothed
string $psms[] = `listConnections -t polySmoothFace $shp`;
setAttr ($psms[0]+".divisions") 0;
setAttr ($shp+".iAmSmoothed") 0;
}
else
{
// Object has alread been smoothed but is not now
string $psms[] = `listConnections -t polySmoothFace $shp`;
setAttr ($psms[0]+".divisions") $alSsNumDivisions;
setAttr ($shp+".iAmSmoothed") 1;

}
}
else
{
// Object has not been smoothed before
addAttr -ln "iAmSmoothed" -sn "ias" -at bool $shp;
string $psms[] = `polySmooth $shp`;
setAttr ($psms[0]+".divisions") $alSsNumDivisions;
setAttr ($shp+".iAmSmoothed") 1;
}
}


global proc alSwitchSmooth()
{
string $sel[] = `ls -sl`;
for ($o in $sel)
{
if (`nodeType $o` == "transform")
{
string $rels[] = `listRelatives -s $o`;
string $shp = $rels[0];
alSmoothStuff $shp;
}
else
if (`nodeType $o` == "mesh")
{
alSmoothStuff $o;
}
else
{
error "Please select either a mesh shape or its transform";
}
}
}

larryvm
05-13-2003, 01:07 PM
this is a base script to change the nurbs mental aproxx


// mel script to set the teselation of the nurbs surfaces in mental ray
// Fernando Vizoso Martinez
//larry@hbfsolutions.com
// 05-12-2003
// is a basic script for select the surfaceApprox nodes



//to do
// an interface to control all the attributes of the node

global proc fvTeselationMental( float $u, float $v,float $sharp)
{
string $lista[];
$lista=`ls -sl `;
string $elemento;
string $listaMental[];
int $existe;
int $conectado;
string $listaTemp[];
$indice=0;
string $shapes[];
for ($elemento in $lista)
{
$shapes=`pickWalk -d down $elemento`;
$elemento=$shapes[0];

$existe=`attributeQuery -node $elemento -ex miSurfaceApprox`;

if ($existe==1)
{
$listaTemp=`listConnections ($elemento+".miSurfaceApprox")`;
$listaMental[$indice]=$listaTemp[0];
$indice++;
}
}
for ($elemento in $listaMental)
{
setAttr ($elemento+".uSubdivisions") $u;
setAttr ($elemento+".vSubdivisions") $v;
setAttr ($elemento+".sharp") $sharp;
}
}

hom
05-13-2003, 01:42 PM
Heres a fun script that uses the dos commands "net view" and "net send" to create a little messenger program via MEL. Will only work on NT / 2K / XP machines.

It will correctly parse any machines found on a LAN into a contact list so you can send a message to them.

Its only for fun, but hope it works for you.

- John


//////////////////////////////////////////////////////////////////////////
// //
// Maya Messenger V1.0 - John Lomax and Michael Sharpe //
// //
// Description: //
// A simple Mel based usage of Net view and Net send //
// //
// Usage: //
// Place in your scripts folder and launch by typing: //
// //
// "maya_messenger" in your maya command prompt //
// //
// For updates goto \www.johnlomax.com //
// //
//////////////////////////////////////////////////////////////////////////

global proc maya_messenger()
{
if (`windowPref -exists editRootWindow`) windowPref -remove jlm_window;

if (`window -exists jlm_window`) deleteUI -window jlm_window;

window -width 400 -height 150 -title "Maya Messenger V1.0" -menuBar true -rtf 0 jlm_window;

string $form = `formLayout`;
scrollField -ww 1 jl_message;
scrollField -ww 1 -ed 0 jl_message_history;
textScrollList -ams 1 jl_contact_list;
button -label "Send" -align "center" -command ("send_message") mm_send_button;
button -label "Close" -align "center" -command ("deleteUI -window jlm_window") mm_close_button;
setParent ..;

formLayout -edit
-af jl_message_history "top" 1
-af jl_message_history "left" 1
-ap jl_message_history "right" 1 65
-ap jl_message_history "bottom" 1 40

-af jl_message_history "bottom" 1
-af jl_message "left" 1
-ap jl_message "right" 1 65
-ac jl_message "top" 1 jl_message_history
-ac jl_message "bottom" 1 mm_send_button

-af jl_contact_list "top" 1
-af jl_contact_list "right" 1
-ac jl_contact_list "left" 1 jl_message
-ac jl_contact_list "bottom" 1 mm_close_button

-af mm_send_button "bottom" 1
-af mm_send_button "left" 1
-ap mm_send_button "right" 1 50

-af mm_close_button "bottom" 1
-ap mm_close_button "left" 1 50
-af mm_close_button "right" 1
$form;
string $JL_Filemenu = `menu -label "File"`;
menuItem -label "Add Contact" -command ("jl_add_contact") menuItem1;
menuItem -label "Quit" -command ("deleteUI -window jlm_window") menuItem2;
string $JL_Filemenu = `menu -label "Edit"`;
menuItem -label "Refresh Contacts" -command ("jl_refresh_contacts") menuItem3;
menuItem -label "Clear Message History" -command ("jl_remove_message_history") menuItem4;
string $JL_Filemenu = `menu -label "Help"`;
menuItem -label "About Maya Messenger" -command ("jl_about_window") menuItem5;
showWindow;

jl_refresh_contacts;

}

global proc send_message()
{
int $counter;
string $machine_name[] = `textScrollList -q -si jl_contact_list`;
string $message = `scrollField -q -tx jl_message`;

for ($counter = 0 ; $counter < size($machine_name); $counter++)
{
system("net send " + $machine_name[$counter] + " " + $message );
scrollField -edit -it ($machine_name[$counter] + ": " + $message + "\n") jl_message_history;
}
scrollField -edit -tx "" jl_message;
}

global proc jl_add_contact()
{
string $text;
string $result = `promptDialog -title "Add Contact"
-message "Enter Machine Name or IP:"
-button "OK" -button "Cancel"
-defaultButton "OK" -cancelButton "Cancel"
-dismissString "Cancel"`;
if ($result == "OK")
{
$text = `promptDialog -query -text`;
textScrollList -e -a $text jl_contact_list;
}
}

global proc jl_refresh_contacts()
{
textScrollList -e -ra jl_contact_list;

string $net_dump = `system("net view ")`;
int $x;
string $buffer[];
string $buffer2[];
string $test = "\\";

$numTokens = `tokenize $net_dump $buffer`;

print (size($buffer));

for ($x = 0; $x < size($buffer); $x++)
{
string $check = `match "[\\- ]+" $buffer[$x]`;
if ($check != "")
{
string $shorter_string = `substring $buffer[$x] 3 (size($buffer[$x]))`;
$buffer2[$x] = $shorter_string;
}
}

for ($counter = 0; $counter < size ($buffer2) ; $counter ++)
{
textScrollList -e -a $buffer2[$counter] jl_contact_list;
}
}

global proc jl_remove_message_history()
{
scrollField -e -cl jl_message_history;
}

global proc jl_about_window()
{
if ( `window -exists jla_window` ) deleteUI -window jla_window;

window -width 250 -height 140 -s 0 -title "About" -rtf 1 jla_window;
columnLayout -adj 1;
text -label "" -align "center";
text -label "Maya Messenger V1.0" -align "center";
separator -style "none";
text -label "John Lomax and Michael Sharpe" -align "center";
separator -style "none";
text -label "For Updates Goto: www.johnlomax.com" -align "center";
text -label "" -align "center";
separator -style "none";
showWindow;
}

mhovland
06-06-2003, 11:07 PM
Hey All,

I tried out John's maya_messenger, and liked it so much I made some modifications to it, that I think are improvements.

Here is what I did:

V1.1 - modified by Mike Hovland
// mhovland@midwaygames.com
//
// removed the refreshing of the contact list on startup. With a large network like Midways, it was a little slow
// as well as we didn't need ALL the machines in the contact list. To add a contact you must go through the file menu
// and add them manually.
//
// Also locked down the size of the window to 400 x 400.
//
// Added a few more menu items:
// Under File menu:
// added "Save Contacts" and "Load Contacts"
// "Save Contacts" saves a file (maya_messenger_contacts.lst) to the root of C:
// I did it this way to avoid the user deleting their contact list by running Disk Cleanup, and, more importantly, I was lazy.
// "Load Contacts" will load the saved list and refresh your contact list.
//
// Under Edit menu:
// added Remove Contact. This will remove the selected contact from the contact list.
=============
mike hovland
technical artist/MEL monkey
midway games

hom
06-10-2003, 07:11 PM
Thats really cool. I thought about adding an ability to save and load contacts but didnt have the time, so Its great you have put that in.

A couple of suggestions:

Maybe when you add a contact you have the option of browsing available network machines, so you dont have to type the names in.

It would be nice if it detected if you had a saved contact list on startup and automatically loaded that up.

Take it easy.

- John

syntetik
06-17-2003, 11:02 PM
Hi!
I´m absolutely no "MEL-LER", I write some expression only when I have to and I´m new to this stuff.

This is a glittering RUNTIME expression for particle cloud. I thought I would have to write a mel with some array, but I realized it was not necessary (also I haven´t created any array so far):
___________________________________________

if (particleShape.opacityPP <= 0)
particleShape.opacityPP = abs(rand(1));
$temp = particleShape.opacityPP;
particleShape.opacityPP = $temp - 0.01;

___________________________________________

That´s all! but, I´m proud about these 4 lines, because it works just as I wanted. the particles get random opacity and then smoothly disapear one by one, and so on. :)

larryvm
06-20-2003, 07:10 PM
a simple script to move an object to a vector position, can be made as an expresion to constraint the object to any vertex


{
//get the local vertex position
float $post[];
$post=`getAttr pSphere1.vtx[235]`;

//get the vertex tweak
float $teak[];
$teak=`getAttr pSphere1.vrts[235]`;

//get the world matrix from pSphere
float $mat[];
$mat=`getAttr pSphere1.wm `;

//get the vertex real local position
float $posicion[];
$posicion[0]=$post[0]+$teak[0];
$posicion[1]=$post[1]+$teak[1];
$posicion[2]=$post[2]+$teak[2];

float $result[];
$result=`pointMatrixMult $posicion $mat`;

//get the translate ob the object
float $abspos[];
$abspos=`getAttr pSphere1.translate`;

//add to the world position
$result[0]+=$abspos[0];
$result[1]+=$abspos[1];
$result[2]+=$abspos[2];

//move the object
move -a -ws $result[0] $result[1] $result[2] locator1;
}



for any object you only have to change the pSphere for your poly object the vertex num for the one you want and the locator1 for any object

lostpencil
06-26-2003, 07:37 PM
// *************************************************
//
// This routine will change the size of the name field in the Blend Shape Editor
//
//
// Usage:
//
// 1) source the mel script file in the command line:
// source adjustBlend.mel
//
// 2) select blendshape node (click on select button in BlendShape Editor
//
// 3) type in the command line:
// adjustBlend(100);
//
// (where 100 is the size of the blend shape name field)
//
// Author: Paul Mikulecky (paul@lostpencil.com) - use at own
// risk, distribute freely
//
// *************************************************

global proc adjustBlend (int $size)
{
string $mypnl[] = `getPanel -type blendShapePanel`;
if (size($mypnl) == 0)
{
print "No BlendShape Editor is open\n";
}
else
{
for ($i=0; $i<`size($mypnl)`; $i++)
{
string $mytgt[] = `selectedNodes`;
if (`size($mytgt)` == 1)
{
if (`objectType -isType "blendShape" $mytgt[0]`)
{
int $count = 0;
string $allcontrols[] = `lsUI -type control`;
for ($j=0;$j<=`size($allcontrols)`;++$j)
{
if (`gmatch $allcontrols[$j] "*tgtLabel*"`)
{
if ($allcontrols[$j] == $mytgt[0]+"_tgtLabel"+$count)
{
string $myx = $mytgt[0]+"_tgtLabel"+$count;
textField -e -w $size $myx;
$count++;
}
}
}
}
else
print "Please select one blendshape node \n";
}
else
print "Please select one blendshape node \n";
}
};
}

cgcreator
07-02-2003, 10:39 PM
I noticed that someone wanted the ability have the soloRender work with objects too, so I gave it a whorl, hope you don’t mind Alec... let me know if there are any bugs in my scripting.

You can D/L it here or just Ctrl-C and Ctrl-V it.

SoloRender (http://www.cgcreator.com/soloRender.mel)

// Name: soloRender()
// Created By: Alec Fredericks
// Edited By: Keith E. Lackey
// Last Edited: 7/01/2003

// Description: Inspired by an old lighting TD tool used at ILM. This script allows
// the user to click any light in the scene and render a test with just that light
// affecting the scene. No more turning off lights, hiding them or layering them.
// This script is especially useful if you bind it to a hotkey, such as Ctrl-r.

// Edited Description: Added feature to include the selection of geometry in the scene.
// Now you can select either Lights or Geometry and the it will render only that.

// Usage: Select any number of lights or geometry in your scene and type soloRender
// into the command line. That's it! Attach it to a hotkey and it's even easier.

// Examples Of Use:
// 1. Select one or more lights, renders all geometry only with selected lights.
// 2. Select one or more geometry, renders selected geometry with all lights.
// 3. Select one or more lights, and one or more geometry, and it renders
// selected geometry with selected lights.
// 4. Select nothing, and it renders like normal.(Could replace your render hotkey!)


global proc soloRender()
{
string $arrayLights[];
string $itemLight;
string $lightParent[];
string $arrayLightVis[];
string $arrayLightVisVal[];
int $arrayCountLights = 0;
int $visStateLights;

string $arrayGeometry[];
string $itemGeometry;
string $geometryParent[];
string $arrayGeometryVis[];
string $arrayGeometryVisVal[];
int $arrayCountGeometry = 0;
int $visStateGeometry;

string $selectedObjects[] = `ls -sl`;
string $selectedLights[] = eval("listRelatives -p (`ls -sl -dag -lights`)");
string $selectedGeometry[] = eval("listRelatives -p (`ls -sl -dag -geometry`)");
$arrayLights = eval("listRelatives -p (`ls -lights`)");
$arrayGeometry = eval("listRelatives -p (`ls -geometry`)");

if(size($selectedLights) != 0)
{
for ($itemLight in $arrayLights)
{
$visStateLights = `getAttr ($itemLight + ".visibility")`;
$arrayLightVis[$arrayCountLights] = $itemLight;
$arrayLightVisVal[$arrayCountLights] = $visStateLights;
if (stringArrayCount($itemLight,$selectedObjects) > 0)
setAttr ($itemLight + ".visibility ") 1;
else
setAttr ($itemLight + ".visibility ") 0;

$arrayCountLights = $arrayCountLights + 1;
}
};

if(size($selectedGeometry) != 0)
{
for ($itemGeometry in $arrayGeometry)
{
$visStateGeometry = `getAttr ($itemGeometry + ".visibility")`;
$arrayGeometryVis[$arrayCountGeometry] = $itemGeometry;
$arrayGeometryVisVal[$arrayCountGeometry] = $visStateGeometry;
if (stringArrayCount($itemGeometry,$selectedObjects) > 0)
setAttr ($itemGeometry + ".visibility ") 1;
else
setAttr ($itemGeometry + ".visibility ") 0;

$arrayCountGeometry = $arrayCountGeometry + 1;
}
};

renderIntoNewWindow render;

if(size($selectedLights) != 0)
{
int $sizeArrayLights = size($arrayLightVis);
int $x;
for ($x=0;$x<$sizeArrayLights;$x++)
if ($arrayLightVisVal[$x] == 1)
setAttr ($arrayLightVis[$x] + ".visibility") 1;
else
setAttr ($arrayLightVis[$x] + ".visibility") 0;
};

if(size($selectedGeometry) != 0)
{
int $sizeArrayGeometry = size($arrayGeometryVis);
int $x;
for ($x=0;$x<$sizeArrayGeometry;$x++)
if ($arrayGeometryVisVal[$x] == 1)
setAttr ($arrayGeometryVis[$x] + ".visibility") 1;
else
setAttr ($arrayGeometryVis[$x] + ".visibility") 0;

};

clear($arrayLightVis);
clear($arrayLightVisVal);
clear($arrayLights);

clear($arrayGeometryVis);
clear($arrayGeometryVisVal);
clear($arrayGeometry);
};

ACFred
07-02-2003, 11:13 PM
Very cool, Keith. I'd forgotten about that one. One of these days I'll have to rewrite soloRender to make it more robust. It's great that you added to it in the mean time. I'll post your addition to my web site tomorrow.

Alec

Sanctuary
07-02-2003, 11:36 PM
here a little something :) i need your advices/ bug reports before submitting to HighEnd3D

for modelers ...

componentSelector v1.2 (http://www.highend3d.com/maya/mel/?section=modeling#2414)

cgcreator
07-03-2003, 02:47 AM
Here is another script I whipped up real quick... don’t know if someone has already came up with it but I know I use this one a lot... I made this script because I hated the work flow of set driven, which I use constantly in character rigging (i.e. select all driven, open set driven window, select the driver and then load it in) this script takes care of that in one motion.

You can download it here or Copy and Paste it into your Scripts Folder.

setDriver (http://www.cgcreator.com/setDriver.mel)

// Name: setDriver()
// Created By: Keith E. Lackey
// Last Edited: 7/01/2003

// Description: Bypasses the need to load your driver object in seperately.
// Automaticly loads the last select object as your driver.

// Usage: Select all objects that are going to be driven, then shift-select
// the driver object and run the script: setDriver()

global proc setDriver()
{
string $selectedObjects[] = `ls -sl`;
int $numbSelected = size($selectedObjects);

if($numbSelected > 1)
{
SetDrivenKeyOptions;
select -r $selectedObjects[$numbSelected-1];
updateSetDrivenWnd("driver","","");
select -cl;
int $x = 0;
for($x; $x<($numbSelected-1); $x++)
{
select -tgl $selectedObjects[$x];
};
updateSetDrivenWnd("driven","","");
select -cl;
}
else if($numbSelected == 1)
{
SetDrivenKeyOptions;
updateSetDrivenWnd("driven","","");
select -cl;
}
else
{
error "Nothing Selected... Please Select Driven, And Then Driver Object";
}
};

hom
07-18-2003, 05:23 PM
Heres a simple script to emulate the polygon counter from max, allowing budgets to be set for your scene or objects.

http://www.johnlomax.com/polycount.jpg

In the next version I will put on texture budgets, and fix any bugs people may come across :)

Place in your scripts folder and type:

"jl_Polygon_Count"



//////////////////////////////////////////////////
/* Procedure creates the PolyCount UI */
/* */
/* Modify at your own risk - John Lomax */
/* */
/* Visit www.johnlomax.com for updates */
//////////////////////////////////////////////////

global proc jl_Polygon_Count()
{
if (`windowPref -exists jl_window`) windowPref -remove jl_window;

if ( `window -exists jl_window` )
deleteUI -window jl_window;

window -width 330 -height 260 -title "JL Polygon Count V1.0 - John Lomax 2003"
-menuBar true -rtf 1 -s 0 jl_window;

string $form = `formLayout`;
frameLayout -label "Selected Objects" -labelAlign "center" -borderStyle "out" jl_selected_frameLayout;
string $form2 = `formLayout`;
text -label "Budget" -al "right" jl_selected_budget_text;
floatField -cc ("jl_refresh_triangle_count") -v 100 -pre 0 jl_selected_budget;
text -label "Current" -al "right" jl_selected_current_text;
floatField -ed 0 -pre 0 jl_selected_count;
text jl_selected_textfield;
jl_refresh_triangle_count;
int $jobNum = `scriptJob -e "SelectionChanged" jl_refresh_triangle_count -p jl_selected_textfield`;
setParent $form2;
setParent $form;

frameLayout -label "All Objects" -labelAlign "center" -borderStyle "out" jl_all_frameLayout;
string $form3 = `formLayout`;
text -label "Budget" -al "right" jl_all_budget_text;
floatField -cc jl_refresh_all_triangle_count -v 1000 -pre 0 jl_all_budget;
text -label "Current" -al "right" jl_all_current_text;
floatField -ed 0 -pre 0 jl_all_count;
text jl_all_textfield;
jl_refresh_all_triangle_count;
int $jobNumb = `scriptJob -e "SelectionChanged" jl_refresh_all_triangle_count -p jl_selected_textfield`;
setParent $form3;
setParent $form;

button -label "Close" -align "center" -command ("deleteUI -window jl_window") jl_close_button;
setParent $form;

formLayout -edit
-af jl_selected_frameLayout "top" 5
-af jl_selected_frameLayout "left" 5
-af jl_selected_frameLayout "right" 5
-ac jl_selected_frameLayout "bottom" 5 jl_all_frameLayout

-af jl_all_frameLayout "left" 5
-af jl_all_frameLayout "right" 5
-ap jl_all_frameLayout "top" 1 45
-ac jl_all_frameLayout "bottom" 5 jl_close_button

-af jl_close_button "bottom" 5
-ap jl_close_button "left" 5 25
-ap jl_close_button "right" 5 75
-af jl_close_button "right" 5
$form;

formLayout -edit
-af jl_selected_budget_text "top" 5
-ap jl_selected_budget_text "left" 5 25
-ap jl_selected_budget_text "right" 5 50

-af jl_selected_budget "top" 5
-ap jl_selected_budget "left" 5 50
-ap jl_selected_budget "right" 5 100

-ap jl_selected_current_text "left" 5 25
-ap jl_selected_current_text "right" 5 50
-ac jl_selected_current_text "top" 5 jl_selected_budget_text

-ap jl_selected_count "left" 5 50
-ap jl_selected_count "right" 5 100
-ac jl_selected_count "top" 5 jl_selected_budget

-af jl_selected_textfield "left" 5
-af jl_selected_textfield "right" 5
-ac jl_selected_textfield "top" 5 jl_selected_count

$form2;

formLayout -edit
-af jl_all_budget_text "top" 5
-ap jl_all_budget_text "left" 5 25
-ap jl_all_budget_text "right" 5 50

-af jl_all_budget "top" 5
-ap jl_all_budget "left" 5 50
-ap jl_all_budget "right" 5 100

-ap jl_all_current_text "left" 5 25
-ap jl_all_current_text "right" 5 50
-ac jl_all_current_text "top" 5 jl_all_budget_text

-ap jl_all_count "left" 5 50
-ap jl_all_count "right" 5 100
-ac jl_all_count "top" 5 jl_all_budget

-af jl_all_textfield "left" 5
-af jl_all_textfield "right" 5
-ac jl_all_textfield "top" 5 jl_all_count

$form3;

showWindow;
}

global proc jl_refresh_triangle_count()
{
int $selected_count[] = `triangleCounter`;
floatField -e -v $selected_count[0] jl_selected_count;
float $selected_budget = `floatField -q -v jl_selected_budget`;

if ($selected_count[0] < $selected_budget)
{
text -e -bgc 1 1 1 jl_selected_textfield;
text -e -label ("You are currently " + ($selected_budget - $selected_count[0]) + " triangles under your budget") -bgc 1 1 1 jl_selected_textfield;
}
if ($selected_count[0] == $selected_budget)
{
text -e -bgc 0 1 0 jl_selected_textfield;
text -e -label ("You are currently at your selected budget") -bgc 1 1 1 jl_selected_textfield;
}
if ($selected_count[0] > $selected_budget)
{
text -e -bgc 1 0 0 jl_selected_textfield;
text -e -label ("You are currently " + ($selected_count[0] - $selected_budget) + " triangles over your specified budget") jl_selected_textfield;
}
}

global proc jl_refresh_all_triangle_count()
{
int $selected_count[] = `alltriangleCounter`;
floatField -e -v $selected_count[0] jl_all_count;
float $selected_budget = `floatField -q -v jl_all_budget`;

if ($selected_count[0] < $selected_budget)
{
text -e -bgc 1 1 1 jl_all_textfield;
text -e -label ("You are currently " + ($selected_budget - $selected_count[0]) + " triangles under your budget") jl_all_textfield;
}
if ($selected_count[0] == $selected_budget)
{
text -e -bgc 0 1 0 jl_all_textfield;
text -e -label ("You are currently at your selected budget") jl_all_textfield;
}
if ($selected_count[0] > $selected_budget)
{
text -e -bgc 1 0 0 jl_all_textfield;
text -e -label ("You are currently " + ($selected_count[0] - $selected_budget) + " triangles over your specified budget") jl_all_textfield;
}
}


////////////////////////////////////////
// Procedures from Bonus Game tools //
// Modified by me for this script //
// //
////////////////////////////////////////
global proc int[] triangleCounter ()
{
string $names[] = `filterExpand -sm 12` ; // polygon
int $tcountSelected[0];

if (`size( $names )`)
$tcountSelected = `polyEvaluate -t`;
else
$tcountSelected[0] = 0;

return $tcountSelected;
}

global proc int[] alltriangleCounter ()
{
string $all_objects[] = `ls -g`;
string $current_objects[] = `ls -sl`;

select $all_objects;

string $names[] = `filterExpand -sm 12` ; // polygon
int $tcountSelected[0];

if (`size( $names )`)
$tcountSelected = `polyEvaluate -t`;
else
$tcountSelected[0] = 0;

if ($current_objects[0] == 0)
select -cl;
if ($current_objects[0] != 0)
select $current_objects;

return $tcountSelected;
}


Direct Download:
http://www.johnlomax.com/jl_Polygon_Count.zip

- John

Levitateme
07-21-2003, 11:45 PM
i wish this thread was like 40 pages long...oi...

i know some mel. i just put a bunch of commands together.
this script i mostly use after i merge some polygon objects.
it merges the verticies, chekcks for cleanups, softens the normals to a value you prefer, then it deletes history.

////////////////////////
polyMergeVertex -d 0.01 ;

toggleSelMode;
changeSelectMode -object;

polyCleanupArgList 3 { "0","1","1","0","0","0","0","0","0","1e-005","0","1e-005","0","1e-005","0","1","0" };

toggleSelMode;
changeSelectMode -object;

polySoftEdge -a 180 ;

toggleSelMode;
changeSelectMode -object;

DeleteHistory;
delete -ch;
select -cl;

Levitateme
07-27-2003, 04:41 AM
if anyone has played with wings 3d, they knwo about its great great tweak tool


if (`selectPref -q -clickDrag`)
selectPref -clickDrag false;
else
selectPref -clickDrag true;

i have that as part of one of my marking menus. it turns on or off the click drag its exactly like the tweak tool without the radius, i turn it off when i want to start really moving verts very handy. my friend is recompiling the TWEAK plugin that is suppose to be just like wings tweak with fall off and everything. so im just using this until he gets that done.

ToFu
07-30-2003, 09:20 PM
All these great MELs are mostly overwhelming for Ultra-Newbie like myself but is there a MEL or way to have ‘Back, Left and Bottom’ Orthographic Camera setup in addition to the Default Marking menu every time I start Maya or new scene? I know I can flip the cameras or create new ones but it would be nice to have those from the start(like in Max)

boraddd
08-08-2003, 12:30 AM
i`ll copy/paste my post here too... Just to keep mel stuff handy in one place....

Hi all,
I saw this question "how to protect a mb file" recently while reading highend3d`s mel section.
I wrote a mel script to do this. Called `mbLock`.
After you lock a scene with mbLock, it is not possible to save or export anything
from the scene anymore. Exciting huh!?

you download these files,
http://homepagez.com/boraddd/mblock.zip
http://homepagez.com/boraddd/sampleLockedFile.zip
http://homepagez.com/boraddd/source_mblock.zip

How to use:
- Open the scene you wish to lock
- type `$bypassLock=1` in command line
- Open up expression editor
- Copy/paste the mblock.mel here
- Hit the Create button
- Now save your scene (make sure you don`t overwrite the orginal scene)
- done.
Everything will go back to normal after you restart Maya



I`ll tell a little more about how it works and what it does for people with strong mel skills.

mbLock works as an expression first of all. It simply replaces some global procedures defined
when Maya boots up with safe(!) ones. so you can not use `save`, `save as` or any `export` features
for the active maya session.(need to restart maya to clean everything up).
The main challange is to keep those dirty mel gru`s away from hacking mbLock so they can`t enable those
features back. To achieve this, mbLock also disables `script editor`, `command line` and
`expression editor`. If you try to open a scene locked with mblock while in prompt mode(maya -prompt)
it kills the Maya process in the memory. Lock will still be active if you try to import or even reference
the locked file in any other scene. So it is quite difficult (but not impossible) to unlock a scene once
it is locked.

Please send your comments and suggestions.
* Also let me know if you can find a way to hack it.I know one, but not going to tell you ;)

Bora,

Levitateme
08-14-2003, 10:48 PM
My friend Doogie onhere, wrote me a great useful script in about 5 minutes. if you duplicate something you want mirrored while modeling, this also will follow the rotate, translations. It is the same thing that have in 3ds max i belive.




global proc pfDupe ()
{
string $curSel[] = `ls -sl`;
string $dupeObj = $curSel[0] + "_dupe";
instance -n $dupeObj; scale -1 1 1;
parentConstraint -mo $curSel[0] $dupeObj;
}
pfDupe();

playmesumch00ns
08-15-2003, 10:37 AM
Quick revision of this script to counter the errors that occured when you delete history on the object. Also added a window to control number of divisions. Type alSwitchSmoothWin to get the window



/////////////////////////////////////////////////////////////////
// s w i t c h S m o o t h . m e l
// --
// Anders Langlands 2003
// Ver 2.0
// Revised to stop stupid errors when you delete history
// Added a control window so you can change the number of smoothing divisions
//
// Written in ten minutes to shut those goddamn lightwavers up!
//
// Usage: select your mesh object and run alSwitchSmooth to
// toggle between smoothed/non-smoothed versions. Bind
// to a hotkey (not tab!). To change the level of
// smoothing, change the value of $alSsNumDivisions,
// below.
//
// Known Issues: Does funny stuff when used on components, but
// shouldn't cause any errors. If it does, e-mail me
//////////////////////////////////////////////////////////////////

global int $alSsNumDivisions = 2;




/////////////////////////////////////////////////////////////
// Do the sh*t!
/////////////////////////////////////////////////////////////
proc alSmoothStuff(string $shp)
{
global int $alSsNumDivisions;
if (`attributeExists "iAmSmoothed" $shp`)
{
// Object has been swicthsmoothed before
int $isSmoothed = `getAttr ($shp+".iAmSmoothed")`;
if ($isSmoothed)
{
// Object is already smoothed
string $psms[] = `listConnections -t polySmoothFace $shp`;

if (size($psms) == 0)
{
// oversight! we've deleted the history! we can't unsmooth now so we must
// be wanting to smooth again
$psms = `polySmooth $shp`;
setAttr ($psms[0]+".divisions") $alSsNumDivisions;
setAttr ($shp+".iAmSmoothed") 1;
}
else
{
setAttr ($psms[0]+".divisions") 0;
setAttr ($shp+".iAmSmoothed") 0;
}
}
else
{
// Object has alread been smoothed but is not now
string $psms[] = `listConnections -t polySmoothFace $shp`;
if (size($psms) == 0)
{
// oversight! we've deleted the history! we can't unsmooth now so we must
// be wanting to smooth again
$psms = `polySmooth $shp`;
setAttr ($psms[0]+".divisions") $alSsNumDivisions;
setAttr ($shp+".iAmSmoothed") 1;
}
else
{
setAttr ($psms[0]+".divisions") $alSsNumDivisions;
setAttr ($shp+".iAmSmoothed") 1;
}

}
}
else
{
// Object has not been smoothed before
addAttr -ln "iAmSmoothed" -sn "ias" -at bool $shp;
string $psms[] = `polySmooth $shp`;
setAttr ($psms[0]+".divisions") $alSsNumDivisions;
setAttr ($shp+".iAmSmoothed") 1;
}
}

/////////////////////////////////////////////////////////////
// Wrapper - check the selected objects are right
/////////////////////////////////////////////////////////////
global proc alSwitchSmooth()
{
string $sel[] = `ls -sl`;
for ($o in $sel)
{
if (`nodeType $o` == "transform")
{
string $rels[] = `listRelatives -s $o`;
string $shp = $rels[0];
alSmoothStuff $shp;
}
else
if (`nodeType $o` == "mesh")
{
alSmoothStuff $o;
}
else
{
error "Please select either a mesh shape or its transform";
}
}
}

/////////////////////////////////////////////////////////////
// Control window
/////////////////////////////////////////////////////////////
global proc alSwitchSmoothWin()
{
if (`window -ex alSwitchSmoothWindow`) deleteUI alSwitchSmoothWindow;

global int $alSsNumDivisions;

window
-widthHeight 180 85
-title "SwitchSmooth"
alSwitchSmoothWindow
;

frameLayout -l "" -marginWidth 5 mainFrame;
columnLayout -rs 10 mainCol;

intFieldGrp -l "Divisions" -value1 $alSsNumDivisions -cc "$alSsNumDivisions = `intFieldGrp -q -v1 divisionsF`;" -cl2 "left" "left" -ct2 "left" "left" -cw2 80 80 divisionsF;
setParent mainCol;
button -label "SwitchSmooth" -c "alSwitchSmooth" -width 160 -height 30;

showWindow alSwitchSmoothWindow;
}

ajk48n
08-15-2003, 07:30 PM
This is a really simple script, but everyone seems to need to do it. This script checks to see if a window exists, if it does, it deletes it.

proc checkWindow(string $windowName)
{
if (`window -ex $windowName`)
deleteUI $windowName;
}

Levitateme
08-23-2003, 05:34 PM
anyone seen that script that would find if you had triangles on your model? i think it would find ngons also...i always found that relaly helpful. i cant find it on cgtalk anymoer though. anyone have a link or just the script?

ajk48n
08-26-2003, 08:45 AM
Well, this isn't a MEL, but I've been starting with the API, and I made this for someone else, so hopefully it could help someone else out. The plugin adds a value to a float or integer attribute. It works with objects, polygon vertices, or Nurbs CV's. If you had a ball, you could add 3 to the translate X by running:

adding ball.translateX 3

or

adding ball.vtx[3] 1 3 -.5

With a nurbs surface "ball":

adding ballShape.cv[2][5] 1 2 -3.5

Go to

www.geocities.com/ajk48n/Plugins

The zip file has the source code and the file adding.mll for Maya 5.0 and adding45.mll for Maya 4.5

I'm just starting with Maya's API, so the plugin has limitations, but it does work. I tested running it 100,000 times, against running setAttr and getAttr. The plugin ran in about 26 seconds, while the MEL commands took about 56.

There's also a help file to show how to use the command.

Feel free to modify the code, and send any suggestions or advice to ffsmailing@yahoo.com.

ravindra_mo
08-26-2003, 01:46 PM
Hi.. Nice thread... has more than I expected...

any bdy let me know a way of making particles flow on a given curve? without using curveflow? I had posted this in the dynamics section but had no results.

I know it could be done with Mel but Im not an expert at that (any way trying to learn!!) so Im here to bother some bdy who might come up with some cool sctript or some suggetion.

THX....bye

brunodek
08-29-2003, 11:14 AM
Hello,
that's a small mel to create a channel speed and acceleration from any selected channel of any selected node.
Some time it's very usefull.


code :
------------------------------------------------------------------------------

// SpAccChannel.mel Add channel Speed and/or Acceleration for selected objects on selected channels
//Bruno Dekeijser 2000 12 11


global proc SpAccChannel()
{
string $channelist[]=`channelBox -q -sma mainChannelBox`;
string $curcha;
string $selectlist[]=`ls -sl`;
string $current;
for ($current in $selectlist)
{
for ($curcha in $channelist)
{
// addAttr Channels Speed
string $chsns = $curcha+"s";
string $chlns = $curcha+"Speed";
string $curchsns = $current+"."+$chsns;
print ("\nadd channels Speed and Acceleration on "+$curchsns);select -cl; select $current;
addAttr -at "float" -ln $chlns -sn $chsns -k 1 $current;
string $expname = ("exp"+$current+$chlns);
string $expadd = "float $valcurcha = `getAttr "+$current+"."+$curcha+"`;\n";
$expadd = $expadd+"float $valcurcha2 = `getAttr -time (frame-1) "+$current+"."+$curcha+"`;\n";
$expadd = $expadd+$curchsns+" = abs($valcurcha - $valcurcha2);";
expression -s ($expadd) -o $current -ae 1 -uc all -n $expname;
// addAttr Channels Acceleration
string $chsna = $curcha+"a";
string $chlna = $curcha+"Acc";
string $curchsna = $current+"."+$chsna;
print (" "+$curchsna+"\n");select -cl; select $current;
addAttr -at "float" -ln $chlna -sn $chsna -k 1 $current;
$expname = ("exp"+$current+$chlna);
$expadd = "float $valcurcha = `getAttr "+$current+"."+$curcha+"`;\n";
$expadd = $expadd+"float $valcurcha1 = `getAttr -time (frame-1) "+$current+"."+$curcha+"`;\n";
$expadd = $expadd+"float $valcurcha2 = `getAttr -time (frame-2) "+$current+"."+$curcha+"`;\n";
$expadd = $expadd+$curchsna+" = ($valcurcha2 - $valcurcha1)-($valcurcha1 - $valcurcha);";
expression -s ($expadd) -o $current -ae 1 -uc all -n $expname;
}
}
}


__________________
Bruno Dekeijser
Animation setup Maya
bruno@movida3d.com

(B-HOLM)
09-14-2003, 01:15 PM
just made a little annotation script, nothing special but the first useful thing I've written :P


string $selection[] = `ls -sl` ; // current selection
int $objectcounter = size($selection) ; // number of objects selected
int $i ; // for-loop counter

print($objectcounter + " Objects selected.") ;

for($i = 0; $i <= $objectcounter; $i++)
{
float $pos_x = `getAttr ($selection[$i] + ".translateX")` ;
float $pos_y = `getAttr ($selection[$i] + ".translateY")` ;
float $pos_z = `getAttr ($selection[$i] + ".translateZ")` ;

annotate -tx $selection[$i] -p $pos_x ($pos_y + 5) $pos_z $selection[$i] ;
}


oh yea, just select some kind of object and then use the script :D

hom
09-24-2003, 10:00 PM
Hi all, Ive updated my poly / budget count to include texture budgets, and it also writes out at .bud file so you dont have to re-enter info.

More of a use to those game makers out there.

Simply place both scripts in your scripts folder and type:

"jl_budget_count;" in your maya command prompt.

http://www.johnlomax.com/jl_budget_count.zip

- John

safakoner
10-24-2003, 09:24 AM
Hi

This is my second mel script. "Global Polygon Smooth Control V2"
Firstly, I created a mel about poly\smooth divisions att. for poly objects in the scene.

And I added "Smooth on render" property in V2. I want to help from Mr. Bryan Ewert for the property. I hope you like it. :)

Thanks to Bryan Ewert for help on "Smooth on Render" property.


Click here (http://www.safakoner.com/05_source/03_mel/equinox_gpsc_v2.rar) to download .rar file.

/****************************************************************************************
Global Polygon Smooth Control For Maya 5 Version 2.0

Author: Safak Oner (c) 2003
safak@safakoner.com
www.safakoner.com

History
V 1.0 = Global Polygon Smooth Control
V 2.0 = Added "Smooth on Render" property

Run Command = equinox_gpsc;

*****************************************************************************************/

global proc equinox_gpsc()
{
if (`window -q -exists dfs`) deleteUI dfs;
window -w 152 -h 210 -menuBar true -title "equinox_gpsc" -iconName "equinox_gpsc" dfs;

menu -label "About" -tearOff true;;
menuItem -label "About..." -command "about_proc";

//--------------------------------------------------------------------------------
//-- UI

columnLayout;
frameLayout -l "Smooth Level" -cll true -borderStyle "in" -h 163 -w 145;
rowColumnLayout -nc 2 -width 170 -cw 1 70 -cw 2 70 ;

text -label "On Scene" -fn "boldLabelFont" -align "center";
text -label "On Render" -fn "boldLabelFont" -align "center";

button -label "0 - Reset" -w 40 -h 25-command "equinox_gpsc_os 0";
button -label "0 - Reset" -w 40 -h 25-command "equinox_gpsc_or 0";
button -label "1" -w 20 -h 25-command "equinox_gpsc_os 1";
button -label "1" -w 20 -h 25-command "equinox_gpsc_or 1";
button -label "2" -w 20 -h 25-command "equinox_gpsc_os 2";
button -label "2" -w 20 -h 25-command "equinox_gpsc_or 2";
button -label "3" -w 20 -h 25-command "equinox_gpsc_os 3";
button -label "3" -w 20 -h 25-command "equinox_gpsc_or 3";
button -label "4" -w 40 -h 25-command "equinox_gpsc_os 4";
button -label "4" -w 40 -h 25-command "equinox_gpsc_or 4";

setParent..;
setParent..;

//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------

showWindow dfs;
}

//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
//-- COMMANDS


global proc equinox_gpsc_os( int $param )
{
string $psl[] = `ls -type polySmoothFace`;
for ($i in $psl)
{
setAttr ($i + ".divisions") $param;
}
}

//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------


global proc equinox_gpsc_or( int $param )
{
if ( $param > 0 )
{
string $preCommand;
string $postCommand;

string $sor[] = `ls -type polySmoothFace`;

for ($i in $sor)
{
int $divisions = `getAttr ( $i + ".divisions" )`;

$preCommand = $preCommand +
"setAttr " + $i + ".divisions "
+ $param + ";";

$postCommand = $postCommand +
"setAttr " + $i + ".divisions "
+ $divisions + ";";
}

setAttr -type "string" defaultRenderGlobals.preRenderMel
$preCommand;
setAttr -type "string" defaultRenderGlobals.postRenderMel
$postCommand;

}
else
{
setAttr -type "string" defaultRenderGlobals.preRenderMel ("");
setAttr -type "string" defaultRenderGlobals.postRenderMel ("");
}
}

//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------


proc about_proc()
{
confirmDialog -title "About Equinox Tools" -message "Equinox Tools\nGPSC V 2.0\nGlobal Polygon Smooth Control\nSafak Oner Computer Graphics\n\nhttp://www.safakoner.com\nsafak@safakoner.com\n___________________________\n\nThanks to Bryan Ewert for Help\nhttp://www.ewertb.com\n"
-ma "center"
-button "Ok" -defaultButton "Yes"
-cancelButton "No" -dismissString "No";
}

//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
//-- END SCRIPT

BigSky
10-26-2003, 02:15 AM
Hey Levitateme,

Just so your dupe can work across scale as well:

global proc pfDupe()
{

string $curSel[] = `ls -sl`;
string $dupObj = $curSel[0] + "_dupe";
instance -n $dupObj; scale -r -1 1 1;
//relative flag so that your object doesn't scale down if original isn't 1 1 1.
parentConstraint -mo $curSel[0] $dupObj;
scaleConstraint -mo $curSel[0] $dupObj;

}
pfDupe();

:)

safakoner
11-03-2003, 01:21 PM
Hi

Orient joint quickly

/*********************************************
Orient Joint Version 1 For Maya 5

Author: Safak Oner (c) 2003
safak@safakoner.com
www.safakoner.com


Run Command = equinox_oj;

*************************************/
global proc equinox_oj()
{
if (`window -q -exists oj_w`) deleteUI oj_w;
window -w 90 -h 140 -menuBar true -title "Equinox OJ" -iconName "Equinox OJ" oj_w;

menu -label "Window" -tearOff false;;
menuItem -label "Reset Size" -command "window -e -w 194 -h 134 oj_w;";
menuItem -divider true;
menuItem -label "About..." -command "about_oj_w";


columnLayout;
frameLayout -l " Orient Joint" -cll true -borderStyle "in" -h 87 -w 186;
rowColumnLayout -numberOfColumns 3 -cw 1 60 -cw 2 60 -cw 3 60;
text -label "X" -align "center" -fn "tinyBoldLabelFont";
text -label "Y" -align "center" -fn "tinyBoldLabelFont";
text -label "Z" -align "center" -fn "tinyBoldLabelFont";
button -label "90" -w 40 -h 25-command "ojx_90";
button -label "90" -w 20 -h 25-command "ojy_90";
button -label "90" -w 20 -h 25-command "ojz_90";
button -label "- 90" -w 40 -h 25-command "ojx_n90";
button -label "- 90" -w 20 -h 25-command "ojy_n90";
button -label "- 90" -w 20 -h 25-command "ojz_n90";
setParent..;
setParent..;



showWindow oj_w;
}


global proc ojx_90()
{
rotate -r -os 90 0 0;
}

global proc ojy_90()
{
rotate -r -os 0 90 0;
}

global proc ojz_90()
{
rotate -r -os 0 0 90;
}
global proc ojx_n90()
{
rotate -r -os -90 0 0;
}

global proc ojy_n90()
{
rotate -r -os 0 -90 0;
}

global proc ojz_n90()
{
rotate -r -os 0 0 -90;
}


global proc about_oj_w()
{
confirmDialog -title "About Equinox Tool" -message "Orient Joint V 1\n\nEquinox Tools\nSafak Oner Computer Graphics\n\nhttp://www.safakoner.com\nsafak@safakoner.com\n"
-ma "center"
-button "Ok" -defaultButton "Yes"
-cancelButton "No" -dismissString "No";
}

//-- END OF SCRIPT

mhovland
12-03-2003, 05:13 PM
Here is a quick script I whipped up at someones request.

From the script header:

/*
mhShaderPalette.mel - v1.0
by: Mike Hovland
mhovland@midwaygames.com

This script creates a window with 15 separate color swatches. Clicking on a color swatch will create a shader
of that color, and apply it to the current selection (faces or entire object). If the shader already exists,
it will apply the existing shader.

If you want to edit the colors feel free. You will need to make changes in a few places.

The colors swatches are defined in this manner

string $can1 = `canvas -w 25 -h 25 -rgb 1 0 0 -pc "mhApplyShaderToSelection RedShader 1 0 0" redCanvas`;

You will need to change the following values

-rgb <r, g, b> //This is the color of the swatch in the interface
-pc "mhApplyShaderToSelection <New Name for the Shader> <r, g, b>" <New Maya internal name of the color swatch> //This is the command to apply the shader to the selection

Enjoy!
*/

safakoner
12-27-2003, 01:03 PM
Equinox | Image Plane Creator | Beta

/*
//--Equinox Tool Name (c) 2003
Image Plane Creator

//--Version
Beta
For Maya 5.1

//--Author
Safak Oner

//--Web Site
www.safakoner.com

//--E-mail
safak@safakoner.com

//--History
V 1.0 = 12.2003

//--Run Command
eq_ipc;
*/

global proc eq_ipc()
{

if (`window -q -exists ipc_w`) deleteUI ipc_w;

window -menuBar true -maximizeButton false -title " Equinox | Image Plane Creator | Beta" -iconName " Equinox | IPC" -widthHeight 378 259 ipc_w;

menu -label "Window" -tearOff false;;
menuItem -label "Reset Size" -command "window -e -w 387 -h 259 ipc_w;" re_s;
menuItem -divider true;
menuItem -label "About..." -command "aba";

columnLayout ;
frameLayout -label " Planes" -cll true -width 380 fl_planes;

columnLayout -cat "both" 10 -rs 5 -cw 385;
rowColumnLayout -nc 6 -cw 1 75 -cw 2 65 -cw 3 40 -cw 4 65 -cw 5 45 -cw 6 65;
text -l "Front Plane" -fn "boldLabelFont" -align "left";
checkBox -v true -l "Create" -onc "on_front" -ofc "off_front" cb_front;
text -l " Width";
floatField -minValue -0.1 -maxValue 500 -v 1.0 f_w;
text -l " Height";
floatField -minValue -0.1 -maxValue 500 -v 1.0 f_h;

text -l "Side Plane" -fn "boldLabelFont" -align "left";
checkBox -v true -l "Create" -onc "on_side" -ofc "off_side" cb_side;
text -l " Width";
floatField -minValue -0.1 -maxValue 500 -v 1.0 s_w;
text -l " Height";
floatField -minValue -0.1 -maxValue 500 -v 1.0 s_h;

text -l "Top Plane" -fn "boldLabelFont" -align "left";
checkBox -v false -l "Create" -onc "on_top" -ofc "off_top" cb_top;
text -l " Width";
floatField -en false -minValue -0.1 -maxValue 500 -v 1.0 t_w;
text -l " Height";
floatField -en false -minValue -0.1 -maxValue 500 -v 1.0 t_h;
text -vis 0 -l "Options"; text -vis 0 -l ""; text -vis 0 -l ""; text -vis 0 -l ""; text -vis 0 -l ""; text -vis 0 -l "";

separator -style "single"; separator -style "single"; separator -style "single"; separator -style "single"; separator -style "single"; separator -style "single";

text -vis 0 -l ""; text -vis 0 -l ""; text -vis 0 -l ""; text -vis 0 -l ""; text -vis 0 -l ""; text -vis 0 -l "";
text -l "Attribute E." -fn "boldLabelFont" -align "left";
checkBox -v false -l "Not Open" -onc "on_ae" -ofc "off_ae" o_ae;
text -vis 0 -l ""; text -vis 0 -l ""; text -vis 0 -l ""; text -vis 0 -l ""; text -vis 0 -l "";

setParent..;

rowColumnLayout -nc 1 -cw 1 355;
button -l "Create Plane (s)" -ann "Create Plane (s)" -c "c_p" b_c_p;
button -l "Delete Plane (s)" -vis 0 -ann "Delete Plane (s)" -c "d_p" b_d_p;
setParent..;
setParent..;
setParent..;


frameLayout -label " Reference Images" -vis 0 -cll true -width 380 fl_img;

columnLayout -cat "both" 3 -rs 5 -cw 376;
rowColumnLayout -nc 2 -cw 1 80 -cw 2 355;
text -l " Front Image" -vis 0 -fn "boldLabelFont" -align "left" t_f;
attrColorSliderGrp -vis 0 -cw 1 1 -cw 2 60 -l "" m_f;

text -l " Side Image" -vis 0 -fn "boldLabelFont" -align "left" t_s;
attrColorSliderGrp -vis 0 -cw 1 1 -cw 2 60 -l "" m_s;

text -l " Top Image" -vis 0 -fn "boldLabelFont" -align "left" t_t;
attrColorSliderGrp -vis 0 -cw 1 1 -cw 2 60 -l "" m_t;

setParent..;
setParent..;
setParent..;

frameLayout -label " Global Scale" -vis 0 -cll true -width 380 fl_scl;

columnLayout -cat "both" 3 -rs 5 -cw 376;
rowColumnLayout -nc 3 -cw 1 50 -cw 2 230 -cw 3 80;
text -l " Scale" -fn "boldLabelFont" -align "left" t_scl;
floatSliderGrp -field true -v 1 -cw 1 10 -cw 2 50 -cw 3 50 -l "" s_f;
button -l "Finish" -w 120 -ann "Finish" -c "fin_p" ;
setParent..;

showWindow ipc_w;

if(`objExists REF_Planes`)
{
button -e -vis 1 b_d_p;
button -e -en false b_c_p;
warning " | Equinox Warning | : Existing Object = \" REF_Planes \" \n";
}
else
{
window -e -w 387 -h 259 ipc_w;
}
}

global proc on_front()
{
floatField -e -en true f_w;
floatField -e -en true f_h;
}
global proc off_front()
{
floatField -e -en false f_w;
floatField -e -en false f_h;
}

global proc on_side()
{
floatField -e -en true s_w;
floatField -e -en true s_h;
}
global proc off_side()
{
floatField -e -en false s_w;
floatField -e -en false s_h;
}

global proc on_top()
{
floatField -e -en true t_w;
floatField -e -en true t_h;
}
global proc off_top()
{
floatField -e -en false t_w;
floatField -e -en false t_h;
}

global proc on_ae()
{
checkBox -e -l " Open" o_ae;
}
global proc off_ae()
{
checkBox -e -l "Not Open" o_ae;
}

global proc c_p()
{


if(`objExists REF_Planes`)
{
warning " | Equinox Warning | : Existing Object = \" REF_Planes \" \n";
}
else
{



if( `checkBox -q -v cb_front` ) {
polyPlane -w 1 -h 1 -sx 1 -sy 1 -ax 0 1 0 -tx 1 -ch 1;
string $CurSel[]=`ls -sl`;
rename $CurSel[0] Front_Plane;
setAttr "Front_Plane.rotateX" 90;
float $f_w_val = `floatField -q -v f_w`;
float $f_h_val = `floatField -q -v f_h`;
setAttr ("Front_Plane.scaleX") $f_w_val;
setAttr ("Front_Plane.scaleZ") $f_h_val;

string $frontLamb = `shadingNode -asShader lambert`;
select Front_Plane;
hyperShade -assign $frontLamb;
rename $frontLamb REF_Front;

frameLayout -e -vis 0 fl_planes;
frameLayout -e -vis 1 fl_img;
text -e -vis 1 t_f;
attrColorSliderGrp -e -vis 1 -at "REF_Front.color" m_f;
} else {
}


if( `checkBox -q -v cb_side` ) {
polyPlane -w 1 -h 1 -sx 1 -sy 1 -ax 0 1 0 -tx 1 -ch 1;
string $CurSel[]=`ls -sl`;
rename $CurSel[0] Side_Plane;
setAttr "Side_Plane.rotateZ" 90;
float $s_w_val = `floatField -q -v s_w`;
float $s_h_val = `floatField -q -v s_h`;
setAttr ("Side_Plane.scaleX") $s_w_val;
setAttr ("Side_Plane.scaleZ") $s_h_val;

string $sideLamb = `shadingNode -asShader lambert`;
select Side_Plane;
hyperShade -assign $sideLamb;
rename $sideLamb REF_Side;

frameLayout -e -vis 0 fl_planes;
frameLayout -e -vis 1 fl_img;
text -e -vis 1 t_s;
attrColorSliderGrp -e -vis 1 -at "REF_Side.color" m_s;
} else {
}


if( `checkBox -q -v cb_top` ) {
polyPlane -w 1 -h 1 -sx 1 -sy 1 -ax 0 1 0 -tx 1 -ch 1;
string $CurSel[]=`ls -sl`;
rename $CurSel[0] Top_Plane;
float $t_w_val = `floatField -q -v t_w`;
float $t_h_val = `floatField -q -v t_h`;
setAttr ("Top_Plane.scaleX") $t_w_val;
setAttr ("Top_Plane.scaleZ") $t_h_val;

string $topLamb = `shadingNode -asShader lambert`;
select Top_Plane;
hyperShade -assign $topLamb;
rename $topLamb REF_Top;

frameLayout -e -vis 0 fl_planes;
frameLayout -e -vis 1 fl_img;
text -e -vis 1 t_t;
attrColorSliderGrp -e -vis 1 -at "REF_Top.color" m_t;
} else {
}

window -e -w 387 -h 198 ipc_w;
select -cl;
group -em -n REF_Planes;
connectControl s_f REF_Planes.sx REF_Planes.sy REF_Planes.sz;
select REF_Planes;
createDisplayLayer -name "REF_Planes_L";
layerEditorLayerButtonTypeChange REF_Planes_L;
layerEditorLayerButtonTypeChange REF_Planes_L;
frameLayout -e -vis 1 fl_scl;
menuItem -e -command "window -e -w 387 -h 198 ipc_w;" re_s;

if(`checkBox -q -v o_ae`)
{
openAEWindow;
}
else
{
}


if (`objExists Front_Plane`)
{
parent Front_Plane REF_Planes;
}
else
{
}

if (`objExists Side_Plane`)
{
parent Side_Plane REF_Planes;
}
else
{
}

if (`objExists Top_Plane`)
{
parent Top_Plane REF_Planes;
}
else
{
}

select REF_Planes;
fitPanel -selected;
string $currentPanel = `getPanel -withFocus`;
string $panelType = `getPanel -to $currentPanel`;
if ($panelType == "modelPanel"){
modelEditor -edit -da "smoothShaded" -displayTextures on -dl "default" $currentPanel;
print " | Equinox Feedback | : Reference Image Plane(s) Created\n";
}
}
}


global proc d_p()
{

if (`objExists "REF_Front"`)
{
delete REF_Front;
}
else
{
}

if (`objExists "REF_Side"`)
{
delete REF_Side;
}
else
{
}

if (`objExists "REF_Top"`)
{
delete REF_Top;
}
else
{
}
//--
if (`objExists "REF_Planes"`)
{
delete REF_Planes;
}
else
{
}

if (`objExists "REF_Planes_L"`)
{
layerEditorDeleteLayer REF_Planes_L;
}
else
{
}
button -e -en 1 b_c_p;
button -e -vis 0 b_d_p;
print " | Equinox Feedback | : Existing Object Deleted\n";
}


global proc fin_p()
{
select REF_Planes;
fitPanel -selected;
makeIdentity -apply true -t 1 -r 1 -s 1;
select -cl;
window -e -w 387 -h 259 ipc_w;
menuItem -e -command "window -e -w 387 -h 259 ipc_w;" re_s;
deleteUI ipc_w;
print " | Equinox Feedback | : Process Finished\n";
}

global proc aba()
{
int $about_eq_ipc = 250;
if ( `window -exists about_eq_ipc` ) deleteUI about_eq_ipc;
window
-menuBar true
-maximizeButton false
-resizeToFitChildren false
-title " About Equinox Tools"
-iconName " About Equinox Tools"
-wh 300 325
about_eq_ipc;

menu -label "Window" -tearOff false;;
menuItem -label "Reset Size" -command "window -e -w 300 -h 325 about_eq_ipc;";
menuItem -divider true;
menuItem -label "Visit www.safakoner.com" -command "showHelp -a \"http://www.safakoner.com/index.htm\"";


string $form_l = `formLayout -numberOfDivisions 100`;
string $scroll_l =`scrollLayout -hst 16 -vst 16 -childResizable true -minChildWidth $about_eq_ipc`;
columnLayout -adjustableColumn true -rowSpacing 5;

text -label " Equinox Tool Name : " -fn "boldLabelFont" -align "left";
text -label " Image Plane Creator" -align "left";

text -label " Version : " -fn "boldLabelFont" -align "left";
text -label " Beta" -align "left";

separator -style "single";

text -label " Author : " -fn "boldLabelFont" -align "left";
text -label " Safak Oner" -align "left";

text -label " Web Site : " -fn "boldLabelFont" -align "left";
text -label " http://www.safakoner.com" -align "left";

text -label " E-mail : " -fn "boldLabelFont" -align "left";
text -label " safak@safakoner.com" -align "left";

setParent ..;
setParent ..;

string $button_close = `button -label "Close" -command "deleteUI about_eq_ipc"`;

formLayout -edit
-attachForm $scroll_l "top" 4
-attachForm $scroll_l "left" 4
-attachControl $scroll_l "bottom" 4 $button_close
-attachForm $scroll_l "right" 4

-attachNone $button_close "top"
-attachForm $button_close "left" 4
-attachForm $button_close "bottom" 4
-attachForm $button_close "right" 4
$form_l;

showWindow about_eq_ipc;
}

safakoner
12-30-2003, 09:49 PM
Orient Joint V1.5 :bounce:
/*
//Equinox Tool Name (c) 2003
Orient Joint

//Version
1.5
For Maya 5.1

//Author
Safak Oner

//Web Site
www.safakoner.com

//E-mail
safak@safakoner.com

//History
V 1.0 = 10.2003
V 1.5 = 11.2003
"Show Axis" Added

//Run Command
eq_oj;

*/
global proc eq_oj()
{
if (`window -q -exists oj_w`) deleteUI oj_w;
window -w 110 -h 214 -menuBar true -maximizeButton false -title " EQ" -iconName " Equinox OJ" oj_w;

menu -label "Window" -tearOff false;;
menuItem -label "Reset Size" -command "window -e -w 110 -h 214 oj_w;";
menuItem -divider true;
menuItem -label "About..." -command "about_oj_w";

columnLayout;
frameLayout -l "Display Axis" -cll true -borderStyle "in" -h 80 -w 104;
columnLayout -columnAttach "both" 3 -rowSpacing 3 -columnWidth 99;
button -label "Show" -w 70 -h 25 -command "s_on";
button -label "Hide" -w 70 -h 25 -command "s_off";
setParent..;
setParent..;

frameLayout -l " Orient Joint" -cll true -borderStyle "in" -h 87 -w 104;
rowColumnLayout -numberOfColumns 3 -cw 1 33 -cw 2 33 -cw 3 33;
text -label "X" -align "center" -fn "tinyBoldLabelFont";
text -label "Y" -align "center" -fn "tinyBoldLabelFont";
text -label "Z" -align "center" -fn "tinyBoldLabelFont";
button -label "90" -w 40 -h 25-command "ojx_90";
button -label "90" -w 20 -h 25-command "ojy_90";
button -label "90" -w 20 -h 25-command "ojz_90";
button -label "- 90" -w 40 -h 25-command "ojx_n90";
button -label "- 90" -w 20 -h 25-command "ojy_n90";
button -label "- 90" -w 20 -h 25-command "ojz_n90";
setParent..;
setParent..;

showWindow oj_w;
}
global proc s_on()
{
string $iksc[] = `ls -type joint`;
for ($i in $iksc)
setAttr ($i + ".displayLocalAxis") 1;
}
global proc s_off()
{
string $iksc[] = `ls -type joint`;
for ($i in $iksc)
setAttr ($i + ".displayLocalAxis") 0;
}
global proc ojx_90()
{
rotate -r -os 90 0 0;
}

global proc ojy_90()
{
rotate -r -os 0 90 0;
}

global proc ojz_90()
{
rotate -r -os 0 0 90;
}
global proc ojx_n90()
{
rotate -r -os -90 0 0;
}

global proc ojy_n90()
{
rotate -r -os 0 -90 0;
}

global proc ojz_n90()
{
rotate -r -os 0 0 -90;
}

global proc about_oj_w()
{
int $about_oj_w_W = 250;
if ( `window -exists about_oj_w` ) deleteUI about_oj_w;
window
-menuBar true
-maximizeButton false
-resizeToFitChildren false
-title " About Equinox Tools"
-iconName " About Equinox Tools"
-wh 300 325
about_oj_w;

menu -label "Window" -tearOff false;;
menuItem -label "Reset Size" -command "window -e -w 300 -h 325 about_oj_w;";
menuItem -divider true;
menuItem -label "Visit www.safakoner.com" -command "showHelp -a \"http://www.safakoner.com/index.htm\"";


string $form_l = `formLayout -numberOfDivisions 100`;
string $scroll_l =`scrollLayout -hst 16 -vst 16 -childResizable true -minChildWidth $about_oj_w_W`;
columnLayout -adjustableColumn true -rowSpacing 5;


text -label " Equinox Tool Name : " -fn "boldLabelFont" -align "left";
text -label " Orient Joint" -align "left";

text -label " Version : " -fn "boldLabelFont" -align "left";
text -label " 1.5" -align "left";

separator -style "single";

text -label " Author : " -fn "boldLabelFont" -align "left";
text -label " Safak Oner" -align "left";

text -label " Web Site : " -fn "boldLabelFont" -align "left";
text -label " http://www.safakoner.com" -align "left";

text -label " E-mail : " -fn "boldLabelFont" -align "left";
text -label " safak@safakoner.com" -align "left";

setParent ..;
setParent ..;

string $button_close = `button -label "Close" -command "deleteUI about_oj_w"`;

formLayout -edit
-attachForm $scroll_l "top" 4
-attachForm $scroll_l "left" 4
-attachControl $scroll_l "bottom" 4 $button_close
-attachForm $scroll_l "right" 4

-attachNone $button_close "top"
-attachForm $button_close "left" 4
-attachForm $button_close "bottom" 4
-attachForm $button_close "right" 4
$form_l;

showWindow about_oj_w;
}

safakoner
01-10-2004, 05:43 PM
Hi all

I have some new and rebuild mel script. I hope, you like my scripts :bounce:

Smooth Proxy with Side by Side V2.0|
Download (http://www.safakoner.com/05_source/03_mel/eq_sp.rar)
How can I use this mel ? DivX avi (http://www.safakoner.com/05_source/01_tutorial/05_spsbs/spsbs.avi)
UI

http://www.safakoner.com/05_source/03_mel/03_spsbs_b.gif


Skeleton Renamer V1.0
Download (http://www.safakoner.com/05_source/03_mel/eq_sr.rar)
How can I use this mel ? DivX avi (http://www.safakoner.com/05_source/01_tutorial/07_sr/sr.avi)
UI

http://www.safakoner.com/05_source/03_mel/05_sr_b.gif

Image Plane Creator V1.0
Download (http://www.safakoner.com/05_source/03_mel/eq_ipc.rar)
How can I use this mel ? DivX avi (http://www.safakoner.com/05_source/01_tutorial/06_ipc/ipc.avi)
UI

http://www.safakoner.com/05_source/03_mel/07_ipc_b.gif

safakoner
01-10-2004, 05:44 PM
Global Polygon Smooth Control V2.1
Download (http://www.safakoner.com/05_source/03_mel/eq_gpsc.rar)
UI

http://www.safakoner.com/05_source/03_mel/01_gpsc_b.gif

Orient Joint V1.5
Download (http://www.safakoner.com/05_source/03_mel/eq_oj.rar)
UI

http://www.safakoner.com/05_source/03_mel/06_oj_b.gif

safakoner
01-10-2004, 05:45 PM
Rigid Solver V1.0
Download (http://www.safakoner.com/05_source/03_mel/eq_rs.rar)
UI

http://www.safakoner.com/05_source/03_mel/08_rs_b.gif

Global IK Handle Stickiness Control V1.1
Download (http://www.safakoner.com/05_source/03_mel/eq_gikhsc.rar)
UI

http://www.safakoner.com/05_source/03_mel/02_giksc_b.gif

Lambert Transparency Control V2.0
Download (http://www.safakoner.com/05_source/03_mel/eq_lambert.rar)
UI

http://www.safakoner.com/05_source/03_mel/01_lambert_b.gif

Levitateme
01-10-2004, 06:18 PM
no way...thanks equinox

Levitateme
01-21-2004, 06:22 AM
My friend Doogie on here,he made this script for me and my friend. it does like wings 3d flatten. if you want all your verts at the X axis it will do that, it also does z y, but he added a value to this tool which is great. enjoy, its a awesome script. thanks DOOGIE! i also asked if he could make it so if you have edges, it would flatten the edges. it does now, but yuo get weird results. if he does ill update.


// Author: Paul Franz (paul@paulfranz.com)
// Date: 12-22-2003
// Description: Snaps selected verts to defined axis
//
// If ya wanna use or modify it (in other
// scripts), i dont really care. Just let me know.


global proc pfSetVal ()
{
$win = "pfSetValWin";
if (`window -exists $win`)
deleteUI $win;

pfSetValWin $win;

showWindow $win;
}

proc pfSetValWin (string $win)
{

// create the window
window -t "pf Set Value" $win;

columnLayout -cat both 5 -adj true -rowSpacing 1;

radioButtonGrp
-numberOfRadioButtons 3
-label "Axis:"
-labelArray3 "X" "Y" "Z"
-on1 ""
-on2 ""
-on3 ""
-sl 1
axisRadButGrp;

floatSliderGrp -minValue -50.0 -maxValue 50.0 -label "Value:" -field true pfSetValOffset;

button -l "Ok" -c "pfSetTheVal()";
}

proc pfSetTheVal()
{
string $sel[] = `ls -sl -fl`;
string $vert;
string $axis;
float $transVal[];
int $tmpINT = `radioButtonGrp -q -sl axisRadButGrp`;
float $offset = `floatSliderGrp -q -value pfSetValOffset`;

switch ($tmpINT){
case 1:
$axis = "x";
break;
case 2:
$axis = "y";
break;
case 3:
$axis = "z";
break;
default:
error "No axis selected. Pick a radio box";
break;
}

if (size($sel) == 0)
{
error "select something";
}


for ($vert in $sel)
{
$transVal = `xform -q -ws -t $vert`;

switch ($axis){
case "x":
xform -ws -t $offset $transVal[1] $transVal[2] $vert;
break;
case "y":
xform -ws -t $transVal[0] $offset $transVal[2] $vert;
break;
case "z":
xform -ws -t $transVal[0] $transVal[1] $offset $vert;
break;
default:
error "No axis selected";
break;
}
}
}

pfSetVal();
// eof

AndersEgleus
02-15-2004, 03:11 PM
I don't know if ths is the right thread to post this in, but I'm making a skin weights transfer script that's got a few useful features, aeSkinWeightsTransfer. It's not UV- or topology dependant, but instead depends on the world space positions of the weighted control points, kind of like Michael Comet's saveWeights.mel, but it can average weights between several exported points in the vicinity of the import point if none is found at the same location.

So far, I've gotten it to work with the features I want, but I haven't written a proper manual yet.

Get it here (http://www.cgtalk.com/showthread.php?s=&threadid=122121).

PsychoSilence
02-23-2004, 10:36 AM
http://www.cgtalk.com/showthread.php?s=&threadid=124771

just check out the thread and give C&C please ;)

cheers

psycho

larryvm
02-23-2004, 11:17 AM
a script that create a motion field for the fluids.

its altmost the same that the maya fluids but this calculate the force from the world position and not from the previous key.


you only have to select the geometry first and then the fluid and type fvMotionField

global proc fvMotionField()
{
string $lista[];
$lista= `ls -sl `;
string $padre, $fluido;
$padre=$lista[0];
$fluido=$lista[1];
select -cl;
string $nombre[]= `uniform`;
string $elemento;
$elemento=$nombre[0];
connectDynamic -f $elemento $fluido ;
print ($elemento+" "+$padre+"\n");
parent $elemento $padre;
setAttr ($elemento+".translateX") 0;
setAttr ($elemento+".translateY") 0;
setAttr ($elemento+".translateZ") 0;
setAttr ($elemento+".rotateX") 0;
setAttr ($elemento+".rotateY") 0;
setAttr ($elemento+".rotateZ") 0;
setAttr ($elemento+".volumeShape") 2;
if (!`attributeExists "pushIntensity" $elemento`)
{
addAttr -ln pushIntensity -dv 2 -at double $elemento;
setAttr -e -keyable true ($elemento+".pushIntensity");
}
if (!`attributeExists "antX" $elemento`)
addAttr -ln antX -at double $elemento;
if (!`attributeExists "antY" $elemento`)
addAttr -ln antY -at double $elemento;
if (!`attributeExists "antZ" $elemento`)
addAttr -ln antZ -at double $elemento;
string $expresion="float $newX,$newY,$newZ;\n";
$expresion+="float $aX,$aY,$aZ;\n";
$expresion+="float $distX,$distY,$distZ;\n";
$expresion+="float $longitud;\n";
$expresion+="float $posicion[]=`xform -q -ws -t "+$elemento+"`;\n";
$expresion+="$newX=$posicion[0];\n";
$expresion+="$newY=$posicion[1];\n";
$expresion+="$newZ=$posicion[2];\n";
$expresion+="if (frame>0)\n";
$expresion+=" {\n";
$expresion+=" $aX=`getAttr "+$elemento+".antX`;\n";
$expresion+=" $aY=`getAttr "+$elemento+".antY`;\n";
$expresion+=" $aZ=`getAttr "+$elemento+".antZ`;\n";
$expresion+=" }\n";
$expresion+="else\n";
$expresion+=" {\n";
$expresion+=" $aX=$newX;\n";
$expresion+=" $aY=$newY;\n";
$expresion+=" $aZ=$newZ;\n";
$expresion+=" }\n";
$expresion+="$distX=$aX-$newX;\n";
$expresion+="$distY=$aY-$newY;\n";
$expresion+="$distZ=$aZ-$newZ;\n";
$expresion+="$longitud=`sqrt($distX*$distX+$distY*$distY+$distZ*$distZ)`;\n";
$expresion+="if ($longitud>0.0001)\n";
$expresion+="{\n";
$expresion+=" $distX/=$longitud;\n";
$expresion+=" $distY/=$longitud;\n";
$expresion+=" $distZ/=$longitud;\n";
$expresion+="}\n";
$expresion+=$elemento+".directionX=$distX;\n";
$expresion+=$elemento+".directionY=$distY;\n";
$expresion+=$elemento+".directionZ=$distZ;\n";
$expresion+="setAttr "+$elemento+".antX $newX;\n";
$expresion+="setAttr "+$elemento+".antY $newY;\n";
$expresion+="setAttr "+$elemento+".antZ $newZ;\n";
$expresion+=$elemento+".magnitude="+$elemento+".pushIntensity*$longitud*20;\n";
expression -s $expresion;

}

alexx
03-08-2004, 09:24 AM
Levitateme:
that "vertex flatten script".. emm.. that can be done with a snapping in maya...
why the script?

cheers

alexx

rmsmedia
03-13-2004, 02:17 AM
I need to export the component spreadsheet of my skin weights. I don't want to use the weight map import/export because of the inconsistency of the imported maps. If anyone could help me out with a script thats already written or send me down the right path I would greatly appreciate it. Something that could paste in to Excel would be nice...

larryvm
03-13-2004, 02:08 PM
this is a basic script to read the weight of the vertex in a smooth bind, i hope can help you to write a better script


global proc fvPesos()

{
string $objeto[];
string $geometria;
$objeto= `ls -sl`;
$geometria=$objeto[0];
$poligono=`pickWalk -d down `;
print ($poligono[0]+"\n");
string $deformador[]=`listConnections ($poligono[0]+".inMesh")`;
print ($deformador[0]+"\n");
print ($geometria+"\n");
select -r $geometria;
PolySelectConvert 3;
string $vertices[]=`ls -fl -sl`;
string $vertice;
int $contador;
string $joint[] =`listConnections ($deformador[0]+".matrix")`;
int $valor;
for ($vertice in $vertices)
{
print ($vertice+"\n");
float $valores[]=`skinPercent -q -v $deformador[0] $vertice`;
for ($valor=0;$valor<size($valores);$valor++)
{
print ("joint-"+$joint[$valor]+" "+$valores[$valor]+" ");
}
print "\n";

}
}


i think that can be easy write the data to a file.

abie1
03-25-2004, 04:42 AM
I don't know if this is the right place to ask this but...I want to write a script that toggles -wos of the selected geometery only. However, the only command that toggles wireFrameOnShaded is the modelEditor command (as u all probably already know) and it does it to all the geometry in the scene. Hence, my dilema; it's not at all like using the -xRay flag with the displaySurface command that all you have to do is say...displaySurface -xRay 1 or 0 ball for example. If I try to do it like that with the modelEditor command, modelEditor -e -wos 1 ball, I get an error in the ScriptEditor: Object not found: |ball. The default script that Maya runs for this is...modelEditor -e -wos 1 or 0 modelPanel4; Someone suggested that I use the filterExpand command but even then I still have the same problem. Maya can't find the selected geometry. Is there a way to cycle through the current modelPanel and toggle the -wos of the specified geo? Is this even possible? I'm not looking 4 an easy answer, and if someone out there has already written a script that does, this don't post the final script, I just need some guidance. I'm looking forward to hear from some of your suggestions. Thanx.

jHromika
03-25-2004, 05:45 AM
Here's one I just finished up. Can't say it's going to be anything ground breaking, but I think it might speed up workflow a bit. It provides you with a single window to lock out and hide attributes on your character controls.

http://www.hromikarenders.com/images/misc/cleanControls.jpg


//////////////////////////////////////////////////////////////////
// //
// jhCleanControls.mel //
// //
// Author: Jared Hromika - jhromika@hromikarenders.com //
// Date: 3-23-04 //
// //
// Purpose: To expedite the process of locking and hiding //
// various attributes on controllers. //
// //
//////////////////////////////////////////////////////////////////


global proc jhCleanControls ()
{
$win = "jhCleanControlsWIN";

if (`window -exists $win`)
deleteUI $win;

jhCleanControlsWin $win;

showWindow $win;
}

global proc jhCleanControlsWin (string $win)
{
window -t "jhCleanControls" -w 600 $win;

columnLayout -cat both 5 -adj true;

separator -height 10 -style "none";

rowLayout -numberOfColumns 2
-columnWidth2 200 350
-columnAttach 1 "both" 5
-columnAttach 2 "both" 5;

columnLayout -cat both 5 -adj true;

textScrollList -ams true -nr 5 -w 150 jhCleanControlsTSL;

button -l "Add Objects" -c jhAddObjects;
button -l "Remove Objects" -c jhRemoveObjects;

setParent..;

columnLayout;

radioButtonGrp
-numberOfRadioButtons 2
-labelArray2 "Unlock" "Lock"
-select 2
jhRadioGrpLock;

radioButtonGrp
-numberOfRadioButtons 2
-labelArray2 "Unkeyable" "Keyable"
-select 1
jhRadioGrpKey;

separator -height 10 -style "none";

string $label[] = {"Rotate", "Translate", "Scale"};
string $checkName[] = {"jhCheckGrpRotate", "jhCheckGrpTranslate", "jhCheckGrpScale"};

for ($i = 0; $i <= 2; $i++)
{
checkBoxGrp
-numberOfCheckBoxes 3
-label $label[$i]
-labelArray3 "X" "Y" "Z"
-columnWidth4 60 40 40 40
$checkName[$i];
}

checkBoxGrp
-numberOfCheckBoxes 1
-label "Visibility"
-columnWidth2 60 40
jhCheckGrpVisibility;

setParent..;
setParent..;

separator -height 10 -style "out";

button -l "Clean Controls" -c jhCleanControlsRun;
}

global proc jhCleanControlsRun ()
{
string $controls[0];
string $axis[] = {"", "X", "Y", "Z"};
string $transform[] = {"", "rotate", "translate", "scale"};
string $jhTransform[] = {"", "jhCheckGrpRotate", "jhCheckGrpTranslate", "jhCheckGrpScale"};

int $checkVal;

$controls = `textScrollList -q -ai jhCleanControlsTSL`;
$lockSel = `radioButtonGrp -q -sl jhRadioGrpLock` - 1;
$keySel = `radioButtonGrp -q -sl jhRadioGrpKey` - 1;

// For each control in the text scroll list it retrieves the value of the checkbox for each of the three
// transforms and their axis. If the box is checked, the attribute is locked / unlocked and
// made keyable or unkeyable based on the radio button selections.

// The visibility check is outside of the nested loops because it doesn't have 3 axis like the others.

for ($currentControl in $controls)
{
for ($i = 1; $i <= 3; $i++)
{
for ($j = 1; $j <= 3; $j++)
{
$checkVal = `checkBoxGrp -q ("-v" + $j) $jhTransform[$i]`;

if ($checkVal == 1)
setAttr -lock $lockSel -keyable $keySel ($currentControl + "." + $transform[$i] + $axis[$j]);
}
}

$checkVal = `checkBoxGrp -q -v1 jhCheckGrpVisibility`;

if ($checkVal == 1)
setAttr -lock $lockSel -keyable $keySel ($currentControl + ".visibility");
}
}

global proc jhAddObjects ()
{
string $objects[0];
string $current[0];
string $new[0];

// Check the current selection, as well as the current values in the text scroll list.

$objects = `ls -sl`;
$current = `textScrollList -q -ai jhCleanControlsTSL`;

// Clear the text scroll list.

textScrollList -e -ra jhCleanControlsTSL;

// Refill the list with the previous list as well as the current selection. First the strings
// are combined and then checked for duplicate entries. These duplicate entries are then
// removed and the list is repopulated.

$new = `stringArrayCatenate $objects $current`;
$new = `stringArrayRemoveDuplicates $new`;

for ($item in $new)
textScrollList -e -a $item jhCleanControlsTSL;
}

global proc jhRemoveObjects ()
{
string $currentSel[0];

// Determine which objects are selected within the text scroll list. These items are then removed.

$currentSel = `textScrollList -q -si jhCleanControlsTSL`;

for ($item in $currentSel)
textScrollList -e -ri $item jhCleanControlsTSL;
}

Sanctuary
03-25-2004, 07:17 AM
... a script that toggles -wos of the selected geometery only

-wos is a property of modelEditor so i`m pretty sure you can`t write that script of your


However, the only command that toggles wireFrameOnShaded is the modelEditor command (as u all probably already know) and it does it to all the geometry in the scene.

wrong ... because the -wos flag is specifically to modelEditor and it can be applied only to the modelEditor itself not to the geometry


If I try to do it like that with the modelEditor command, modelEditor -e -wos 1 ball, I get an error in the ScriptEditor: Object not found: |ball. Maya can't find the selected geometry.

as expected because the ball is not a modelEditor. and Maya is looking for a modelEditor named ball


Is there a way to cycle through the current modelPanel and toggle the -wos of the specified geo? Is this even possible?

maybe in Maya 6 :bounce:

abie1
03-25-2004, 07:52 AM
Thanx. u've helped a lot. I guess I've actually found something that maya can't do. Again thanx.

Sanctuary
03-25-2004, 08:49 AM
Originally posted by abie1
Thanx. u've helped a lot. I guess I've actually found something that maya can't do. Again thanx.

maya can`t do because it wasn`t suppose to do :D

stallion151
03-31-2004, 06:04 AM
what about the other wireframe on shaded? the one in the preferences under display.... it isn't -wos but -wsa

how do you toggle that?

Sanctuary
03-31-2004, 06:56 AM
Originally posted by stallion151
what about the other wireframe on shaded? the one in the preferences under display.... it isn't -wos but -wsa

how do you toggle that?

that wirefame on shaded is for selected objects in the scene, so if you want to select an object and don`t see his wireframe topology choose None there.


hope this helps

stallion151
04-02-2004, 06:43 AM
yeh i have shelf buttons for that, but i find the shelf takes too much room and i am more of a hotkey kinda guy.

how do you write something like that? i know i should learn to write my own, but i keep making excuses.... :rolleyes: so if you could help here it would be great.

rwm
04-07-2004, 03:22 PM
dunno if this will be any help to anyone?
i wrote this today, im learning mel so did this for practice. its a really stupid thing to do, but again its only for practice.
heres the script:

window -t "MELPracWindow" -wh 436 460;
columnLayout;
button -l "CreateSphere" -command "sphere";
attrFieldSliderGrp -l "TranslateX"
-minValue -10 -maxValue 10 -cal 1 left
-adjustableColumn true -attribute nurbsSphere1.tx;
attrFieldSliderGrp -l "TranslateY"
-minValue -10 -maxValue 10 -cal 1 left
-adjustableColumn true -attribute nurbsSphere1.ty;
attrFieldSliderGrp -l "TranslateZ"
-minValue -10 -maxValue 10 -cal 1 left
-adjustableColumn true -attribute nurbsSphere1.tz;
attrFieldSliderGrp -l "ScaleX"
-minValue -10 -maxValue 10 -cal 1 left
-adjustableColumn true -attribute nurbsSphere1.sy;
attrFieldSliderGrp -l "ScaleY"
-minValue -10 -maxValue 10 -cal 1 left
-adjustableColumn true -attribute nurbsSphere1.sx;
attrFieldSliderGrp -l "ScaleZ"
-minValue -10 -maxValue 10 -cal 1 left
-adjustableColumn true -attribute nurbsSphere1.sz;
attrFieldSliderGrp -l "RotateX"
-minValue -360 -maxValue 360 -cal 1 left
-adjustableColumn true -attribute nurbsSphere1.rx;
attrFieldSliderGrp -l "RotateY"
-minValue -360 -maxValue 360 -cal 1 left
-adjustableColumn true -attribute nurbsSphere1.ry;
attrFieldSliderGrp -l "RotateZ"
-minValue -360 -maxValue 360 -cal 1 left
-adjustableColumn true -attribute nurbsSphere1.rz;
rowColumnLayout -numberOfRows 8 -rowHeight 1 25 -rowHeight 2 25 -rowHeight 3 25 -rowHeight 4 25 -rowHeight 5 25 -rowHeight 6 25 -rowHeight 7 25 -rowHeight 8 25
-rowAttach 1 "top" 10 -rowAttach 2 "top" 10 -rowAttach 3 "top" 10 -rowAttach 4 "top" 10 -rowAttach 5 "top" 10 -rowAttach 6 "top" 10 -rowAttach 7 "top" 10 -rowAttach 8 "top" 10;
button -l "CreateLambertNode" -command "shadingNode -asShader lambert;";
button -l "CreateBlinnNode" -command "shadingNode -asShader blinn;";
button -l "CreatePhongNode" -command "shadingNode -asShader phong;";
button -l "Create PhongENode" -command "shadingNode -asShader phongE;";
button -l "Create AnisotropicNode" -command "shadingNode -asShader anisotropic;";
button -l "Create RampShaderNode" -command "shadingNode -asShader rampShader;";
button -l "Create ShadingMapNode" -command "shadingNode -asShader shadingMap;";
button -l "Create SurfaceShaderNode" -command "shadingNode -asShader surfaceShader;";
button -l "AssignLambertToSphere" -command "defaultNavigation -source lambert2 -destination |nurbsSphere1|nurbsSphereShape1.instObjGroups[0] -connectToExisting;";
button -l "AssignBlinnToSphere" -command "defaultNavigation -source blinn1 -destination |nurbsSphere1|nurbsSphereShape1.instObjGroups[0] -connectToExisting;";
button -l "AssignPhongToSphere" -command "defaultNavigation -source phong1 -destination |nurbsSphere1|nurbsSphereShape1.instObjGroups[0] -connectToExisting;";
button -l "AssignPhongEToSphere" -command "defaultNavigation -source phongE1 -destination |nurbsSphere1|nurbsSphereShape1.instObjGroups[0] -connectToExisting;";
button -l "AssignAnisotropicToSphere" -command "defaultNavigation -source anisotropic1 -destination |nurbsSphere1|nurbsSphereShape1.instObjGroups[0] -connectToExisting;";
button -l "AssignRampShaderToSphere" -command "defaultNavigation -source rampShader1 -destination |nurbsSphere1|nurbsSphereShape1.instObjGroups[0] -connectToExisting;";
button -l "AssignShadingMapToSphere" -command "defaultNavigation -source shadingMap1 -destination |nurbsSphere1|nurbsSphereShape1.instObjGroups[0] -connectToExisting;";
button -l "AssignSurfaceShaderToSphere" -command "defaultNavigation -source surfaceShader1 -destination |nurbsSphere1|nurbsSphereShape1.instObjGroups[0] -connectToExisting;";
button -l "LambertAttributes" -command "showEditor lambert2;";
button -l "BlinnAttributes" -command "showEditor blinn1;";
button -l "PhongAttributes" -command "showEditor phong1;";
button -l "PhongEAttributes" -command "showEditor phongE1;";
button -l "AnisotropicAttributes" -command "showEditor anisotropic1;";
button -l "RampShaderAttributes" -command "showEditor rampShader1;";
button -l "ShadingMapAttributes" -command "showEditor shadingMap1;";
button -l "SurfaceShaderAttributes" -command "showEditor surfaceShader1;";
showWindow;

oh, and if you do run the script, you must first create a nurbs sphere. it should be called nurbsSphere1. the default. i havent figured out how to run the script without creating the sphere.

alesmav
04-15-2004, 10:00 AM
Hey...

I was wondering how to query the number of vertices on a selected curve. MisterDi gave me a tip that this value equals degree + spans. So here's the script, that adds `vtxNum`(number of vertices) attribute to the curve transform. You just select the curve and run the script. Now you can query this attribute for whatever operations you need to make on a per vertex basis.

---------------------------------------------

string $sel[] = `ls -dag -ap -sl`;
int $degree = `getAttr ($sel[1] + ".degree")`;
int $spans = `getAttr ($sel[1] + ".spans")`;
int $vtxNum;

int $vtxNum = $degree + $spans;
addAttr -ln vtxNum -at long ("|" + $sel[0]);
setAttr -e -keyable true ("|" + $sel[0] + ".vtxNum");
setAttr ($sel[0] + ".vtxNum") $vtxNum;

-------------------------------------------------------------

ALES

onlooker
04-22-2004, 04:56 PM
Hi there Mel scripters. How can I get my "spans UV" on Nurbs objects displayed as a HUD on my in my Maya window like my poly count is?

Can anyone help me with this. It's really setting me back.

dwalden74
04-22-2004, 07:05 PM
You need 2 procs: 1 proc should return the .spansUV attr on the currently shape node; the second proc should create the HUD (and call the 1st proc). Like this:

global proc int[] dwGetSpansUV()
{
//Get selected obj.
string $sel[] = `ls -sl -o`;
//Return empty array if nothing is selected.
if (! `size $sel`)
return {};

//Get shapes (where .spansUV resides)
string $shape[] = `listRelatives -s $sel[0]`;

//Return empty array if no shapes exist.
if (! `size $shape`)
return {};
//Return empty array if no spansUV attr exists.
if (! `attributeExists "spansUV" $shape[0]`)
return {};

int $spansUV[] = `getAttr ($sel[0] + ".spansUV")`;
return $spansUV;
}

{
if (!`headsUpDisplay -exists dwHUDSpansUVDisplay`)
{
headsUpDisplay
-section 4 -block 7 -blockSize "medium"
-label "spansUV:"
-labelFontSize "small"
-command "dwGetSpansUV"
-event "SelectionChanged"
dwHUDSpansUVDisplay;
}
else
headsUpDisplay -rem dwHUDSpansUVDisplay;
}


Here I didn´t make the 2nd a proc really; you can put that on a shelf as-is. The 1st proc must be global however, and you can save that to an extra .mel file if you want (dwGetSpansUV.mel). Note that the 1st proc returns an empty array if non of the necessary criteria are met. Also, note that if you have multiple objs selected, it will display the spans only for the first obj in the selection list.

:beer:
David

onlooker
04-23-2004, 06:13 AM
Hey that was fast. Thanks! I totally appreciate that. You Mel guy's are saints. :D

{edit} that totally works perfectly. That's exactly what I needed. I love you man! :thumbsup:

Levitateme
04-23-2004, 07:02 AM
can people start posting "mel questions, requests"...in the mel section instead of on "mel scripts" gets annoying getting a reply to this email with someone asking requesting something.

SajNT
04-26-2004, 04:41 AM
Hi, i'm looking at writing a script that can actually display the Control Points of a nurbs surface rather than the CV cords. Can anyone help me with it? The one way i can get it displayed out now is to edit the CVs attribute in the channel box.. and it'll show up in the script editor..

Whirlwind
07-18-2004, 09:35 PM
Neat little script used to display wireframe on shaded poly meshes, I mapped it to alt-w. Only works if you have a panel selected. Its a modification of another script used to display X-ray. Don't know who orignally wrote it, but they get props. All I did was replace X-ray with wos.

-D



$p[0] = `getPanel -wf`;
modelEditor -e -wos (!`modelEditor -q -wos ($p[0])`) ($p[0]);

R.Vor
07-19-2004, 08:56 AM
i think xray script was writen by somebody from digital-tutors.com

Ppl i wanted to also modify that script but to rotate my front camera so it would be back
But i didn`t find the comands i needed.
BY default if I`m not mistaken Y-90 front Y-270 back.
So if it`s not hard can somebody write a little srcipt so it would rotate the camera like if 90 rotate 270 and the other way. And that it would only rotate camera named front (so i wouldn`t have to select it).

If somebody could do it it would be great.

Thanks a lot.

alexx
08-12-2004, 01:26 PM
back and bottom camera are predefined under: view->predefined Bookmarks

cheers

alexx

SajNT
08-17-2004, 01:35 PM
guys, say when i create a columnLayout,put up a pic with the -image command,is there anyway the image can resize according to my window size interactively? somethin like what you'll get when u scale the contents inside render view..the image scales along with the window ..-rtf doesn't seem to work at all.. ; (

dom93hatch
08-23-2004, 08:55 PM
I know my friend did this once, but I can't seem to contact him anymore. It's a script that lets you toggle between turning on and off x-ray shading. I was wondering if anyone could put one up for me. Thanks :)

Levitateme
08-24-2004, 02:01 AM
Look on highend...there are alot of them plus i see them everywere.

www.google.com

abie1
08-24-2004, 08:10 PM
this script was not created by me, but has spoiled me rotten. It allows u to toggle xray on object and component mode; very useful.

http://www.backwaterbunch.com/free_stuff/f_scripts.htm

mrBullseye
08-30-2004, 09:49 PM
Hey there scripters.. I just wanted to share my two first mel-scripts ever with all of you.
I hope someone will find them useful, as I sure have..:)

The first script I wipped up today, when I got tired of moving render-cameras to a nice position. especially if you have found a nice place for your perspective camera, and want a new one in the exact same position..


/* Camera Convenience script written by Johan Bäckström.
C&C:s to mrbullseye@bredband.net
This is a simple script that places a camera in the exact position
of the perspective default camera and then names it renderCAM.
This allows you to quickly create a new camera in the position of your choice.
Convenient huh?*/
global proc cameraCon()
{
vector $perspPos;

vector $perspRot;

float $xPos, $yPos, $zPos, $xRot, $yRot, $zRot;

$perspPos = `camera -q -position perspShape`;

$perspRot = `camera -q -rotation perspShape`;

$xPos = ($perspPos.x);
$yPos = ($perspPos.y);
$zPos = ($perspPos.z);

$xRot = ($perspRot.x);
$yRot = ($perspRot.y);
$zRot = ($perspRot.z);
camera -name renderCAM -position $xPos $yPos $zPos -rotation $xRot $yRot $zRot;
}


Simple but timeconsuming (edit - Duuh, timesaving of course) and powerful - Just the way I like it

The second script is a spinoff on 3dsmax:s wonderful select object tool, wich pops up a list with all the objects in the scene, and lets you delete, select, show or hide objects.
I've also written an automatic hotkey assigner for this script.

This one ain't entirely finished, but it works :rolleyes:


/*
quickSel version 0.9
This script was written by Johan Bäckström as a project in school.
C&C:s to mrbullseye@bredband.net
If you want an automatic hotkey assignment to this nifty little tool, run
the accompanying script quickSelHotKey, but remember to source this script
first.
This is a tool that pops up on the press of a key, and shows you a list of all
the objects currently in the scene (only DAG-objects, hence version 0.9) and lets you select, delete and show/hide
these objects at will.
The script was written with speed in mind, and is soooooo much faster to use
than the outliner or the hypergraph.
You can doubleclick an object in the list to select it, and you can select
multiple objects just by mouse-dragging and ctrl- or shift-clicking. You can
also delete selected objects by pressing delete.
The list on the left will in version 1.0 show which objects are hidden and
which ones are visible
The hotkey-script will check four different key-combinations which are:
ctrl-y, ctrl-u, ctrl-alt-y and ctrl-alt-u.
If one or more of these are available, then the one most to the left in the
list will be assigned.
*/
global proc quickSel()
{
global int $changes=0;
global string $preSelection[];
$preSelection = `selectedNodes`;
select -all/*DagObjects*/;
global string $allSceneObjects[];
$allSceneObjects = `selectedNodes -dagObjects`;

global string $camList[];
$camList = `listCameras -o`;
global int $strSize;
$strSize=size($allSceneObjects);
global int $preStrSize;
$preStrSize=size($preSelection);

global int $camListSize;
$camListSize=size($camList);

int $nRows = $strSize + $camListSize + 1;

if ($strSize == 0)
{
noObjectsProc();
}
select -clear;
if(`window -exists quickSelWin`)
{
deleteUI quickSelWin;
}
window
-title "Quick Select Window"
-toolbox true
-menuBar true
-menuBarVisible true
-resizeToFitChildren true
-sizeable false
-widthHeight 300 280
quickSelWin;
formLayout
-numberOfDivisions 100
-width 300
-height 280
quickSelForm;
scrollLayout
-horizontalScrollBarThickness 0
-width 300
-height 190
quickSelScroll;
rowColumnLayout
-numberOfColumns 2
-columnWidth 1 140
-columnWidth 2 140
-columnAlign 1 "left"
-columnAlign 2 "right"
-columnAttach 1 "both" 10
-columnAttach 2 "both" 10
quickSelColumn;
textScrollList
-numberOfRows $nRows
-allowMultiSelection true
-deleteKeyCommand "deleteKeyProc($changes)"
-doubleClickCommand "selectProc()"
quickSelScrollList;
textScrollList
-edit
-append "persp"
quickSelScrollList;
/*
textScrollList
-edit
-append "top"
quickSelScrollList;

textScrollList
-edit
-append "side"
quickSelScrollList;

textScrollList
-edit
-append "front"
quickSelScrollList;
*/

for ($i=0;$i<$camListSize;$i++)
{
textScrollList
-edit
-append $camList[$i]
quickSelScrollList;
}

print $camListSize;

for ($i=0;$i<$strSize;$i++)
{
textScrollList
-edit
-append $allSceneObjects[$i]
quickSelScrollList;
}
textScrollList
-numberOfRows $nRows
-backgroundColor 0.2 0.7 0.2
quickSelScrollListHide;
for ($i=0;$i<$nRows;$i++)
{
textScrollList
-edit
-append "N/A"
quickSelScrollListHide;
}
setParent quickSelForm;
string $selectButton=
`button
-width 50
-height 25
-label "Select"
-command "selectProc()"`;
string $cancelButton=
`button
-width 50
-height 25
-label "Cancel"
-command "cancelProc($preSelection, $preStrSize, $changes)"`;
string $hideButton=
`button
-width 50
-height 25
-label "Hide Selected"
-command "hideProc()"`;
string $showButton=
`button
-width 50
-height 25
-label "Show Selected"
-command "showProc()"`;
formLayout
-edit
-attachPosition $selectButton "left" 2 50
-attachForm $selectButton "bottom" 5
-attachForm $selectButton "right" 5
-attachForm $cancelButton "left" 5
-attachForm $cancelButton "bottom" 5
-attachPosition $cancelButton "right" 2 50
-attachPosition $hideButton "left" 2 50
-attachForm $hideButton "bottom" 35
-attachForm $hideButton "right" 5
-attachForm $showButton "left" 5
-attachForm $showButton "bottom" 35
-attachPosition $showButton "right" 2 50
-attachForm quickSelScroll "top" 0
quickSelForm;

window
-edit
-widthHeight 300 280
quickSelWin;
showWindow quickSelWin;
}
global proc deleteKeyProc(int $changes)
{
string $selectedOnList[];
print $changes;
$selectedOnList = `textScrollList
-query
-selectItem
quickSelScrollList`;
int $selectedListSize = size($selectedOnList);
for ($i=0;$i<$selectedListSize;$i++)
{
textScrollList
-edit
-removeItem $selectedOnList[$i]
quickSelScrollList;
}
delete $selectedOnList;
$changes++;
print $changes;
}
global proc selectProc()
{
string $selectedOnList[];
$selectedOnList = `textScrollList
-query
-selectItem
quickSelScrollList`;
select $selectedOnList;
deleteUI quickSelWin;
}
global proc hideProc()
{
string $shownOnList[];
$shownOnList = `textScrollList
-query
-selectItem
quickSelScrollList`;
hide $shownOnList;
}
global proc showProc()
{
string $hiddenOnList[];
$hiddenOnList = `textScrollList
-query
-selectItem
quickSelScrollList`;
showHidden $hiddenOnList;
}
global proc cancelProc(string $preSelection[],int $preStrSize, int $changes)
{
if ($preStrSize != 0)
{
if ($changes == 0)
{
select $preSelection;
}
else warning "You have deleted some items, and the PreSelection cannot be ReSelected";
}
deleteUI quickSelWin;
}
global proc noObjectsProc()
{
error "This plugin is useless if there are no objects in your scene!";

if(`window -exists quickSelWin`)
{
deleteUI quickSelWin;
}
}


here is the hotkey assigner


/*
quickSelHotKey version 0.9
This script was written by Johan Bäckström as a project in school.
C&C:s to mrbullseye@bredband.net
This is the script to run if you want an automatic hotkey assignment to the
script QuickSelect
Only run this script once, otherwise you will have multiple hotkeys assigned.
This hotkey-script will check four different key-combinations which are:
ctrl-y, ctrl-u, ctrl-alt-y and ctrl-alt-u.
If one or more of these are available, then the one most to the left in the
list will be assigned.
*/
global proc quickSelHotKey()
{
nameCommand
-annotation "start Quick Select "
-command "quickSel"
quickSelHot;
int $key1 = `hotkey -query -ctl y`;
int $key2 = `hotkey -query -ctl u`;
int $key3 = `hotkey -query -ctl -alt y`;
int $key4 = `hotkey -query -ctl -alt u`;
int $key1Assigned=0;
int $key2Assigned=0;
int $key3Assigned=0;
int $key4Assigned=0;
if (($key1 == 1) && ($key2 == 1) && ($key3 == 1) && ($key4 == 0))
{
hotkey -ctl -alt -k "u" -name "quickSelHot";
$key4Assigned=1;
}
else
{
warning "hotkey ctrl alt u is unavailable or a hotkey is already assigned";
}
int $key4 = `hotkey -query -ctl -alt u`;
if (($key1 == 1) && ($key2 == 1) && ($key3 == 0))
{
hotkey -ctl -alt -k "y" -name "quickSelHot";
$key3Assigned=1;
}
else
{
warning "hotkey ctrl alt y is unavailable or a hotkey is already assigned";
}
$key3 = `hotkey -query -ctl -alt y`;
if (($key1 == 1) && ($key2 == 0))
{
hotkey -ctl -k "u" -name "quickSelHot";
$key2Assigned=1;
}
else
{
warning "hotkey ctrl u is unavailable or ctrl y is already assigned";
}
$key2 = `hotkey -query -ctl u`;
if ($key1 != 1)
{
hotkey -ctl -k "y" -name "quickSelHot";
$key1Assigned=1;
}
else
{
warning "hotkey ctrl y is unavailable";
}
$key1 = `hotkey -query -ctl y`;

if ($key1Assigned == 1)
{
print "Hotkey ctrl y has been assigned";
print "\n";
}
if ($key2Assigned == 1)
{
print "Hotkey ctrl u has been assigned";
print "\n";
}
if ($key3Assigned == 1)
{
print "Hotkey ctrl alt y has been assigned";
print "\n";
}
if ($key4Assigned == 1)
{
print "Hotkey ctrl alt u has been assigned";
print "\n";
}
if (($key1Assigned != 1) && ($key2Assigned != 1) && ($key3Assigned != 1) && ($key4Assigned != 1))
{
error "No hotkeys have been assigned. You will have to start manually or assign one you know is available!";
}
}


To infinity and beyond doesn't sound so difficult when you have MEL to work with :thumbsup:
(edit - I pasted a slightly modified version of the quick select script. It is more complete now)

stallion151
08-31-2004, 12:13 AM
i can't seem to get them to load. should we just paste those into the script editor and a window should pop up? or do we need to make *.mel scripts in our folders? tried it also as a hotkey and it didn't load. probably missing something obvious here...
would love to see that 3dsmax window found that really helpful when i was using max

mrBullseye
08-31-2004, 12:22 AM
I think it ought to work either way, but do the safe thing :) Save the code as .mel files, named the same as the main global procedure, so the quickselect window should be quickSel.mel, the hotkeys should be quickSelHotKey.mel and the camera-script should be cameraCon.mel, then you write in the script editor:

source quickSel;
quickSel;

and press ctrl enter to source the script. Then you copy the same thing you wrote above, and MMB drag it to the shelf, and there you have it..
Do the same with the camera script, but not the hotkey script, beacuse the hotkey script only needs to be sourced once, and after the quickSel script i might add, otherwise you're going to get multiple hotkey assignments (pain in the a**)

i think I explained this in the comments of the scripts, in case not, I'm sorry, my bad:shrug:

You might need to restart maya after putting the scripts in you folder, or it might not know they are there

ricma
09-13-2004, 07:25 PM
Hi there guys!
I`ve just finished this little script and I hope you`ll like it.:bounce:
It allows you to insert selected isoparm parametric value to multiple NURBS objects.
For example, create two NURBS planes and place them one next to the other.
Select desired isoparm parametric value on one of them, and holding SHIFT key select other NURBS plane and run this script.
A new window will open, and then click "Load".
Pay attention to the status line of the window, and you will notice a few options available.

I hope you`ll like it.

Here is the link to where you can download it and read how it works.
http://ricma3d.europe.webmatrixhosting.net/inserter.html

cheers,
ricma :beer:

Sheepshooter
09-17-2004, 10:10 AM
tell me again pliz...
how do i customize my MEL button on the shelf??

thx

ricma
09-19-2004, 10:07 PM
save the script to your hard drive and rename it to reseter.mel.
Copy that file to your Maya/scripts directory.
Enter Maya and open script editor
type: source "reseter.mel";
select that text and holding your middle mouse button, drag it on your shelf


ricma

Iconoklast
09-21-2004, 11:23 PM
to customise a mel button on the shelf, just right click on the black arrow thingy on the left of the shelf and go to shelf editor.

ephemeros
10-16-2004, 02:47 AM
i discovered today this thread, very good!
i hope to help people with mines. here is the one i made for my workplace, to toggle xray on and off, for the curent viewport:

int $valoare;
string $currentPanel = `getPanel -wf`;
$valoare= `modelEditor -pnl $currentPanel -q -xray $currentPanel`;
if ($valoare==0) {
eval("modelEditor -pnl $currentPanel -e -xray 1 "+$currentPanel);
}
if ($valoare==1) {
eval("modelEditor -pnl $currentPanel -e -xray 0 "+$currentPanel);
};


make it shelf button,or put it on hotkey.

someone asked if there was a game made in maya mel. mabye there are more, but i made only one :) i would like to share it but i cannot attach, sorry. if someone has a place for me to upload, pls. tell me.

X-Tender
11-07-2004, 04:42 PM
I saw a method to create normalmaps on this page: http://www.pinwire.com/article82.html
its a good wuick way for creating normalmaps for textures e.g. .. now i packed this documentklnowledge into a script and addet a GUI + some functions .. ;) ..

You can read the doc first maybe .. an example is includet in the zip

Documentation (http://xtender.mthn.net/normalis/normalis.htm)
Download (http://xtender.mthn.net/downloads/xt_normalis.zip)

R-Tillery
11-07-2004, 08:24 PM
I’m looking for a Good Mel script on X-ray, the one from Digital Tutors is for Maya 4.5 and the one on highend3d.com are nothing but shaders , the one On Digital tutors works great but only on 4 and 4.5, I have 6 and there’s seems to be nothing out there that I can find. If some one can kick me a good link id appreciate it. :)

X-Tender
11-07-2004, 09:43 PM
somethign like that?!

if (`modelEditor -q -xray modelPanel1` == 1)
{modelEditor -e -xray 0 modelPanel1;}
else {modelEditor -e -xray 1 modelPanel1;};
;
if (`modelEditor -q -xray modelPanel2` == 1)
{modelEditor -e -xray 0 modelPanel2;}
else {modelEditor -e -xray 1 modelPanel2;};
;
if (`modelEditor -q -xray modelPanel3` == 1)
{modelEditor -e -xray 0 modelPanel3;}
else {modelEditor -e -xray 1 modelPanel3;};
;
if (`modelEditor -q -xray modelPanel4` == 1)
{modelEditor -e -xray 0 modelPanel4;}
else {modelEditor -e -xray 1 modelPanel4;};
;

R-Tillery
11-08-2004, 12:05 AM
Cool thanks,, but not to sound ungrateful, but do you think you can make one that only uses the X-ray on a selected object and not the whole view, it helps out when working with image planes. So I can see the image better. If not that’s cool. I’m grateful for the help.:applause:

X-Tender
11-08-2004, 10:07 AM
afaik it is not possible without shader stuff ;/

Iconoklast
11-08-2004, 01:17 PM
http://www.backwaterbunch.com/free_stuff/scripts/dlXray.zip

That's the digital tutors xray script that works only on the selected object.

Note that it does work on Maya 6. I use it every day.

Sheepshooter
11-08-2004, 02:40 PM
mrBullseye (http://www.cgtalk.com/member.php?u=57335) vbmenu_register("postmenu_1542789", true);

how do it apply the script...
icopy it into the script editor...the NUMenter...and nothing heppand....what shoul i do.?

Iconoklast
11-08-2004, 05:18 PM
source the script like you did, then bind dlXray(); to a key. Press it while having and object selected

R-Tillery
11-08-2004, 06:59 PM
http://www.backwaterbunch.com/free_stuff/scripts/dlXray.zip

That's the digital tutors xray script that works only on the selected object.

Note that it does work on Maya 6. I use it every day.
How are you putting it in? I put it in my editor then middel click on it and darg it to my tool shelf, then when I try to use it as a mel script Icon I get a syntex error? I was told that it was only for 4.0 4.5?

Iconoklast
11-08-2004, 07:50 PM
what errors are you getting?

make sure to just make a shelf button of dlXray(); and not all the script information.

R-Tillery
11-08-2004, 08:22 PM
I just peed my self, I got it to work:applause: :bounce: :buttrock: Thanks bro:thumbsup:

Sheepshooter
11-09-2004, 11:56 AM
source the script like you did, then bind dlXray(); to a key. Press it while having and object selected
well...
pliz...im new at MEL scripting....
can you help me step by step...what i need to do and how...

plizi plizi =)

R-Tillery
11-09-2004, 12:54 PM
Let me tell you how I did it..

I put this Script in the script editor at the very bottom right hand corner in Maya.

Click to open it up and clear any other script in the editor and paste this in.



// declare variables

string $selected[];

string $hilited[];

string $object;

int $test[];

int $hold;



// assign values to variables for selected objects

$selected = `ls -sl -dag -ap -typ surfaceShape`;

$hilited = `ls -hl -dag -ap -typ surfaceShape`;



// loop through any objects in component mode

// and toggle their x-ray display

for ($object in $hilited){

$test = `displaySurface -q -xRay $object`;

$hold = $test[0];

if ($hold != false)

displaySurface -xRay false $object;

else

displaySurface -xRay true $object;



// clear test variable

clear $test;

}



// loop through any objects in object mode

// and toggle their x-ray display

for ($object in $selected){

$test = `displaySurface -q -xRay $object`;

$hold = $test[0];

if ($hold != false)

displaySurface -xRay false $object;

else

displaySurface -xRay true $object;



// clear test variable

clear $test;

}



// clear selection variables

clear $selected;

clear $hilited;

// Result: 0 //



After it’s in select all of the script in the editor and middle mouse click on it and drag it to your tool shelf and you should get a small gray button in your shelf that say’s Mel then create your own Icon 32x32 and edit you shelf and place it to your new mel script and you got your new X-ray Mel script button. This is like the best X-Ray script in the world.

Sheepshooter
11-11-2004, 03:20 PM
ok so....
iim talking abot the CAMERA MEL in the 11th page....when you use it it make a camera exectly in the perps defult camera postion...

so...
i copy the script to the script edtor...(done)
i drag it to the custom shelf (for exemple) (done)
i place my perps camera in the postion i want.... (done)
click the mel icon....aannndd....nothing happning again....im afraid that something worng with the script...

and how i can save the script as a MEL file in order to surce it from file>surce script>blah_blah_blah.mel

pliz help me...if this script will work...it will save a lot of time for me.

rohithtalk
11-13-2004, 08:03 AM
hello pal,

these scripts are really useful, but i was thing did u ever create mel scripts for the birds i mean feathers, so that are attached to the body! and which can even create bone for itself for the deformation, because when ever the feather is done and trying to be layed out it would be two job done one layout the feathers and the other rigging the feathers.

well i can give u some idea,how about using the particles to add points on the birds body"
and later select the script were u find primary , secondary, tritory feathers and say apply to each of the particles selected.

if u are done please help me this

regards
Rohith

mattswilson
11-14-2004, 04:10 PM
Hey guys,

Is there a way to float buttons over an image(with very irregular distribution). I would love to have checkboxes or radio buttons floating over a large image(Like a map) to control scene elements more dynamically. I can lay the boxes out in a grid manner, but it doesn't really overlay on the image where I need it to, in order to be useful. I need someting like that old operation game but in stead of the holes where you pull out the apple, you would have a checkbox. I would love to be able to use a solid image as the background for the ui and not have to slice it up into grids.

(simple version of the question: is there a way to position radio or check boxes based on x and Y values in a window?)

Cheers,
Matt

Datasage
03-02-2005, 08:34 AM
http://www.theworldisgrey.com/mel/scScatter.zip

This script is basically a mass duplicate/instance on a surface. It works pretty much with any type of object.

I wrote a bunch of scatter modes to control somewhat the amount of scatter given to an object. Including using a texture map with nurbs. Thanks to BigSky for pointing out colorAtPoint.

I will keep expanding this script. If you have ideas for it, let me know.

ashishdantu
03-02-2005, 10:06 PM
Hello people..

would like to share my small scripts, i use everyday with particles and fluids..

The particle tool has a small window with few buttons.. create an emiter,particle with one click button, then set the emiter and particles to standard fire type emission and the last two help to connect and disconnect selected emiter and then the particle..

Code:

/*
// Ashparts MEL // Quick particle / emiter setups
// Save to ur script folder as AshParts.mel and run source the script.
// Usage : ashpartsUI;
// Description: Quick click buttons to create emiters and particles.
// Select the required objects > emiters or particles and use the respective button. Last two buttons allow you to quickly link and delink selected emiter and particle..
// Please send your suggestions to Ashish Dantu: ashishdantu@yahoo.com
//
*/


global proc ashpartsUI()
{
if ( `window -exists UI_ashparts` )
deleteUI UI_ashparts;

window -t "Parts Utils" -w 200 -s 1 UI_ashparts;
columnLayout -rowSpacing 2 -adj 1 -cal "center";


button -l "Create Parts" -c "particle";
button -l "Create Emiter" -c "CreateEmitter";
button -l "Set Particles" -c "ashparts()";
button -l "Set Emiters" -c "ashemitrs()";
button -l "=><=" -c "ashconnect()";
button -l "<==>" -c "ashdisconnect()";


showWindow;

}

global proc ashparts()

{
string $obj[]= `ls -sl`;
string $shapes[] = `listRelatives -s $obj[0]`;
print $shapes[0];

setAttr ($shapes[0] + ".depthSort") 1;
setAttr ($shapes[0] + ".particleRenderType") 8;

setAttr ($shapes[0] + ".lifespanMode") 2;
setAttr ($shapes[0] + ".lifespan") 2;
setAttr ($shapes[0] + ".lifespanRandom") 1;

addAttr -ln radiusPP -dt doubleArray $shapes[0];
addAttr -ln radiusPP0 -dt doubleArray $shapes[0];
arrayMapper -target $shapes[0] -destAttr radiusPP -inputV ageNormalized -type ramp;

addAttr -ln "opacityPP" -dt doubleArray $shapes[0];
addAttr -ln "opacityPP0" -dt doubleArray $shapes[0];
arrayMapper -target particleShape1 -destAttr opacityPP -inputV ageNormalized -type ramp;


}


global proc ashemitrs()
{
string $emitr[]= `ls -sl`;

setAttr ($emitr[0] + ".emitterType") 0;
setAttr ($emitr[0] + ".directionY") 5;
setAttr ($emitr[0] + ".spread") 0.2;
setAttr ($emitr[0] + ".speed") 5;

}


global proc ashconnect()
{
string $connects[]=`ls -sl`;
connectDynamic -em $connects[0] $connects[1] ;
}

global proc ashdisconnect()
{
string $connects[]=`ls -sl`;
connectDynamic -d -em $connects[0] $connects[1] ;
}

ashpartsUI();



And FluidButs tool : quick window to show bounding box on / off of the selected FluidShape, enable / disable and show / hide it.


/*
// FluidButs MEL // Quick Fluid toggles.
// Save to ur script folder as fluidbuts.mel and run source the script.
// Usage : ashUI;
// Description: Quick click buttons to toggle Display > Bounding box, Enable / Disable and to show / hide the selected Fluid Shape.
// Please send your suggestions to Ashish Dantu: ashishdantu@yahoo.com
//
*/

global proc ashUI()
{
if ( `window -exists UI_ash` )
deleteUI UI_ash;

window -t "Fluid Utils" -w 200 -s 1 UI_ash;
columnLayout -rowSpacing 2 -adj 1 -cal "center";

button -l "Box Show" -c "D()";
button -l "Box No" -c "DN()";

button -l "Enable" -c "EN()";
button -l "Disable" -c "E()";

button -l "Show" -c "Show()";
button -l "Hide" -c "Hide()";

showWindow;

}

global proc D()
{
string $what[]= `ls -sl`;
int $sizu=(size($what));

for ($i=0;$i<$sizu;$i++)
{
setAttr ($what[$i]+".boundaryDraw") 4;
}
}

global proc DN()
{
string $what[]= `ls -sl`;
int $sizu=(size($what));

for ($i=0;$i<$sizu;$i++)
{
setAttr ($what[$i]+".boundaryDraw") 5;
}
}

global proc E()
{
string $what[]= `ls -sl`;
int $sizu=(size($what));

for ($i=0;$i<$sizu;$i++)
{
setAttr ($what[$i]+".disableInteractiveEval") 1;

}
}

global proc EN()
{
string $what[]= `ls -sl`;
int $sizu=(size($what));

for ($i=0;$i<$sizu;$i++)
{
setAttr ($what[$i]+".disableInteractiveEval") 0;

}
}

global proc Show()
{
string $what[]= `ls -sl`;
int $sizu=(size($what));

for ($i=0;$i<$sizu;$i++)
{
ShowSelectedObjects;

}
}

global proc Hide()
{
string $what[]= `ls -sl`;
int $sizu=(size($what));

for ($i=0;$i<$sizu;$i++)
{
HideSelectedObjects;
}
}
ashUI();


If you have any suggestions / comments, I need them all !!
cheers,

DezFX
03-03-2005, 02:45 AM
I've already posted all of these over at 3D Buzz (http://sv2.3dbuzz.com/vbforum/showthread.php?s=&threadid=69730) but I decided to put them up here as well in case some of you have never been to that forum.
//ToggleOutliner:
if ( `window -exists outlinerPanel1Window` )
deleteUI -window outlinerPanel1Window;
else
tearOffPanel "Outliner" "outlinerPanel" false;

//ToggleGrid:
string $currentPanel = `getPanel -underPointer`;

if ($currentPanel == "")
$currentPanel = `getPanel -withFocus`;

if (`modelEditor -q -ex $currentPanel`)
{
modelEditor -e -grid (!`modelEditor -q -grid $currentPanel`) $currentPanel;
}

//Toggle Background Color:
float $c[] = `displayRGBColor -q background`;

if ($c[0] > .6)
displayRGBColor -c background .357 .357 .357;

else if ($c[0]==0)
displayRGBColor -c background .672 .672 .672;

else
displayRGBColor -c background 0 0 0;

//Toggle Viewport X-Ray:
$currentPanel = `getPanel -withFocus`;

string $panelType = `getPanel -to $currentPanel`;

if ($panelType == "modelPanel")
{
modelEditor -e -xray ( !`modelEditor -q -xray $currentPanel` ) $currentPanel;
}

//ToggleWireframe:
$currentPanel = `getPanel -withFocus`;

string $panelType = `getPanel -to $currentPanel`;

if ($panelType == "modelPanel")
{
modelEditor -e -wos ( !`modelEditor -q -wos $currentPanel` ) $currentPanel;
}

//Toggle Normals:
string $all[] = `ls -sl`;
toggle -normal $all

//Toggle Walk Through Cameras:
string $currentPanel = `getPanel -underPointer`;

if ($currentPanel == "")
$currentPanel = `getPanel -withFocus`;

if(`getPanel -to $currentPanel` == "modelPanel")
{
if(`modelPanel -q -cam $currentPanel` == "top")
switchModelView front;
else if(`modelPanel -q -cam $currentPanel` == "front")
switchModelView side;
else if(`modelPanel -q -cam $currentPanel` == "side")
switchModelView Perspective;
else if(`modelPanel -q -cam $currentPanel` == "persp")
switchModelView top;
}

else
error "I'm sorry, but that is not a valid camera panel.";


//Look through selected:
string $currentPanel = `getPanel -underPointer`;

if ($currentPanel == "")
$currentPanel = `getPanel -withFocus`;

if(`getPanel -to $currentPanel` == "modelPanel")
{
string $sel[] = `ls -sl`;
lookThru $sel[0];
}

else
error "That is not a camera panel.";


//Camera home:
string $currentPanel = `getPanel -underPointer`;

if ($currentPanel == "")
$currentPanel = `getPanel -withFocus`;

if(`getPanel -to $currentPanel` == "modelPanel")
{
string $camera = `modelEditor -q -camera $currentPanel`;
viewSet -home $camera;
}

else
error "I'm sorry, but that is not a valid camera panel.";

//Toggle Walk Through Shelf Tabs:
int $shelfQty = `shelfTabLayout -q -nch MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout`;
int $shelfNum = `tabLayout -q -sti MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout`;

if ($shelfNum < $shelfQty)
{
shelfTabLayout -edit -selectTabIndex ($shelfNum + 1)
MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout;
optionVar -iv selectedShelf `tabLayout -q -sti MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout`;
shelfTabChange;
}

else
{
shelfTabLayout -edit -selectTabIndex 1
MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout;
optionVar -iv selectedShelf `tabLayout -q -sti MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout`;
shelfTabChange;
}

string $shelfName = `shelfTabLayout -q -st MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout`;

print ("New shelf is " + $shelfName);



//Help window:
string $myWindow = "cmdHelp";

if (`window -ex $myWindow`)
deleteUI $myWindow;

window -rtf true -s false -title "Command Help" $myWindow;

columnLayout;
textFieldGrp -label "Command:" -cw 1 75 -cw 2 200 -cc cmdHelp cmd;
button -w 275 -l "Find" -c "cmdHelp";

showWindow $myWindow;

proc cmdHelp()
{
string $cmd = `textFieldGrp -q -tx cmd`;
help -doc $cmd;
}

//I've found that when modeling you want to jump between the different modes for the transform tool
// Here are 3 small scripts to toggle through these modes
//Object: Alt + o
if (`manipMoveContext -q -mode Move` == 2)
manipMoveContext -edit -mode 0 Move;

else
manipMoveContext -edit -mode 2 Move;

//Local: Alt + l
if (`manipMoveContext -q -mode Move` == 2)
manipMoveContext -edit -mode 1 Move;

else
manipMoveContext -edit -mode 2 Move;

//Normal: Alt + n
if (`manipMoveContext -q -mode Move` == 2)
manipMoveContext -edit -mode 3 Move;

else
manipMoveContext -edit -mode 2 Move;


//Toggle the render view window
if(`window -ex renderViewWindow`)
deleteUI -window "renderViewWindow";
else
RenderViewWindow;

//Toggle the Attribute Editor

string $panel = `getPanel -withFocus`;
if (`window -ex AEWindow`)
deleteUI -window "AEWindow";
else
openAEWindow;
setFocus $panel;


// This is an X-Ray command to toggle all viewports at the same time
select -all;
$sel = `ls -sl -dag -ap -typ surfaceShape`;
for ($obj in $sel)
{
$temp = `displaySurface -q -xRay $obj`;
$value = $temp[0];
if ($value == 1)
displaySurface -xRay 0 $obj;
else
displaySurface -xRay 1 $obj;
}
select -cl;


//Toggle Hypershade
if ( `window -exists hyperShadePanel1Window` )
deleteUI -window hyperShadePanel1Window;
else
tearOffPanel "Hypershade" "hyperShadePanel" true;

//Toggle Hypergraph
if ( `window -exists hyperGraphPanel1Window` )
deleteUI -window hyperGraphPanel1Window;
else
tearOffPanel "Hypergraph" "hyperGraphPanel" true;

//Toggle Multilister
if ( `window -exists multiListerPanel1Window` )
deleteUI -window multiListerPanel1Window;
else
tearOffPanel "Multilister" "multiListerPanel" true;

//Here's a little script that will delete any motion path connected to the selected object

code:string $obj[] = `ls -sl`;
string $mPath[] = `listConnections -type "motionPath" $obj[0]`;
delete $mPath[0];

You can also get some of my larger scripts by either downloading them from Highend 3D (http://www.highend3d.com/maya/mel/) or directly from my site (http://www.dezfx.com/HTML_Pages/MELScripts.html).

eblondin
03-09-2005, 06:28 PM
sweet! thank you, i knew i was really really close, i was basically one word off in my command thanks a lot!

eblondin
03-09-2005, 07:24 PM
the mel command to toggle the graph editor is a little bit different, just incase any one needs it i figured it out

if ( `window -exists graphEditor1Window` )
deleteUI -window graphEditor1Window;
else
tearOffPanel "Graph Editor" "graphEditorPanel" true;

thanks again for your help Dezfx

ashishdantu
03-10-2005, 02:39 PM
Hi, people,...

Updated my AshParts (utilities for particles) with "reset particle inistial states" and "set initial state" options too.

Pls lemme know how to improve any of these..

UR CCs are awaited ..

Remmers
03-26-2005, 01:43 PM
I been look a little bit around here and some of this scripts seem very useful but what about the curve cube in on the first post what is it good for I have tryed to do something usefull with it but I can't figure out what it is I am supose to use it for.

cpan
03-26-2005, 01:56 PM
here's a MM to toggle between Pers/Hypershade/Hypergraph/etc for all those who said hypershade/graph open slow

ajk48n
04-29-2005, 03:09 AM
Here's a script to convert edges into extruded tubes. Source the script, and run

convertEdges(float radius, float hide, float finishPercent)

radius is the radius of the tube, .01 seems to work nicely
hide is whether or not the object that has the edges gets hidden, 1 it gets hidden, 0 it does not
finishPercent is the percentage of the edges that get made into tubes, if you enter 0 or 100 it does all of them

azshall
05-02-2005, 07:00 PM
Thats really cool. I thought about adding an ability to save and load contacts but didnt have the time, so Its great you have put that in.

A couple of suggestions:

Maybe when you add a contact you have the option of browsing available network machines, so you dont have to type the names in.

It would be nice if it detected if you had a saved contact list on startup and automatically loaded that up.

Take it easy.

- John

would be cool if you could rename the box to the person that uses it. rather than seeing a computer machine name... would help that way i'm not kicking messeges over to a producer or accounting or something :)

az

kickass tho

SajNT
05-10-2005, 02:33 PM
To toggle between xray views, try this:

string $p[];
$p[0] = `getPanel -wf`
modelEditor -e -xray (!`modelEditor -q -xray ($p[0])`) $p[0];

then assign it to a hotkey, i had alt+x for mine. Each time you hit the keys, it does the oppsite of whatz already in the panel ( because of the ! )..pretty handy when it comes to rigging where u have to pick underlaying joints beneath the mesh.

R-Tillery
06-13-2005, 01:23 PM
Any one know if the view panels X.Y.Z have their own hot keys assigned like the perspective view dose like =Alt+p or is there a script out there I can get?

R-Tillery
06-14-2005, 03:34 AM
If any one is interested I found the way to set up the Hot Keys I needed for the X / Y / Z View I needed. Courtesy of a cool dude called (

Vladimirjp)



Just add this line into you hot key editor and setup the key you want.



"switchModelView Perspective"

Front

Side

Top



Make sure to space between Modelview and the Panel you want to open. I cant script for Sh!t so it kicked my butt.

GennadiyKorol
07-16-2005, 12:30 PM
Have just worked with some polygon smooth, and felt that it would be very nice to be able to set the divisions for the smooth like you can do that for nurbs and subdivs with 1 2 3 hotkeys. So I wrote a basic mel to do that:


proc HKSetSmoothDivisions( int $Divisions )
{
$Sel = `ls -sl -fl`;
string $inLst, $cur, $History[];
for ( $cur in $Sel )
{
if ( `nodeType $cur` == "polySmoothFace")
setAttr ($cur+".divisions") $Divisions;
else if ( `nodeType $cur` == "transform")
{
$History = `listHistory $cur`;

for ( $inLst in $History )
if ( `nodeType $inLst` == "polySmoothFace")
{
setAttr ($inLst+".divisions") $Divisions;
break;
}
}
}
}
HKSetSmoothDivisions(2)



Works on selected objects, transforms, smooths. use it like HKSetSmoothDivisions( number of divisions ), I've setted it together with maya's default displaySmoothness command on my 1 2 3 hotkeys to set 0 1 and 2 division level accordingly for selected objects that have polySmooth node in history or selected poly smooth nodes. If the object is selected it sets divisions for the highest polysmooth node in history. Hope you will enjoy it : )

Anchuvi
07-18-2005, 02:42 PM
Cool thread!!!

I am looking for some help with a script and thought this might be the place to post. I am working on a scene which hold alot of instances and I basically need a script that will guve me -

1. The trianlge count if the scene ignoring instances.
2. The triangle count of a scene as if instances were real objects...

This is what I have so far -


string $modelList[] = `ls -et mesh`;

int $values[1] = {0,0};

for ($model in $modelList)
{
string $hasHistory[] = `listHistory -pdo 1 $model`;
string $hasShader[] = `listConnections -type shadingEngine $model`;

if (`size($hasHistory)` > 1 || `size($hasShader)` != 0)
{
int $polyCnt[] = `polyEvaluate -t $model`;
string $instCheck[] = `listRelatives -ap $model`;

$values[0] = $values[0] + ($polyCnt[0]*size($instCheck));
$values[1] = $values[1] + $polyCnt[0];
}
}

print $values;


but its not exact as some of the geometry has history etc....any help appreciated!

larryvm
08-12-2005, 09:04 AM
this is a mel script to see the near and far clip planes, and the near and far sharp visibility in DOF.

you only have to select a camera and run the script fvDOF

global proc fvDOF ()
{
string $seleccion[],$camara,$tipo;

$seleccion=`ls -sl -dag -ca`;
if (size($seleccion)!=0)
{
$camara=$seleccion[0];
$tipo=`nodeType $camara`;
$cam=`listRelatives -p $camara`;

addAttr -ln hiperfocal -at double $camara;
setAttr -e -keyable true ($camara+".hiperfocal");
addAttr -ln nearSharp -at double $camara;
setAttr -e -keyable true ($camara+".nearSharp");
addAttr -ln farSharp -at double $camara;
setAttr -e -keyable true ($camara+".farSharp");
connectAttr -f ($camara+".coi") ($camara+".fd");
//creamos el cubo de volumen visual
polyCube -w .001 -h .001 -d .001 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -tx 1 -ch 1 -n ($camara+"_fustrumCube");
//creamos los planos cercanos y lejanos de enfoque
polyPlane -w 1 -h 1 -sx 10 -sy 10 -ax 0 1 0 -tx 1 -ch 1 -n ($camara+"_farPlane");
polyPlane -w 1 -h 1 -sx 10 -sy 10 -ax 0 1 0 -tx 1 -ch 1 -n ($camara+"_nearPlane");
//los emparentamos a la camara
parent ($camara+"_farPlane") $cam[0];
parent ($camara+"_nearPlane") $cam[0];
parent ($camara+"_fustrumCube") $cam[0];

//asignamos los valores de las transformaciones relativos a la camara
setAttr ($camara+"_farPlane.translateX") 0.0;
setAttr ($camara+"_farPlane.translateY") 0.0;
setAttr ($camara+"_farPlane.translateZ") 0.0;
setAttr ($camara+"_farPlane.rotateX") 90.0;
setAttr ($camara+"_farPlane.rotateY") 0.0;
setAttr ($camara+"_farPlane.rotateZ") 0.0;

setAttr ($camara+"_nearPlane.translateX") 0.0;
setAttr ($camara+"_nearPlane.translateY") 0.0;
setAttr ($camara+"_nearPlane.translateZ") 0.0;
setAttr ($camara+"_nearPlane.rotateX") 90.0;
setAttr ($camara+"_nearPlane.rotateY") 0.0;
setAttr ($camara+"_nearPlane.rotateZ") 0.0;

setAttr ($camara+"_fustrumCube.translateX") 0.0;
setAttr ($camara+"_fustrumCube.translateY") 0.0;
setAttr ($camara+"_fustrumCube.translateZ") 0.0;
setAttr ($camara+"_fustrumCube.rotateX") 0.0;
setAttr ($camara+"_fustrumCube.rotateY") 0.0;
setAttr ($camara+"_fustrumCube.rotateZ") 0.0;

//eliminamos los parametros de render y de shading;

setAttr ($camara+"_farPlane.castsShadows") 0;
setAttr ($camara+"_farPlane.receiveShadows") 0;
setAttr ($camara+"_farPlane.motionBlur") 0;
setAttr ($camara+"_farPlane.primaryVisibility") 0;
setAttr ($camara+"_farPlane.smoothShading") 0;
setAttr ($camara+"_farPlane.visibleInReflections") 0;
setAttr ($camara+"_farPlane.visibleInRefractions") 0;
setAttr ($camara+"_farPlane.template") 1;


setAttr ($camara+"_nearPlane.castsShadows") 0;
setAttr ($camara+"_nearPlane.receiveShadows") 0;
setAttr ($camara+"_nearPlane.motionBlur") 0;
setAttr ($camara+"_nearPlane.primaryVisibility") 0;
setAttr ($camara+"_nearPlane.smoothShading") 0;
setAttr ($camara+"_nearPlane.visibleInReflections") 0;
setAttr ($camara+"_nearPlane.visibleInRefractions") 0;
setAttr ($camara+"_nearPlane.template") 1;


setAttr ($camara+"_fustrumCube.castsShadows") 0;
setAttr ($camara+"_fustrumCube.receiveShadows") 0;
setAttr ($camara+"_fustrumCube.motionBlur") 0;
setAttr ($camara+"_fustrumCube.primaryVisibility") 0;
setAttr ($camara+"_fustrumCube.smoothShading") 0;
setAttr ($camara+"_fustrumCube.visibleInReflections") 0;
setAttr ($camara+"_fustrumCube.visibleInRefractions") 0;
setAttr ($camara+"_fustrumCube.template") 1;


////////////////////////////////////////////
//creamos la expresion
///////////////////////////
string $expres;
$expres=("float $cameraApertureH,$cameraApertureV;\n");
$expres+=("float $hiperFocal;\n");

$expres+=("$cameraApertureH="+$camara+".horizontalFilmAperture;\n");
$expres+=("$cameraApertureV="+$camara+".verticalFilmAperture;\n");
$expres+=("$focalLength="+$camara+".focalLength;\n");
$expres+=("float $fov = (0.5 * $cameraApertureH) / ($focalLength * 0.03937);\n");
$expres+=("$fov = 2.0 * atan ($fov);\n");
$expres+=("$fov = 57.29578 * $fov; \n");
$expres+=("$fov*=.5;\n");
$expres+=("$fov=$fov*3.14159/180;\n");
$expres+=("$cameraApertureH*=25.64;\n");
$expres+=("$cameraApertureV*=25.64;\n");

$expres+=("$distancia="+$camara+".centerOfInterest;\n");
$expres+=("$distancia=$distancia*100;\n");
$expres+=("$focalStop= "+$camara+".fStop;\n");
$expres+=("$circuloDeConfusion=(sqrt (($cameraApertureH * $cameraApertureH) + ($cameraApertureV * $cameraApertureV))) / 1730.0;\n");
$expres+=("$hiperFocal=(($focalLength*$focalLength)/($focalStop*$circuloDeConfusion));\n");
$expres+=("$focoCercano=($distancia*($hiperFocal-$focalLength))/($hiperFocal+$distancia-2*$focalLength);\n");
$expres+=("$focoLejano=($distancia*($hiperFocal-$focalLength))/($hiperFocal-$distancia);\n");
$expres+=("//cambiamos de medida los valores (cm/m)\n");
$expres+=("$hiperFocal*=.01;\n");
$expres+=("$focoCercano*=.01;\n");
$expres+=("$focoLejano*=.01;\n");

$expres+=("//asignamos los valores a la camara;\n");
$expres+=($camara+".hiperfocal=$hiperFocal;\n");
$expres+=($camara+".nearSharp=$focoCercano;\n");
$expres+=($camara+".farSharp=$focoLejano;\n");
$expres+=($camara+"_farPlane.translateZ=-1.0*$focoLejano;\n");
$expres+=($camara+"_farPlane.scaleX=(`tan($fov)`*$focoLejano)*2;\n");
$expres+=($camara+"_farPlane.scaleZ=(`tan($fov)`*$focoLejano)*2/1.33;\n");
$expres+=("//ocultamos el far sharp plane si la distancia es infinita;\n");
$expres+=("if ("+$camara+".farSharp<0)\n");
$expres+=($camara+"_farPlane.visibility=0;\n");
$expres+=("else\n");
$expres+=($camara+"_farPlane.visibility=1;\n");

$expres+=($camara+"_nearPlane.translateZ=-1.0*$focoCercano;\n");
$expres+=($camara+"_nearPlane.scaleX=(`tan($fov)`*$focoCercano)*2;\n");
$expres+=($camara+"_nearPlane.scaleZ=(`tan($fov)`*$focoCercano)*2/1.33;\n");
$expres+=("///asignamos hiperfocal, nearSharp y far sharp planes\n");


$expres+=("//calculamos las posiciones near y far (con un desfase para poder verlas en camara.\n");
$expres+=("float $nc="+$camara+".nearClipPlane+.01;\n");
$expres+=("$near=($nc)*-1.0;\n");
$expres+=("float $fc="+$camara+".farClipPlane-.1;\n");
$expres+=("$far=$fc*-1.0;\n");
$expres+=("//calculamos los extremos de volumen visual;\n");

$expres+=("$xnear=(`tan($fov)`*$nc);\n");
$expres+=("$xfar=(`tan($fov)`*$fc);\n");
$expres+=("$ynear=(((`tan($fov)`*($nc)))/1.333);\n");
$expres+=("$yfar=(((`tan($fov)`*($fc)))/1.333);\n");
$expres+=("//asignamos los puntos;\n");

$expres+=($camara+"_fustrumCube.pnts[0].pntz=$near;\n");
$expres+=($camara+"_fustrumCube.pnts[0].pntx=-1.0*$xnear;\n");
$expres+=($camara+"_fustrumCube.pnts[0].pnty=-1.0*$ynear;\n");

$expres+=($camara+"_fustrumCube.pnts[1].pntz=$near;\n");
$expres+=($camara+"_fustrumCube.pnts[1].pntx=$xnear;\n");
$expres+=($camara+"_fustrumCube.pnts[1].pnty=-1.0*$ynear;\n");

$expres+=($camara+"_fustrumCube.pnts[2].pntz=$near;\n");
$expres+=($camara+"_fustrumCube.pnts[2].pntx=-1.0*$xnear;\n");
$expres+=($camara+"_fustrumCube.pnts[2].pnty=$ynear;\n");

$expres+=($camara+"_fustrumCube.pnts[3].pntz=$near;\n");
$expres+=($camara+"_fustrumCube.pnts[3].pntx=$xnear;\n");
$expres+=($camara+"_fustrumCube.pnts[3].pnty=$ynear;\n");
$expres+=($camara+"_fustrumCube.pnts[4].pntz=$far;\n");
$expres+=($camara+"_fustrumCube.pnts[4].pntx=-1.0*$xfar;\n");
$expres+=($camara+"_fustrumCube.pnts[4].pnty=$yfar;\n");
$expres+=($camara+"_fustrumCube.pnts[5].pntz=$far;\n");
$expres+=($camara+"_fustrumCube.pnts[5].pntx=$xfar;\n");
$expres+=($camara+"_fustrumCube.pnts[5].pnty=$yfar;\n");
$expres+=($camara+"_fustrumCube.pnts[6].pntz=$far;\n");
$expres+=($camara+"_fustrumCube.pnts[6].pntx=-1.0*$xfar;\n");
$expres+=($camara+"_fustrumCube.pnts[6].pnty=-1.0*$yfar;\n");
$expres+=($camara+"_fustrumCube.pnts[7].pntz=$far;\n");
$expres+=($camara+"_fustrumCube.pnts[7].pntx=$xfar;\n");
$expres+=($camara+"_fustrumCube.pnts[7].pnty=-1.0*$yfar;\n");
expression -s $expres -o $camara -ae 1 -uc all ;
}

else
{
print ("there is no camera selected\n");
}
}

velburg20
10-09-2005, 12:35 AM
I have not done any work with MEL well very little, however, I am makeing a project that involves controling the motion of a simple low poly mechanical arm, something like a backhoe, and I want to be able to control the motion of this arm by using hot keys that I define and have this render in real-time.

I have heard that MEL will work for this and has been done before. I was wondering if someone knew about this or could point me to a site that could be helpful, though I am not sure if a tutorial web site would have this kind of information.

Mr Elusive
10-14-2005, 10:18 PM
Here's a little trick I turned into a script. Instead of having to rely on hotkeys to turn on xray or toggle wireframe only (which is a bummer when I need to still have my textured geo planes showing), I just put them in the time slider.

So I just select an object I want to use it on, use the script and it resizes the scenes playback time to 3, sets the transparency on the objects material on frame 2 to 75% (about what xray uses), and 100% on frame 3 (frame 1 is no transparency).


$s=`ls -sl`;
$shade=`listSets -t 1 -ets -o $s`;
string $connections[] = `listConnections -d 0 -s 1 $shade`;
$material = $connections[0];
$transparency = $material+".transparency";

playbackOptions -min 1 -max 3;
currentTime 1;
setKeyframe $transparency;
currentTime 2;
setAttr $transparency -type double3 .75 .75 .75;
setKeyframe $transparency;
currentTime 3;
setAttr $transparency -type double3 1 1 1;
setKeyframe $transparency;
currentTime 4;
setAttr $transparency -type double3 0 0 0;
setKeyframe $transparency;
currentTime 1;

velburg20
10-15-2005, 12:08 PM
I could use some help with figuring out creating hotkeys to control the movement of a mechanical arm. The mechanical arm needs to rotate L/R, extend, retracked, raise, and lowwer. Also what keys can I use, will I be able to use teh number pad being numbers have an action that is used in the program already?

bartlomiejk
10-19-2005, 04:32 PM
Hi all
one question...
is it possible to translate pivot via MEL?

bartlomiejk
10-20-2005, 11:32 AM
Never mind...
There are some flags to transform particular modification or something (eg. poly_extrude_edge)

bartlomiejk
10-20-2005, 01:34 PM
Or you can use xform (eg. xform -os -piv 0 1 0 ;)
:)

ruukki
11-15-2005, 07:44 AM
Byron's Automatic Unwrap Tools

I made a script that allows to automatically unwrap a polygonal object.

You define the cuts, and/or create special Zones to control the Flow of the UVMesh und click a Button ... et voilà .

You can download it here because its to big to post it:

http://www.highend3d.com/maya/mel/?section=polygon#2075

Bests
Sebastian

Hi, I'd love to try this but it's now moved somewhere due to Highend3D:s changes... if it's not too much trouble, could you please update?

ruukki
11-15-2005, 07:52 AM
Okay, DUMB question:

Where is the SCRIPTS directory? I ask because I have the following scripts folders:

C:\Documents and Settings\Steve\My Documents\maya\4.5\scripts
C:\Documents and Settings\Steve\My Documents\maya\scripts
C:\Program Files\AliasWavefront\Maya4.5\scripts
C:\Program Files\AliasWavefront\mental ray for Maya 1.5\scripts


I assume the first folder is the one you are referring to, but why does AW keep reusing this directory name? Makes it confusing.

-=STZ=-

I had some trouble with the location too, but then I accidentally found the solution: in the Script Editor, do Source Script and have a look at the path there. Would have required some divergent intelligence to start from that end, I was just lucky.

cpan
11-15-2005, 09:03 AM
Hi, I'd love to try this but it's now moved somewhere due to Highend3D:s changes... if it's not too much trouble, could you please update?

the script is available for downloading on byron's website...
http://www.byronimo.de/download_scripts.htm
... but he says the script might not work on newer maya versions.


cheers

calebros
11-17-2005, 10:47 PM
does anyone know if there is a way to query maya's internal clock (or some other way of measuring "real" time?) Frames won't work because the timeline has to play for that.

(an example to be clear) say i was trying to set up a game in maya where something happens every 20 seconds, or say i was trying to make an autosave feature that saved every 30 min for me.

any thoughts?

rblitz7
11-18-2005, 01:42 AM
If any one is interested I found the way to set up the Hot Keys I needed for the X / Y / Z View I needed. Courtesy of a cool dude called (

Vladimirjp)



Just add this line into you hot key editor and setup the key you want.



"switchModelView Perspective"

Front

Side

Top



Make sure to space between Modelview and the Panel you want to open. I cant script for Sh!t so it kicked my butt.
didnt work. do I need to download a mel script? it says Error: Too few arguments given

R-Tillery
11-18-2005, 02:34 AM
Try typing it in with out the quotations,, it works for me fine?

rblitz7
11-19-2005, 01:26 AM
Hey this is what I have but it says syntax error
http://img352.imageshack.us/img352/8037/picture14wz.png

R-Tillery
11-19-2005, 02:26 AM
Make = "switchModelView Perspective"

Look like = switchModelView Perspective"

just need to take off the ( " ) quotation on the first part and leave it on the end.

Edit
Sorry take off the " and put ; at the end

danyrey
11-24-2005, 12:35 PM
Here a new mel script to share, have a look:

>>Download drTrail at the Highend3D site<< (http://www.highend3d.com/maya/downloads/mel_scripts/modeling/poly_tools/3851.html)

Command:
drTrail

Description:
drTrail creates a polygonal trail object.
drTrail creates four objects:






pTrail - this is the polygon object representing the trail
grpTrail - this is the main locator, it has an attribute called "Trail Length" which specifies the length of the trail
lcTrail and lcTrail1 - the direct line between theese two locators is, where the trail origin is.
How to use:
Attach the main locator to an animated object (parenting or with constraints) and you are done.

Set keyframes on the polygon object(pTrail) for extra effects like wind or gravity.

Limitations:


The trail need some preroll to render correctly. E.g. if the trail length is 10 you need 10 frames preroll, so the trail has its initial position.
Has not been tested yet with distributed rendering.
Known Bugs:
Not a bug exactly: quick motions or some viewing angles, especially when the trail has transparency, can produce render artifacts. Quick workaround is to convert the pTrail object to SubDiv (Proxy object).

Bonus:
There is a example shader for pTrail within the zip file!

-daniel

zenfull
12-02-2005, 05:59 AM
This is a MEL Script that creates a UI that allows you to smooth objects to various levels using the Sculpt Polygons Tool - Flood. I hope you like it, it's my first written script ever.

proc SmoothV1()
{
SculptPolygonsToolOptions;
artPuttyCtx -e -op 0.3200 `currentCtx`;
artPuttyCtx -e -r 1.5000 `currentCtx`;
artPuttyCtx -e -lr 1.5000 `currentCtx`;
artPuttyCtx -e -clear `currentCtx`;
}

proc SmoothV2()
{
SculptPolygonsToolOptions;
artPuttyCtx -e -op 0.4500 `currentCtx`;
artPuttyCtx -e -r 1.5000 `currentCtx`;
artPuttyCtx -e -lr 1.5000 `currentCtx`;
artPuttyCtx -e -clear `currentCtx`;
}

proc SmoothV3()
{
SculptPolygonsToolOptions;
artPuttyCtx -e -op 0.70000 `currentCtx`;
artPuttyCtx -e -r 1.5000 `currentCtx`;
artPuttyCtx -e -lr 1.5000 `currentCtx`;
artPuttyCtx -e -clear `currentCtx`;
}

proc SmoothV4()
{
SculptPolygonsToolOptions;
artPuttyCtx -e -op 1.00000 `currentCtx`;
artPuttyCtx -e -r 1.5000 `currentCtx`;
artPuttyCtx -e -lr 1.5000 `currentCtx`;
artPuttyCtx -e -clear `currentCtx`;
}

window -title "Sculpt Polygons SmoothBox" PolySmooth;
columnLayout;
button -label "Smooth v1" -command "SmoothV1";
button -label "Smooth v2" -command "SmoothV2";
button -label "Smooth v3" -command "SmoothV3";
button -label "Smooth v4" -command "SmoothV4";
button -label "Undo" -command "undo";

showWindow;

Alife513
12-02-2005, 10:45 AM
Hi,

If you have to store loads of data in a scene, I like to use string array attributes. 2 simple procedures that help with that are these:


proc arrayToAttr(string $array[], string $attr)
{
string $attrs = "";
for($i = 0; $i < `size $array`; $i++)
$attrs = ($attrs + " \"" + $array[$i] + "\"");
$exp = ("setAttr " + $attr + " -type stringArray " + `size $array` + " " + $attrs + ";");
eval($exp);
}
proc string[] attrToArray(string $attr)
{
return `getAttr $attr`;
}


I thought they might be usefull to share, as the -stringArray option is not that clearly documented in the help.

to use it create an object and add a stringArray Attribute to it:
addAttr -ln myStringArrayAttribute -dt stringArray locator1

to store an array onto that attribute:

string $myArray[] = `ls -sl`;
arrayToAttr $myArray locator1.myStringArrayAttribute;


to retrive data:
string $myArray2 = `attrToArray locator1.myStringArrayAttribute`;

Hope this is usefull to anyone.

Micha

j.tobergte
01-05-2006, 01:01 AM
Hi Folks!

I just updated my MEL section on my page - if you want to have a look, please feel free to visit: www.polystorm.de/mel (http://www.polystorm.de/mel)

Just 3 Tools available now, but i have much unreleased scripts, so i will release script by script in the future...

Hope you like it - enjoy...
ciao, joerg.

MTCG
01-07-2006, 04:26 AM
Hi,
Here are some mels iv created for rendering and lighting, and they are realy greate to save your time by getting rid of the time consuming tasks such as linking lights together and creating lights and cameras .. etc :


1- Create at perspictive view :

DISCRIPTION :
When ever you create a light or camera or even objects and click the mel it will automaticaly move it to be in the same place as the perspictive is and let it point to the same view.



global float $Pos[2];
global string $Temp[];
global proc Choose_Cam()
{
camera -centerOfInterest 5 -focalLength 35 -lensSqueezeRatio 1 -cameraScale 1 -horizontalFilmAperture 1.41732 -horizontalFilmOffset 0 -verticalFilmAperture 0.94488 -verticalFilmOffset 0 -filmFit Fill -overscan 1 -motionBlur 0 -shutterAngle 144 -nearClipPlane 0.01 -farClipPlane 1000 -orthographic 0 -orthographicWidth 30; objectMoveCommand; cameraMakeNode 1 "";
rename "Cam";
$Pos[0]=getAttr("persp.translateX");
$Pos[1]=getAttr("persp.translateY");
$Pos[2]=getAttr("persp.translateZ");

$Temp=`ls-sl`;
setAttr($Temp[0]+".translateX",$Pos[0]);
setAttr($Temp[0]+".translateY",$Pos[1]);
setAttr($Temp[0]+".translateZ",$Pos[2]);
$Pos[0]=getAttr("persp.rotateX");
$Pos[1]=getAttr("persp.rotateY");
$Pos[2]=getAttr("persp.rotateZ");

setAttr($Temp[0]+".rotateX",$Pos[0]);
setAttr($Temp[0]+".rotateY",$Pos[1]);
setAttr($Temp[0]+".rotateZ",$Pos[2]);
setAttr($Temp[0]+".focalLength",31.1);
}

global proc active()
{
$Temp=`ls-sl`;
$Pos[0]=getAttr("persp.translateX");
$Pos[1]=getAttr("persp.translateY");
$Pos[2]=getAttr("persp.translateZ");
setAttr($Temp[0]+".translateX",$Pos[0]);
setAttr($Temp[0]+".translateY",$Pos[1]);
setAttr($Temp[0]+".translateZ",$Pos[2]);
$Pos[0]=getAttr("persp.rotateX");
$Pos[1]=getAttr("persp.rotateY");
$Pos[2]=getAttr("persp.rotateZ");
setAttr($Temp[0]+".rotateX",$Pos[0]);
setAttr($Temp[0]+".rotateY",$Pos[1]);
setAttr($Temp[0]+".rotateZ",$Pos[2]);
select -r $Temp[0];
pickWalk -d down;
$Temp=`ls-sl`;
if (attributeExists("focalLength",$Temp[0]))
{
setAttr($Temp[0]+".focalLength",31.1);
}
print($Temp[0]);

}
active();



2- In the next post.

3- MentalRay Resolution Manager:

DISCRIPTION :
A UI that give the ability to change between MR`s res typs (Draft,Preview,Production,FineTrace) without losing your other settings such as the FG or the GI,and directly without creating or loading presets.



proc Draft()
{
setAttr "miDefaultOptions.minSamples" -2;
setAttr "miDefaultOptions.maxSamples" 0;
setAttr "miDefaultOptions.filter" 0;
setAttr "miDefaultOptions.filterWidth" 1;
setAttr "miDefaultOptions.filterHeight" 1;
setAttr "miDefaultOptions.contrastR" 0.1;
setAttr "miDefaultOptions.contrastG" 0.1;
setAttr "miDefaultOptions.contrastB" 0.1;
setAttr "miDefaultOptions.contrastA" 0.1;
setAttr "miDefaultOptions.jitter" 0;
setAttr "miDefaultOptions.maxReflectionRays" 1;
setAttr "miDefaultOptions.maxRefractionRays" 1;
setAttr "miDefaultOptions.maxRayDepth" 2;
setAttr "miDefaultOptions.maxShadowRayDepth" 2;
setAttr miDefaultOptions.scanline 1;
}

proc Preview()
{
setAttr "miDefaultOptions.minSamples" -1;
setAttr "miDefaultOptions.maxSamples" 1;
setAttr "miDefaultOptions.filter" 1;
setAttr "miDefaultOptions.filterWidth" 1;
setAttr "miDefaultOptions.filterHeight" 1;
setAttr "miDefaultOptions.contrastR" 0.1;
setAttr "miDefaultOptions.contrastG" 0.1;
setAttr "miDefaultOptions.contrastB" 0.1;
setAttr "miDefaultOptions.contrastA" 0.1;
setAttr "miDefaultOptions.jitter" 0;
setAttr "miDefaultOptions.maxReflectionRays" 2;
setAttr "miDefaultOptions.maxRefractionRays" 2;
setAttr "miDefaultOptions.maxRayDepth" 3;
setAttr "miDefaultOptions.maxShadowRayDepth" 2;
setAttr miDefaultOptions.scanline 1;
}

proc Production()
{
setAttr "miDefaultOptions.minSamples" 0;
setAttr "miDefaultOptions.maxSamples" 2;
setAttr "miDefaultOptions.filter" 2;
setAttr "miDefaultOptions.filterWidth" 1;
setAttr "miDefaultOptions.filterHeight" 1;
setAttr "miDefaultOptions.contrastR" 0.1;
setAttr "miDefaultOptions.contrastG" 0.1;
setAttr "miDefaultOptions.contrastB" 0.1;
setAttr "miDefaultOptions.contrastA" 0.1;
setAttr "miDefaultOptions.jitter" 0;
setAttr "miDefaultOptions.maxReflectionRays" 10;
setAttr "miDefaultOptions.maxRefractionRays" 10;
setAttr "miDefaultOptions.maxRayDepth" 20;
setAttr "miDefaultOptions.maxShadowRayDepth" 2;
setAttr miDefaultOptions.scanline 1;
}
proc FineTrace()
{
setAttr "miDefaultOptions.minSamples" 1;
setAttr "miDefaultOptions.maxSamples" 2;
setAttr "miDefaultOptions.filter" 1;
setAttr "miDefaultOptions.filterWidth" 0.75;
setAttr "miDefaultOptions.filterHeight" 0.75;
setAttr "miDefaultOptions.contrastR" 0.02;
setAttr "miDefaultOptions.contrastG" 0.02;
setAttr "miDefaultOptions.contrastB" 0.02;
setAttr "miDefaultOptions.contrastA" 0.1;
setAttr "miDefaultOptions.jitter" 1;
setAttr "miDefaultOptions.maxReflectionRays" 1;
setAttr "miDefaultOptions.maxRefractionRays" 1;
setAttr "miDefaultOptions.maxRayDepth" 1;
setAttr "miDefaultOptions.maxShadowRayDepth" 2;
setAttr miDefaultOptions.scanline 0;
}
////////////////////////////////////////////////////////////////////////////////
// Generated with MELANIE v0.4
////////////////////////////////////////////////////////////////////////////////
window -height 165 -width 309;
columnLayout -columnWidth 301 -height 139 -width 301;
rowLayout -columnWidth1 311 -height 17 -numberOfColumns 1 -width 311;
text -align "center" -height 17 -label "Mental Ray" -width 311;
setParent ..;
button -height 28 -label "Draft" -width 300 -c Draft;
button -height 28 -label "Preview" -width 300 -c Preview;
button -height 28 -label "Production" -width 300 -c Production;
button -height 28 -label "FineTrace" -width 300 -c FineTrace;
showWindow;

MTCG
01-07-2006, 04:28 AM
2- Connector :

DISCRIPTION :
Connects the attributes of a light to another to make it an instance of it , it can connect all types of lights.

USAGE :
Select a light , for example a directional and add select another light with same type as in our case itll be an instance then click the mel and choose the type of connection in our case itll be directional , then the first selected light will be named a master light and itll control the other one that will be named a slave light.

Warnings :
Dont click the mel with other than two lights selected or the script will crash,and also when two lights are connected close the mel UI and reopen it to connect another light and so on.


global proc Main_proc()
{
global string $temp_name[];
$temp_name=`ls-sl`;
rename $temp_name[0] ObjA;
rename $temp_name[1] ObjB;
print("Ready To initiate");
}
Main_proc();
global proc Connect_DL()
{
connectAttr -f ObjA.objectColor ObjB.objectColor;
connectAttr -f ObjA.visibility ObjB.visibility;
connectAttr -f ObjA.template ObjB.template;
connectAttr -f ObjA.ghosting ObjB.ghosting;
connectAttr -f ObjA.useObjectColor ObjB.useObjectColor;
connectAttr -f ObjA.drawOverride ObjB.drawOverride;
connectAttr -f ObjA.lodVisibility ObjB.lodVisibility;
connectAttr -f ObjA.renderInfo ObjB.renderInfo;
connectAttr -f ObjA.ghostDriver ObjB.ghostDriver;
connectAttr -f ObjA.ghostRangeEnd ObjB.ghostRangeEnd;
connectAttr -f ObjA.ghostRangeStart ObjB.ghostRangeStart;
connectAttr -f ObjA.ghostFrames ObjB.ghostFrames;
connectAttr -f ObjA.mentalRayControls ObjB.mentalRayControls;
connectAttr -f ObjA.rotateQuaternion ObjB.rotateQuaternion;
connectAttr -f ObjA.displayLocalAxis ObjB.displayLocalAxis;
connectAttr -f ObjA.inheritsTransform ObjB.inheritsTransform;
connectAttr -f ObjAShape.visibility ObjBShape.visibility;
connectAttr -f ObjAShape.intermediateObject ObjBShape.intermediateObject;
connectAttr -f ObjAShape.template ObjBShape.template;
connectAttr -f ObjAShape.ghosting ObjBShape.ghosting;
connectAttr -f ObjAShape.objectColor ObjBShape.objectColor;
connectAttr -f ObjAShape.useObjectColor ObjBShape.useObjectColor;
connectAttr -f ObjAShape.lodVisibility ObjBShape.lodVisibility;
connectAttr -f ObjAShape.renderInfo ObjBShape.renderInfo;
connectAttr -f ObjAShape.ghostingControl ObjBShape.ghostingControl;
connectAttr -f ObjAShape.ghostFrames ObjBShape.ghostFrames;
connectAttr -f ObjAShape.ghostRangeStart ObjBShape.ghostRangeStart;
connectAttr -f ObjAShape.ghostRangeEnd ObjBShape.ghostRangeEnd;
connectAttr -f ObjAShape.ghostDriver ObjBShape.ghostDriver;
connectAttr -f ObjAShape.color ObjBShape.color;
connectAttr -f ObjAShape.intensity ObjBShape.intensity;
connectAttr -f ObjAShape.useRayTraceShadows ObjBShape.useRayTraceShadows;
connectAttr -f ObjAShape.shadowColor ObjBShape.shadowColor;
connectAttr -f ObjAShape.shadowRays ObjBShape.shadowRays;
connectAttr -f ObjAShape.rayDepthLimit ObjBShape.rayDepthLimit;
connectAttr -f ObjAShape.centerOfIllumination ObjBShape.centerOfIllumination;
connectAttr -f ObjAShape.lightRadius ObjBShape.lightRadius;
connectAttr -f ObjAShape.castSoftShadows ObjBShape.castSoftShadows;
connectAttr -f ObjAShape.useDepthMapShadows ObjBShape.useDepthMapShadows;
connectAttr -f ObjAShape.reuseDmap ObjBShape.reuseDmap;
connectAttr -f ObjAShape.useMidDistDmap ObjBShape.useMidDistDmap;
connectAttr -f ObjAShape.dmapFilterSize ObjBShape.dmapFilterSize;
connectAttr -f ObjAShape.dmapResolution ObjBShape.dmapResolution;
connectAttr -f ObjAShape.dmapBias ObjBShape.dmapBias;
connectAttr -f ObjAShape.dmapFocus ObjBShape.dmapFocus;
connectAttr -f ObjAShape.dmapWidthFocus ObjBShape.dmapWidthFocus;
connectAttr -f ObjAShape.useDmapAutoFocus ObjBShape.useDmapAutoFocus;
connectAttr -f ObjAShape.volumeShadowSamples ObjBShape.volumeShadowSamples;
connectAttr -f ObjAShape.fogShadowIntensity ObjBShape.fogShadowIntensity;
connectAttr -f ObjAShape.useDmapAutoClipping ObjBShape.useDmapAutoClipping;
connectAttr -f ObjAShape.dmapNearClipPlane ObjBShape.dmapNearClipPlane;
connectAttr -f ObjAShape.dmapFarClipPlane ObjBShape.dmapFarClipPlane;
connectAttr -f ObjAShape.useOnlySingleDmap ObjBShape.useOnlySingleDmap;
connectAttr -f ObjAShape.dmapUseMacro ObjBShape.dmapUseMacro;
connectAttr -f ObjAShape.dmapName ObjBShape.dmapName;
connectAttr -f ObjAShape.dmapLightName ObjBShape.dmapLightName;
connectAttr -f ObjAShape.dmapSceneName ObjBShape.dmapSceneName;
connectAttr -f ObjAShape.dmapFrameExt ObjBShape.dmapFrameExt;
connectAttr -f ObjAShape.writeDmap ObjBShape.writeDmap;
connectAttr -f ObjAShape.lastWrittenDmapAnimExtName ObjBShape.lastWrittenDmapAnimExtName;
connectAttr -f ObjAShape.receiveShadows ObjBShape.receiveShadows;
connectAttr -f ObjAShape.mentalRayControls ObjBShape.mentalRayControls;
rename ObjA Master_DL;
rename ObjB Slave_DL;
}
global proc Connect_SL()
{
connectAttr -f ObjAShape.coneAngle ObjBShape.coneAngle;
connectAttr -f ObjAShape.penumbraAngle ObjBShape.penumbraAngle;
connectAttr -f ObjAShape.dropoff ObjBShape.dropoff;
connectAttr -f ObjA.visibility ObjB.visibility;
connectAttr -f ObjA.mentalRayControls ObjB.mentalRayControls;
connectAttr -f ObjAShape.visibility ObjBShape.visibility;
connectAttr -f ObjAShape.useObjectColor ObjBShape.useObjectColor;
connectAttr -f ObjAShape.objectColor ObjBShape.objectColor;
connectAttr -f ObjAShape.renderInfo ObjBShape.renderInfo;
connectAttr -f ObjAShape.color ObjBShape.color;
connectAttr -f ObjAShape.intensity ObjBShape.intensity;
connectAttr -f ObjAShape.useRayTraceShadows ObjBShape.useRayTraceShadows;
connectAttr -f ObjAShape.shadowColor ObjBShape.shadowColor;
connectAttr -f ObjAShape.shadowRays ObjBShape.shadowRays;
connectAttr -f ObjAShape.rayDepthLimit ObjBShape.rayDepthLimit;
connectAttr -f ObjAShape.centerOfIllumination ObjBShape.centerOfIllumination;
connectAttr -f ObjAShape.lightRadius ObjBShape.lightRadius;
connectAttr -f ObjAShape.castSoftShadows ObjBShape.castSoftShadows;
connectAttr -f ObjAShape.useDepthMapShadows ObjBShape.useDepthMapShadows;
connectAttr -f ObjAShape.reuseDmap ObjBShape.reuseDmap;
connectAttr -f ObjAShape.useMidDistDmap ObjBShape.useMidDistDmap;
connectAttr -f ObjAShape.dmapFilterSize ObjBShape.dmapFilterSize;
connectAttr -f ObjAShape.dmapResolution ObjBShape.dmapResolution;
connectAttr -f ObjAShape.dmapBias ObjBShape.dmapBias;
connectAttr -f ObjAShape.dmapFocus ObjBShape.dmapFocus;
connectAttr -f ObjAShape.dmapWidthFocus ObjBShape.dmapWidthFocus;
connectAttr -f ObjAShape.useDmapAutoFocus ObjBShape.useDmapAutoFocus;
connectAttr -f ObjAShape.volumeShadowSamples ObjBShape.volumeShadowSamples;
connectAttr -f ObjAShape.fogShadowIntensity ObjBShape.fogShadowIntensity;
connectAttr -f ObjAShape.useDmapAutoClipping ObjBShape.useDmapAutoClipping;
connectAttr -f ObjAShape.dmapNearClipPlane ObjBShape.dmapNearClipPlane;
connectAttr -f ObjAShape.dmapFarClipPlane ObjBShape.dmapFarClipPlane;
connectAttr -f ObjAShape.useOnlySingleDmap ObjBShape.useOnlySingleDmap;
connectAttr -f ObjAShape.dmapUseMacro ObjBShape.dmapUseMacro;
connectAttr -f ObjAShape.dmapName ObjBShape.dmapName;
connectAttr -f ObjAShape.dmapLightName ObjBShape.dmapLightName;
connectAttr -f ObjAShape.dmapSceneName ObjBShape.dmapSceneName;
connectAttr -f ObjAShape.dmapFrameExt ObjBShape.dmapFrameExt;
connectAttr -f ObjAShape.writeDmap ObjBShape.writeDmap;
connectAttr -f ObjAShape.lastWrittenDmapAnimExtName ObjBShape.lastWrittenDmapAnimExtName;
connectAttr -f ObjAShape.receiveShadows ObjBShape.receiveShadows;
connectAttr -f ObjAShape.mentalRayControls ObjBShape.mentalRayControls;
rename ObjA Master_SL;
rename ObjB Slave_SL;
}

global proc Connect_ArL()
{
connectAttr -f ObjA.visibility ObjB.visibility;
connectAttr -f ObjA.intermediateObject ObjB.intermediateObject;
connectAttr -f ObjA.template ObjB.template;
connectAttr -f ObjA.ghosting ObjB.ghosting;
connectAttr -f ObjA.useObjectColor ObjB.useObjectColor;
connectAttr -f ObjA.objectColor ObjB.objectColor;
connectAttr -f ObjA.lodVisibility ObjB.lodVisibility;
connectAttr -f ObjA.renderInfo ObjB.renderInfo;
connectAttr -f ObjA.ghostingControl ObjB.ghostingControl;
connectAttr -f ObjA.ghostFrames ObjB.ghostFrames;
connectAttr -f ObjA.ghostRangeStart ObjB.ghostRangeStart;
connectAttr -f ObjA.ghostRangeEnd ObjB.ghostRangeEnd;
connectAttr -f ObjA.ghostDriver ObjB.ghostDriver;
connectAttr -f ObjA.shear ObjB.shear;
connectAttr -f ObjA.mentalRayControls ObjB.mentalRayControls;
connectAttr -f ObjA.inheritsTransform ObjB.inheritsTransform;
connectAttr -f ObjAShape.visibility ObjBShape.visibility;
connectAttr -f ObjAShape.intermediateObject ObjBShape.intermediateObject;
connectAttr -f ObjAShape.template ObjBShape.template;
connectAttr -f ObjAShape.ghosting ObjBShape.ghosting;
connectAttr -f ObjAShape.useObjectColor ObjBShape.useObjectColor;
connectAttr -f ObjAShape.objectColor ObjBShape.objectColor;
connectAttr -f ObjAShape.lodVisibility ObjBShape.lodVisibility;
connectAttr -f ObjAShape.renderInfo ObjBShape.renderInfo;
connectAttr -f ObjAShape.ghostingControl ObjBShape.ghostingControl;
connectAttr -f ObjAShape.ghostFrames ObjBShape.ghostFrames;
connectAttr -f ObjAShape.ghostRangeStart ObjBShape.ghostRangeStart;
connectAttr -f ObjAShape.ghostRangeEnd ObjBShape.ghostRangeEnd;
connectAttr -f ObjAShape.ghostDriver ObjBShape.ghostDriver;
connectAttr -f ObjAShape.color ObjBShape.color;
connectAttr -f ObjAShape.intensity ObjBShape.intensity;
connectAttr -f ObjAShape.useRayTraceShadows ObjBShape.useRayTraceShadows;
connectAttr -f ObjAShape.shadowColor ObjBShape.shadowColor;
connectAttr -f ObjAShape.shadowRays ObjBShape.shadowRays;
connectAttr -f ObjAShape.rayDepthLimit ObjBShape.rayDepthLimit;
connectAttr -f ObjAShape.centerOfIllumination ObjBShape.centerOfIllumination;
connectAttr -f ObjAShape.lightRadius ObjBShape.lightRadius;
connectAttr -f ObjAShape.castSoftShadows ObjBShape.castSoftShadows;
connectAttr -f ObjAShape.useDepthMapShadows ObjBShape.useDepthMapShadows;
connectAttr -f ObjAShape.reuseDmap ObjBShape.reuseDmap;
connectAttr -f ObjAShape.useMidDistDmap ObjBShape.useMidDistDmap;
connectAttr -f ObjAShape.dmapFilterSize ObjBShape.dmapFilterSize;
connectAttr -f ObjAShape.dmapResolution ObjBShape.dmapResolution;
connectAttr -f ObjAShape.dmapBias ObjBShape.dmapBias;
connectAttr -f ObjAShape.dmapFocus ObjBShape.dmapFocus;
connectAttr -f ObjAShape.dmapWidthFocus ObjBShape.dmapWidthFocus;
connectAttr -f ObjAShape.useDmapAutoFocus ObjBShape.useDmapAutoFocus;
connectAttr -f ObjAShape.volumeShadowSamples ObjBShape.volumeShadowSamples;
connectAttr -f ObjAShape.fogShadowIntensity ObjBShape.fogShadowIntensity;
connectAttr -f ObjAShape.useDmapAutoClipping ObjBShape.useDmapAutoClipping;
connectAttr -f ObjAShape.dmapNearClipPlane ObjBShape.dmapNearClipPlane;
connectAttr -f ObjAShape.dmapFarClipPlane ObjBShape.dmapFarClipPlane;
connectAttr -f ObjAShape.useOnlySingleDmap ObjBShape.useOnlySingleDmap;
connectAttr -f ObjAShape.dmapUseMacro ObjBShape.dmapUseMacro;
connectAttr -f ObjAShape.dmapName ObjBShape.dmapName;
connectAttr -f ObjAShape.dmapLightName ObjBShape.dmapLightName;
connectAttr -f ObjAShape.dmapSceneName ObjBShape.dmapSceneName;
connectAttr -f ObjAShape.dmapFrameExt ObjBShape.dmapFrameExt;
connectAttr -f ObjAShape.writeDmap ObjBShape.writeDmap;
connectAttr -f ObjAShape.lastWrittenDmapAnimExtName ObjBShape.lastWrittenDmapAnimExtName;
connectAttr -f ObjAShape.receiveShadows ObjBShape.receiveShadows;
connectAttr -f ObjAShape.lightGlow ObjBShape.lightGlow;
connectAttr -f ObjAShape.normalCamera ObjBShape.normalCamera;
rename ObjA Master_ArL;
rename ObjB Slave_ArL;
}
global proc Connect_VL()
{
connectAttr -f ObjA.visibility ObjB.visibility;
connectAttr -f ObjA.intermediateObject ObjB.intermediateObject;
connectAttr -f ObjA.template ObjB.template;
connectAttr -f ObjA.ghosting ObjB.ghosting;
connectAttr -f ObjA.useObjectColor ObjB.useObjectColor;
connectAttr -f ObjA.objectColor ObjB.objectColor;
connectAttr -f ObjA.lodVisibility ObjB.lodVisibility;
connectAttr -f ObjA.renderInfo ObjB.renderInfo;
connectAttr -f ObjA.ghostingControl ObjB.ghostingControl;
connectAttr -f ObjA.ghostFrames ObjB.ghostFrames;
connectAttr -f ObjA.ghostRangeStart ObjB.ghostRangeStart;
connectAttr -f ObjA.ghostRangeEnd ObjB.ghostRangeEnd;
connectAttr -f ObjA.ghostDriver ObjB.ghostDriver;
connectAttr -f ObjA.shear ObjB.shear;
connectAttr -f ObjA.rotateAxis ObjB.rotateAxis;
connectAttr -f ObjA.mentalRayControls ObjB.mentalRayControls;
connectAttr -f ObjAShape.visibility ObjBShape.visibility;
connectAttr -f ObjAShape.intermediateObject ObjBShape.intermediateObject;
connectAttr -f ObjAShape.template ObjBShape.template;
connectAttr -f ObjAShape.ghosting ObjBShape.ghosting;
connectAttr -f ObjAShape.useObjectColor ObjBShape.useObjectColor;
connectAttr -f ObjAShape.objectColor ObjBShape.objectColor;
connectAttr -f ObjAShape.lodVisibility ObjBShape.lodVisibility;
connectAttr -f ObjAShape.renderInfo ObjBShape.renderInfo;
connectAttr -f ObjAShape.ghostingControl ObjBShape.ghostingControl;
connectAttr -f ObjAShape.ghostFrames ObjBShape.ghostFrames;
connectAttr -f ObjAShape.ghostRangeStart ObjBShape.ghostRangeStart;
connectAttr -f ObjAShape.ghostRangeEnd ObjBShape.ghostRangeEnd;
connectAttr -f ObjAShape.ghostDriver ObjBShape.ghostDriver;
connectAttr -f ObjAShape.color ObjBShape.color;
connectAttr -f ObjAShape.intensity ObjBShape.intensity;
connectAttr -f ObjAShape.useRayTraceShadows ObjBShape.useRayTraceShadows;
connectAttr -f ObjAShape.shadowColor ObjBShape.shadowColor;
connectAttr -f ObjAShape.shadowRays ObjBShape.shadowRays;
connectAttr -f ObjAShape.rayDepthLimit ObjBShape.rayDepthLimit;
connectAttr -f ObjAShape.centerOfIllumination ObjBShape.centerOfIllumination;
connectAttr -f ObjAShape.lightRadius ObjBShape.lightRadius;
connectAttr -f ObjAShape.castSoftShadows ObjBShape.castSoftShadows;
connectAttr -f ObjAShape.useDepthMapShadows ObjBShape.useDepthMapShadows;
connectAttr -f ObjAShape.reuseDmap ObjBShape.reuseDmap;
connectAttr -f ObjAShape.useMidDistDmap ObjBShape.useMidDistDmap;
connectAttr -f ObjAShape.dmapFilterSize ObjBShape.dmapFilterSize;
connectAttr -f ObjAShape.dmapResolution ObjBShape.dmapResolution;
connectAttr -f ObjAShape.dmapBias ObjBShape.dmapBias;
connectAttr -f ObjAShape.dmapFocus ObjBShape.dmapFocus;
connectAttr -f ObjAShape.dmapWidthFocus ObjBShape.dmapWidthFocus;
connectAttr -f ObjAShape.useDmapAutoFocus ObjBShape.useDmapAutoFocus;
connectAttr -f ObjAShape.volumeShadowSamples ObjBShape.volumeShadowSamples;
connectAttr -f ObjAShape.fogShadowIntensity ObjBShape.fogShadowIntensity;
connectAttr -f ObjAShape.useDmapAutoClipping ObjBShape.useDmapAutoClipping;
connectAttr -f ObjAShape.dmapNearClipPlane ObjBShape.dmapNearClipPlane;
connectAttr -f ObjAShape.dmapFarClipPlane ObjBShape.dmapFarClipPlane;
connectAttr -f ObjAShape.useOnlySingleDmap ObjBShape.useOnlySingleDmap;
connectAttr -f ObjAShape.dmapUseMacro ObjBShape.dmapUseMacro;
connectAttr -f ObjAShape.dmapName ObjBShape.dmapName;
connectAttr -f ObjAShape.dmapLightName ObjBShape.dmapLightName;
connectAttr -f ObjAShape.dmapSceneName ObjBShape.dmapSceneName;
connectAttr -f ObjAShape.dmapFrameExt ObjBShape.dmapFrameExt;
connectAttr -f ObjAShape.writeDmap ObjBShape.writeDmap;
connectAttr -f ObjAShape.lastWrittenDmapAnimExtName ObjBShape.lastWrittenDmapAnimExtName;
connectAttr -f ObjAShape.receiveShadows ObjBShape.receiveShadows;
connectAttr -f ObjAShape.fogGeometry ObjBShape.fogGeometry;
connectAttr -f ObjAShape.fogRadius ObjBShape.fogRadius;
connectAttr -f ObjAShape.lightGlow ObjBShape.lightGlow;
connectAttr -f ObjAShape.fogType ObjBShape.fogType;
connectAttr -f ObjAShape.fogIntensity ObjBShape.fogIntensity;
connectAttr -f ObjAShape.lightShape ObjBShape.lightShape;
connectAttr -f ObjAShape.volumeLightDir ObjBShape.volumeLightDir;
connectAttr -f ObjAShape.arc ObjBShape.arc;
connectAttr -f ObjAShape.coneEndRadius ObjBShape.coneEndRadius;
connectAttr -f ObjAShape.emitAmbient ObjBShape.emitAmbient;
rename ObjA Master_VL;
rename ObjB Slave_VL;
}
global proc Connect_AL()
{
connectAttr -f ObjA.visibility ObjB.visibility;
connectAttr -f ObjA.intermediateObject ObjB.intermediateObject;
connectAttr -f ObjA.template ObjB.template;
connectAttr -f ObjA.ghosting ObjB.ghosting;
connectAttr -f ObjA.useObjectColor ObjB.useObjectColor;
connectAttr -f ObjA.objectColor ObjB.objectColor;
connectAttr -f ObjA.lodVisibility ObjB.lodVisibility;
connectAttr -f ObjA.renderInfo ObjB.renderInfo;
connectAttr -f ObjA.ghostingControl ObjB.ghostingControl;
connectAttr -f ObjA.ghostFrames ObjB.ghostFrames;
connectAttr -f ObjA.ghostRangeStart ObjB.ghostRangeStart;
connectAttr -f ObjA.ghostRangeEnd ObjB.ghostRangeEnd;
connectAttr -f ObjA.ghostDriver ObjB.ghostDriver;
connectAttr -f ObjA.shear ObjB.shear;
connectAttr -f ObjA.inheritsTransform ObjB.inheritsTransform;
connectAttr -f ObjA.mentalRayControls ObjB.mentalRayControls;
connectAttr -f ObjAShape.visibility ObjBShape.visibility;
connectAttr -f ObjAShape.intermediateObject ObjBShape.intermediateObject;
connectAttr -f ObjAShape.template ObjBShape.template;
connectAttr -f ObjAShape.ghosting ObjBShape.ghosting;
connectAttr -f ObjAShape.useObjectColor ObjBShape.useObjectColor;
connectAttr -f ObjAShape.objectColor ObjBShape.objectColor;
connectAttr -f ObjAShape.lodVisibility ObjBShape.lodVisibility;
connectAttr -f ObjAShape.renderInfo ObjBShape.renderInfo;
connectAttr -f ObjAShape.ghostingControl ObjBShape.ghostingControl;
connectAttr -f ObjAShape.ghostFrames ObjBShape.ghostFrames;
connectAttr -f ObjAShape.ghostRangeStart ObjBShape.ghostRangeStart;
connectAttr -f ObjAShape.ghostRangeEnd ObjBShape.ghostRangeEnd;
connectAttr -f ObjAShape.ghostDriver ObjBShape.ghostDriver;
connectAttr -f ObjAShape.color ObjBShape.color;
connectAttr -f ObjAShape.intensity ObjBShape.intensity;
connectAttr -f ObjAShape.useRayTraceShadows ObjBShape.useRayTraceShadows;
connectAttr -f ObjAShape.shadowColor ObjBShape.shadowColor;
connectAttr -f ObjAShape.shadowRays ObjBShape.shadowRays;
connectAttr -f ObjAShape.rayDepthLimit ObjBShape.rayDepthLimit;
connectAttr -f ObjAShape.centerOfIllumination ObjBShape.centerOfIllumination;
connectAttr -f ObjAShape.ambientShade ObjBShape.ambientShade;
connectAttr -f ObjAShape.castSoftShadows ObjBShape.castSoftShadows;
connectAttr -f ObjAShape.receiveShadows ObjBShape.receiveShadows;
connectAttr -f ObjAShape.shadowRadius ObjBShape.shadowRadius;
rename ObjA Master_AL;
rename ObjB Slave_AL;
}
global proc Connect_PL()
{
connectAttr -f ObjA.visibility ObjB.visibility;
connectAttr -f ObjA.intermediateObject ObjB.intermediateObject;
connectAttr -f ObjA.template ObjB.template;
connectAttr -f ObjA.ghosting ObjB.ghosting;
connectAttr -f ObjA.useObjectColor ObjB.useObjectColor;
connectAttr -f ObjA.objectColor ObjB.objectColor;
connectAttr -f ObjA.lodVisibility ObjB.lodVisibility;
connectAttr -f ObjA.renderInfo ObjB.renderInfo;
connectAttr -f ObjA.ghostingControl ObjB.ghostingControl;
connectAttr -f ObjA.ghostFrames ObjB.ghostFrames;
connectAttr -f ObjA.ghostRangeStart ObjB.ghostRangeStart;
connectAttr -f ObjA.ghostRangeEnd ObjB.ghostRangeEnd;
connectAttr -f ObjA.ghostDriver ObjB.ghostDriver;
connectAttr -f ObjA.shear ObjB.shear;
connectAttr -f ObjA.inheritsTransform ObjB.inheritsTransform;
connectAttr -f ObjA.mentalRayControls ObjB.mentalRayControls;
connectAttr -f ObjAShape.visibility ObjBShape.visibility;
connectAttr -f ObjAShape.intermediateObject ObjBShape.intermediateObject;
connectAttr -f ObjAShape.template ObjBShape.template;
connectAttr -f ObjAShape.ghosting ObjBShape.ghosting;
connectAttr -f ObjAShape.useObjectColor ObjBShape.useObjectColor;
connectAttr -f ObjAShape.objectColor ObjBShape.objectColor;
connectAttr -f ObjAShape.lodVisibility ObjBShape.lodVisibility;
connectAttr -f ObjAShape.renderInfo ObjBShape.renderInfo;
connectAttr -f ObjAShape.ghostingControl ObjBShape.ghostingControl;
connectAttr -f ObjAShape.ghostFrames ObjBShape.ghostFrames;
connectAttr -f ObjAShape.ghostRangeStart ObjBShape.ghostRangeStart;
connectAttr -f ObjAShape.ghostRangeEnd ObjBShape.ghostRangeEnd;
connectAttr -f ObjAShape.ghostDriver ObjBShape.ghostDriver;
connectAttr -f ObjAShape.color ObjBShape.color;
connectAttr -f ObjAShape.intensity ObjBShape.intensity;
connectAttr -f ObjAShape.useRayTraceShadows ObjBShape.useRayTraceShadows;
connectAttr -f ObjAShape.shadowColor ObjBShape.shadowColor;
connectAttr -f ObjAShape.shadowRays ObjBShape.shadowRays;
connectAttr -f ObjAShape.rayDepthLimit ObjBShape.rayDepthLimit;
connectAttr -f ObjAShape.centerOfIllumination ObjBShape.centerOfIllumination;
connectAttr -f ObjAShape.lightRadius ObjBShape.lightRadius;
connectAttr -f ObjAShape.castSoftShadows ObjBShape.castSoftShadows;
connectAttr -f ObjAShape.useDepthMapShadows ObjBShape.useDepthMapShadows;
connectAttr -f ObjAShape.reuseDmap ObjBShape.reuseDmap;
connectAttr -f ObjAShape.useMidDistDmap ObjBShape.useMidDistDmap;
connectAttr -f ObjAShape.dmapFilterSize ObjBShape.dmapFilterSize;
connectAttr -f ObjAShape.dmapResolution ObjBShape.dmapResolution;
connectAttr -f ObjAShape.dmapBias ObjBShape.dmapBias;
connectAttr -f ObjAShape.dmapFocus ObjBShape.dmapFocus;
connectAttr -f ObjAShape.dmapWidthFocus ObjBShape.dmapWidthFocus;
connectAttr -f ObjAShape.useDmapAutoFocus ObjBShape.useDmapAutoFocus;
connectAttr -f ObjAShape.volumeShadowSamples ObjBShape.volumeShadowSamples;
connectAttr -f ObjAShape.fogShadowIntensity ObjBShape.fogShadowIntensity;
connectAttr -f ObjAShape.useDmapAutoClipping ObjBShape.useDmapAutoClipping;
connectAttr -f ObjAShape.dmapNearClipPlane ObjBShape.dmapNearClipPlane;
connectAttr -f ObjAShape.dmapFarClipPlane ObjBShape.dmapFarClipPlane;
connectAttr -f ObjAShape.useOnlySingleDmap ObjBShape.useOnlySingleDmap;
connectAttr -f ObjAShape.dmapUseMacro ObjBShape.dmapUseMacro;
connectAttr -f ObjAShape.dmapName ObjBShape.dmapName;
connectAttr -f ObjAShape.dmapLightName ObjBShape.dmapLightName;
connectAttr -f ObjAShape.dmapSceneName ObjBShape.dmapSceneName;
connectAttr -f ObjAShape.dmapFrameExt ObjBShape.dmapFrameExt;
connectAttr -f ObjAShape.writeDmap ObjBShape.writeDmap;
connectAttr -f ObjAShape.lastWrittenDmapAnimExtName ObjBShape.lastWrittenDmapAnimExtName;
connectAttr -f ObjAShape.receiveShadows ObjBShape.receiveShadows;
connectAttr -f ObjAShape.fogGeometry ObjBShape.fogGeometry;
connectAttr -f ObjAShape.fogRadius ObjBShape.fogRadius;
connectAttr -f ObjAShape.lightGlow ObjBShape.lightGlow;
connectAttr -f ObjAShape.fogType ObjBShape.fogType;
connectAttr -f ObjAShape.fogIntensity ObjBShape.fogIntensity;
connectAttr -f ObjAShape.mentalRayControls ObjBShape.mentalRayControls;
rename ObjA Master_PL;
rename ObjB Slave_PL;
}
////////////////////////////////////////////////////////////////////////////////
// Generated with MELANIE v0.4
////////////////////////////////////////////////////////////////////////////////
string $window = `window -title "Long Name"
-widthHeight 380 92`;
columnLayout -columnWidth 373 -height 66 -width 373;
rowLayout -columnWidth4 100 100 100 80 -height 29 -numberOfColumns 4 -width 380;
button -height 28 -label "Directional" -width 100 -c Connect_DL;
button -height 28 -label "Spot" -width 100 -c Connect_SL;
button -height 28 -label "Area" -width 100 -c Connect_ArL;
text -height 29 -label "Connection Type" -width 80;
setParent ..;
rowLayout -columnWidth3 100 100 100 -height 28 -numberOfColumns 3 -width 300;
button -height 28 -label "Volume" -width 100 -c Connect_VL;
button -height 28 -label "Ambient" -width 100 -c Connect_AL;
button -height 28 -label "Point" -width 100 -c Connect_PL;
setParent ..;
showWindow $window;

butCherHeLL
02-01-2006, 10:42 AM
//Toggle RenderView

if ( `window -exists renderViewWindow` )

deleteUI -window renderViewWindow;

else

tearOffPanel "Render View" "renderWindowPanel" true;

H3ro
02-17-2006, 11:49 PM
OK, i know this i basic, but i could not find anything like it, and it is my first cript completly on my own.

I makes a random value constant.
Can be used eg on the goalU or goalV if you want all object to have the same random value

---

//input
float $changeR = ;
float $min = ;
float $max = ;

//script body
seed($changeR);
float $a = rand($min,$max);

//output
print $a;

daydreameroperter
03-10-2006, 02:54 AM
has anyone ever heard of a script titled "nuck furbs"? I can't find it anywhere.

Firas
03-20-2006, 06:27 AM
small mel but very usefull to animate over a 2 rails : smartTwoRailDeform

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

goleafsgo
03-28-2006, 03:09 PM
I posted this in another thread and it was popular so I thought I'd put it here as well...this should work with Maya 7.

Copy/paste this into a file named selectEveryNEdge.mel, call selectEveryNEdge to run it.

If you select one edge it will select the edge loop.

If you select two edges on an edge loop or an edge ring it will continue the pattern, skipping however many edges that you missed between the two edges you selected, following the edge loop or edge ring.


proc int getEdgeIdIndex(int $edgeId, int $edgeIds[])
{
int $i;
int $len = `size($edgeIds)`;

for ($i=0; $i<$len; $i++)
{
if ($edgeId == $edgeIds[$i])
return $i;
}

return -1;
}

proc int getEdgeIdFromSelectionString(string $sel)
{
string $buffer[];
int $numTokens;
$numTokens = `tokenize $sel "[]" $buffer`;

if ($numTokens != 2)
return -1;
else
return $buffer[1];
}

global proc selectEveryNEdge()
{
string $selectedObject[] = `ls -sl -o`;

string $initialEdgeSelection[] = `getEdges`;
int $numEdges = `size $initialEdgeSelection`;
if (0 == $numEdges || 2 < $numEdges)
return;

string $firstEdge = $initialEdgeSelection[0];
int $firstEdgeId = getEdgeIdFromSelectionString($firstEdge);

if (1 == $numEdges) {
polySelect -edgeLoop $firstEdgeId $selectedObject[0];
return;
}

string $secondEdge = $initialEdgeSelection[1];
int $secondEdgeId = getEdgeIdFromSelectionString($secondEdge);

int $edgeLoopIds[] = `polySelect -noSelection -edgeLoop $firstEdgeId $selectedObject[0]`;

int $firstEdgeIndex = getEdgeIdIndex($firstEdgeId, $edgeLoopIds);
if ($firstEdgeIndex == -1)
return;

int $secondEdgeIndex = getEdgeIdIndex($secondEdgeId, $edgeLoopIds);
if ($secondEdgeIndex == -1) {
clear $edgeLoopIds;
$edgeLoopIds = `polySelect -noSelection -edgeRing $firstEdgeId $selectedObject[0]`;

$firstEdgeIndex = getEdgeIdIndex($firstEdgeId, $edgeLoopIds);
if ($firstEdgeIndex == -1)
return;

$secondEdgeIndex = getEdgeIdIndex($secondEdgeId, $edgeLoopIds);
if ($secondEdgeIndex == -1) {
return;
}
}

int $numEdgesInLoop = `size($edgeLoopIds)`;
int $isFullLoop = ($edgeLoopIds[0] == $edgeLoopIds[$numEdgesInLoop-1]);

int $edgesToSkip = `abs ($secondEdgeIndex - $firstEdgeIndex)`;

if ($isFullLoop && $edgesToSkip > ($numEdgesInLoop - $edgesToSkip - 1)) {
$edgesToSkip = $numEdgesInLoop - $edgesToSkip - 1;
}

int $i;
string $selectionString = "select ";

for ($i=$firstEdgeIndex; $i<$numEdgesInLoop; $i += $edgesToSkip)
{
$selectionString += $selectedObject[0] + ".e[" + $edgeLoopIds[$i] + "] ";
}

for ($i=$firstEdgeIndex-$edgesToSkip; $i>=0; $i -= $edgesToSkip)
{
$selectionString += $selectedObject[0] + ".e[" + $edgeLoopIds[$i] + "] ";
}

eval($selectionString);
}

ftaswin
05-16-2006, 06:40 AM
@ goleafsgo

That's too cool.... I used to export my model to cinema 4d just to do this!

Any idea how can I do it on faces/vertex as well?


Thanks a lot!

Ft

goleafsgo
05-16-2006, 01:34 PM
This is the original thread that I posted the MEL in...I think I posted one there for faces as well.

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

butCherHeLL
08-13-2006, 12:59 PM
/*Toggle UV Texture Editor*/
if ( `window -exists polyTexturePlacementPanel1Window` )
deleteUI -window polyTexturePlacementPanel1Window;
else
tearOffPanel "UV Texture Editor" "polyTexturePlacementPanel" true;

butCherHeLL
08-13-2006, 01:38 PM
/*Switch to UV Texture Editor*/
string $whichPanel = `getPanel -underPointer`;

if ($whichPanel == "")
$whichPanel = `getPanel -withFocus`;

scriptedPanel -edit -replacePanel $whichPanel polyTexturePlacementPanel1;

larryvm
08-15-2006, 12:05 PM
few day oag i find this shaders (http://www.puppet.cgtalk.ru/download/megatk_e.shtml)to made framebuffers in mr, now i wrote a mel script to convert the maya default shaders to the megaTK shaders and setup the lights and the pass control node.

work with lambert, blinn and phong shaders and with spot, directional and point lights.

global proc cambiaAtributo3(string $shaderIni,string $atributoIni,string $shaderFin,string $atributoFin)
{
$conexiones=`listConnections -p 1 ($shaderIni+"."+$atributoIni)`;
if (`size $conexiones`>0)
{
connectAttr -f ($conexiones[0]) ($shaderFin+"."+$atributoFin) ;
}
else
{
$Color=`getAttr ($shaderIni+"."+$atributoIni)`;
setAttr ($shaderFin+"."+$atributoFin) -type double3 $Color[0] $Color[1] $Color[2];
}
}
global proc baseShader(string $shaderIni,string $shaderFin)
{
cambiaAtributo3($shaderIni,"color",$shaderFin,"cSurface");
cambiaAtributo3($shaderIni,"transparency",$shaderFin,"cOpacity");

setAttr ($shaderFin+".use_simple_diffuse") 1;
$dif=`getAttr ($shaderIni+".diffuse")`;
setAttr ($shaderFin+".cds") $dif;

setAttr ($shaderFin+".use_ambient") 1;
setAttr ($shaderFin+".cAmb") 1.0;
cambiaAtributo3($shaderIni,"ambientColor",$shaderFin,"ambient_color");

setAttr ($shaderFin+".use_incandescence") 1;
setAttr ($shaderFin+".cInc") 1.0;
cambiaAtributo3($shaderIni,"incandescence",$shaderFin,"incandescence");
$bump=`listConnections -p 1 ($shaderIni+".normalCamera")`;
if (`size $bump`>0)
{
setAttr ($shaderFin+".use_normal") 1;
connectAttr -f $bump[0] ($shaderFin+".input_normal") ;
}

}
//global proc fvshaderMegaTK()
{
string $nombre;
string $lambert[],$phong[],$blinn;
string $spot[],$directional[],$point;


$dummy=`polyCube -n "dummycube" -ch on -o on -w 1.0 -d 1.0 -cuv 4`;
setAttr ($dummy[0]+".miExportGeoShader") 1;
$pass=`shadingNode -asShader p_MegaTK_pass -n ($dummy[0]+"_pass")`;

connectAttr -force ($pass+".message") ($dummy[0]+".miGeoShader");


string $SG[];
$lambert=`ls -et lambert`;
for ($elemento in $lambert)
{
if ($elemento!="lambert1")
{
print ("lambert"+$elemento+"\n");
$SG=`listConnections -p 0 ($elemento+".outColor")`;
setAttr ($SG[0]+".miExportMrMaterial") 1;
$nombre=$elemento+"_MTK";
$nombre=`shadingNode -asShader p_MegaTK -n $nombre`;
connectAttr -f ($nombre+".message") ( $SG[0]+".miMaterialShader");
baseShader ($elemento,$nombre);
setAttr ($nombre+".use_phong_specular") 0;
}
}

$Phong=`ls -et phong`;
for ($elemento in $Phong)
{
print ("phongs->"+$elemento+"\n");
$SG=`listConnections -p 0 ($elemento+".outColor")`;
setAttr ($SG[0]+".miExportMrMaterial") 1;
$nombre=$elemento+"_MTK";
$nombre=`shadingNode -asShader p_MegaTK -n $nombre`;
connectAttr -f ($nombre+".message") ( $SG[0]+".miMaterialShader");
baseShader ($elemento,$nombre);
setAttr ($nombre+".use_blinn_specular") 0;
setAttr ($nombre+".use_phong_specular") 1;
setAttr ($nombre+".p_cS") 1;
cambiaAtributo3($elemento,"specularColor",$nombre,"p_specular");
$cp=`getAttr ($elemento+".cosinePower")`;
setAttr ($nombre+".p_exponent") $cp;
setAttr ($nombre+".use_reflection") 1;
$cp=`getAttr ($elemento+".reflectivity")`;
setAttr ($nombre+".cReflect") $cp;
$cp=`getAttr ($elemento+".refractions")`;
setAttr ($nombre+".use_refraction") $cp;
if ($cp==1)
{
$cp=`getAttr ($elemento+".refractiveIndex")`;
setAttr ($nombre+".ior_in_refr") $cp;
$shadow=`shadingNode -asShader mib_shadow_transparency -n ($nombre+"shadow")`;
connectAttr -f ($shadow+".message") ( $SG[0]+".miShadowShader");


cambiaAtributo3($elemento,"color",$shadow,"color");
cambiaAtributo3($elemento,"transparency",$shadow,"transp");
}
}

$Blinn=`ls -et blinn`;
for ($elemento in $Blinn)
{
print ("Blinn->"+$elemento+"\n");
$SG=`listConnections -p 0 ($elemento+".outColor")`;
setAttr ($SG[0]+".miExportMrMaterial") 1;
$nombre=$elemento+"_MTK";
$nombre=`shadingNode -asShader p_MegaTK -n $nombre`;
connectAttr -f ($nombre+".message") ( $SG[0]+".miMaterialShader");
baseShader ($elemento,$nombre);
setAttr ($nombre+".use_phong_specular") 0;
setAttr ($nombre+".use_blinn_specular") 1;
setAttr ($nombre+".b_cS") 1;
cambiaAtributo3($elemento,"specularColor",$nombre,"b_specular");
$cp=`getAttr ($elemento+".eccentricity")`;
setAttr ($nombre+".b_eccentricity") $cp;
$cp=`getAttr ($elemento+".specularRollOff")`;
setAttr ($nombre+".b_specularRollOff") $cp;
setAttr ($nombre+".use_reflection") 1;
$cp=`getAttr ($elemento+".reflectivity")`;
setAttr ($nombre+".cReflect") $cp;
$cp=`getAttr ($elemento+".refractions")`;
setAttr ($nombre+".use_refraction") $cp;
if ($cp==1)
{
$cp=`getAttr ($elemento+".refractiveIndex")`;
setAttr ($nombre+".ior_in_refr") $cp;
$shadow=`shadingNode -asShader mib_shadow_transparency -n ($nombre+"shadow")`;
connectAttr -f ($shadow+".message") ( $SG[0]+".miShadowShader");


cambiaAtributo3($elemento,"color",$shadow,"color");
cambiaAtributo3($elemento,"transparency",$shadow,"transp");
}
}

$spot=`ls -typ spotLight`;
for ($elemento in $spot)
{
$nombre=`shadingNode -asShader p_SpotTK -n $nombre`;
connectAttr -f ($nombre+".message") ( $elemento+".miLightShader");
cambiaAtributo3($elemento,"color",$nombre,"color");
$cp=`getAttr ($elemento+".intensity")`;
setAttr ($nombre+".intensity") $cp;

$cp=`getAttr ($elemento+".coneAngle")`;
setAttr ($nombre+".cone") $cp;


}

$directional=`ls -typ directionalLight`;
for ($elemento in $directional)
{
$nombre=`shadingNode -asShader p_DirectTK -n $nombre`;
connectAttr -f ($nombre+".message") ( $elemento+".miLightShader");
cambiaAtributo3($elemento,"color",$nombre,"color");
$cp=`getAttr ($elemento+".intensity")`;
setAttr ($nombre+".intensity") $cp;
}

$pointL=`ls -typ pointLight`;
for ($elemento in $pointL)
{
$nombre=`shadingNode -asShader p_PointTK -n $nombre`;
connectAttr -f ($nombre+".message") ( $elemento+".miLightShader");
cambiaAtributo3($elemento,"color",$nombre,"color");
$cp=`getAttr ($elemento+".intensity")`;
setAttr ($nombre+".intensity") $cp;
}


}


save as fvshaderMegaTK.mel

ejecute and tune up the dummy pass shaders directorys and outputs

C&C are welcome and apologizes for my porr english

gaiXyn
08-31-2006, 06:02 PM
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!!

instruct9r
11-26-2006, 12:55 AM
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 :)

http://puppettd.com/images/dgRandomiser.jpg

http://puppettd.com/downloads/dgRandomiser.rar

Lamont
12-18-2006, 11:54 PM
Here is FaoGen.Mel 1.0 ::Download (http://forums.cgsociety.org/www.digitalweaponx.net/files/FaoGenRender1.5.rar)::

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



Select the object.
Type the name in the top box.
Hit the export button.
Make settings to your needs.
Finally, hit the render button.
The *.PNG file will spit out to your project directory (The name of the image is NameOfObjectInMaya.png). **You will need FaoGen (http://www.rusteddreams.net) 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.

Lamont
12-22-2006, 03:45 AM
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.

:::LINK:::
(http://forums.cgsociety.org/www.digitalweaponx.net/files/FaoGenRender1.5.rar)

goleafsgo
01-22-2007, 06:59 PM
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];

eval($cmd);
}
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];

eval($cmd);
}
}


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

polySelectBetween("edgeLoop");
polySelectBetween("edgeRing");
polySelectBetween("edgeBorder");

butCherHeLL
01-22-2007, 08:54 PM
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

goleafsgo
01-22-2007, 09:14 PM
Are the edges you have selected actually border edges?

butCherHeLL
01-28-2007, 03:41 PM
thanks for answer.I understood.and a screenshot I sent about how to.

http://img77.imageshack.us/img77/6722/ug0ba359ou4.gif

butCherHeLL
02-02-2007, 12:13 PM
http://img293.imageshack.us/img293/5509/tglfurdd0.png

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

cpan
02-08-2007, 10:11 AM
hotkeys to toggle the AE window and the AE docked tag.

bind this to ctrl+a to toggle the AE window:
if(`isAttributeEditorVisible`)
{
setChannelBoxVisible(1);
}else{
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";
}
else
{
optionVar -iv aeInMainWindow 1;
print "AE: Main Maya Window";
}


just in case someone finds these usefull :)