// =========================================================================== // 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: // This script checks if the layer provided is already in the override mode specified // by the overrideMode variable. If not, and if the layer is not empty, it will prompt // the user about whether it's ok to change the mode of the layer. // // global proc int askUserIfLayerModeChangeIsOK(string $animLayer,int $overrideMode) { int $currOverrideMode = `animLayer -q -override $animLayer`; if($currOverrideMode != $overrideMode) { //see if the layer is empty. If it is, then we don't have to warn about //switching the mode. string $plugsOnLayer[] = `animLayer -q -at $animLayer`; if(size($plugsOnLayer) > 0) { string $title = (uiRes("m_askUserIfLayerModeChangeIsOK.kChangeLayerModeWarning")); string $changeToOverrideMsg = (uiRes("m_askUserIfLayerModeChangeIsOK.kChangeLayerModeOverrideMsg")); string $changeToAdditiveMsg = (uiRes("m_askUserIfLayerModeChangeIsOK.kChangeLayerModeAdditiveMsg")); string $strYes = (uiRes("m_askUserIfLayerModeChangeIsOK.kChangeLayerModeYes")); string $strNo = (uiRes("m_askUserIfLayerModeChangeIsOK.kChangeLayerModeNo")); //we have to warn the user. if($overrideMode) { if(`confirmDialog -title $title -message $changeToOverrideMsg -button $strYes -button $strNo -defaultButton $strYes -cancelButton $strNo -dismissString $strNo` != $strYes) return 0; } else { if(`confirmDialog -title $title -message $changeToAdditiveMsg -button $strYes -button $strNo -defaultButton $strYes -cancelButton $strNo -dismissString $strNo` != $strYes) return 0; } } } return 1; }