// Copyright (C) 1997-2004 Alias Systems Corp.
// 
// The information in this file is provided for the exclusive use of the
// licensees of Alias.  Such users have the right to use, modify,
// and incorporate this code into other products for purposes authorized
// by the Alias license agreement, without fee.
// 
// ALIAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
// INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
// EVENT SHALL ALIAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
// CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.

//
//
//
// ALIAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
// EVENT SHALL ALIAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
//

source clipMenuCommands.mel;

//
//  Create context sensitive Hypergraph menu for clip nodes
//  This is displayed with RMB on clip nodes
//
proc createClipMenuItems( string $editor, string $menu )
{
	setParent -m $menu;
	
	menuItem ClipMenuTitleItem;
	menuItem -divider true;	
	menuItem -divider true;
	menuItem -l "Copy" -annotation "Copy Clip (to be pasted in TraX Window)" ClipCopyItem;
	menuItem -l "Instance" -annotation "Instance Clip at Current Time" ClipInstanceItem;
	menuItem -l "Duplicate"  -annotation "Duplicate Clip" ClipDuplicateItem;
	menuItem -l "Export"  -annotation "Export Clip" ClipExportItem;
	menuItem -divider true;
	menuItem -l "Apply Pose" -annotation "Move Character to Saved Pose or Clip Start" ClipApplyPoseItem;
	menuItem -divider true;
	menuItem -l "Attribute Editor..." ClipAttrEditorItem;
	menuItem -l "Rename" -annotation "Rename Clip" ClipRenameItem;
}



//
// Define context sensitive Hypergraph menu for clip nodes
//
proc defineClipMenuCommands(string $editor, string $menu, string $node)
{
	// The visor uses a hyper graph panel, so the only way to tell
	// that we are in the visor is by the name
	//
	int $isVisor = gmatch( $editor, "*VisorEd" );

	menuItem -edit
		-l ("Clip: " + $node)
		ClipMenuTitleItem;

	menuItem -edit
		-c ("clipCopyMenuCommand " + $node) ClipCopyItem;

	menuItem -edit
		-c ("clipInstanceMenuCommand " + $node) ClipInstanceItem;

	menuItem -edit
		-c ("clipDuplicateMenuCommand " + $node) ClipDuplicateItem;

	menuItem -edit
		-c ("doExportClipArgList 2 { \"\", \"" + $node + "\"}") ClipExportItem;

	menuItem -edit
		-c ("clipApplyPoseMenuCommand " + $node) ClipApplyPoseItem;

	menuItem -edit -c 
		("hyperGraph -e -rename -useFeedbackList " + $editor) 
		ClipRenameItem;
	menuItem -edit -c 
		("hyperGraph -e -attributeEditor single -useFeedbackList " + $editor)
		ClipAttrEditorItem;
}

global proc hypergraphAnimClipMenu(string $editor, string $menu, string $node)
{
	createClipMenuItems($editor, $menu);
	defineClipMenuCommands($editor, $menu, $node);
}
