// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // // // // // // selectCurveCV ( string $CVsToSelect ) // // // None // // // Selects the specified CV on active curve. // // // $CVsToSelect: valid strings are "first", "last" and "all". // // // // Select the first cv. // selectCurveCV("first"); // // // Select the last cv. // selectCurveCV("last"); // // // Select all cv's. // selectCurveCV("all"); // global proc selectCurveCV( string $CVsToSelect ){ //get selected curves string $curves[] = `listRelatives -shapes -type "nurbsCurve"`; //test to see if user has selected curve components if (`size ($curves)` == 0){ $curves = `listRelatives -parent -type "nurbsCurve"`; } //error out if there is nothing to convert if (`size ($curves)` == 0){ string $msg = (uiRes("m_selectCurveCV.kInvalidSelection")); error ($msg); } //clear selection select -clear; //create a string array to store all components string $newSelection[]; int $i = 0; //for each curve for ($curve in $curves){ if ($CVsToSelect == "first"){ //select first CV $newSelection[$i] = ($curve + ".cv[0]") ; } else { //select last or all //find number of CVs in curve int $numCVs = `getAttr -size ($curve + ".controlPoints")`; if ($CVsToSelect == "last"){ //select last curve CV $newSelection[$i] = ($curve + ".cv[" + $numCVs + "]") ; } else { //select all curve CVs $newSelection[$i] = ($curve + ".cv[0:" + $numCVs + "]") ; } } $i++; } select -replace $newSelection; }