// =========================================================================== // 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. // =========================================================================== global proc texSculptCacheContextSetFalloffType (string $tool) { int $newVal = `optionMenuGrp -q -select texSculptCacheFalloffType_OMG` - 1; texSculptCacheContext -e -falloffType $newVal $tool; } global proc texSculptCacheContextSetGrabDirection (string $tool) { int $newVal = `optionMenuGrp -q -select texSculptGrabDirection_OMG` - 1; texSculptCacheContext -e -direction $newVal $tool; } global proc texSculptCacheContextSetPaintMethod(string $tool) { int $newVal = `optionMenuGrp -q -select texSculptPaintMethod_OMG`; if( $newVal == 1 ) texSculptCacheContext -e -pinsmooth true -pinsmoothandpaint true $tool; if( $newVal == 2 ) texSculptCacheContext -e -pinsmooth true -pinsmoothandpaint false $tool; } global proc texSculptCacheContextSetUnfoldBrushSize( float $size ) { int $u3DLoaded = `pluginInfo -q -loaded Unfold3D`; if( $u3DLoaded ) { string $UnfoldTool = "texUnfoldUVContext"; if( `Unfold3DContext -exists $UnfoldTool` ) Unfold3DContext -e -sizeuv $size $UnfoldTool; } } global proc texSculptCacheContextSetSymmetrizeUVBrushSize( float $size ) { int $mtkLoaded = `pluginInfo -q -loaded modelingToolkit`; if ($mtkLoaded) { string $symUVTool = "texSymmetrizeUVContext"; if (`SymmetrizeUVContext -exists $symUVTool`) { SymmetrizeUVContext -e -sizeuv $size $symUVTool; } } } global proc texSculptCacheContextSetSize( float $size, string $tool ) { texSculptCacheContext -e -size $size $tool; texSculptCacheContextSetUnfoldBrushSize( $size ); texSculptCacheContextSetSymmetrizeUVBrushSize($size); } global proc texSculptCacheContextProperties( ) { source "falloffUtility.mel"; string $currContext = `currentCtx`; string $currTool = `contextInfo -c $currContext`; string $currCmd = "texSculptCacheContext"; string $falloffName = "texSculptFalloffCurve"; initCurvePreset(); global string $gCurvePresets[]; global int $gMaxCustomCurveSize; setUITemplate -pushTemplate OptionsTemplate; string $parent = `toolPropertyWindow -q -location`; setParent $parent; columnLayout -adj true texSculptCacheContext; frameLayout -label (uiRes("m_texSculptCacheContextProperties.kBrushSection")) -labelVisible true -collapsable false; rowLayout -numberOfColumns 2 -columnWidth 2 20 -adjustableColumn 1 -rowAttach 2 "top" 0; columnLayout -adjustableColumn true; floatSliderGrp -field true -pre 3 -min 0 -max 1 -fieldMaxValue 10000 -label (uiRes("m_texSculptCacheContextProperties.kFalloffSize")) -annotation (uiRes("m_texSculptCacheContextProperties.kFalloffSizeAnnotation")) -cc ( "texSculptCacheContextSetSize(#1, \"" + $currContext + "\");" ) texSculptFalloffSize_FSG; floatSliderGrp -field true -pre 3 -min 0 -max 100 -fieldMaxValue 100000 -label (uiRes("m_texSculptCacheContextProperties.kFalloffStrength")) -annotation (uiRes("m_texSculptCacheContextProperties.kFalloffStrengthAnnotation")) -cc ( ("texSculptCacheContext -e -strength #1 " + $currContext) ) texSculptFalloffStrength_FSG; checkBoxGrp -label1 (uiRes("m_texSculptCacheContextProperties.kInvert")) -annotation (uiRes("m_texSculptCacheContextProperties.kInvertAnnotation")) -cc ( ("texSculptCacheContext -e -inverted #1 " + $currContext) ) texSculptInvert_CBG; optionMenuGrp -label (uiRes("m_texSculptCacheContextProperties.kPaintMethod")) -annotation (uiRes("m_texSculptCacheContextProperties.kPaintMethodAnnotation")) -cc (("texSculptCacheContextSetPaintMethod(\"" + $currContext + "\");")) texSculptPaintMethod_OMG; menuItem -label (uiRes("m_texSculptCacheContextProperties.kPMPaint")); menuItem -label (uiRes("m_texSculptCacheContextProperties.kPMSmooth")); rowLayout -numberOfColumns 2 -columnWidth 1 132 -columnWidth 2 80 -rowAttach 2 "top" 0 unPinAll_ROW; text -label ""; string $cmd = "TexSculptUnpinAll"; button -label (uiRes("m_texSculptCacheContextProperties.kUnpinAllButton")) -annotation (getRunTimeCommandAnnotation($cmd)) -width 80 -command ($cmd) unPinAll_BTN; setParent ..; rowLayout -numberOfColumns 2 -columnWidth 1 132 -columnWidth 2 80 -rowAttach 2 "top" 0 invertPinned_ROW; text -label ""; $cmd = "TexSculptInvertPin"; button -label (uiRes("m_texSculptCacheContextProperties.kInvertPinnedButton")) -annotation (getRunTimeCommandAnnotation($cmd)) -width 80 -command ($cmd) invertPin_BTN; setParent ..; checkBoxGrp -label1 (uiRes("m_texSculptCacheContextProperties.kTwist")) -annotation (uiRes("m_texSculptCacheContextProperties.kTwistUVAnnotation")) -cc ( ("texSculptCacheContext -e -grabTwist #1 " + $currContext) ) texSculptTwist_CBG; optionMenuGrp -label (uiRes("m_texSculptCacheContextProperties.kGrabDirection")) -cc (("texSculptCacheContextSetGrabDirection(\"" + $currContext + "\");")) texSculptGrabDirection_OMG; menuItem -label (uiRes("m_texSculptCacheContextProperties.kGrabScreen")); menuItem -label (uiRes("m_texSculptCacheContextProperties.kXZ")); menuItem -label (uiRes("m_texSculptCacheContextProperties.kYZ")); setParent ..; setParent ..; setParent ..; frameLayout -label (uiRes("m_texSculptCacheContextProperties.kFalloffSection")) -labelVisible true -collapsable true -collapse false; optionMenuGrp -label (uiRes("m_texSculptCacheContextProperties.kFalloffType")) -cc (("texSculptCacheContextSetFalloffType(\"" + $currContext + "\");")) texSculptCacheFalloffType_OMG; menuItem -label (uiRes("m_texSculptCacheContextProperties.kFalloffHybrid")); menuItem -label (uiRes("m_texSculptCacheContextProperties.kFalloffSurface")); menuItem -label (uiRes("m_texSculptCacheContextProperties.kFalloffVolume")); rowLayout -nc 3 -columnWidth 3 140; text -label (uiRes("m_texSculptCacheContextProperties.kFalloffCurve")); falloffCurve -w 150 -h 165 -cc("curveChanged( \"" + $currCmd + "\",\"" + $currContext + "\", \"#1\")") texSculptFalloffCurve; setUITemplate -popTemplate; columnLayout; iconTextButton -width 23 -height 23 -image "makeBigger.png" -style "iconAndTextHorizontal" -command (("makeLargeCurveWidget(\"" + $currCmd + "\",\"" + $currContext + "\",\"" + $falloffName + "\");")); checkBoxGrp -label1 (uiRes("m_texSculptCacheContextProperties.kSnapToGrid")) -cc (("snapToGridChanged(#1, \"" + $falloffName + "\")")) useSnapToGrid_CBG; button -label (uiRes("m_texSculptCacheContextProperties.kResetCurveButton")) -width 130 -command (("resetCurve( \"" + $currCmd + "\",\"" + $currContext + "\")")); button -label (uiRes("m_texSculptCacheContextProperties.kSaveCurveButton")) -width 130 -command (("saveTexCustomCurve(\"" + $currCmd + "\")")); setParent ..; setUITemplate -pushTemplate OptionsTemplate; setParent ..; rowLayout -nc 2; int $presetCellSize1 = 23; text -label (uiRes("m_texSculptCacheContextProperties.kFalloffCurvePreset")) falloffPresetsText; int $sz = size($gCurvePresets); gridLayout -numberOfColumns $sz -cellWidthHeight $presetCellSize1 $presetCellSize1 falloffProfilePresetsGrid; for($i = 0; $i < $sz; ++$i) { formLayout; falloffCurve -backgroundColor 0.51 0.51 0.51 -h 20 -w 20 -asString $gCurvePresets[$i] -cc ( ("curveChanged( \"" + $currCmd + "\",\"" + $currContext + "\", \"#1\")") ) -readOnly true; setParent ..; } setParent ..; setParent ..; rowLayout -nc 2; text -label (uiRes("m_texSculptCacheContextProperties.kFalloffCurveCustom")) falloffCustomText; gridLayout -numberOfColumns $gMaxCustomCurveSize -cellWidthHeight $presetCellSize1 $presetCellSize1 falloffProfileCustomGrid; for($i = 0 ; $i<$gMaxCustomCurveSize; $i++) { string $falloffCurveName = "texCustomCurve" + $i; formLayout; falloffCurve -backgroundColor 0.51 0.51 0.51 -h 20 -w 20 -asString "" -readOnly true -customCurveWidget true -cc ( ("customCurveOnClick( \"" + $currCmd + "\",\"" + $currContext + "\", \"#1\"," + $i + ")") ) $falloffCurveName; setParent ..; } setParent ..; setParent ..; setParent ..; frameLayout -label (uiRes("m_texSculptCacheContextProperties.kDisplaySection")) -labelVisible true -collapsable true -collapse true; checkBoxGrp -label1 (uiRes("m_texSculptCacheContextProperties.kBrushRing")) -cc ( ("texSculptCacheContext -e -showBrushRingDuringStroke #1 " + $currContext) ) texSculptBrushRing_CBG; setParent ..; setParent ..; setUITemplate -popTemplate; } global proc saveTexCustomCurve(string $currCmd) { global int $gCurrCustomIndex; int $customInsertSlot = findCustomInsertSlot($currCmd); string $ccName = "texCustomCurve" + $customInsertSlot; string $cFalloffCurve = `falloffCurve -q -asString texSculptFalloffCurve`; updateCustomOptionVar($customInsertSlot,$cFalloffCurve); falloffCurve -e -asString `falloffCurve -q -asString texSculptFalloffCurve` $ccName; $gCurrCustomIndex = -1; }