/****************************************************************************** NintendoWare for CTR Maya Plugin File: NW4C_CommonProc.mel Description: common procedure Date: 2009/09/02 Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. ******************************************************************************/ // NW4C_ShowHelp // NW4C_SetCurDirFromFile /****************************************************************************** show help ******************************************************************************/ global proc NW4C_ShowHelp(string $file, string $label) { string $rootPath = getenv("NW4C_ROOT"); if (size($rootPath) == 0) { error "NW4C_ROOT is not defined"; } if (size(match("/$", $rootPath)) == 0) { $rootPath += "/"; } string $helpPath = $rootPath + "documents/DccPlugin/Maya/" + $file; //if (!`filetest -f $helpPath`) //{ // error ("Help file is not found: " + $helpPath); //} if (size($label) != 0) { $helpPath += "#" + $label; } $helpPath = "file:///" + $helpPath; showHelp -a $helpPath; } /****************************************************************************** get unix file path convert "\" to "/" multi-byte is supported for 8.5- ******************************************************************************/ global proc string NW4C_GetUnixFilePath(string $path) { int $size = size($path); string $dst = ""; int $ic; for ($ic = 1; $ic <= $size; ++$ic) { $c = substring($path, $ic, $ic); if ($c == "\\") { $c = "/"; } $dst += $c; } return $dst; } /****************************************************************************** set current directory from file for fileBrowserDialog ******************************************************************************/ global proc NW4C_SetCurDirFromFile(string $path) { if (size($path) == 0) { return; } string $projPath = `workspace -q -rd`; string $dirPath = dirname($path); string $checks[] = { $path, $projPath + $path, $dirPath, $projPath + $dirPath }; for ($check in $checks) { if (`filetest -d $check`) { workspace -dir $check; return; } } }