// =========================================================================== // 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. // =========================================================================== // // // // // // destroyLayout(layoutName) // // // Destroys the layout with the given name(s), from it's descendants up. // // // None. // // // // destroyLayout( "artAttr" ); // // // proc string doDestroyMenu( string $menu ) { string $cmd; string $kids[] = `menu -q -ia $menu`; int $numKids = size($kids); int $i = 0; while( $i < $numKids ){ string $menuItem = ($menu + "|" + $kids[$i]); if( `menuItem -q -subMenu $menuItem` ){ $cmd += doDestroyMenu( $menuItem ); } else { $cmd += ("deleteUI -menuItem \"" + $menuItem + "\";"); } $i++; } $cmd += ("deleteUI -menu \"" + $menu + "\";"); return $cmd; } proc string doDestroyControl(string $control) { string $cmd; string $kids[] = `control -q -pma $control`; int $numKids = size($kids); int $i = 0; while( $i < $numKids ){ $cmd += doDestroyMenu( ($control + "|" + $kids[$i]) ); $i++; } $cmd += ("deleteUI -control \"" + $control + "\";"); return $cmd; } proc string doDestroyLayout(string $layout) { string $cmd; if( `layout -exists $layout` ){ string $kids[] = `layout -q -ca $layout`; int $numKids = size($kids); int $i = 0; while( $i < $numKids ){ $cmd += doDestroyLayout( ($layout + "|" + $kids[$i]) ); $i++; } $cmd += ("deleteUI -layout \"" + $layout + "\";"); } else if( `control -exists $layout` ){ $cmd = doDestroyControl( $layout ); } return $cmd; } global proc destroyLayout(string $layoutName) { string $cmd = doDestroyLayout( $layoutName ); evalDeferred( $cmd ); }