CGTalk > Software > Autodesk Maya > Maya Programming
Login register
reply share thread « Previous Thread | Next Thread »
 
Thread Tools Search this Thread Display Modes
Old 05-16-2014, 11:24 PM   #466
divanovic
Frequenter
 
divanovic's Avatar
portfolio
Dejan Ivanovic
TD
Deform CG Studio
Belgrade, Serbia
 
Join Date: Oct 2005
Posts: 123
Send a message via MSN to divanovic
Quote:
Originally Posted by mrtalloy
I'm trying to make a shelf button to key all of the controls on a character. I've gotten as far as being able to select all of the controls, but cannot figure out how to key them within a loop.


Hi, don't know if you fixed it, but there are couple of things to consider:
This, as you wrote it, will return a 'shape' node of the curve, which you can't key in any case...
Code:
$ctrls = `ls -type "nurbsCurve" ($chars + "*")`;


I suggest you use a naming principle for your controls, suffix or such.
Apart from that, $ctrls must be an array to hold multiple values, so declare something like this:
Code:
string $controls[] = `ls ($chars + "*_ctrl")`;//_ctrl being a suffix of each control object


Then you can loop through them and do whatever needed:
Code:
for( $ctrl in $controls) { // no need to use 'select' command, address an object through setKeyframe command: setKeyframe $ctrl; };


Cheers
__________________
>> Deform CG Studio <<
 
Old 05-17-2014, 12:01 PM   #467
mrtalloy
New Member
portfolio
david talloy
Talloy.com
Penpedairheol, United Kingdom
 
Join Date: Jul 2012
Posts: 4
Thank you, aiming at the transforms instead works perfectly. The rig isn't mine so unfortunately I don't have control over the suffixes. That's useful to know for when I make my own however so thank you!
 
Old 06-12-2014, 08:54 PM   #468
andretom3
New Member
 
andretom3's Avatar
portfolio
Jack Bayder
Viet Nam
 
Join Date: Jun 2014
Posts: 21
I currently have some mel scripts to import lithtech lta files to maya but i don't seem how to get it work. Hope you guys help me out
Here's the download link of the script
Code:
https://www.mediafire.com/?w4eyvqchi6fjfhv
 
Old 06-13-2014, 02:17 AM   #469
andretom3
New Member
 
andretom3's Avatar
portfolio
Jack Bayder
Viet Nam
 
Join Date: Jun 2014
Posts: 21
Thanks these are really useful
 
Old 02-17-2015, 09:03 AM   #470
brentorama
Frequenter
 
brentorama's Avatar
portfolio
Brent Forrest
Fx artist
Toronto, Canada
 
Join Date: Oct 2002
Posts: 143
Lunch Timer

I've created a dumb little script that creates an analogue clock on your viewport, and lets you know how long you've gone for lunch! It also insults the user if you input redundnat commands like "Make clock" when the clock is already made.

Hit ESC to abort the clock.

//Script starts here
/* bClock - a stupid program to leave running on my screen when I leave my desk for lunch 2015 Brent Forrest */

global int $randy;
global string $ins[];
global float $size;
$ins = {"idiot", "stupid", "dummy", "retard", "you beautiful specimen", "Dean", "baby-diapers", "stinky", "ugly", "chumpy", "numbnuts", "dumpy", "lumpy", "friend", "buddy"};
$size = size($ins);

if (`window -exists bClock`){
deleteUI bClock;}
window -title "Lunch Clock"
-iconName "bClock" -s 0
-widthHeight 600 500 bClock;
rowColumnLayout -w 400 -cw 300 300 -numberOfColumns 2;
button -bgc 0.1 0 0.5 -l "Delete the Clock" -command "deleteClock";
button -bgc 0.1 0 0.5 -l "Make the Clock" -command "makeClock" ;
button -bgc 0.1 0 0.5 -l "Set the Time" -command "setTheTime" ;
button -bgc 0.1 0 0.5 -l "Start the Clock" -command "goClock" ;
button -bgc 0.5 0 0.1 -l "Do All" -command "go" ;
setParent ..;
showWindow bClock;



proc go ()
{
if ( `objExists mrMin` ) deleteClock;
if ( !`objExists mrMin` ) makeClock;
setTheTime;
goClock;
}


proc deleteClock ()
{
global string $ins[];
global float $size;
if ( !`objExists mrMin` ){
int $randy = rand($size);
string $insult = $ins[$randy];
print ("No clock exists, " + $insult);
}else{
select "mrSec*" "mrHour*" "mrMin*" "mrFace*" "clockGP*" "pie*";
string $clockIs[] = `ls -sl`;
delete $clockIs ;
}
}



// Create a couple nurbs circles and move the cvs to look like clock hands
proc makeClock ()
{
if ( !`objExists mrMin` ){
circle -c 0 0.0 0.0 -s 12 -d 1 -ch 1 -o on -nr 0 0 -1 -r 10 -n "mrFace";
circle -c 0 0.05 0.2 -s 3 -d 1 -ch 0 -o on -nr 0 0 -1 -r 0.1 -n "mrSec";
circle -c 0 0.4 0.1 -s 3 -d 1 -ch 0 -o on -nr 0 0 -1 -r 0.8 -n "mrMin";
circle -c 0 0.5 0 -s 3 -d 1 -ch 0 -o on -nr 0 0 -1 -r 1 -n "mrHour";
setAttr "mrMin.overrideEnabled" 1;
select -r mrMin.cv[0] mrMin.cv[3] ;
move -r -os -wd 0 10 0 ;
select -r mrSec.cv[0] mrSec.cv[3] ;
move -r -os -wd 0 10 0 ;
select -r mrHour.cv[0] mrHour.cv[3] ;
move -r -os -wd 0 8 0 ;
string $clockIs[] = {"mrSec", "mrHour", "mrMin", "mrFace"};
for ($one in $clockIs){
setAttr ($one+".overrideEnabled") 1;
setAttr ($one+".overrideColor") 16;}
group -w -n "clockGP" $clockIs; xform -os -piv 0 0 0;
rotate 0 180 0 clockGP ;
select -d;
print "Clock has been made";
}else{
global string $ins[];
global float $size;
int $randy = rand($size);
string $insult = $ins[$randy];
print ("There's already a clock there, " + $insult);
}
}


proc setTheTime ()
{
if (`objExists mrMin`){
deleteClock;
makeClock;
string $theTime = `date -t`;
string $token[];
tokenize $theTime ":" $token;
$hour=$token[0];
$minute=$token[1];
$second=$token[2];
float $hour2 = $hour;
float $minute2 = $minute;
float $second2 = $second;
float $rotSec = (6 * $second2);
float $rotMin = (6 * $minute2);
float $rotHour = (30 * $hour2);
rotate 0 0 $rotSec mrSec;
rotate 0 0 $rotMin mrMin;
rotate 0 0 $rotHour mrHour;
refresh;
print ("Time has been set to " + $theTime) ;
}else{
global string $ins[];
global float $size;
int $randy = rand($size);
string $insult = $ins[$randy];
print ("There's no clock there to set, " + $insult);
}
}

proc timer ()
{
if (!`objExists "timer"`){
cylinder -o 1 -ch 1 -ax 0 0 1 -hr 0.05 -r 10 -n "timer";
parent timer clockGP;
nurbsPrimitiveCap 1 1 1;
pickWalk -d down;
pickWalk -d right;
rename "timePie";
delete timerShape;
string $list[] = `listConnections timePieShape`;
rename $list[0] pieRevolve;
string $list[] = `listConnections pieRevolve`;
rename $list[0] pieMake;
rotate 0 0 90 timePie;
orientConstraint -o 180 0 90-n "tpOc" mrMin timePie ;
delete "tpOc";
connectAttr mrMin.rotateZ pieMake.endSweep;
}
}

proc goClock ()
{
if (`objExists mrMin`){
global string $gMainProgressBar;
progressBar -edit
-beginProgress
-isInterruptable true
-status "Ticking Clock"
-maxValue 4500
$gMainProgressBar;
float $sec;
float $min;
float $hour;
string $clockIs[] = {"mrSec", "mrHour", "mrMin"};
if (!`objExists pieColor`) timer;
if (!`objExists pieColor`) mrColor;
makeIdentity -apply true -t 0 -r 1 -s 0 -n 0 $clockIs;
for($sec=0; $sec < 4500; $sec++) {
if(`progressBar -query -isCancelled $gMainProgressBar`)
break;
refresh ;
rotate 0 0 $sec mrSec;
$min = ($sec / 60);
rotate 0 0 $min mrMin;
$hour = ($min / 60);
rotate 0 0 $hour mrHour;
pause -sec 1;
progressBar -edit
-step 10 $gMainProgressBar;
}
progressBar -edit
-endProgress
$gMainProgressBar;
}else{
global string $ins[];
global float $size;
int $randy = rand($size);
string $insult = $ins[$randy];
print ("Do you see a clock there, " + $insult +"?");
}
}

proc mrColor ()
{
shadingNode -name "pieColor" -asTexture ramp;
setAttr "pieColor.colorEntryList[2].color" -type double3 1 0 0 ;
setAttr "pieColor.colorEntryList[0].color" -type double3 0 1 0 ;
setAttr "pieColor.colorEntryList[1].color" -type double3 1 1 0 ;
setAttr "pieColor.colorEntryList[2].position" 1;
setAttr "pieColor.colorEntryList[1].position" 0.6;
setAttr "pieColor.colorEntryList[0].position" 0.3;
setAttr "pieColor.interpolation" 4;
shadingNode -n "pieLambert" -asShader lambert;
shadingNode -n "pieUc" -asUtility unitConversion;
setAttr "pieUc.conversionFactor" 0.15;
connectAttr -force pieUc.output pieColor.uCoord;
setAttr "pieColor.type" 1;
connectAttr -force pieMake.endSweep pieUc.input;
connectAttr -force pieColor.outColor pieLambert.color;
setAttr "pieLambert.incandescence" 0.1 0.1 0.1 ;
setAttr "pieLambert.transparency" 0.5 0.5 0.5 ;
sets -renderable true -noSurfaceShader true -empty -name "pieColorSG";
connectAttr -f pieLambert.outColor pieColorSG.surfaceShader;
sets -forceElement "pieColorSG" "timePie";
refresh -f -cv;
}
 
Old 02-17-2015, 10:38 AM   #471
Reeks
holic
 
Reeks's Avatar
portfolio
Rico Holmes
making pretty pictures
Sweden
 
Join Date: Feb 2002
Posts: 105
What a brilliantly dumb script that is - thanks for making my morning Brentorama
__________________
--------------------------
http://www.ricoholmes.com
 
Old 02-18-2015, 07:31 AM   #472
brentorama
Frequenter
 
brentorama's Avatar
portfolio
Brent Forrest
Fx artist
Toronto, Canada
 
Join Date: Oct 2002
Posts: 143
Compliment Generator: ScriptJobs wow!

Got another one for you. Since my last one generated random insults, this one generates random compliments!

I'm still pretty new to MEL so as you can geuss my coding is rudimentary, that said, here is my first functional foray into ScriptJobs, getting userData and sampling info from an external text file.

Step one: Create a text file and write a compliment on as many lines as you like - or you can just copy / paste my list here. Save that file somewhere easy to navigate to, like C:\temp\compliments.txt
Quote:
you stallion
you champion
you superstar
you genius
you wonderful person
you handsome man
you killer
you maniac
you monster
you prince
you talented mofo
you awesome guy
you nice guy
you cool dude
you amazing specimen
you champ
you're incredible
you're amazing
you're the best
you did it
you've done well
you're quite good looking
you've done it
there's no stopping you
you've got charisma
you rule

Step two, edit line 10 of the code below to match up with your text file path.

Step three, run the code and shower yourself with praise! The compliments update when the playback state changes, so just scrub the timeline if you really want to feel good about yourself.
Quote:

int $complimentMe = `scriptJob -conditionChange "playingBack" "doSomething"`;
doSomething;

global proc doSomething ()
{
string $comps[];
string $filePath = "Y:/forrest/Scripts/compliments.txt" ;
$fileId = `fopen $filePath "r"` ;
string $nextLine = `fgetline $fileId` ;
while (size($nextLine) > 0) {
string $cleanLine = strip($nextLine) ;
$comps[size($comps)] = $cleanLine ;
$nextLine = `fgetline $fileId` ;
}
string $localUser = `getenv userName` ;
$localUser = `capitalizeString $localUser` ;
int $s = size($comps);
int $frame = `currentTime -q`;
int $randy = rand($s);
string $compl = $comps[$randy];
string $texties = ($localUser +", " + $compl+", you went to frame " + $frame+ "!");
if ( `objExists CompTextShape` ) delete CompTextShape;
textCurves -name "CompText" -f "Times-Roman" -t $texties;
fclose $fileId;
fitPanel -selected;
}

global proc killComps(int $complimentMe)
{
if ( `objExists CompTextShape` ) delete CompTextShape;
scriptJob -kill $complimentMe;
deleteUI complimentMe;
}

;

if (`window -exists complimentMe`){
deleteUI complimentMe;}
window -mbv 0 -title "Compliment Me"
-iconName "complimentMe" -s 0
-widthHeight 600 500 complimentMe;
rowColumnLayout -w 400 -cw 300 300 -numberOfColumns 2;
button -bgc 0.1 0 0.5 -l "Compliments Disable" -c "killComps($complimentMe)";
setParent ..;
showWindow complimentMe;

Last edited by brentorama : 02-18-2015 at 08:55 AM.
 
Old 04-06-2015, 03:49 AM   #473
halafradrimx
New Member
portfolio
 
Join Date: Jan 2015
Posts: 1
Can anyone help me to install THIS script? I know nothing of programming and I am really stuck with it. Could use some hand here, guys.

Care to give exact guidance? I seriously suck with Maya and do not know how to use .mel files and stuff.






Text is too long for the forum, so I am providing a link for it :

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

What it does is : it mirrors any polygon with a simple command, but beware with the vertexes separating the polygon in half, they need to be in a meridional line in order to work, otherwise it can create diffrent results.
 
Old 04-08-2015, 09:16 AM   #474
brentorama
Frequenter
 
brentorama's Avatar
portfolio
Brent Forrest
Fx artist
Toronto, Canada
 
Join Date: Oct 2002
Posts: 143
True 8-bit sprite saver/player in MEL

Code:
global int $cSprite[64]; global int $tSprite[144]; //5 animation frames, 64 pixels stored global matrix $coinAn [5] [64]; //6 animation frames, 144 pixels stored global matrix $turtleAn [6] [144]; global int $cT, $tT; global string $shaders[], $cPlane[], $tPlane[]; //assign names to new palette $shaders = {"red","orange", "yellow", "green", "blue", "purple", "brown", "black", "white", "grey", "trans", "hilite"}; //assign rgba values to the new palette float $r[] = {float(1),(1.0),(1.0),(0.0),(0.0),(0.5),(0.2),(0.0 ),(1.0),(0.5),(0.5),(1.0)}; float $g[] = {float(0),(0.5),(1.0),(1.0),(0.0),(0.0),(0.3),(0.0 ),(1.0),(0.5),(0.5),(1.0)}; float $b[] = {float(0),(0.0),(0.0),(0.0),(1.0),(1.0),(0.1),(0.0 ),(1.0),(0.5),(0.5),(1.0)}; float $a[] = {float(0),(0.0),(0.0),(0.0),(0.0),(0.0),(0.0),(0.0 ),(0.0),(0.0),(1.0),(0.0)}; //create the shaders $i = 0; for ($one in $shaders) { shadingNode -n $one -asShader lambert; sets -renderable true -noSurfaceShader true -empty -name ($one + "SG"); connectAttr -f ($one + ".outColor") ($one + "SG.surfaceShader"); setAttr ($one+".colorR") ($r[$i]) ; setAttr ($one+".colorG") ($g[$i]) ; setAttr ($one+".colorB") ($b[$i]) ; addAttr -keyable true -ln "index" -at long -dv ($i) $one; for ($rgb in {"R","G","B"}){ setAttr ($one+".transparency"+$rgb) ($a[$i]) ; } $i++ ; } //create an 8 x 8 sprite as a polyPlane $cPlane = `polyPlane -ch on -o on -w 8 -h 8 -sw 8 -sh 8 -cuv 2 -n "coinPlane"`; move 0 4 0; rotate -x -90; $tPlane = `polyPlane -ch on -o on -w 12 -h 12 -sw 12 -sh 12 -cuv 2 -n "turtlePlane"`; move 10 4 0; rotate -x -90; //the default animation cycles $coinAn = << 10, 10, 11, 2, 2, 1, 10, 10, 10, 11, 2, 1, 2, 2, 1, 10, 10, 2, 2, 2, 1, 2, 1, 10, 10, 2, 2, 2, 1, 2, 1, 10, 10, 2, 2, 2, 1, 2, 1, 10, 10, 2, 2, 2, 1, 2, 1, 10, 10, 2, 2, 1, 2, 2, 1, 10, 10, 10, 2, 2, 2, 1, 10, 10; 10, 10, 10, 2, 1, 10, 10, 10, 10, 10, 2, 2, 2, 1, 10, 10, 10, 10, 2, 1, 2, 1, 10, 10, 10, 10, 2, 1, 2, 1, 10, 10, 10, 10, 2, 1, 2, 1, 10, 10, 10, 10, 2, 1, 2, 1, 10, 10, 10, 10, 2, 2, 2, 1, 10, 10, 10, 10, 10, 2, 1, 10, 10, 10; 10, 10, 10, 2, 2, 10, 10, 10, 10, 10, 10, 8, 8, 10, 10, 10, 10, 10, 10, 8, 8, 10, 10, 10, 10, 10, 10, 8, 8, 10, 10, 10, 10, 10, 10, 8, 8, 10, 10, 10, 10, 10, 10, 8, 8, 10, 10, 10, 10, 10, 10, 8, 8, 10, 10, 10, 10, 10, 10, 2, 2, 10, 10, 10; 10, 10, 10, 11, 2, 10, 10, 10, 10, 10, 11, 2, 2, 2, 10, 10, 10, 10, 11, 2, 11, 2, 10, 10, 10, 10, 11, 2, 11, 2, 10, 10, 10, 10, 11, 2, 11, 2, 10, 10, 10, 10, 11, 2, 11, 2, 10, 10, 10, 10, 11, 2, 2, 2, 10, 10, 10, 10, 10, 11, 2, 10, 10, 10; 10, 10, 8, 2, 2, 2, 10, 10, 10, 8, 2, 2, 8, 2, 2, 10, 10, 8, 2, 1, 2, 8, 2, 10, 10, 8, 2, 1, 2, 8, 2, 10, 10, 8, 2, 1, 2, 8, 2, 10, 10, 8, 2, 1, 2, 8, 2, 10, 10, 8, 2, 2, 1, 2, 2, 10, 10, 10, 8, 2, 2, 2, 10, 10>>; $turtleAn = << 10, 10, 10, 10, 10, 10, 10, 10, 8, 8, 10, 10, 10, 10, 10, 3, 3, 10, 10, 1, 8, 8, 1, 10, 10, 10, 3, 11, 6, 3, 10, 1, 8, 7, 1, 10, 10, 3, 11, 11, 6, 6, 3, 1, 8, 7, 1, 1, 10, 3, 11, 6, 6, 6, 3, 1, 1, 1, 1, 1, 10, 3, 6, 6, 6, 6, 6, 3, 1, 8, 1, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 0, 10, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 1, 10, 10, 3, 6, 6, 6, 6, 6, 6, 3, 1, 1, 10, 10, 3, 6, 6, 6, 6, 6, 6, 6, 3, 1, 10, 10, 7, 7, 6, 6, 6, 7, 7, 7, 7, 10, 10, 10, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 10, 10; 10, 10, 10, 10, 10, 10, 10, 10, 8, 8, 10, 10, 10, 10, 10, 3, 3, 10, 10, 1, 8, 8, 1, 10, 10, 10, 3, 11, 6, 3, 10, 1, 8, 7, 1, 10, 10, 3, 11, 11, 6, 6, 3, 1, 8, 7, 1, 1, 10, 3, 11, 6, 6, 6, 3, 1, 1, 1, 1, 1, 10, 3, 6, 6, 6, 6, 6, 3, 1, 8, 1, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 0, 10, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 1, 10, 10, 3, 6, 6, 6, 6, 6, 6, 3, 1, 1, 10, 10, 3, 6, 6, 6, 6, 6, 6, 6, 3, 1, 10, 10, 7, 7, 6, 6, 6, 7, 7, 7, 7, 10, 10, 10, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 10, 10; 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 3, 3, 10, 10, 10, 8, 8, 10, 10, 10, 10, 3, 11, 6, 3, 10, 1, 8, 11, 1, 10, 10, 3, 11, 11, 6, 6, 3, 1, 8, 7, 1, 1, 10, 3, 11, 6, 6, 6, 3, 1, 11, 7, 1, 1, 10, 3, 6, 6, 6, 6, 6, 3, 1, 8, 1, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 1, 1, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 0, 10, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 1, 10, 10, 3, 6, 6, 6, 6, 6, 6, 6, 3, 1, 10, 10, 7, 7, 6, 6, 7, 7, 7, 7, 10, 10, 10, 10, 7, 7, 7, 7, 7, 7, 7, 7, 7, 10, 10, 10; 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 3, 3, 10, 10, 10, 8, 8, 10, 10, 10, 10, 3, 11, 6, 3, 10, 1, 8, 11, 1, 10, 10, 3, 11, 11, 6, 6, 3, 1, 8, 7, 1, 1, 10, 3, 11, 6, 6, 6, 3, 1, 11, 7, 1, 1, 10, 3, 6, 6, 6, 6, 6, 3, 1, 1, 1, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 1, 1, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 0, 10, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 1, 10, 10, 3, 6, 6, 6, 6, 6, 6, 6, 3, 1, 10, 10, 7, 7, 6, 6, 7, 7, 7, 7, 10, 10, 10, 10, 7, 7, 7, 7, 7, 7, 7, 7, 7, 10, 10, 10; 10, 10, 10, 3, 3, 10, 10, 10, 11, 11, 10, 10, 10, 10, 3, 11, 6, 3, 10, 1, 8, 8, 1, 10, 10, 3, 11, 11, 6, 6, 3, 1, 8, 7, 1, 1, 10, 3, 11, 6, 6, 6, 3, 1, 8, 7, 1, 1, 10, 3, 6, 6, 6, 6, 6, 3, 1, 1, 1, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 1, 1, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 0, 10, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 1, 10, 10, 3, 6, 6, 6, 6, 6, 6, 6, 3, 1, 10, 10, 7, 6, 6, 7, 7, 7, 7, 6, 3, 10, 10, 10, 7, 7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 10, 10; 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 10, 10, 10, 10, 10, 3, 3, 10, 10, 1, 8, 8, 1, 10, 10, 10, 3, 11, 6, 3, 10, 1, 8, 7, 1, 1, 10, 3, 11, 8, 6, 6, 3, 1, 8, 7, 1, 1, 10, 3, 8, 6, 6, 6, 6, 3, 1, 1, 1, 1, 10, 3, 6, 6, 6, 6, 6, 3, 1, 0, 1, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 1, 10, 1, 3, 6, 6, 6, 6, 6, 6, 3, 1, 1, 10, 10, 3, 6, 6, 6, 6, 6, 6, 6, 3, 1, 10, 10, 3, 6, 6, 6, 6, 6, 6, 6, 3, 10, 10, 10, 7, 7, 7, 7, 7, 7, 7, 6, 3, 10, 10, 10, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 10, 10>>; //save the animation frame proc saveFrame(){ int $getIndex; global string $cPlane[], $tPlane[]; global matrix $turtleAn [6] [144]; global matrix $coinAn [5] [64]; for ($i=0;$i<144;$i++){ select -r ($tPlane[0]+".f["+$i+"]"); hyperShade -smn; $obj = `ls - sl`; $getIndex = `getAttr ($obj[0]+".index")`; $turtleAn [3] [$i] = $getIndex; } } global proc animGo(){ global string $shaders[]; global string $sPlane[]; global string $tPlane[], $cPlane[]; global int $cSprite[], $tSprite[]; global matrix $coinAn [5] [64]; global matrix $turtleAn [6] [144]; global int $cT, $tT, $i; if (timerquery() > 0.05) { if ($cT > 4) $cT = 0; if ($tT > 5) $tT=0; for ($i=0;$i<64;$i++){ $cSprite[$i] = $coinAn [$cT] [$i]; } for ($it=0;$it<144;$it++){ $tSprite[$it] = $turtleAn [$tT] [$it]; } for ($i=0;$i<(size($cSprite));$i++){ sets -e -forceElement ($shaders[($cSprite[$i])]+"SG") ($cPlane[0]+".f["+$i+"]"); } for ($it=0;$it<(size($tSprite));$it++){ sets -e -forceElement ($shaders[($tSprite[$it])]+"SG") ($tPlane[0]+".f["+$it+"]"); } $cT++; $tT++; timerstart; } } global proc timerstart() { global float $GstartTime; $GstartTime = `timerX`; } global proc float timerquery() { global float $GstartTime; return (`timerX -startTime $GstartTime`); } global proc animate() { global int $anIndex; if ($anIndex == 0) $anIndex = -1; if (!`scriptJob -ex $anIndex`) { $anIndex = `scriptJob -kws -e idle animGo`; }else{ scriptJob -k $anIndex -f; } } // animate;

Last edited by brentorama : 09-11-2015 at 09:01 AM. Reason: MADE THINGS MORE NICER! URK!
 
Old 04-08-2015, 11:27 AM   #475
uotiug
New Member
portfolio
 
Join Date: Apr 2015
Posts: 1
Nice one Brentorama.

Watch this :


:P
 
Old 04-08-2015, 01:04 PM   #476
brentorama
Frequenter
 
brentorama's Avatar
portfolio
Brent Forrest
Fx artist
Toronto, Canada
 
Join Date: Oct 2002
Posts: 143
Well, naturally

Last edited by brentorama : 09-11-2015 at 09:02 AM.
 
Old 08-14-2015, 02:24 AM   #477
Hamburger
Expert
portfolio
Where is it?
Architectural Viz
Australia
 
Join Date: Sep 2004
Posts: 2,014
If anyone wants a select by angle script instead of the confusing consrtraings menu; This may require Maya 2015 and onwards;

Code:
global proc selectByAngle() { polySelectConstraint -m 2; string $win = `window -title "Select By Angle" -tbm 0`; rowLayout -nc 2; $command = ("deleteUI " + $win); intSliderGrp -label "Angle" -field true -fieldMinValue 0 -fieldMaxValue 180 -minValue 0 -maxValue 180 -value 0 -cc "polySelectConstraint -ap 1 -at #1"; button -label "Quit and Reset" -command ($command+";resetPolySelectConstraint"); showWindow; }
 
Old 09-11-2015, 01:46 AM   #478
brentorama
Frequenter
 
brentorama's Avatar
portfolio
Brent Forrest
Fx artist
Toronto, Canada
 
Join Date: Oct 2002
Posts: 143
Ascii Adventures in Mel



So this is the Nice Rice game - a candyBox style game with the workings of my ascii map editor. On the left you can see the entire world map. On the right you can see the "Visibility" map which gets updated as the player moves around. On the bottom is the result, which will be what the player sees.

Last edited by brentorama : 09-11-2015 at 08:52 AM. Reason: THINGS GOT BROKE! URG!
 
Old 09-11-2015, 05:40 AM   #479
Hamburger
Expert
portfolio
Where is it?
Architectural Viz
Australia
 
Join Date: Sep 2004
Posts: 2,014
Your random compliments script is a hilarious idea brent. At lunch had a spare few minutes and modified it so now before every batch render it compliments me and wishes me good luck hahah
 
Old 09-11-2015, 06:26 AM   #480
brentorama
Frequenter
 
brentorama's Avatar
portfolio
Brent Forrest
Fx artist
Toronto, Canada
 
Join Date: Oct 2002
Posts: 143
More compliments to make you feel good!

Quote:
Originally Posted by Hamburger
Your random compliments script is a hilarious idea


Thanks Hamburger, here's the updated version. Now that I'm delving into python I'm thinking about ways to have the compliment generator query a webservice instead of a local file

Code:
//replace the $filePath string with your own custom compliments. //have the first line of your compliments.txt be Titles, like "Mr, Captain, Buddy.." etc global proc buildWindow(string $texties, int $randy){ $windowName = ("Motivational #"+$randy); $response = `confirmDialog -title $windowName -bgc 0.9 0.8 0.1 -message $texties -button "OK" -button "Motivate me again" -defaultButton "OK" -cancelButton "OK" -dismissString "OK"`; if ( $response == "Motivate me again" ){ complimentMe; } } global proc complimentMe () { string $title[], $comps[], $token[], $user, $localUser, $filePath, $os; int $randy; $os = `about -os`; string $filePath = "/salu/home/wherever/compliments.txt" ; if ($os == "linux64") { $user = `getenv USERNAME`; }else{ $user = `getenv userName`; } $localUser = `capitalizeString $user` ; $fileId = `fopen $filePath "r"` ; string $nextLine = `fgetline $fileId` ; while (size($nextLine) > 0) { string $cleanLine = strip($nextLine) ; $comps[size($comps)] = $cleanLine ; $nextLine = `fgetline $fileId` ; } int $randy = rand(1,(size($comps))); $title = stringToStringArray ($comps[0], " "); int $randTit = rand (size($title)); string $texties = ($title[$randTit]+" "+$localUser+", "+$comps[$randy]); buildWindow($texties, $randy); fclose $fileId; } complimentMe;


Here is a sample Compliments.txt to save

Code:
Mr. Handsome Lord Captain Master Maestro Honorable Hey Mister General King Commander Dudeman Good Yo if you're ever feeling down, if you ever feel unappreciated, stop and realise that this random number generator chose this heartfelt message to deliver right to you. you stallion! you champion! you superstar! you genius! don't you think you've had enough compliments for one day? you may think that I say all these nice things about everybody, but I really only say them about you! the successful warrior is the average man, with laser-like focus you wonderful person you handsome man you can do anything, but not everything. you killer you maniac you're good enough, you're smart enough, and god dammit, people like you! enjoy this picture of a fish: <"{{{>< the reason most people never reach their goals is that they don't define them, or ever seriously consider them as believable or achievable. Winners can tell you where they are going, what they plan to do along the way, and who will be sharing the adventure with them. you monster MOTIVATIONAL MESSAGE #19 NOT FOUND, CONTACT ADMINISTRATOR you prince the distance between insanity and genius is measured only by success. you talented mofo you awesome guy you can't connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future. You have to trust in something--your gut, destiny, life, karma, whatever. This approach has never let me down, and it has made all the difference in my life. you nice guy a martial arts student approached his teacher with a question. "I'd like to improve my knowledge of the martial arts. In addition to learning from you, I'd like to study with another teacher in order to learn another style. What do you think of this idea?" "The hunter who chases two rabbits," answered the master, "catches neither one." you cool dude a doctor reaches into his smock to get a pen to write a prescription and pulls out a rectal thermometer. "Oh, damn it," he proclaims, "Some asshole has my pen!" time for a coffee break. |_P I'd like to teach the world to sing in perfect harmony. La la la! Isn't that nice? you amazing specimen Take up one idea. Make that one idea your life--think of it, dream of it, live on that idea. Let the brain, muscles, nerves, every part of your body, be full of that idea, and just leave every other idea alone. This is the way to success. two factory workers are talking. The woman says, "I can make the boss give me the day off." The man replies, "And how would you do that?" The woman says, "Just wait and see." She then hangs upside down from the ceiling. The boss comes in and says, "What are you doing?" The woman replies, "I'm a light bulb." The boss then says, "You've been working so much that you've gone crazy. I think you need to take the day off." The man starts to follow her and the boss says, "Where are you going?" The man says, "I'm going home, too. I can't work in the dark." you champ! a new student approached the Zen master and asked how he should prepare himself for his training. "Think of me a bell," the master explained. "Give me a soft tap, and you will get a tiny ping. Strike hard, and you'll receive a loud, resounding peal. you're incredible a lawyer runs a stop sign and gets pulled over by a sheriff. He thinks he's smarter being a big shot lawyer from New York and has a better education than an sheriff from West Virginia. The sheriff asks for license and registration. The lawyer asks, "What for?" The sheriff responds, "You didn't come to a complete stop at the stop sign." The lawyer says, "I slowed down and no one was coming." "You still didn't come to a complete stop. License and registration please," say the sheriff impatiently. The lawyer says, "If you can show me the legal difference between slow down and stop, I'll give you my license and registration and you can give me the ticket. If not, you let me go and don't give me the ticket." The sheriff says, "That sounds fair, please exit your vehicle." The lawyer steps out and the sheriff takes out his nightstick and starts beating the lawyer with it. The sheriff says, "Do you want me to stop or just slow down?" you're amazing people who succeed have momentum. The more they succeed, the more they want to succeed, and the more they find a way to succeed. Similarly, when someone is failing, the tendency is to get on a downward spiral that can even become a self-fulfilling prophecy. you're the best you've got a nice face! Q: How do fish get high? A: Seaweed. Q: What is the tallest building in the entire world? A: The library, because it has so many stories. you did it a teacher is teaching a class and she sees that Johnny isn't paying attention, so she asks him, "If there are three ducks sitting on a fence, and you shoot one, how many are left?" Johnny says, "None." The teacher asks, "Why?" Johnny says, "Because the shot scared them all off." The teacher says, "No, two, but I like how you're thinking." Johnny asks the teacher, "If you see three women walking out of an ice cream parlor, one is licking her ice cream, one is sucking her ice cream, and one is biting her ice cream, which one is married?" The teacher says, "The one sucking her ice cream." Johnny says, "No, the one with the wedding ring, but I like how you're thinking!" don't work too hard a martial arts student went to his teacher and said earnestly, "I am devoted to studying your martial system. How long will it take me to master it." The teacher's reply was casual, "Ten years." Impatiently, the student answered, "But I want to master it faster than that. I will work very hard. I will practice everyday, ten or more hours a day if I have to. How long will it take then?" The teacher thought for a moment, "20 years." twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. you must expect great things of yourself before you can do them. you've done well a young woman was taking golf lessons and had just started playing her first round of golf when she suffered a bee sting. Her pain was so intense that she decided to return to the clubhouse for medical assistance. The golf pro saw her heading back and said, "You are back early, what's wrong?" " was stung by a bee!" she said. "Where?" he asked. "Between the first and second hole." she replied. He nodded and said, "Your stance is far too wide." you're quite good looking a master of the tea ceremony in old Japan once accidentally slighted a soldier. He quickly apologized, but the rather impetuous soldier demanded that the matter be settled in a sword duel. The tea master, who had no experience with swords, asked the advice of a fellow Zen master who did possess such skill. As he was served by his friend, the Zen swordsman could not help but notice how the tea master performed his art with perfect concentration and tranquility. "Tomorrow," the Zen swordsman said, "when you duel the soldier, hold your weapon above your head, as if ready to strike, and face him with the same concentration and tranquility with which you perform the tea ceremony." The next day, at the appointed time and place for the duel, the tea master followed this advice. The soldier, readying himself to strike, stared for a long time into the fully attentive but calm face of the tea master. Finally, the soldier lowered his sword, apologized for his arrogance, and left without a blow being struck. Reaching the end of a job interview, the Human Resources Officer asks a young engineer fresh out of the Massachusetts Institute of Technology, "And what starting salary are you looking for?" The engineer replies, "In the region of $125,000 a year, depending on the benefits package." The interviewer inquires, "Well, what would you say to a package of five weeks vacation, 14 paid holidays, full medical and dental, company matching retirement fund to 50% of salary, and a company car leased every two years, say, a red Corvette?" The engineer sits up straight and says, "Wow! Are you kidding?" The interviewer replies, "Yeah, but you started it." you've done it a journey of a thousand miles begins with something something something... I dont know. there's no stopping you a husband and wife are trying to set up a new password for their computer. The husband puts, "Mypenis," and the wife falls on the ground laughing because on the screen it says, "Error. Not long enough." you've got charisma The son of a master thief asked his father to teach him the secrets of the trade. The old thief agreed and that night took his son to burglarize a large house. While the family was asleep, he silently led his young apprentice into a room that contained a clothes closet. The father told his son to go into the closet to pick out some clothes. When he did, his father quickly shut the door and locked him in. Then he went back outside, knocked loudly on the front door, thereby waking the family, and quickly slipped away before anyone saw him. Hours later, his son returned home, bedraggled and exhausted. "Father," he cried angrily, "Why did you lock me in that closet? If I hadn't been made desperate by my fear of getting caught, I never would have escaped. It took all my ingenuity to get out!" The old thief smiled. "Son, you have had your first lesson in the art of burglary." two traveling monks reached a river where they met a young woman. Wary of the current, she asked if they could carry her across. One of the monks hesitated, but the other quickly picked her up onto his shoulders, transported her across the water, and put her down on the other bank. She thanked him and departed. As the monks continued on their way, the one was brooding and preoccupied. Unable to hold his silence, he spoke out. "Brother, our spiritual training teaches us to avoid any contact with women, but you picked that one up on your shoulders and carried her!" "Brother," the second monk replied, "I set her down on the other side, while you are still carrying her." Three elderly men are taking a walk outside their nursing home. The first one says, "Windy, isn't it?" The second one says, "No, it's Thursday!" The third one says, "So am I. Let's go get a beer." you rule Teacher: "Kids,what does the chicken give you?" Student: "Meat!" Teacher: "Very good! Now what does the pig give you?" Student: "Bacon!" Teacher: "Great! And what does the fat cow give you?" Student: "Homework!" be yourself; everyone else is already taken. you're going places! as a group of soldiers stood in formation at an Army Base, the Drill Sergeant said, "All right! All you idiots fall out." As the rest of the squad wandered away, one soldier remained at attention. The Drill Instructor walked over until he was eye to eye with him, and then raised a single eyebrow. The soldier smiled and said, "Sure was a lot of 'em, huh, sir?" you've done so well and in such a short amount of time have I ever told you how much I appreciate you? you're very good looking! I'm about three years into my relationship now and I've started to have erection difficulties. My girlfriend and I have different ideas as to what the problem is: she bought me some Viagra and I bought her a treadmill. Q: How do astronomers organize a party? A: They planet. you smell teriffic here's a joke: Molecule 1: I just lost an electron. Molecule 2: Are you sure? Molecule 1: I'm positive. I don't say this to just anyone but you've got mad skills brother! a scientist and a philosopher are being chased by a hungry lion. The scientist makes some quick calculations and says, "It's no good trying to outrun it. It's catching up!" The philosopher keeps a little ahead and replies, "I'm not trying to outrun the lion, I'm trying to outrun you!" I like you! I like you just the way you are! I just want you to know how much I appreciate you. A monk set off on a long pilgrimage to find the Buddha. He devoted many years to his search until he finally reached the land where the Buddha was said to live. While crossing the river to this country, the monk looked around as the boatman rowed. He noticed something floating towards them. As it got closer, he realized that it was the corpse of a person. When it drifted so close that he could almost touch it, he suddenly recognized the dead body - it was his own! He lost all control and wailed at the sight of himself, still and lifeless, drifting along the river's currents. That moment was the beginning of his liberation. you're respected among your peers I'd like to buy you a beer you look fantastic! Have you lost weight? give me five, brother! Your hair looks amazing. Once upon the time there was an old farmer who had worked his crops for many years. One day his horse ran away. Upon hearing the news, his neighbors came to visit. "Such bad luck," they said sympathetically. "Maybe," the farmer replied. The next morning the horse returned, bringing with it three other wild horses. "How wonderful," the neighbors exclaimed. "Maybe," replied the old man. The following day, his son tried to ride one of the untamed horses, was thrown, and broke his leg. The neighbors again came to offer their sympathy on his misfortune. "Maybe," answered the farmer. The day after, military officials came to the village to draft young men into the army. Seeing that the son's leg was broken, they passed him by. The neighbors congratulated the farmer on how well things had turned out. "Maybe," said the farmer. You're really good at what you do. You are always so happy and kind to people, it's like a big breath of fresh air when I walk into the building and see you here Smart girls want to be called pretty and pretty girls want to be called smart. Infuse your life with action. Don't wait for it to happen. Make it happen. Make your own future. Make your own hope. Make your own love. And whatever your beliefs, honor your creator, not by passively waiting for grace to come down from upon high, but by doing what you can to make grace happen... yourself, right now, right down here on Earth. One day the Master announced that a young monk had reached an advanced state of enlightment. The news caused some stir. Some of the monks went to see the young monk. "We heard you are enlightened. Is that true?" they asked. "It is," he replied. "And how do you feel?" "As miserable as ever," said the monk. There once lived a great warrior. Though quite old, he still was able to defeat any challenger. His reputation extended far and wide throughout the land and many students gathered to study under him. One day an infamous young warrior arrived at the village. He was determined to be the first man to defeat the great master. Along with his strength, he had an uncanny ability to spot and exploit any weakness in an opponent. He would wait for his opponent to make the first move, thus revealing a weakness, and then would strike with merciless force and lightning speed. No one had ever lasted with him in a match beyond the first move. Much against the advice of his concerned students, the old master gladly accepted the young warrior's challenge. As the two squared off for battle, the young warrior began to hurl insults at the old master. He threw dirt and spit in his face. For hours he verbally assaulted him with every curse and insult known to mankind. But the old warrior merely stood there motionless and calm. Finally, the young warrior exhausted himself. Knowing he was defeated, he left feeling shamed. Somewhat disappointed that he did not fight the insolent youth, the students gathered around the old master and questioned him. "How could you endure such an indignity? How did you drive him away?" "If someone comes to give you a gift and you do not receive it," the master replied, "to whom does the gift belong?" People often say that motivation doesn't last. Well, neither does bathing -that's why we recommend it daily. It is hard to fail, but it is worse never to have tried to succeed. (Theodore Roosevelt) The only way of finding the limits of the possible is by going beyond them into the impossible. (Arthur C. Clarke) Happiness resides not in possessions and not in gold; the feeling of happiness dwells in the soul. (Democritus) The happiness of your life depends upon the quality of your thoughts; therefore guard accordingly. (Marcus Aurelius) People with many interests live, not only longest, but happiest. (George Matthew Allen) Happiness is not achieved by the conscious pursuit of happiness; it is generally the by-product of other activities. (Aldous Huxley) I am more and more convinced that our happiness or unhappiness depends far more on the way we meet the events of life, than on the nature of those events themselves. (Baron Alexander von Humboldt) Who is the happiest of men? He who values the merits of others, and in their pleasure takes joy, even as though 'twere his own. (Johann Wolfgang von Goethe) HI! Found you through Sugardoodle on Facebook today.. and I am so glad you did!! You have great ideas! I am looking forward to exploring your blog!! Thanks ! You're doing some amazing work! You've got a good head on your shoulders. People seem to like you. I like you! Everyone says you're the greatest! Have you played the Rice Game yet? looking good today! this above allthings: Know thyself. Confuscious say: Man who sleeps with itchy bum wakes with smelly finger WAre you drinking enough water? Don't you think it's time you otok a short break? OLM loves you! Isn't this better than working at Toneplus? It's party time!!
 
reply share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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

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

All times are GMT. The time now is 01:36 AM.


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