// =========================================================================== // 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. // =========================================================================== // // // Creation Date: February 13, 2004 // // Description: // This a helper script which will add the currently selected // objects to the mainListConnection of an editor. // // Input Arguments: // The name of the editor to modify // // string $options Options for this menu // Option words are specified within the // the string, with each option seperated // by a space (e.g. "noScroll otherOption") // // Current options: // noOptions A nice "do nothing" string to pass // useCharacters Add support for characters // // Return Value: // None. // global proc addSelectedToEditorWithOptions (string $options, string $editor) { // Make sure the editor exists // if (!`editor -exists $editor`) { string $errMsg = (uiRes("m_addSelectedToEditorWithOptions.kEditorNotFound")); error (`format -s $editor $errMsg`); } // First, find out what is connected to this editor // string $mainListConnection = `editor -query -mainListConnection $editor`; // If it is the active list, then there is nothing to be done // string $defaultConnection = getDefaultConnection ($editor); if ( ($mainListConnection == "activeList") || ($mainListConnection == "animationList") || ($mainListConnection == $defaultConnection) || ($mainListConnection == "") ) return; // If this is a modelEditor, then we can add the members directly // if (`modelEditor -exists $editor`) { modelEditor -edit -addSelected $editor; return; } // Create a locked copy of the current activeList // string $activeList = ""; string $activeCacheList = ""; if (match ("useCharacters", $options) == "useCharacters") { $activeList = `selectionConnection -lock true -activeCharacterList -parent $editor`; $activeCacheList = `selectionConnection -lock true -activeCacheList -parent $editor`; } else { $activeList = `selectionConnection -lock true -activeList -parent $editor`; } // If this is a list connection store the name of the connection. Otherwise create a // new list connection to hold the original connection + the active list. // int $isList = (`selectionConnection -query -identify $mainListConnection` == "listList")? true : false; string $connection = ( ($isList) ? $mainListConnection : `selectionConnection -connectionList -add $mainListConnection -parent $editor` ); // Add the entries to the list selectionConnection -edit -add $activeList $connection; if(size($activeCacheList)) selectionConnection -edit -add $activeCacheList $connection; // Add the new list if ($isList == false) editor -edit -mainListConnection $connection $editor; }