// =========================================================================== // 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. // =========================================================================== // // // // // containerRemoveBindingSet // // // None // // // This script removes a binding set from the template associated // with a container. // // // string $container, the container to use, or "" to use selected // string $bindingSet, the bindingSet to remove, or "" have default // bindingSet determined automatically // // // // Remove binding set "MyBindings". // containerRemoveBindingSet(myContainer, "MyBindings"); // // // Remove default binding set (since binding set is not // // specified, the default binding set will be used) // containerRemoveBindingSet(myContainer, "") // // // global proc containerRemoveBindingSet(string $container, string $bindingSetName) { // Use default binding set name if one is not passed in string $bsName = $bindingSetName; if (size($bsName) == 0) { $bsName = containerDefaultBindingSet(); } // Check that container has a template associated with it, the template // exists and it is loaded. string $templateName = `getAttr ($container + ".templateName")`; string $templatePath = `getAttr ($container + ".templatePath")`; if( $templateName == "" ) { string $fmt = (uiRes("m_containerRemoveBindingSet.kNoTemplateOnContainer")); string $msg = `format -stringArg $container $fmt`; error($msg); } if (! `containerTemplate -exists $templateName`) { containerTemplate -load -fn $templatePath $templateName; } // Check that the named binding set already exists on this template. string $bsList[] = `containerTemplate -q -bsl $templateName`; int $bsExists = stringArrayContains($bsName,$bsList); if (!$bsExists) { string $fmt = (uiRes("m_containerRemoveBindingSet.kNotFound")); string $msg = `format -stringArg $bsName -stringArg $container $fmt`; error ($msg); } // Remove the binding set and re-save the template containerTemplate -edit -removeBindingSet $bsName $templateName; containerTemplate -save $templateName; }