// =========================================================================== // 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. // =========================================================================== // // // // // // containerRmbMenu() // // // The containerRmbMenu script is an example of how to write a // rightMenuButton (RMB) callback for the container node. To create // your own customized RMB menu, write a similar script which returns a // string array defining the desired menu names and their callbacks. // // To try this script out, create a container node, and // enter a value of "containerRmbMenu" into the container node's // rmbCommand attribute (Rmb Command in the Attribute Editor). // // Then press the RMB over an object in your container in the viewport // or the outliner. You will see the extra container-related items // in the menu. Clicking on a menu item will invoke the callback // specified by the return. The callback will receive a string argument // indicating the object that was RMBed on. // // // // returns an array of strings of the form: // { "Menu Label Name 1", "callbackName1", // "Menu Label Name 2", "callbackName1", ... } // // // // request the RMB menu list for a container // string $items[] = `containerRmbMenu`; // // global proc containerSelectRootExample(string $object) { string $container = `container -q -findContainer $object`; if (size($container) > 0) { string $root = `container -q -publishAsRoot $container`; if (size($root) > 0) { select -r $root; } } } global proc containerSelectParentAnchorsExample(string $object) { string $container = `container -q -findContainer $object`; if (size($container) > 0) { string $parents[] = `container -q -publishAsParent $container`; if (size($parents) > 0) { select -d; for ($ii = 1; $ii < size($parents); $ii+=2) { select -add $parents[$ii]; } } } } global proc containerSelectChildAnchorsExample(string $object) { string $container = `container -q -findContainer $object`; if (size($container) > 0) { string $children[] = `container -q -publishAsChild $container`; if (size($children) > 0) { select -d; for ($ii = 1; $ii < size($children); $ii+=2) { select -add $children[$ii]; } } } } global proc string[] containerRmbMenu() { return {"Select Selection Transform", "containerSelectRootExample", "Select Parent Anchors", "containerSelectParentAnchorsExample", "Select Child Anchors", "containerSelectParentAnchorsExample"}; }