Hi,Anybody can help me sove this script.i use for maya2010. when sounce the script give messg
// Error: Cannot cast data of type string to string[]. before i use maya2008 work alright on this scripts.
Below is the script download from.
/* This file downloaded from Highend3d.com
''
'' Highend3d.com File Information:
''
'' Script Name: mh_imagePlaneCamera v0.1
'' Author: Mike Harris
'' Last Updated: February 25, 2005
'' Update/Change this file at:
'' http://www.highend3d.com/maya/mel/?section=modeling#3279
''
'' History:
'' v on December 7, 2004 by Mike Harris
''
'' Please do not alter any information above this line
'' it is generated dynamically by Highend3d.com and will
'' be changed automatically on any updates.
*/
///////////////////////////////////////////////////////////////////////
// Created by: Mike Harris
// Date: 02/25/2005
// Tested for Maya v.5 & 6
//
// Update 0.1: Fixed incorrect camera setting.
//
// Description:
// This is a Image Plane Camera utility that generates an
// orthographic camera for your image planes and assigns
// it to a layer to easily control them in your scene.
//
// If you have any comments or suggestions
// you can contact me at: mikeh@dezfx.com
///////////////////////////////////////////////////////////////////////
// Create UI
string $imagePlaneCamWin = "imagePlaneCam";
if (window -ex $imagePlaneCamWin
)
deleteUI $imagePlaneCamWin;
window -s false -wh 175 120 -title "Image Plane Camera" $imagePlaneCamWin;
columnLayout -cal "center" -adj 1;
separator -height 2 -style "none";
text -l "Camera View:";
separator -height 2 -style "none";
rowColumnLayout -nc 2 -cw 1 90 -cw 2 90 -co 1 "left" 30;
radioCollection camType;
radioButton -sl -l "Top" top;
radioButton -l "Bottom" bottom;
radioButton -l "Front" front;
radioButton -l "Back" back;
radioButton -l "Right" right;
radioButton -l "Left" left;
setParent ..;
separator -height 2 -style "none";
rowLayout -nc 2 -cw2 83 83 -cl2 "center" "center";
button -l "Import Image" -w 83 -c "gmh_imagePlaneCamera(radioCollection -q -sl camType
); deleteUI imagePlaneCam";
button -l "Cancel" -w 83 -c "deleteUI imagePlaneCam";
showWindow $imagePlaneCamWin;
// Set the position of the image plane camera based on the UI
proc mh_positonImageCam(string $camType, string $imageCamName)
{
// Set-up camera positions
switch ($camType)
{
case "top":
int $tx = 0;
int $ty = 100;
int $tz = 0;
int $rx = -90;
int $ry = 0;
int $rz = 0;
break;
case "front":
int $tx = 0;
int $ty = 0;
int $tz = 100;
int $rx = 0;
int $ry = 0;
int $rz = 0;
break;
case "right":
int $tx = 100;
int $ty = 0;
int $tz = 0;
int $rx = 0;
int $ry = 90;
int $rz = 0;
break;
case "bottom":
int $tx = 0;
int $ty = -100;
int $tz = 0;
int $rx = -90;
int $ry = 0;
int $rz = 180;
break;
case "back":
int $tx = 0;
int $ty = 0;
int $tz = -100;
int $rx = 0;
int $ry = 180;
int $rz = 0;
break;
case "left":
int $tx = -100;
int $ty = 0;
int $tz = 0;
int $rx = 0;
int $ry = -90;
int $rz = 0;
break;
}
xform -a -ws -t $tx $ty $tz -ro $rx $ry $rz $imageCamName;
}
// Build the image planes
proc mh_buildImagePlane(string $camType, string $currentPanel, string $imageCamName, string $layerName)
{
lookThroughModelPanel $imageCamName $currentPanel;
layerEditorAddObjects $layerName;
buildImagePlaneMenu ($currentPanel + "imagePlaneSubMenu") $currentPanel;
importImagePlane $currentPanel;
string $imagePlane[] = ls -sl
;
setAttr ($imagePlane[0] + ".displayMode") 2;
setAttr ($imagePlane[0] + ".lockedToCamera") 0;
setAttr ($imagePlane[0] + ".width") 30;
setAttr ($imagePlane[0] + ".height") 30;
// Set-up image offsets so they are behind their opposing cameras
switch ($camType)
{
case "top":
setAttr ($imagePlane[0] + ".centerY") -101;
break;
case "front":
setAttr ($imagePlane[0] + ".centerZ") -101;
break;
case "right":
setAttr ($imagePlane[0] + ".centerX") -101;
break;
case "bottom":
setAttr ($imagePlane[0] + ".centerY") 101;
break;
case "back":
setAttr ($imagePlane[0] + ".centerZ") 101;
break;
case "left":
setAttr ($imagePlane[0] + ".centerX") 101;
break;
}
}
// Main proceedure
global proc gmh_imagePlaneCamera(string $camType)
{
string $currentPanel = getPanel -underPointer
;
if ($currentPanel == "")
{
$currentPanel = getPanel -withFocus
;
}
if(getPanel -to $currentPanel
== "modelPanel")
{
string $camName = modelPanel -q -cam $currentPanel
;
// Create display layers so the user has access to hide/toggle the image planes
string $layerName = createDisplayLayer -name ($camType + "\_ImgLyr1") -number 1 -empty
;
setAttr ($layerName + ".displayType") 2;
// Extract camera names and numbers from the display layer
string $camera[];
tokenize $layerName "_" $camera; // $camera[0] will be the camera name
string $camNum[];
tokenize $camera[1] "r" $camNum; // $camNum[1] will be the camera number
string $imageCamName[] = camera -n ($camera[0] + "\_ImgCam" + $camNum[1])
;
string $imageCamShape[] = listRelatives -s $imageCamName[0]
;
setAttr ($imageCamShape[0] + ".orthographic") 1;
setAttr ($imageCamShape[0] + ".orthographicWidth") 30;
mh_positonImageCam($camType, $imageCamName[0]); // Call to proceedure
mh_buildImagePlane($camType, $currentPanel, $imageCamName[0], $layerName); // Call to proceedure
lookThroughModelPanel $camName $currentPanel;
}
else
{
error "I'm sorry, but that is not a valid camera panel.";
}
select -cl;
}
Thank who help me!!!