// =========================================================================== // 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. // =========================================================================== // // Procedure Name: // createImportedImagePlane // // Description: // Creates an image plane with the file name provided and // connects the node to one or more camera shapes // // Input Arguments: // imageName : image file name from the browser // type : file type // // Return Value: // Returns 1 so that the file browser will close. // global proc int createImportedMovieImagePlane (string $cameraList[], string $imageName, string $type) { // Check whether an image filename was provided if ( $imageName != "" ) { if (size($cameraList)) { // query orthographic flag int $isOrtho = `camera -q -o $cameraList[0]`; // create imageplane shape. string $newImagePlane[] = createImagePlane($cameraList[0]); // set the image plane type to movie file setAttr ($newImagePlane[1] + ".type") 2; // NOTE: if you changing the way that the attributes // for a movie get setup then a similar change // needs to be made in the AEassignImageCB script // connect to the time line setAttr ($newImagePlane[1] + ".useFrameExtension") 1; // assign the imageName to the imagePlane setAttr ($newImagePlane[1] + ".imageName") -type "string" $imageName; int $pixmapSize[] = `imagePlane -q -iz $newImagePlane[1]`; float $width = (float)$pixmapSize[0] / 100; imagePlane -e -w $width $newImagePlane[1]; // set up expression $nodeAttr = $newImagePlane[1] + ".frameExtension"; // shouldn't happen as it is a new image plane, but make sure that // there isn't something attached to it already // if ( `connectionInfo -isDestination $nodeAttr` == false ) { expression -s ($nodeAttr + "=frame" ) ; } // // Sync maya time with the Movie Image Plane time. // Without those lines, the movie time is always 1 frame behind // maya time. (SEE MAYA-75400) // int $animationStartTime = `playbackOptions -q -animationStartTime`; int $frameOffset = (1-$animationStartTime); int $minAnimationStartTime = min(0, $animationStartTime); setAttr ($newImagePlane[1] + ".frameIn") $minAnimationStartTime; setAttr ($newImagePlane[1] + ".frameOffset") $frameOffset; } } return 1; } // Procedure Name: // importImagePlane // // Description: // Imports an movie file as an image plane for one or more cameras // global proc importMovieImagePlane( string $cameraList[] ) { if (size($cameraList)) { // Set the current working directory to the project's // sourceimage directory string $workspace = `workspace -q -fullName`; setWorkingDirectory $workspace "image" "movie"; string $cameraListString = stringArrayToString($cameraList, "\",\""); $cameraListString = "{ \"" + $cameraListString + "\" }"; string $cmd = ("createImportedMovieImagePlane " + $cameraListString); string $open = (uiRes("m_importMovieImagePlane.kOpen")); fileBrowser ($cmd, $open, "movie", 0); } }