// bevelProfile // v0.8beta // April 26 2000 // Soren 'kurgan' Jacobsen // kurgan@ns-media.dk (suggestions/bugreports welcome) // // Usage: // Use 'create->text->curves' to create a text/logo type // DO NOT EDIT/CHANGE THE _GROUPING_!!!! this script depends on it!!!! // Select the _top_ node of the textgroup (something like: 'Text_Maya_1') // Run the script. // Thats all... // // Description: // This melscript automates 'profile beveling' of text // created with 'create->text->curves' tool. // It creates a 'bevelprofile' line wich it extrudes // along the edges of the letters (it also checks and attempts // to correct 'non-closed' outline curves). // It creates 'planar' cappings. // It turn on 'smoothEdge' tesselation for all generated surfaces. // And it 'parents' the resulting geometry under the // 'curvegroupnodes' created by the 'Text' tool, so each letter // is easily selectable. // Finally it 'unparents', the 'outlinecurves' to prevent // 'doubletransformations'. // ConstructionHistory is preserved, so it is possible // to edit both the profile curve, and the outline curves // afterwards. // // v0.8:enhancement: attempt to fix bevels going the wrong way // only very little testing has been performed. But it seems to // work allright. // // // Future enhancements: // I'd like to create a GUI for it, possibly with a preset profile // library. // Cleaning up the code!!! global proc bevelProfile() { string $sellist[]= `ls -sl`; select $sellist[0]; string $sellist2[]= `ls -sl -dag -type nurbsCurve`; string $profile = `curve -d 3 -p -0.001 0 0 -p 0.01 0 -0.003 -p 0.05 0 -0.01 -p 0.04 0 -0.5 -p 0.05 0 -0.99 -p 0.01 0 -0.997 -p -0.001 0 -1 -k 0 -k 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 4 -k 4 `; string $profileinv[] = `duplicate -un $profile`; scale -1 1 1 $profileinv; string $newsurf[], $tempcurve[]; select $sellist[0]; string $nextnode[] = `pickWalk -d down`; int $counter=0; do { $sellist[$counter] = $nextnode[0] ; $counter++; $nextnode = `pickWalk -d right` ; string $current4[] = `planarSrf -ch 1 -d 3 -ko 0 -tol 0.01 -rn 0 -po 0 $nextnode`; string $tempnode[] = `pickWalk -d down`; setAttr ($tempnode[0] + ".smoothEdge") 1; pickWalk -d up; string $current5[] = `duplicate -ic`; move -rpr 0 0 -1 ; select -r $current4 $current5 $nextnode; parent; select -r $nextnode; } while ($nextnode[0] != $sellist[0]) ; for ($current in $sellist2) { $current2 = $current + ".form"; if (`getAttr $current2` == 0) { closeCurve -ch 0 -ps 1 -rpo 1 -bb 0.5 -bki 0 -p 0.1 $current; } // if offsetting is on // $tempcurve = `offsetCurve -ch on -rn false -cb 2 -st true -cl true -cr 0 -d 0.001 -tol 0.01 -sd 5 -ugn false $current` ; // $current = $tempcurve[0]; // end if( `getAttr ($current + ".controlPoints[1].yValue")` < `getAttr ($current + ".controlPoints[0].yValue")` ) { $newsurf = `extrude -ch true -rn false -po 0 -et 2 -ucp 1 -fpt 1 -upn 1 -rotation 0 -scale 1 -rsp 1 $profileinv[0] $current`; } else { $newsurf = `extrude -ch true -rn false -po 0 -et 2 -ucp 1 -fpt 1 -upn 1 -rotation 0 -scale 1 -rsp 1 $profile $current`; } string $tempnode[] = `pickWalk -d down`; setAttr ($tempnode[0] + ".smoothEdge") 1; select -r $current; string $ungroupcurve[] = `pickWalk -d up`; string $current3[] = `pickWalk -d up`; select -r $newsurf $current3 ; parent; select -r $ungroupcurve; parent -w; } }