// =========================================================================== // 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. // =========================================================================== // // Description: Display Modeling Toolkit Tool Settings window // // Input Arguments: // None. // // Return Value: // None. // proc addShortcuts( int $mode ) { string $lmb = getPluginResource("modelingToolkit", "kLMB"); string $mmb = getPluginResource("modelingToolkit", "kMMB"); string $rmb = getPluginResource("modelingToolkit", "kRMB"); string $shift = getPluginResource("modelingToolkit", "kShift"); string $ctrl = getPluginResource("modelingToolkit", "kCtrl"); string $tab = getPluginResource("modelingToolkit", "kTab"); frameLayout -l (getPluginResource("modelingToolkit", "kShortcuts")) -collapsable true -collapse 1; string $name = "right", $desc = "left"; if (1 == $mode) { rowColumnLayout -numberOfColumns 2 -cw 1 180 -cw 2 200 -columnSpacing 2 10; text -align $name -font boldLabelFont -label ($lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kMultiCutShortcut0")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($ctrl + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kMultiCutShortcut1")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($ctrl + " + " + $mmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kMultiCutShortcut2")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kMultiCutShortcut3")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($mmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kMultiCutShortcut4")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($mmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kMultiCutShortcut5")) -ww true; separator;separator; text -align $name -font boldLabelFont -label (getPluginResource("modelingToolkit", "kBackOrDelete") + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kMultiCutShortcut6")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($shift + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kMultiCutShortcut7")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($shift + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kMultiCutShortcut8")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($ctrl + " + " + $shift + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kMultiCutShortcut9")) -ww true; separator;separator; text -align $name -font boldLabelFont -label (getPluginResource("modelingToolkit", "kSnapToGrid") + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kMultiCutShortcutSnapToGrid")) -ww true; separator;separator; text -align $name -font boldLabelFont -label (getPluginResource("modelingToolkit", "kSnapToPoints") + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kMultiCutShortcutSnapToPoints")) -ww true; separator;separator; text -align $name -font boldLabelFont -label (getPluginResource("modelingToolkit", "kEnter") + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kMultiCutShortcut10")) -ww true; setParent ..; } else if (2 == $mode) { text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut0")) -ww true; separator; rowColumnLayout -numberOfColumns 2 -cw 1 180 -cw 2 200 -columnSpacing 2 10; text -align $name -font boldLabelFont -label ($lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut1")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($lmb + " / " + $mmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut2")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($ctrl + " + " + $shift + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut3")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($tab + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut4")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($tab + " + " + $mmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut5")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($shift + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut6")) -ww true; separator;separator; setParent ..; text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut8")) -ww true; separator; rowColumnLayout -numberOfColumns 2 -cw 1 180 -cw 2 200 -columnSpacing 2 10; text -align $name -font boldLabelFont -label ($lmb + " / " + $mmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut9")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($ctrl + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut10")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($ctrl + " + " + $mmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut11")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($shift + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut12")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($shift + " + " + $mmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut13")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($tab + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut14")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($tab + " + " + $mmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut15")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($ctrl + " + " + $shift + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut16")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($ctrl + " + " + $shift + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut17")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($ctrl + " + " + $shift + " + " + $mmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut18")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($ctrl + " + " + $shift + " + " + $rmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kQuadDrawShortcut19")) -ww true; separator;separator; setParent ..; } else if (3 == $mode) { rowColumnLayout -numberOfColumns 2 -cw 1 180 -cw 2 200 -columnSpacing 2 10; text -align $name -font boldLabelFont -label ($lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kConnectShortcut0")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($shift + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kConnectShortcut1")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($ctrl + " + " + $lmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kConnectShortcut2")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($mmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kConnectShortcut3")) -ww true; separator;separator; text -align $name -font boldLabelFont -label ($ctrl + " + " + $shift + " + " + $rmb + ":"); text -align $desc -label (getPluginResource("modelingToolkit", "kConnectShortcut4")) -ww true; setParent ..; } setParent ..; } global proc MTKTool_ColorChanged(string $tool, int $opt) { string $name = "modelingToolkit"; string $parent = (`toolPropertyWindow -q -location` + "|" + $name); setParent $parent; string $uiName = ""; string $optName = ""; if (0 == $opt) { $optName = "hiliteColorCutLine"; $uiName = ($tool + "_LineColor_CSG"); } else if (1 == $opt) { $optName = "hiliteColorCutEdge"; $uiName = ($tool + "_EdgeColor_CSG"); } else if (2 == $opt) { $optName = "hiliteColorCutVert"; $uiName = ($tool + "_VertexColor_CSG"); } else if (3 == $opt) { $optName = "hiliteColorCutFace"; $uiName = ($tool + "_FaceColor_CSG"); } else if (4 == $opt) { $optName = "appendMeshColor"; $uiName = ($tool + "_OverlayAppendColor_CSG"); } else if (5 == $opt) { $optName = "meshColorOverride"; $uiName = ($tool + "_MeshColorOverride_CSG"); } else { return; } float $newColor[] = `colorSliderGrp -q -rgb $uiName`; nexOpt -e $optName $newColor[0] $newColor[1] $newColor[2] 1; } proc addLiveConstraintOptions(string $tool) { string $colorCmd = ("MTKTool_ColorChanged " + $tool + " "); frameLayout -l (getPluginResource("modelingToolkit", "kLiveSurfaceOptions")) -collapsable true -collapse 1; columnLayout; rowColumnLayout -numberOfRows 1; checkBoxGrp -label (uiRes("m_modelingToolkitProperties.kOverlayAppendMesh")) -cc "dR_overlayAppendMeshTGL" ($tool + "_OverlayAppend_CBG"); colorSliderGrp -label "" -columnWidth 1 5 -columnWidth 2 75 -columnWidth 3 0 -cc ($colorCmd+"4") -dc ($colorCmd+"4") ($tool + "_OverlayAppendColor_CSG"); setParent ..; rowColumnLayout -numberOfRows 1; checkBoxGrp -label (uiRes("m_modelingToolkitProperties.kMeshColorOverride")) -cc "dR_meshColorOverrideTGL" ($tool + "_MeshColorOverride_CBG"); colorSliderGrp -label "" -columnWidth 1 5 -columnWidth 2 75 -columnWidth 3 0 -cc ($colorCmd+"5") -dc ($colorCmd+"5") ($tool + "_MeshColorOverride_CSG"); setParent ..; rowColumnLayout -numberOfRows 1; checkBoxGrp -label (uiRes("m_modelingToolkitProperties.kMeshAlpha")) -cc "dR_meshAlphaTGL" ($tool + "_MeshAlpha_CBG"); floatSliderGrp -label "" -columnWidth 1 5 -min 0.0 -max 1.0 -fieldMinValue 0 -fieldMaxValue 1.0 -field true -cc "nexOpt -e meshAlpha #1" -dc "nexOpt -e meshAlpha #1" ($tool + "_MeshAlpha_FSG"); setParent ..; rowColumnLayout -numberOfRows 1; checkBoxGrp -label (uiRes("m_modelingToolkitProperties.kMeshOffset")) -cc "dR_meshOffsetTGL" ($tool + "_MeshOffset_CBG"); floatSliderGrp -label "" -columnWidth 1 5 -min 0.0 -max 0.1 -step 0.01 -fieldMinValue -100 -fieldMaxValue 100 -field true -cc "nexOpt -e meshOffset #1" -dc "nexOpt -e meshOffset #1" ($tool + "_MeshOffset_FSG"); setParent ..; checkBoxGrp -label (uiRes("m_modelingToolkitProperties.kSnapToBackfaces")) -cc ("dR_snapToBackfacesTGL") ($tool + "_SnapToBackfaces_CBG"); setParent ..; setParent ..; } proc createMultiCutProperties() { columnLayout; intSliderGrp -min 1 -max 90 -fieldMinValue 1 -fieldMaxValue 90 -step 1 -field true -label ((uiRes("m_modelingToolkitProperties.kSnapStep"))) -cc "nexOpt -e cutSnapAngle #1" -dc "nexOpt -e cutSnapAngle #1" MultiCut_SnapStep_ISG; frameLayout -label (uiRes("m_modelingToolkitProperties.kCutToolsOptions")) -collapsable true; intSliderGrp -min 0 -max 180 -fieldMinValue 0 -fieldMaxValue 180 -step 1 -field true -label ((uiRes("m_modelingToolkitProperties.kSmoothAngle"))) -cc "nexOpt -e cutSmoothingAngle #1" -dc "nexOpt -e cutSmoothingAngle #1" MultiCut_SmoothAngle_ISG; checkBoxGrp -label (uiRes("m_modelingToolkitProperties.kEdgeFlow")) -cc ("nexOpt -e useEdgeFlow #1;") MultiCut_EdgeFlow_CBG; floatSliderGrp -cc ("nexOpt -e edgeFlowValue #1;") -dc ("nexOpt -e edgeFlowValue #1;") MultiCut_EdgeFlowTolerance_FSG; intSliderGrp -label (uiRes("m_modelingToolkitProperties.kSubdivisions")) -min 1 -max 10 -fieldMinValue 1 -fieldMaxValue 100000 -step 1 -cc ("nexOpt -e cutSubdivisions #1;") -dc ("nexOpt -e cutSubdivisions #1;") MultiCut_Subds_ISG; setParent ..; frameLayout -label (uiRes("m_modelingToolkitProperties.kSliceToolOptions")) -collapsable true; checkBoxGrp -label (uiRes("m_modelingToolkitProperties.kIgnoreBackfaces")) -cc ("dR_setSliceMode sliceIgnoreBackfaces #1;") MultiCut_IgnoreBackfaces_CBG; checkBoxGrp -label (uiRes("m_modelingToolkitProperties.kDeleteFaces")) -cc ("dR_setSliceMode useDeleteFaces #1;") MultiCut_DeleteFaces_CBG; checkBoxGrp -label (uiRes("m_modelingToolkitProperties.kExtractFaces")) -cc ("dR_setSliceMode useExtractFaces #1;") MultiCut_ExtractFaces_CBG; floatFieldGrp -label "" -numberOfFields 3 -cc "nexOpt -e extractFacesX #1; nexOpt -e extractFacesY #2; nexOpt -e extractFacesZ #3" MultiCut_ExtractFacesValues_FFG; rowLayout -numberOfColumns 4; text -align "right" -label (uiRes("m_modelingToolkitProperties.kSliceAlongLabel")); button -label (uiRes("m_modelingToolkitProperties.kYZ")) -c ("dr_polyCut(0);"); button -label (uiRes("m_modelingToolkitProperties.kZX")) -c ("dr_polyCut(1);"); button -label (uiRes("m_modelingToolkitProperties.kXY")) -c ("dr_polyCut(2);"); setParent ..; setParent ..; string $colorCmd = "MTKTool_ColorChanged MultiCut "; frameLayout -label (uiRes("m_modelingToolkitProperties.kColourOptions")) -collapsable true -collapse true; colorSliderGrp -label (uiRes("m_modelingToolkitProperties.kLineColor")) -rgb 0 0 1 -cc ($colorCmd+"0") -dc ($colorCmd+"0") MultiCut_LineColor_CSG; colorSliderGrp -label (uiRes("m_modelingToolkitProperties.kEdgeColor")) -rgb 0 0 1 -cc ($colorCmd+"1") -dc ($colorCmd+"1") MultiCut_EdgeColor_CSG; colorSliderGrp -label (uiRes("m_modelingToolkitProperties.kVertexColor")) -rgb 0 0 1 -cc ($colorCmd+"2") -dc ($colorCmd+"2") MultiCut_VertexColor_CSG; colorSliderGrp -label (uiRes("m_modelingToolkitProperties.kFaceColor")) -rgb 0 0 1 -cc ($colorCmd+"3") -dc ($colorCmd+"3") MultiCut_FaceColor_CSG; setParent ..; addLiveConstraintOptions("MultiCut"); addShortcuts(1); setParent ..; } proc createQuadDrawProperties() { columnLayout; rowColumnLayout -numberOfRows 1; checkBoxGrp -label (uiRes("m_modelingToolkitProperties.kAutoWeld")) -cc "dR_autoWeldTGL" QuadDraw_AutoWeld_CBG; intSliderGrp -label "" -columnWidth 1 5 -min 0 -max 40 -fieldMinValue 0 -fieldMaxValue 40 -step 1 -cc "nexOpt -e autoWeldTolerance #1" -dc "nexOpt -e autoWeldTolerance #1" QuadDraw_AutoWeldTolerance_ISG; setParent ..; rowLayout -numberOfColumns 3 -cw3 132 20 190; text -l (uiRes("m_modelingToolkitProperties.kRelax")) -align right; string $relaxButton = `iconTextButton -w 17 -h 26 -image ("popupMenuIcon.png")`; popupMenu -button 1 -p $relaxButton; menuItem -label (uiRes("m_modelingToolkitProperties.kAutoLockLbl")) -command ("nexOpt -e relaxAffects 3;"); menuItem -label (uiRes("m_modelingToolkitProperties.kInteriorVerticesLbl")) -command ("nexOpt -e relaxAffects 1;"); menuItem -label (uiRes("m_modelingToolkitProperties.kBorderVerticesLbl")) -command ("nexOpt -e relaxAffects 2;"); menuItem -label (uiRes("m_modelingToolkitProperties.kAllVerticesLbl")) -command ("nexOpt -e relaxAffects 0;"); setParent -menu ..; textField -ed false -width 190 -height 25 RelaxEditField; setParent ..; rowLayout -numberOfColumns 3 -cw3 132 20 190; text -l (uiRes("m_modelingToolkitProperties.kExtend")) -align right; string $extendButton = `iconTextButton -w 17 -h 26 -image ("popupMenuIcon.png")`; popupMenu -button 1 -p $extendButton; menuItem -label (uiRes("m_modelingToolkitProperties.kEdgeLbl")) -command ("nexOpt -e extendType 0;"); menuItem -label (uiRes("m_modelingToolkitProperties.kLoopLbl")) -command ("nexOpt -e extendType 1;"); menuItem -label (uiRes("m_modelingToolkitProperties.kBorderLbl")) -command ("nexOpt -e extendType 2;"); setParent -menu ..; textField -ed false -width 190 -height 25 ExtendEditField; setParent ..; intSliderGrp -label (uiRes("m_modelingToolkitProperties.kQuadStripWidthLabel")) -min 4 -max 200 -step 1 -cc "nexOpt -e quaDrawStripSize #1" QuadDraw_StripSize_ISG; rowLayout -numberOfColumns 1; button -label (uiRes("m_modelingToolkitProperties.kClearDotsLabel")) -c "dR_quadDrawClearDots" -width 100; setParent ..; addLiveConstraintOptions("QuadDraw"); addShortcuts(2); setParent ..; } proc createConnectProperties() { string $oldParent = `setParent -q`; string $col = `columnLayout`; int $fieldHeight = 20; string $rb = `formLayout`; string $c1 = `columnLayout -columnAlign "right" -width 75`; radioCollection; radioButton -label (uiRes("m_modelingToolkitProperties.kSlideLbl")) -height $fieldHeight -onCommand ("nexOpt -e connectCurLmbMap slide;") Connect_Slide_RB; radioButton -label (uiRes("m_modelingToolkitProperties.kSegmentsLbl")) -height $fieldHeight -onCommand ("nexOpt -e connectCurLmbMap segments;") Connect_Segments_RB; radioButton -label (uiRes("m_modelingToolkitProperties.kPinchLbl")) -height $fieldHeight -onCommand ("nexOpt -e connectCurLmbMap pinch;") Connect_Pinch_RB; setParent ..; string $c2 = `columnLayout`; floatField -height $fieldHeight -changeCommand ("nexCtx -e -manipVal connect slide #1") -step 0.01 -value 0.1 -minValue 0.01 -maxValue 0.99 Connect_Slide_FF; intField -height $fieldHeight -changeCommand ("nexCtx -e -manipVal connect segments #1") -value 1 -minValue 1 -maxValue 50 -step 2 Connect_Segments_IF; floatField -height $fieldHeight -changeCommand ("nexCtx -e -manipVal connect pinch #1") -step 0.01 -value 0.1 -minValue -0.99 -maxValue 10.0 Connect_Pinch_FF; setParent ..; setParent ..; formLayout -edit -attachForm $c1 left 75 -attachForm $c1 top 5 -attachNone $c1 right -attachNone $c1 bottom -attachControl $c2 left 5 $c1 -attachForm $c2 top 5 -attachNone $c2 right -attachNone $c2 bottom $rb; addShortcuts(3); if ("" != $oldParent) setParent $oldParent; } proc createEmptyMTKProperties() { columnLayout; button -label (uiRes("m_modelingToolkitProperties.kShowModelingToolkit")) -w 150 -command "showModelingToolkit"; setParent ..; } global proc modelingToolkitProperties() { // Global template variables for form spacing global int $gToolOptionBoxTemplateFrameSpacing; string $parent = `toolPropertyWindow -q -location`; setParent $parent; setUITemplate -pushTemplate ToolOptionBoxTemplate; string $form = `formLayout modelingToolkit`; string $tabs = `tabLayout -tabsVisible false MTKToolPropertiesTabs`; createMultiCutProperties(); createQuadDrawProperties(); createConnectProperties(); createEmptyMTKProperties(); columnLayout; setParent ..; columnLayout; setParent ..; formLayout -e -attachForm $tabs "top" 0 -attachForm $tabs "left" 0 -attachForm $tabs "bottom" 0 -attachForm $tabs "right" 0 $form; setUITemplate -popTemplate; }