// =========================================================================== // 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. // =========================================================================== // // If any of the segmentation properties change we need to // update the shader assignment. // source "createTextureToGeom.mel"; global proc TGcolorChangeAttr( string $attr ) { string $tokenAry[]; tokenize( $attr, ".", $tokenAry ); TGcolorChange( $tokenAry[0] ); } global proc TGcolorChange( string $nodeName ) // // Description: // If the user changes any of the parameters that will result in a new // segmentation of the image then we must reassign the shaders. // { string $mesh[] = `listConnections -shapes true -type "mesh" ($nodeName + ".message")`; if ( size($mesh) > 0 ) { string $if = `getAttr ($nodeName + ".imageFile")`; if ( !`filetest -r $if` ) { string $msg = (uiRes("m_TGcolorChange.kFileDoesNotExist")); error(`format -stringArg $if $msg`); } // Extract the new basename (if it has changed). // $baseName = basenameEx( $if ); // Assign new group ids. // assignGroupIds( $baseName, $nodeName, $mesh[0] ); if ( objExists ($nodeName + ".shaderAssignment") ) { // Do the actual shader assignment. // string $shading = `getAttr ($nodeName + ".shaderAssignment")`; textureToGeomApplyColor( $nodeName, $if, $mesh[0], $shading ); } } }