// =========================================================================== // 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. // =========================================================================== // // // Creation Date: Nov 2002 // // // // Procedure Name: // artAttrColorPerVertexToolScript // // Description: // Create wrapper around the artAttrCtx command. // // Input Arguments: // 6 ==> enter the tool (create if necessary) with vertexFaceColorRGB chosen // 5 ==> enter the tool (create if necessary) with vertexColorRGB chosen // 4 ==> enter the tool (create if necessary) // 3 ==> property sheet box // // Return Value: // None. // global proc string artAttrColorPerVertexToolScript( int $setToTool ) // // Description : // 4 ==> enter the tool { // Poly color per vertex Paint Tool. string $tool = "artAttrColorPerVertexContext"; makePaintable -activateAll false; makePaintable -activate true "mesh" "vertexFaceColorRGB" ; makePaintable -activate true "mesh" "vertexColorRGB" ; if( ! `artAttrPaintVertexCtx -exists $tool` ) { rememberCtxSettings `artAttrPaintVertexCtx -i1 "paintVertexColour.png" -whichTool "colorPerVertex" $tool`; } // Enter color-per-vertex shaded mode if the switch indicates so // if (`optionVar -q polyAutoShowColorPerVertex`) { optionVar -intValue colorShadedDisplay 1 -intValueAppend colorShadedDisplay 1; DisplaySmoothShaded; polyOptions -cs 1; } // By the traditional default, disable all color feedback and types clamping // (This will negate the corresponding saved settings in Maya for those items) // (i.e. if alpha clamping was set to upper, on the next session that setting won't be retained) // $res = `artAttrPaintVertexCtx -e -colorfeedback false -clamp none -alphaclamp none $tool` ; setToolTo $tool; if( 3 == $setToTool ) { toolPropertyWindow; } else if( 4 != $setToTool && 5 != $setToTool && 6 != $setToTool) { warning( (uiRes("m_artAttrColorPerVertexToolScript.kWrongInput")) ); } switch ( $setToTool ) { case 5 : // vertex artAttrPaintVertexCtx -e -paintComponent 1 `currentCtx` ; break ; case 6 : // vertex face artAttrPaintVertexCtx -e -paintComponent 2 `currentCtx` ; break ; case 7 : // face artAttrPaintVertexCtx -e -paintComponent 3 `currentCtx` ; break ; } return $tool; }