// =========================================================================== // 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: 2002 // // Description: Create a locator that shows the elevation of an ocean's // surface // global proc oceanLocator(string $oceanShader, float $px, float $py) { string $nType = nodeType( $oceanShader ); int $isMesh = ($nType == "mesh"); if( !$isMesh && $nType != "oceanShader" ){ warning((uiRes("m_oceanLocator.kNeedOceanShader"))); return; } string $result[] = `spaceLocator -p $px 0.0 $py`; string $loc = $result[0]; string $exp = ( "float $u = " + $loc + ".tx;\n" +"float $v = " + $loc + ".tz;\n" ); if( $isMesh ){ $exp += ($loc+".ty = `meshHeight "+ $oceanShader +" $u $v`;\n"); } else { $exp += ("float $disp[] = `colorAtPoint -u $u -v $v " +$oceanShader+"`;\n" +$loc+".ty = $disp[0];\n" +"float $dummy = " + $oceanShader + ".displacement;\n"); } expression -s $exp; }