PythonSource Maya

Maya的Python竟然没有Mel中的source函数,就自己写了个。

PythonSource
global proc PythonSource(string $inputFileName) 
{
$fileId
=fopen($inputFileName,"r");
string $fileDetails = "";
string $nextLine = "";
do
{
$nextLine
= `fgetline $fileId`;
$fileDetails
+= $nextLine;
}
while ( size( $nextLine ) > 0 );
fclose $fileId;
python($fileDetails );
}

  

然后悲催的发现,python中已经有这样的函数了

execfile("D:\\UniqueTransform.py")

  

原文地址:https://www.cnblogs.com/sitt/p/2155167.html