// =========================================================================== // 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: December 11/2000 // // Description: // // This file contains the procedure which builds a popup menu for a file // the user has RMB clicked on in a hypergraph/visor. // global proc buildHypergraphFilePopupMenuItems( string $editor, string $menu, string $filePath) { setParent -menu $menu; string $fileNameArray[]; tokenize($filePath, "/", $fileNameArray); string $fileNameTail = $fileNameArray[size($fileNameArray) - 1]; string $fileTypesArray[] = `file -query -type $filePath`; string $fileType = $fileTypesArray[0]; string $menuName; string $menuAnnot; if ($fileType == "mayaBinary" || $fileType == "mayaAscii" || $fileType == "mayaPLE") { // The file under the cursor is a maya binary or ascii file. // $menuName = (uiRes("m_buildHypergraphFilePopupMenuItems.kImportMayaFile")); menuItem -label `format -s $fileNameTail $menuName` -command ("performFileImportAction( \"" + $filePath + "\")"); } else if ($fileType == "FBX") { // The file under the cursor is a FBX file. // $menuName = (uiRes("m_buildHypergraphFilePopupMenuItems.kImportFBXFile")); menuItem -label `format -s $fileNameTail $menuName` -command ("performFileImportAction( \"" + $filePath + "\")"); } else if ($fileType == "image") { int $withPlacement; $withPlacement = (`optionVar -query createTexturesWithPlacement`); $menuName = (uiRes("m_buildHypergraphFilePopupMenuItems.kImportAsNormal")); $menuAnnot = (uiRes("m_buildHypergraphFilePopupMenuItems.kImportAsNormalAnnot")); menuItem -label `format -s $fileNameTail $menuName` -annotation `format -s $fileNameTail $menuAnnot` -command ("importImageFile \"" + $filePath + "\" " + "false " // asProjection + "false " // asStencil + $withPlacement ); $menuName = (uiRes("m_buildHypergraphFilePopupMenuItems.kImportAsProjection")); $menuAnnot = (uiRes("m_buildHypergraphFilePopupMenuItems.kImportAsProjectionAnnot")); menuItem -label `format -s $fileNameTail $menuName` -annotation `format -s $fileNameTail $menuAnnot` -command ("importImageFile \"" + $filePath + "\" " + "true " // asProjection + "false " // asStencil + $withPlacement ); $menuName = (uiRes("m_buildHypergraphFilePopupMenuItems.kImportAsStencil")); $menuAnnot = (uiRes("m_buildHypergraphFilePopupMenuItems.kImportAsStencilAnnot")); menuItem -label `format -s $fileNameTail $menuName` -annotation `format -s $fileNameTail $menuAnnot` -command ("importImageFile \"" + $filePath + "\" " + "false " // asProjection + "true " // asStencil + $withPlacement ); menuItem -divider true; menuItem -label (uiRes("m_buildHypergraphFilePopupMenuItems.kIncludePlacement")) -checkBox $withPlacement -annotation (uiRes("m_buildHypergraphFilePopupMenuItems.kIncludePlacementAnnot")) -command ("optionVar -intValue createTexturesWithPlacement " + (!$withPlacement) + "; refreshCreateNodeUI();"); menuItem -divider true; menuItem -label (uiRes("m_buildHypergraphFilePopupMenuItems.kRefreshSwatch")) -annotation (uiRes("m_buildHypergraphFilePopupMenuItems.kRefreshSwatchAnnot")) -command ("visor -refreshSwatch \"" + $filePath + "\" " + $editor); } else if ($fileType == "mel") { // The file under the cursor is a mel file. // $menuName = (uiRes("m_buildHypergraphFilePopupMenuItems.kSource")); menuItem -label `format -s $fileNameTail $menuName` -command ("source \"" + $filePath + "\""); } else { // There is no file under the cursor, or there is a file under the // cursor but we do not recognize its type. // menuItem -label (uiRes("m_buildHypergraphFilePopupMenuItems.kNoOptions")) -enable false; } }