// =========================================================================== // 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: Jan 30, 1996 // // Description: // These procs create the controls for a propMod tool property sheet. // See also propModValues.mel for procs that set the state of the // property sheet. // // // Input Arguments: // None. // // Return Value: // None. // global proc propModSpaceCallback( int $space ) { int $currentMode = eval("propModCtx -q -t " + `currentCtx`); int $newMode; int $ws; if( $space == 1 ) { // World space $newMode = $currentMode - 5; $ws = 1; radioButtonGrp -e -vis 1 modType3; } else { // Parametric space $newMode = $currentMode + 5; if ($newMode == 10) { // If we switch from NURBS : World Space to Parametric we're left // in an undefined state, switch to Linear : Parametric $newMode = 6; } $ws = 0; radioButtonGrp -e -vis 0 modType3; } propModCtx -e -t $newMode -ws $ws `currentCtx`; propModDimmer $newMode; } global proc propModTypeCallback( int $type ) { int $currentSpace = eval("propModCtx -q -ws " + `currentCtx`); int $newType; if( $currentSpace == 1 ) { $newType = $type; } else { $newType = $type + 5; } propModCtx -e -t $newType `currentCtx`; propModDimmer $newType; } proc propModSetCallbacks( string $parent ) // // Description: // Set the callbacks for all of the controls in the dialog. // Modifying the context will force propModValues() to be called // // { setParent $parent; radioButtonGrp -e -on1 "propModSpaceCallback 1" -on2 "propModSpaceCallback 2" modSpace; radioButtonGrp -e -on1 "propModTypeCallback 1" -on2 "propModTypeCallback 2" modType; radioButtonGrp -e -on1 "propModTypeCallback 3" -on2 "propModTypeCallback 4" modType2; radioButtonGrp -e -on1 "propModTypeCallback 5" modType3; checkBoxGrp -e -on1 "propModDirCheckToVec 0 1" -on2 "propModDirCheckToVec 1 1" -on3 "propModDirCheckToVec 2 1" -of1 "propModDirCheckToVec 0 0" -of2 "propModDirCheckToVec 1 0" -of3 "propModDirCheckToVec 2 0" modDir; floatSliderGrp -e -cc "propModLinearDistToSlope #1" linearField; floatSliderGrp -e -cc "propModLinearParamCutoff 0 #1" linearFieldU; floatSliderGrp -e -cc "propModLinearParamCutoff 1 #1" linearFieldV; floatSliderGrp -e -cc "propModCtx -e -pc #1 `currentCtx`" powerCutoff; floatSliderGrp -e -cc "propModPowerCutoff 0 #1" powerCutoffU; floatSliderGrp -e -cc "propModPowerCutoff 1 #1" powerCutoffV; floatSliderGrp -e -cc "propModCtx -e -pd #1 `currentCtx`" powerDegree; floatSliderGrp -e -cc "propModCtx -e -pdp #1 `currentCtx`" powerDegreeParam; textFieldGrp -e -cc "propModCtx -e -s #1 `currentCtx`" scriptName; textFieldGrp -e -cc "propModCtx -e -sp #1 `currentCtx`" scriptNameParam; textField -edit -cc "propModAnimCurveSet \"#1\"" animCurveName; textField -edit -cc "propModAnimCurveParamSet \"#1\"" animCurveNameParam; textField -edit -cc "propModCtx -e -nc #1 `currentCtx`" nurbsCurveName; } global proc createAnimCurvesPopup() { global string $gPropModAnimCurvePrefix; popupMenu -e -dai animCurvePopup; setParent -menu animCurvePopup; string $all[] = `ls ($gPropModAnimCurvePrefix + "*")`; string $select = ""; int $i, $n; $n = size($all); if( $n > 0 ) { $select = "select -d "; for( $i=0; $i<$n; $i+=1 ) { $select = $select + ( $all[$i] + " " ); } $select = $select + "; "; for( $i=0; $i<$n; $i+=1 ) { menuItem -label $all[$i] -c ($select + "select -add " + $all[$i] + "; " + "propModAnimCurveSet " + $all[$i] + "; "); } } else { string $noAnimCurve = (uiRes("m_propModProperties.kNoAnimCurves")); string $menuAnim = `format -s $gPropModAnimCurvePrefix $noAnimCurve`; menuItem -label $menuAnim; } menuItem -d true; menuItem -label (uiRes("m_propModProperties.kCreateNew")) -c "propModAnimCurveSet \"\";"; } global proc createAnimCurvesParamPopup() { global string $gPropModAnimCurvePrefix; popupMenu -e -dai animCurveParamPopup; setParent -menu animCurveParamPopup; string $all[] = `ls ($gPropModAnimCurvePrefix + "*")`; string $select = ""; int $i, $n; $n = size($all); if( $n > 0 ) { $select = "select -d "; for( $i=0; $i<$n; $i+=1 ) { $select = $select + ( $all[$i] + " " ); } $select = $select + "; "; for( $i=0; $i<$n; $i+=1 ) { menuItem -label $all[$i] -c ($select + "select -add " + $all[$i] + "; " + "propModAnimCurveParamSet " + $all[$i] + "; "); } } else { string $noAnimCurve = (uiRes("m_propModProperties.kNoAnimCurveParam")); string $noAnimItem = `format -s $gPropModAnimCurvePrefix $noAnimCurve`; menuItem -label $noAnimItem; } menuItem -d true; menuItem -label (uiRes("m_propModProperties.kCreateNewParam")) -c "propModAnimCurveParamSet \"\";"; } global proc createNurbsCurvesPopup() { popupMenu -e -dai nurbsCurvePopup; setParent -menu nurbsCurvePopup; string $all[] = `ls -lf -dag -type "nurbsCurve"` ; string $select = ""; int $i, $n; $n = size($all); if( $n > 0 ) { for( $i=0; $i<$n; $i+=1 ) { menuItem -label $all[$i] -c ( "propModNurbsCurveSet " + $all[$i] + "; "); } } else { menuItem -label (uiRes("m_propModProperties.kNoNURBSCurves")); } } global proc propModProperties() // // Description: // This procedure builds the property sheet and assigns callbacks to // its controls. The state of the controls are set in propModValues(). // // { // Defined as part of OptionsTemplate in setDefaultTemplates.mel. // global int $gOptionsTemplateControlAreaWidth; global int $gOptionsTemplateExtraWidth; string $parent = `toolPropertyWindow -q -location`; setUITemplate -pushTemplate OptionsTemplate; setParent $parent; columnLayout propMod; $parent = `setParent -query`; separator -style "none"; string $parametric = (uiRes("m_propModProperties.kParametric")); radioButtonGrp -nrb 2 -sl 1 -label (uiRes("m_propModProperties.kModificationType")) -label1 (uiRes("m_propModProperties.kWorld")) -label2 $parametric modSpace; string $power = (uiRes("m_propModProperties.kPower")); radioButtonGrp -nrb 2 -sl 1 -label (uiRes("m_propModProperties.kModificationFalloff")) -label1 (uiRes("m_propModProperties.kLinear")) -label2 $power modType; string $curve = (uiRes("m_propModProperties.kCurve")); radioButtonGrp -nrb 2 -label "" -label1 (uiRes("m_propModProperties.kScript")) -label2 $curve -scl modType modType2; radioButtonGrp -nrb 1 -label "" -label1 (uiRes("m_propModProperties.kNURBSCurveOption")) -scl modType modType3; tabLayout -tabsVisible false propModTypeTabs; // Power tab parametric. // // ** The tab with the largest number of controls needs to come first, to reserve enough vertical // space in the layout // columnLayout propModPowerParamTab; string $distanceCutoffU = (uiRes("m_propModProperties.kDistanceCutoffU")); string $distanceCutoffV = (uiRes("m_propModProperties.kDistanceCutoffV")); floatSliderGrp -field true -label $distanceCutoffU -fmn -100000.0 -fmx 100000.0 -min 0.01 -max 20.0 -v 0.5 -pre 2 powerCutoffU; floatSliderGrp -field true -label $distanceCutoffV -fmn -100000.0 -fmx 100000.0 -min 0.01 -max 20.0 -v 0.5 -pre 2 powerCutoffV; string $degree = (uiRes("m_propModProperties.kDegree")); floatSliderGrp -field true -label $degree -min -5.0 -max 5.0 -v -0.1 powerDegreeParam; setParent ..; // Power tab. // columnLayout propModPowerTab; string $distanceCutoff = (uiRes("m_propModProperties.kDistanceCutoff")); floatSliderGrp -field true -label $distanceCutoff -fmn -100000.0 -fmx 100000.0 -min 0.01 -max 20.0 -v -0.1 -pre 2 powerCutoff; floatSliderGrp -field true -label $degree -min -5.0 -max 5.0 -v -0.1 powerDegree; setParent ..; // Linear tab -- Parametric. // columnLayout propModLinearParamTab; floatSliderGrp -field true -label $distanceCutoffU -fmn 0.0 -fmx 100000.0 -min 0.0 -max 10.0 -s 0.05 -ss 0.05 -v 0.5 -pre 2 linearFieldU; floatSliderGrp -field true -label $distanceCutoffV -fmn 0.0 -fmx 100000.0 -min 0.0 -max 10.0 -s 0.05 -ss 0.05 -v 0.5 -pre 2 linearFieldV; setParent ..; // Linear tab. // columnLayout propModLinearTab; floatSliderGrp -field true -label $distanceCutoff -fmn -100000.0 -fmx 100000.0 -min 0.01 -max 20.0 -v -0.1 -pre 2 linearField; setParent ..; // Script tab - Parametric. // columnLayout propModScriptParamTab; string $userDefinedScript = (uiRes("m_propModProperties.kUserDefinedScript")); textFieldGrp -label $userDefinedScript scriptNameParam; setParent ..; // Script tab. // columnLayout propModScriptTab; textFieldGrp -label $userDefinedScript scriptName; setParent ..; // Anim curve tab - Parametric. // columnLayout propModAnimParamTab; rowLayout -numberOfColumns 3 -columnAttach 3 "left" 0 -columnWidth 2 $gOptionsTemplateControlAreaWidth -columnWidth 3 $gOptionsTemplateExtraWidth ; string $animCurve = (uiRes("m_propModProperties.kAnimCurve")); text -label $animCurve; textField animCurveNameParam; symbolButton -image "dropArrow.png" -height 22; popupMenu -button 1 -postMenuCommand "createAnimCurvesParamPopup" animCurveParamPopup; setParent ..; floatSliderGrp -field true -label (uiRes("m_propModProperties.kScaleU")) -min 0.0 -max 1.0 -v 1.0 -pre 2 animParamFieldU; floatSliderGrp -field true -label (uiRes("m_propModProperties.kScaleV")) -min 0.0 -max 1.0 -v 1.0 -pre 2 animParamFieldV; setParent ..; // Anim curve tab. // columnLayout propModAnimTab; rowLayout -numberOfColumns 3 -columnAttach 3 "left" 0 -columnWidth 2 $gOptionsTemplateControlAreaWidth -columnWidth 3 $gOptionsTemplateExtraWidth ; text -label $animCurve; textField animCurveName; symbolButton -image "dropArrow.png" -height 22; popupMenu -button 1 -postMenuCommand "createAnimCurvesPopup" animCurvePopup; setParent ..; setParent ..; // // NURBS curve tab -- parametric version. This is simply an empty placeholder to clear // the tab // columnLayout propModNurbsParamTab; setParent ..; // NURBS curve tab (there is no parametric version). // columnLayout propModNurbsTab; rowLayout -numberOfColumns 3 -columnAttach 3 "left" 0 -columnWidth 2 $gOptionsTemplateControlAreaWidth -columnWidth 3 $gOptionsTemplateExtraWidth ; text -label (uiRes("m_propModProperties.kNURBSCurve")) ; textField nurbsCurveName; symbolButton -image "dropArrow.png" -height 22; popupMenu -button 1 -postMenuCommand "createNurbsCurvesPopup" nurbsCurvePopup; setParent ..; setParent ..; setParent ..; tabLayout -tabsVisible false propModDirTabs; columnLayout propModDirVis; string $yAxis = (uiRes("m_propModProperties.kYaxis")); string $zAxis = (uiRes("m_propModProperties.kZaxis")); checkBoxGrp -ncb 3 -label (uiRes("m_propModProperties.kDistanceBasedOn")) -label1 (uiRes("m_propModProperties.kXaxis")) -label2 $yAxis -label3 $zAxis -v1 on -v2 on -v3 on modDir; setParent ..; columnLayout propModDirInvis; setParent ..; setParent ..; setParent ..; // propMod setUITemplate -popTemplate; propModSetCallbacks( $parent ); }