This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //all procedures require writeToTextFileAndOpen() proc @ https://gist.github.com/berniebernie/c493e1d13a8aa5a4f161 | |
| // | |
| // 1) output translate, rotate, scale for the current frame to a text file | |
| // | |
| $file = ""; | |
| $file += "\n\n//==========EDIT AND PASTE IN THE SCRIPT EDITOR ===========================================================\n\n\n"; | |
| for($o in `ls -sl -l`){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| proc writeToTextFileAndOpen(string $textToWrite, string $fileLocation, int $openAfterWriting){ | |
| //cross platform write to textfile or temp textfile | |
| string $tmpfile = ""; | |
| if($fileLocation == ""){ | |
| string $file = `file -q -sn -shn`; | |
| int $r = `rand 1000 10000`; | |
| $file = ($file=="")?"tmp_maya_file."+$r+".txt":$file+"."+$r+".txt"; | |
| string $myScriptDir = `internalVar -utd`; | |
| $tmpfile = $myScriptDir+$file; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (`window -exists AllIconsWin`) deleteUI AllIconsWin; | |
| if (`windowPref -exists AllIconsWin`) windowPref -remove AllIconsWin; | |
| string $window = `window -title "All icons" -rtf 1 -widthHeight 840 550 AllIconsWin`; | |
| columnLayout -adj 1; | |
| $labels = `textFieldGrp -label "Resources: " -text "click icons to get icon names"`; | |
| $scrollLayout = `scrollLayout -verticalScrollBarThickness 16 -h 500`; | |
| rowColumnLayout -numberOfColumns 25; | |
| string $icons[] = `resourceManager -nameFilter "*"`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| proc incrementAndSave(){ | |
| //takes the current scene, increments (or adds '01' suffix if none found). Padding set to 2 | |
| //so many regexes because I suck at this | |
| string $path = `file -q -loc`; | |
| $path = `match "^.*/" $path`; | |
| string $file = `file -q -sn -shn`; | |
| $ext = fileExtension($file); | |
| $file = `match "^[^\.]*" $file`; | |
| string $suffix = `match "[0-9]+$" $file`; | |
| $file = `match ".*[^0-9]" $file`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //not tested on really heavy meshes | |
| // | |
| //selects shells with same number of faces | |
| //expects 1 shell to be selected in face mode | |
| //change numberOfTests according to mesh density | |
| int $numberOfTests = 5000; //change according to mesh density and distribution, this took approx 10s on a 25k poly object | |
| int $useMoreThanFacesCount = 1; //change to 1 if you want to match using UVs/edge, can be nice if you have same poly count but different UVs/edges count | |
| int $debug = 0; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| global string $selectedFace; | |
| string $selected[] = `ls -sl`; | |
| $selectedFace = $selected[0]; | |
| string $window = `window -title "Select similar faces"`; | |
| columnLayout; | |
| floatSliderGrp -label "Angle threshold " -field true | |
| -minValue 0 -maxValue 180 | |
| -cc "growSel" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* usage: | |
| run script, select objects to be hidden, press "Select Objects to be hidden" =) | |
| then create and select spheres that will serve as control objects and "Select balls to control" | |
| you can add/remove spheres and objects afterwards by adding remove from the two sets 'objs' and 'control' | |
| slightly buggy because of setAttr in expressions | |
| */ | |
| global string $objs; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| string $singleEdges[] = {}; | |
| string $sel[] = `ls -sl -fl`; | |
| for($o in $sel){ | |
| select -r $o; | |
| SelectEdgeRingSp; | |
| polySplitRing -ch 0; | |
| string $sel2[] = `ls -sl -fl -hd 1`; | |
| $singleEdges[size($singleEdges)] = $sel2[0]; | |
| } |