// =========================================================================== // 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: Feb 15, 2002 // // Description: // This procedure runs the given quicktime movie from the Movies directory // global proc runMovie( string $fileName ) { string $suffixes[] = { ".mov", ".asx", ".mpg", ".mp4" }; // This only works on Windows operating systems. // if (!`about -ntOS`&& !`about -mac`) { warning (uiRes("m_runMovie.kPlatforms")); return; } string $searchPaths[]; int $foundMovie = false; int $launched = true; // Get the correct directory for the movies // string $helpRoot = getenv("MAYA_MOVIE_DIR"); int $len = `size($helpRoot)`; if (0 == $len) { // // Environment variable wasn't set, so try again // $helpRoot = getenv("MAYA_LOCATION"); if( `about -mac` ) { $helpRoot += "/../.."; } $helpRoot += "/movies/"; } else { // // Make sure the string ends in a slash // if (`substring $helpRoot $len $len` != "/") { $helpRoot += "/"; } } // Complete the path name // string $moviePath = $helpRoot + "quickStart"; // Find and launch the movie; // string $theMovie = findMovieWithSuffix( $moviePath, $fileName, $suffixes ); // The movie's been found. Will it launch? // if( size( $theMovie ) > 0 ) { $foundMovie = true; $cmd = ( "launch -movie \"" + $theMovie + "\"" ); // Successful launch returns the name of the launched // movie. If that name is empty, failure. // string $launchResult = evalEcho( $cmd ); if( size( $launchResult ) == 0 ) { $launched = false; } } else { // Add to list of searched paths. (Error information // for later.) // $searchPaths[ size($searchPaths) ] = $moviePath; } // Found the movie // if( $foundMovie ) { // But couldn't launch the player // if( !$launched ) { warning (uiRes("m_runMovie.kCannotLaunch")); error (uiRes("m_runMovie.kQuicktimeNotFound")); } } else { string $suffixList; for( $suffix in $suffixes ) { $suffixList += ( " " + $suffix ); } string $fmt = (uiRes("m_runMovie.kLookingForSuffixes")); print `format -s $fileName -s $suffixList $fmt`; $searchPaths = stringArrayRemoveDuplicates( $searchPaths ); for( $path in $searchPaths ) { print( "\t" + $path + "\n" ); } $fmt = (uiRes("m_runMovie.kCannotFindMovie")) ; error `format -s $fileName $fmt`; } } global proc string findMovieWithSuffix( string $moviePath, string $fileName, string $suffixes[] ) // // Description: // At this point, $moviePath contains the entire full // path name to the movie file, minus the filename extension. // For instance: // // $MAYA_LOCATION/extras/Movies/en_US/quickStart/MayaTransformMovie // // We try to append various standard movie suffixes and return // the full path name (including suffix) of the first one // we find. // { string $theMovie = ""; int $found = false; // First look for large, general version of the movie // file. // for( $suffix in $suffixes ) { if( $found ) { break; } string $tryThisOne = ( $moviePath + "/" + $fileName + $suffix ); if( `filetest -f $tryThisOne` != 0 ) { $theMovie = $tryThisOne; $found = true; break; } } return $theMovie; }