Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 38
  1. #21
    Join Date
    Jan 2004
    Location
    Sunny Southern California
    Posts
    3,828
    Here is a link for his home page.

  2. #22
    Join Date
    Jun 2005
    Posts
    32
    Sure why not put mine in. Its a script that will create random sized cubes, that is useful for making low poly cities.


    /*
    R.P.C. BY PELTRA 2005

    ###FOR NON-COMERCIAL USE ONLY###

    Usage: Put this script into your My Documents\maya\scripts
    --------------------------------------------
    This script creates random sized cubes,
    automating the process that would usually
    take much more time.
    */

    //set's up the creation settings
    int $ZS = rand(2,42);
    int $YS = rand(2,28);
    int $XS = rand(2,42);

    //creates the cube
    polyCube -w $XS -h $YS -d $ZS -sx 1 -sy 1 -sz 1 -ax 0 1 0 -tx 1 -ch 1;
    I know this is very easy, but I found a need for it.

    NOTE: I intend to keep working on it, this is just version 1.0
    Last edited by Peltra; 12-06-2006 at 03:03 PM.

  3. #23
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    6
    http://koshigayastudios.com has an awsome script suite.

  4. #24
    Join Date
    Mar 2003
    Posts
    60
    Ok, here's a script I use from time to time, find it useful for big scenes. It's a select by name script I wrote a while back. It just does a simple wildcard match to user input string, could be extended with regexp.

    Code:
    global proc selectNodes(string $name)
    {
    	string $sel;
    	string $selection;
    	string $select[];
    	string $sel;
    	string $cur_select[];
    
    	$cur_select = `ls -sl`;
    	$sel = `select -cl`;
    	$selection = `select -r -allDependencyNodes`;
      	$select = `ls -sl`;
      	$sel = `select -cl`;
    
      	for ($node in $select)
      	{
          	string $match = `match $name $node`;
          	if($match != ""){
          		string $sel = `select -add $node`;
          	}
      	}
    
    	if(`checkBox -q -value addToSelection` == true)
    	{
    		$sel = `select -add $cur_select`;
    	}
    
    	if(`checkBox -q -value isolateSelection` == true)
    	{
    		$pane = `getPanel -withFocus`;
    		enableIsolateSelect $pane 1;
    		isolateSelect -state 1 $pane;
    		isoSelectAutoAddNewObjs $pane 1;
    	}
    }
    
    global proc test()
    {
    	string $blah = `textField -q -text objectName`;
    	selectNodes($blah);
    }
    
    global proc selectByName()
    {
      	if ( `window -exists selectWindow` )
    		deleteUI - window selectWindow;
    
    	window
    		-title "Select By Name"
            -width 300 -height 300
            -sizeable true
        	selectWindow;
    
       	columnLayout -adjustableColumn true;
    	textField objectName;
    	checkBox -label "Add to current selection" addToSelection;
    	checkBox -label "Isolate selection" -v 1 isolateSelection;
        button -label "Select" -c ("test()");
    
    	setParent ..;
    	showWindow;
    }
    
    selectByName();
    Oh, and please check out my newly started greelbe script. I'd like some feedback to continute it, and make a decent greebler for the community
    Last edited by deesine; 10-22-2005 at 02:15 PM.

  5. #25
    Join Date
    Oct 2005
    Location
    Hannover / Germany
    Posts
    2
    Hi Folks!

    I wrote some scripts, too. =) I have a lot of unreleased mel scripts - i think i will finish them soon and release on my mel section: view mel section

    Let me shortly introduce the 3 scripts...

    1) jt_scalpel_Tool v0.1

    Think you want to cut edges with a scalpel - whatever this picture should explain how it works: view scalpel picture

    2) jt_unfreezeTranslate_Tool v0.1

    If you know what is freeze translate on a transform - with this tiny tool you may unfreeze the translate of the selected transform(s). This is useful to keep your transforms "clean" in worldspace =)

    3) jt_stencilPolyMeshes_Tool v0.1

    Small tool inspired by lightwave's stencil function. It uses Booleans to "Project" one polygon object onto another polygon object. This picture could explain: view stencil polymesh picture

    Ok, thanks for reading and greetings from outa hannover...
    ciao, joerg.

  6. #26
    Join Date
    Jul 2005
    Posts
    25
    here's my contribution. This takes the selected object and moves it a distance of ($distance)in front of the camera. I got fed up with everything always popping to the origin when working with big maps. (Z axis is up, not Y for this)

    Code:
    // getting camera info
    float $cameraTX = `getAttr persp.translateX`;
    float $cameraTY = `getAttr persp.translateY`;
    float $cameraTZ = `getAttr persp.translateZ`;
    
    float $cameraRX = `getAttr persp.rotateX`;
    float $cameraRZ = `getAttr persp.rotateZ`;
    
    // convert degrees to radians
    $cameraRX = $cameraRX * (3.1516 / 180);
    $cameraRZ = $cameraRZ * (3.1516 / 180);
    
    // sets object's distance from camera
    $distance = 10;
    
    // moves selected object into memory
    string $object[] = `ls -selection`;
    
    // converting Spherical to Cartesian Coordinates.
    $theta = $cameraRZ - 1.5708;
    $phi = 3.1416 - $cameraRX;
    $s = $distance * sin ($phi);
    
    //==============Equations==================
    	$x = $s * cos ($theta);
    	$y = $s * sin ($theta);
    	$z = $distance * cos ($phi);
    //=========================================
    
    // sets new x, y, and z on selected object.
    setAttr ($object[0] + ".translateX") ($cameraTX - $x);
    setAttr ($object[0] + ".translateY") ($cameraTY - $y);
    setAttr ($object[0] + ".translateZ") ($cameraTZ + $z);

  7. #27
    Join Date
    Jul 2003
    Location
    Austin, TX
    Posts
    55

    Missing texture finder

    I wrote this one for a project where we were converting a lot of assets with incorrect paths; it lets you select a starting folder and then searches through all subfolders to locate missing texture files. If it finds them it updates the path to the found texture file.
    Attached Files Attached Files

  8. #28
    Join Date
    May 2005
    Location
    Germany
    Posts
    14

    Post Toggle Through Translate and Arcball Modes - Depending on Which Tool is Active

    This script toggles through the Move tool's Local, World and Normal Translate modes and through the Rotate tool's Local and World Arcball modes - depending on which of the tools is active. It's inspired and based on scripts and hints by DezFX and volXen (see below, see also the edit paragraph).

    Code:
    /*
    What this script does:
    At first, it gets the currently active tool.
    If the Move tool is active it toggles through
    the tool's Local, World and Normal Translate modes.
    */
    
    string $currentTool = `currentCtx`;
    
    if ($currentTool == "moveSuperContext")
    {
    	if (`manipMoveContext -q -m Move` == 2)
    	manipMoveContext -e -m 3 Move;
    	
    	else if (`manipMoveContext -q -m Move` == 3)
    	manipMoveContext -e -m 1 Move;
    	
    	else
    	manipMoveContext -e -m 2 Move;
    }
    
    /*
    If the Rotate tool is active this script toggles
    through the tool's Local and World Arcball modes.
    */
    
    if ($currentTool == "RotateSuperContext")
    {
    	if (`manipRotateContext -q -m Rotate` == 0)
    	manipRotateContext -e -m 1 Rotate;
    	
    	else
    	manipRotateContext -e -m 0 Rotate;
    }
    Earlier in this thread DezFX posted three MEL scripts that select the Move tool's Object, Local and Normal Translate modes when I hit the specified hotkey. With volXen's hint in this thread I wanted to combine them into a single script that toggles though the desired modes - and not only of the Move tool but of the Rotate tool, too. If you know how to do it, it's quite easy. So maybe it's not worth posting it in this thread. But since I didn't know how to do it and initially made a mistake in the script it might be helpful for others.

    //edit:
    I found it useful to be able to toggle through the Move tool's World, Normal and Local Translate modes - I changed the script accordingly. I realised that I could also shorten the script whithout losing any of the initial functionality. I did that, too.
    Last edited by X1alpha; 05-15-2006 at 07:04 PM.
    Be prepared... to simplify your life.

  9. #29
    Join Date
    Mar 2003
    Posts
    60
    Here's a script I wrote the other day, it has a simple interface with two buttons that saves and restores the translate, rotate and scale values of selected objects. Haven't used it enough to flush out potential bugs yet, but seems to work fine so far.

    Code:
    // Matrix for storing an objects Rotate, Scale & Transform values.
    global matrix 	$objectPosition[256][9];
    global string 	$objectNameIndx[256];
    global int		$tmpIndex = 0;
    
    global proc SavePosition()
    {
    	global matrix 	$objectPosition[256][9];
    	global string 	$objectNameIndx[256];
    	global int		$tmpIndex;
    
    	float $tmpTranslateX;
    	float $tmpTranslateY;
    	float $tmpTranslateX;
    
    	float $tmpRotateX;
    	float $tmpRotateY;
    	float $tmpRotateZ;
    
    	float $tmpScaleX;
    	float $tmpScaleY;
    	float $tmpScaleZ;
    
    	int $noMatch = 1;
    
    	string $select[] = `ls -sl`;
    
    	if($tmpIndex > 0)
    	{
    		for($node in $select)
    		{
    			for($i = 0; $i < $tmpIndex; $i++)
    			{
    				if($objectNameIndx[$i] == $node)
    				{
    					print("Setting new position for "+$node+"\n");
    
    					// Name matches. Set new position.
    					$tmpTranslateX = `getAttr ($node+".translateX")`;
    					$tmpTranslateY = `getAttr ($node+".translateY")`;
    					$tmpTranslateZ = `getAttr ($node+".translateZ")`;
    
    					$tmpRotateX = `getAttr ($node+".rotateX")`;
    					$tmpRotateY = `getAttr ($node+".rotateY")`;
    					$tmpRotateZ = `getAttr ($node+".rotateZ")`;
    
    					$tmpScaleX = `getAttr ($node+".scaleX")`;
    					$tmpScaleY = `getAttr ($node+".scaleY")`;
    					$tmpScaleZ = `getAttr ($node+".scaleZ")`;
    
    					$objectPosition[$i][0] = $tmpTranslateX;
    					$objectPosition[$i][1] = $tmpTranslateY;
    					$objectPosition[$i][2] = $tmpTranslateZ;
    
    					$objectPosition[$i][3] = $tmpRotateX;
    					$objectPosition[$i][4] = $tmpRotateY;
    					$objectPosition[$i][5] = $tmpRotateZ;
    
    					$objectPosition[$i][6] = $tmpScaleX;
    					$objectPosition[$i][7] = $tmpScaleY;
    					$objectPosition[$i][8] = $tmpScaleZ;
    
    					$noMatch = 0;
    	            }
    	        }
            }
    		if($noMatch)
    		{
    			// This object is not in the position matrix, add it.
    			print("Adding new object "+$node+"\n");
    			$tmpTranslateX = `getAttr ($node+".translateX")`;
    			$tmpTranslateY = `getAttr ($node+".translateY")`;
    			$tmpTranslateZ = `getAttr ($node+".translateZ")`;
    
    			$tmpRotateX = `getAttr ($node+".rotateX")`;
    			$tmpRotateY = `getAttr ($node+".rotateY")`;
    			$tmpRotateZ = `getAttr ($node+".rotateZ")`;
    	
    			$tmpScaleX = `getAttr ($node+".scaleX")`;
    			$tmpScaleY = `getAttr ($node+".scaleY")`;
    			$tmpScaleZ = `getAttr ($node+".scaleZ")`;
    	
    			$objectPosition[$tmpIndex][0] = $tmpTranslateX;
    			$objectPosition[$tmpIndex][1] = $tmpTranslateY;
    			$objectPosition[$tmpIndex][2] = $tmpTranslateZ;
    	
    			$objectPosition[$tmpIndex][3] = $tmpRotateX;
    			$objectPosition[$tmpIndex][4] = $tmpRotateY;
    			$objectPosition[$tmpIndex][5] = $tmpRotateZ;
    	
    			$objectPosition[$tmpIndex][6] = $tmpScaleX;
    			$objectPosition[$tmpIndex][7] = $tmpScaleY;
    			$objectPosition[$tmpIndex][8] = $tmpScaleZ;
    	
    			$objectNameIndx[$tmpIndex] = $node;
    	
    			$tmpIndex++;
            }
        }
    	else
    	{
    		for($node in $select)
    		{
    			print("Setting position for "+$node+"\n");
    			$tmpTranslateX = `getAttr ($node+".translateX")`;
    			$tmpTranslateY = `getAttr ($node+".translateY")`;
    			$tmpTranslateZ = `getAttr ($node+".translateZ")`;
    
    			$tmpRotateX = `getAttr ($node+".rotateX")`;
    			$tmpRotateY = `getAttr ($node+".rotateY")`;
    			$tmpRotateZ = `getAttr ($node+".rotateZ")`;
    	
    			$tmpScaleX = `getAttr ($node+".scaleX")`;
    			$tmpScaleY = `getAttr ($node+".scaleY")`;
    			$tmpScaleZ = `getAttr ($node+".scaleZ")`;
    	
    			$objectPosition[$tmpIndex][0] = $tmpTranslateX;
    			$objectPosition[$tmpIndex][1] = $tmpTranslateY;
    			$objectPosition[$tmpIndex][2] = $tmpTranslateZ;
    	
    			$objectPosition[$tmpIndex][3] = $tmpRotateX;
    			$objectPosition[$tmpIndex][4] = $tmpRotateY;
    			$objectPosition[$tmpIndex][5] = $tmpRotateZ;
    	
    			$objectPosition[$tmpIndex][6] = $tmpScaleX;
    			$objectPosition[$tmpIndex][7] = $tmpScaleY;
    			$objectPosition[$tmpIndex][8] = $tmpScaleZ;
    	
    			$objectNameIndx[$tmpIndex] = $node;
    	
    			$tmpIndex++;
    		}
    	}
    }
    
    global proc ResetPosition()
    {
    	global matrix 	$objectPosition[256][9];
    	global string 	$objectNameIndx[256];
    	global int		$tmpIndex;
    
    	string $select[] = `ls -sl`;
    
    	for($node in $select)
    	{
    		for($i = 0; $i < $tmpIndex; $i++)
    		{
    			if($objectNameIndx[$i] == $node)
    			{
    				print("Resetting position for "+$node+"\n");
    
    				// Name matches. Reset position.
    				setAttr ($node+".translateX") $objectPosition[$i][0];
    				setAttr ($node+".translateY") $objectPosition[$i][1];
    				setAttr ($node+".translateZ") $objectPosition[$i][2];
    
    				setAttr ($node+".rotateX") $objectPosition[$i][3];
    				setAttr ($node+".rotateY") $objectPosition[$i][4];
    				setAttr ($node+".rotateZ") $objectPosition[$i][5];
    
    				setAttr ($node+".scaleX") $objectPosition[$i][6];
    				setAttr ($node+".scaleY") $objectPosition[$i][7];
    				setAttr ($node+".scaleZ") $objectPosition[$i][8];
                }
            }
        }
    }
    
    global proc SaveResetPos()
    {
      	if ( `window -exists SaveResetPosWindow` )
    		deleteUI - window SaveResetPosWindow;
    
    	window
    		-title "SaveResetPos"
            -width 100 -height 100
            -sizeable true
        	SaveResetPosWindow;
    
    	columnLayout -adjustableColumn true;
    
    	int $buttonHeight = 50;
    
    	button
    		-label "Save Position"
    		-bgc 0.7 0.7 0.9
    		-w 100
    		-h $buttonHeight
    		-c ("SavePosition()");
    
    	button
    		-label "Reset Position"
    		-bgc 0.9 0.7 0.7
    		-w 100
    		-h $buttonHeight
    		-c ("ResetPosition()");
    
    	setParent ..;
    	showWindow;
    }
    
    SaveResetPos();
    A couple more that may come in handy:
    procedures to Lock/unlock selected
    Code:
    global proc lockSelected()
    {
    	string $selection[] = `ls -sl`;
    
    	if($selection[0] == "")
    	{
    		warning ("No selection, select nodes to lock.");
    	}
    	else
    	{
    		for($node in $selection)
    		{
    			setAttr ($node+".tx") -l true;
    			setAttr ($node+".ty") -l true;
    			setAttr ($node+".tz") -l true;
    
    			setAttr ($node+".rx") -l true;
    			setAttr ($node+".ry") -l true;
    			setAttr ($node+".rz") -l true;
    
    			setAttr ($node+".sx") -l true;
    			setAttr ($node+".sy") -l true;
    			setAttr ($node+".sz") -l true;
    
    			setAttr ($node+".visibility") -l true;
    		}
    	}
    }
    
    global proc unlockSelected()
    {
    	string $selection[] = `ls -sl`;
    
    	if($selection[0] == "")
    	{
    		warning ("No selection, select nodes to unlock.");
    	}
    	else
    	{
    		for($node in $selection)
    		{
    			setAttr ($node+".tx") -l false;
    			setAttr ($node+".ty") -l false;
    			setAttr ($node+".tz") -l false;
    
    			setAttr ($node+".rx") -l false;
    			setAttr ($node+".ry") -l false;
    			setAttr ($node+".rz") -l false;
    
    			setAttr ($node+".sx") -l false;
    			setAttr ($node+".sy") -l false;
    			setAttr ($node+".sz") -l false;
    
    			setAttr ($node+".visibility") -l false;
    		}
    	}
    }
    Procedure to unlock read-only cameras:
    Code:
    global proc unlockCameras()
    {
    	string $selection[] = `ls -sl`;
    
    	if($selection[0] == "")
    	{
    		warning ("No selection, select cameras to unlock.");
    	}
    	else
    	{
    		for($node in $selection)
    		{
    			print ("Unlocking camera "+$node+"...");
    			camera -e -startupCamera false $node;
    			print ("done.\n");
    		}
    	}
    }
    And a procedure to list invisible transforms
    Code:
    global proc listInvisibleTransforms()
    {
    	string $selection[] = `ls -dag`;
    
    	for($node in $selection)
    	{
    		string $visible = `getAttr ($node+".visibility")`;
    
    		if($visible == "0")
    		{
    			print($node + " is invisible\n");
            }
        }
    }
    Last edited by deesine; 05-02-2006 at 02:43 AM.

  10. #30
    Join Date
    Jan 2004
    Location
    Sunny Southern California
    Posts
    3,828
    Hey deesine, thanks for the scripts. One thing I'd like to point out is that you could potentially combine your lock and unlock scripts into one toggle script. Try the following:
    Code:
    global proc toggleLockSelected()
    {
    	string $selection[] = `ls -sl`;
    
    	if($selection[0] == "")
    	{
    		warning ("No selection, select nodes to lock/unlock.");
    	}
    	else
    	{
    		for($node in $selection)
    		{
    			setAttr ($node+".tx") -l (!`getAttr -l ($node+".tx")`);
    			setAttr ($node+".ty") -l (!`getAttr -l ($node+".ty")`);
    			setAttr ($node+".tz") -l (!`getAttr -l ($node+".tz")`);
    
    			setAttr ($node+".rx") -l (!`getAttr -l ($node+".rx")`);
    			setAttr ($node+".ry") -l (!`getAttr -l ($node+".ry")`);
    			setAttr ($node+".rz") -l (!`getAttr -l ($node+".rz")`);
    
    			setAttr ($node+".sx") -l (!`getAttr -l ($node+".sx")`);
    			setAttr ($node+".sy") -l (!`getAttr -l ($node+".sy")`);
    			setAttr ($node+".sz") -l (!`getAttr -l ($node+".sz")`);
    
    			setAttr ($node+".v")-l (!`getAttr -l ($node+".v")`);
    		}
    	}
    }
    Dez
    Pipeline Technical Director
    Legend 3D | VFX

Page 3 of 4 FirstFirst 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •