// =========================================================================== // 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: 26 June 1997 // // Description: // This procedure sets the selection mode. // // Input Arguments: // A name for the higer level selection mode. // A ui name for the mode. // // Return Value: // None. // // *********************************************************************** // // Warning: // Be sure that any changes made in this file are also reflected in // getSelectMode.mel // // *********************************************************************** proc string maskFieldText_melToUI(string $mel) { string $result = $mel; if($mel == "NURBS"){ $result = (uiRes("m_setSelectMode.kNURBS")); } else if($mel == "Hierarchy"){ $result = (uiRes("m_setSelectMode.kHierarchy")); } else if($mel == "Animation"){ $result = (uiRes("m_setSelectMode.kAnimation")); } else if($mel == "Deformations"){ $result = (uiRes("m_setSelectMode.kDeformations")); } else if($mel == "Deform"){ $result = (uiRes("m_setSelectMode.kDeform")); } else if($mel == "Dynamics"){ $result = (uiRes("m_setSelectMode.kDynamics")); } else if($mel == "Polygons"){ $result = (uiRes("m_setSelectMode.kPolygons")); } else if($mel == "Rendering"){ $result = (uiRes("m_setSelectMode.kRendering")); } else if($mel == "Objects"){ $result = (uiRes("m_setSelectMode.kObjects")); } else if($mel == "Components"){ $result = (uiRes("m_setSelectMode.kComponents")); } else if($mel == "All Objects"){ $result = (uiRes("m_setSelectMode.kAllObjects")); } else if($mel == "All Components"){ $result = (uiRes("m_setSelectMode.kAllComponents")); } else { uiToMelMsg( "maskFieldText_melToUI", $mel, 1 ); } return $result; } proc setOnlyMasks( string $masks[]) { int $i; string $cmd; for ($i = 0; $i < size($masks); $i++) { $cmd = "selectType -" + $masks[$i] + " true;"; eval($cmd); } } global proc setSelectMode( string $mode, string $uiString ) { // // Set the selection masks using a case statement // global string $gAnimationSelectionMasksOn[]; global string $gNURBSelectionMasksObjects[]; global string $gNURBSelectionMasksComponents[]; global string $gDeformersSelectionMasksObjects[]; global string $gDeformersSelectionMasksComponents[]; global string $gRenderingSelectionMasksObjects[]; global string $gRenderingSelectionMasksComponents[]; if (!`exists selectionMaskRestoreOnce`) source selectionMaskStackInit; // When switching from a standard selection mode to a non-standard // selection mode, we want to save the selection state (mode, prefs // and masks). When we return to a standard selection mode from // a non-standard selection mode, we want to restore the selection // state. switch( $mode ) { // standard selection modes case "hierarchy": selectionMaskRestoreOnce(); selectMode -hierarchical; break; case "root": selectionMaskRestoreOnce(); selectMode -root; break; case "leaf": selectionMaskRestoreOnce(); selectMode -leaf; break; case "template": selectionMaskRestoreOnce(); selectMode -template; break; case "objects": selectionMaskRestoreOnce(); selectMode -object; break; case "components": selectionMaskRestoreOnce(); selectMode -component; break; // custom selection modes case "animation": selectionMaskSaveOnce(); selectMode -object; selectPriority -allObjects 1; selectPref -ignoreSelectionPriority false; selectPriority -handle 5 -ikHandle 5 -joint 4; selectType -allObjects false -allComponents false; setOnlyMasks($gAnimationSelectionMasksOn); break; case "nurbsModeling": selectionMaskSaveOnce(); selectMode -preset; selectPref -ignoreSelectionPriority false; selectPref -allowHiliteSelection false; selectPriority -allComponents 1; selectPriority -isoparm 2; selectType -allObjects false -allComponents false; setOnlyMasks($gNURBSelectionMasksObjects); setOnlyMasks($gNURBSelectionMasksComponents); break; case "polyModeling": selectionMaskSaveOnce(); selectMode -component; selectType -allObjects false -allComponents false; selectPref -ignoreSelectionPriority true; selectPref -allowHiliteSelection true; selectType -polymesh true -subdiv true -plane true -facet true; break; case "deformations": selectionMaskSaveOnce(); selectMode -preset; selectPref -ignoreSelectionPriority false; selectPref -allowHiliteSelection false; selectPriority -allObjects 1 -allComponents 1; selectPriority -sculpt 5 -nonlinear 5 -lattice 5 -cluster 5 -locator 5; selectType -allObjects false -allComponents false; setOnlyMasks($gDeformersSelectionMasksObjects); setOnlyMasks($gDeformersSelectionMasksComponents); break; case "dynamics": selectionMaskSaveOnce(); selectMode -preset; selectType -allObjects false -allComponents false; selectType -particleShape true -emitter true -field true -fluid true -hairSystem true -follicle true -collisionModel true -spring true -rigidBody true -rigidConstraint true -particle true -springComponent true -nCloth true -nRigid true -dynamicConstraint true; selectPref -allowHiliteSelection true; break; case "rendering": selectionMaskSaveOnce(); selectMode -preset; selectType -allObjects false -allComponents false; setOnlyMasks($gRenderingSelectionMasksObjects); setOnlyMasks($gRenderingSelectionMasksComponents); selectPref -allowHiliteSelection false; break; case "vertices": selectionMaskSaveOnce(); selectMode -component; selectType -allObjects false -allComponents false; selectType -controlVertex true -subdivMeshPoint true -vertex true -latticePoint true -particle true; break; case "hulls": selectionMaskSaveOnce(); selectMode -component; selectType -allObjects false -allComponents false; selectType -hull true; break; case "lines": selectionMaskSaveOnce(); selectMode -component; selectType -allObjects false -allComponents false; selectType -isoparm true -polymeshEdge true -subdivMeshEdge true -surfaceEdge true -springComponent true; break; case "points": selectionMaskSaveOnce(); selectMode -component; selectType -allObjects false -allComponents false; selectType -editPoint true -curveParameterPoint false -surfaceParameterPoint false -polymeshUV true -subdivMeshUV true; break; case "surfacePoints": selectionMaskSaveOnce(); selectMode -component; selectType -allObjects false -allComponents false; selectType -editPoint false -curveParameterPoint true -surfaceParameterPoint true -polymeshUV true -subdivMeshUV true; break; case "allComponents": selectionMaskRestoreOnce(); selectionMaskSaveOnce(); selectMode -component; selectType -allObjects false -allComponents true; break; case "allObjects": selectionMaskRestoreOnce(); selectionMaskSaveOnce(); selectMode -object; selectType -allObjects true -allComponents false; selectPref -ignoreSelectionPriority true; break; default: selectionMaskRestoreOnce(); selectMode -object; selectType -allObjects true -allComponents false; selectPref -ignoreSelectionPriority false; break; } if ($uiString != "") { textField -e -text `maskFieldText_melToUI $uiString` maskField; } }