// =========================================================================== // 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. // =========================================================================== proc int isShadingPressureMap( int $mapIndex ) { if( (($mapIndex >= 2 ) && ($mapIndex <= 5 )) || ($mapIndex == 8) || ($mapIndex == 9) ) { return true; } return false; } global proc presetSetPressure(int $pindex, int $mapping, float $min, float $max ) { global float $gPresetBrushShadeBlend; global float $gPresetBrushShapeBlend; global int $gPresetBlending; global string $gCreatorWireCtx; string $whichCtx = $gCreatorWireCtx; int $cMap; int $isShade; float $cMin, $cMax; if( $gPresetBlending && ($gPresetBrushShadeBlend < .999 || $gPresetBrushShapeBlend < .999 )) { switch( $pindex ) { case 1: $cMap = `dynWireCtx -q -pm1 $whichCtx`; $cMin = `dynWireCtx -q -ps1 $whichCtx`; $cMax = `dynWireCtx -q -px1 $whichCtx`; break; case 2: $cMap = `dynWireCtx -q -pm2 $whichCtx`; $cMin = `dynWireCtx -q -ps2 $whichCtx`; $cMax = `dynWireCtx -q -px2 $whichCtx`; break; case 3: $cMap = `dynWireCtx -q -pm3 $whichCtx`; $cMin = `dynWireCtx -q -ps3 $whichCtx`; $cMax = `dynWireCtx -q -px3 $whichCtx`; break; default: return; } $isShade = isShadingPressureMap( $cMap ); if( $cMap != $mapping ) { if( ($isShade && $gPresetBrushShadeBlend < 0.5 ) ||(!$isShade && $gPresetBrushShapeBlend < 0.5 )) { return; } else { $mapping = $cMap; } } else { if( $isShade ) { $min = $min * $gPresetBrushShadeBlend + $cMin * (1-$gPresetBrushShadeBlend); $max = $max * $gPresetBrushShadeBlend + $cMax * (1-$gPresetBrushShadeBlend); } else { $min = $min * $gPresetBrushShapeBlend + $cMin * (1-$gPresetBrushShapeBlend); $max = $max * $gPresetBrushShapeBlend + $cMax * (1-$gPresetBrushShapeBlend); } } } setStrokePressure( $pindex, $mapping, $min, $max ); }