// =========================================================================== // 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 createImportedImagePlane (string $cameraList[], string $imageName, string $type) { // Check whether an image filename was provided if ( $imageName != "" ) { if (size($cameraList)) { // create imageplane shape. string $newImagePlane[] = createImagePlane($cameraList[0]); // set the image plane type to image file setAttr ($newImagePlane[1] + ".type") 0; // 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]; } } return 1; } // // Procedure Name: // importImagePlane // // Description: // Imports an image file as an image plane for one or more cameras // // Input Arguments: // None. // // Return Value: // None. // global proc importImagePlane( string $cameraList[] ) { if (size($cameraList)) { // Set the current working directory to the project's // sourceimage directory string $workspace = `workspace -q -fullName`; setWorkingDirectory $workspace "image" "sourceImages"; string $cameraListString = stringArrayToString($cameraList, "\",\""); $cameraListString = "{ \"" + $cameraListString + "\" }"; string $cmd = ("createImportedImagePlane " + $cameraListString); string $open = (uiRes("m_importImagePlane.kOpen")); fileBrowser ($cmd, $open, "image", 0); } }