// =========================================================================== // 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. // =========================================================================== // // Procedure Name: // createOneClickSelectionDialog // // Description: // Create dialog to confirm with the user, when there is no // current selection, whether they want to send the previous // selection to the receiving app, or the entire scene if there // is none. // // Input Arguments: // $hasPreviousSelection - Whether or not there is a previous selection to send - send entire scene if not // // Return Value: // None. // global proc createOneClickSelectionDialog(int $hasPreviousSelection) { // Get the dialog's formLayout. // string $form = `setParent -q`; formLayout -e -w 250 $form; string $selectionText = ""; if($hasPreviousSelection) { $selectionText = `text -l (uiRes("m_createOneClickSelectionDialog.kUsePreviousSelection"))`; } else { $selectionText = `text -l (uiRes("m_createOneClickSelectionDialog.kUseEntireScene"))`; } string $defaultSettingCheckBox = `checkBox -label (uiRes("m_createOneClickSelectionDialog.kDontAskAgain"))`; if($hasPreviousSelection) { checkBox -edit -changeCommand "global int $gOneClickDefaultSendPreviousSelection; $gOneClickDefaultSendPreviousSelection = #1;" $defaultSettingCheckBox; } else { checkBox -edit -changeCommand "global int $gOneClickDefaultSendEntireScene; $gOneClickDefaultSendEntireScene = #1;" $defaultSettingCheckBox; } string $yesButton = `button -l (uiRes("m_createOneClickSelectionDialog.kYes")) -c "layoutDialog -dismiss \"Yes\""`; string $noButton = `button -l (uiRes("m_createOneClickSelectionDialog.kNo")) -c "layoutDialog -dismiss \"No\""`; int $spacer = 10; int $top = 10; int $edge = 15; formLayout -edit -attachForm $selectionText "top" $top -attachForm $selectionText "left" $edge -attachNone $selectionText "bottom" -attachNone $selectionText "right" -attachControl $defaultSettingCheckBox "top" $spacer $selectionText -attachForm $defaultSettingCheckBox "left" $edge -attachNone $defaultSettingCheckBox "bottom" -attachNone $defaultSettingCheckBox "right" -attachControl $yesButton "top" $spacer $defaultSettingCheckBox -attachForm $yesButton "left" $edge -attachNone $yesButton "bottom" -attachPosition $yesButton "right" $spacer 50 -attachControl $noButton "top" $spacer $defaultSettingCheckBox -attachPosition $noButton "left" $spacer 50 -attachNone $noButton "bottom" -attachForm $noButton "right" $edge $form; }