// =========================================================================== // 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. // =========================================================================== // This method brings up the basic framework of // the tool property sheet. // // All the individual property sheets place themselves // within this framework. global proc toolPropertyWinSetCommon(string $toolName, string $icon) { string $printMsg = (uiRes("m_toolPropertyWindow1.kPrintMessage")); print ($printMsg); error (uiRes("m_toolPropertyWindow1.kObsoleteProcedure")); } // Set up the common properties needed for all tools // This is : name, icon, help doc // global proc toolPropertySetCommon(string $name, string $icon, string $help) { // If we are displaying the icon, set it for the tool // string $image = `toolPropertyWindow -query -icon`; if ($image != "") picture -edit -image $icon $image; string $nameField = `toolPropertyWindow -query -field`; string $reset = `toolPropertyWindow -query -resetButton`; string $helpButton = `toolPropertyWindow -query -helpButton`; if ($help != "") { string $cmd = "showHelp "+$help; button -edit -enable true -command $cmd $helpButton; } else { button -edit -enable false $helpButton; } string $toolCtxName; if ( `contextInfo -exists $name` ){ $toolCtxName = `contextInfo -t $name`; button -edit -enable true $reset; } else { $toolCtxName = (uiRes("m_toolPropertyWindow1.kChannelBoxManipulator")); button -edit -enable false $reset; } text -edit -label $toolCtxName $nameField; button -edit -command ("resetTool " + $name) $reset; } global proc toolPropertyShow() { if (`window -exists toolProperties`) { // // Bug fix #145854. Calling the "showWindow" command on NT // has the effect of giving that window focus. Consequently, // that takes keyboard focus away from the main Maya window // and hotkeys are no longer active. // if (!`window -query -visible toolProperties`) { showWindow toolProperties; } } } global proc toolPropertySelect(string $whichPropSheet) { string $parent = `toolPropertyWindow -query -location`; setParent $parent; tabLayout -edit -selectTab $whichPropSheet $parent; toolPropertyShow(); } proc createToolSettingsWindow() { global string $gToolSettingsSeparateWindowLocation; global string $gToolSettingsSeparateWindowIcon; global string $gToolSettingsSeparateWindowName; global string $gToolSettingsSeparateWindowResetButton; global string $gToolSettingsSeparateWindowHelpButton; string $window = `window -title (localizedUIComponentLabel("Tool Settings")) -iconName (uiRes("m_toolPropertyWindow1.kTools")) -width 428 -height 500 toolProperties`; string $form = `formLayout toolProperties_C`; string $imageAndNameForm = `formLayout`; string $image = `picture -image "vacantCell.png" toolSmallIcon`; string $name = `text -label "" -align "left"`; setParent ..; formLayout -edit -attachForm $image "top" 1 -attachForm $image "left" 2 -attachNone $image "bottom" -attachNone $image "right" -attachForm $name "top" 10 -attachControl $name "left" 5 $image -attachNone $name "bottom" -attachNone $name "right" $imageAndNameForm; // Add this in so we can load in help icons when required // columnLayout helpIconArea; setParent ..; string $targetName = `tabLayout -scrollable true -tabsVisible false -innerMarginWidth 5 -innerMarginHeight 5 context_T`; setParent ..; string $reset = `button -label (uiRes("m_toolPropertyWindow1.kResetTool"))`; string $help = `button -label (uiRes("m_toolPropertyWindow1.kToolHelp"))`; string $close = `button -label (uiRes("m_toolPropertyWindow1.kClose")) -command ("deleteUI toolProperties")`; formLayout -e -attachForm $imageAndNameForm "top" 0 -attachForm $imageAndNameForm "left" 0 -attachForm $imageAndNameForm "right" 0 -attachControl helpIconArea "top" 0 $imageAndNameForm -attachForm helpIconArea "left" 0 -attachForm helpIconArea "right" 0 -attachControl $targetName "top" 0 helpIconArea -attachForm $targetName "left" 0 -attachForm $targetName "right" 0 -attachControl $targetName "bottom" 2 $close -attachNone $reset "top" -attachForm $reset "left" 2 -attachForm $reset "bottom" 2 -attachPosition $reset "right" 1 33 -attachNone $help "top" -attachPosition $help "left" 1 33 -attachForm $help "bottom" 2 -attachPosition $help "right" 1 66 -attachPosition $close "left" 1 66 -attachForm $close "bottom" 2 -attachForm $close "right" 2 -attachNone $close "top" $form; setParent ..; $gToolSettingsSeparateWindowLocation = $targetName; $gToolSettingsSeparateWindowIcon = $image; $gToolSettingsSeparateWindowName = $name; $gToolSettingsSeparateWindowResetButton = $reset; $gToolSettingsSeparateWindowHelpButton = $help; redirectToolSettings("Separate Window"); } proc showToolProperties(string $location) // // Description: // Show the tool properties in the specified location. // // Arguments: // $location - Either "Main Window" or "Separate Window". // { // Determine if the Tool Settings are currently displayed in // a separate window. // int $windowFloating = false; string $tsDockWidget = getUIComponentDockControl("Tool Settings", false); if (size($tsDockWidget)) { $windowFloating = `workspaceControl -q -floating $tsDockWidget`; } if(!isUIComponentVisible("Tool Settings")) { // Show the Tool Settings component. // toggleUIComponentVisibility("Tool Settings"); } else { // If Tool Settings is already open, raise it so it is shown. // raiseToolSettings(); } if (size($tsDockWidget)) { if (`workspaceControl -query -collapse $tsDockWidget`){ workspaceControl -edit -collapse false $tsDockWidget; } if (("Separate Window" == $location && !$windowFloating) || ("Main Window" == $location && $windowFloating)){ workspaceControl -e -floating (!$windowFloating) $tsDockWidget; } } } global proc toolPropertyWindow1(string $location) { if ("" == $location) { // // Determine if the Tool Settings are currently displayed in // a separate window. // int $windowFloating = false; string $tsDockWidget = getUIComponentDockControl("Tool Settings", false); if (size($tsDockWidget)) { $windowFloating = `workspaceControl -q -floating $tsDockWidget`; } if ($windowFloating) { // // Window is up so use that location. // $location = "Separate Window"; } else { // // Component is up so use that location. // $location = "Main Window"; } } showToolProperties($location); }