文档库 最新最全的文档下载
当前位置:文档库 › MAYA自动保存

MAYA自动保存

MAYA自动保存
MAYA自动保存

MAYA自身并没有自动保存的选项, 它会在意外崩溃时尝试保存备份, 一般存在当前用户的TEMP目录里, 事实证明大多是完全可用的. 保存成功率很高.

其实MAYA的自动备份也是很好用的功能, 它会在保存文件的同时保存一个备份到文件所在的incrementalSave目录. 在文件出现打开错误时或误删时能够最大程度地挽回损失.

要使用MAYA的自动备份其实很简单, 只要开启file\save scene右边的方盒按钮, 就会见到有关的设置.

其中Incremental Save就是开关, Limited Incremental Save是限制备份个数的选项, 具体限制多少个可以在下面的滑条进行定义...

以下是程序代码:

///////////////////////////////////////////////////////////////////////

//程序名称:自动保存程序V1.0(timeSave V1.0)

//编写日期:2004.4.27

//作者:刘阔

//版权:刘阔

//声明:此程序免费自由使用,由该程序引起的数据故障或数据丢失// 版权持有者概不负责。

///////////////////////////////////////////////////////////////////////

proc int server(string $dName, string $sName)

{

return initDataServer($dName,$sName,"localhost", "", "",2);

}

proc attachDD( string $device, string $channel, float $scale,

string $target, string $attribute)

{

string $axisName;

$axisName = $channel;

string $atrName = $target+"."+$attribute;

attachDeviceAttr -d $device -ax $axisName $atrName;

setAttrMapping -a -d $device -ax $axisName -at $attribute -s $scale; }

proc attachHandNode(string $device, string $handt )

{

attachDD($device, "minutes", 1, $handt, "sTime");

}

global proc string getSystemTime()

{

string $dName="clock";

string $sName="mayaClockServer";

if ( 0 != server($dName, $sName) )

{

error("Couldn't launch " + $sName );

return "";

}

if(`objExists systemTime`==0)

string $handtt=`createNode unknown -n systemTime`;

addAttr -ln sTime -at double -dv 0 systemTime;

setAttr -e -keyable true systemTime.sTime;

addAttr -ln cTime -at long -dv 1 systemTime;

setAttr -e -keyable true systemTime.cTime;

attachHandNode($dName, $handtt);

}

else

{

error "自动保存程序正在进行";

}

return $sName;

}

global proc timeSaveProc(string $sw,int $minute)

{

float $attrValue=`getAttr systemTime.cTime`;

float $value=$attrValue+1;

setAttr systemTime.cTime $value;

float $ifValue=$attrValue % $minute;

if($ifValue==0)

{

if($sw=="save")

SaveScene;

if($sw=="saveAs")

SaveSceneAs;

}

}

global proc timeSaveProc1(string $sw,int $minute)

{

getSystemTime;

scriptJob -attributeChange systemTime.sTime ("timeSaveProc "+$sw+" "+$minute); }

///////////////////////////////////////////////////////////////////////

//程序名称:timeSave

//作用:是自动保存程序的界面程序也是主程序。

// 调入并执行:

// timeSaveStop;

// timeSaveStart;

///////////////////////////////////////////////////////////////////////

global proc timeSave()

if(`window -ex timeSaveWin`==1)deleteUI timeSaveWin;

window -t "自动保存程序V1.0" timeSaveWin;

formLayout timeSaveLayout ;

//--Create Controllers--//

text -label "分钟" "text73" ;

separator -width 200 "separator24" ;

separator -width 200 "separator25" ;

button -label "关于" -w 85 -h 22 -c "timeSaveVersionInfo;" "part6" ;

button -label "关闭窗口" -w 85 -h 22 -c "deleteUI timeSaveWin;" "part5" ;

button -label "停止自动保存" -h 28 -w 180 -bgc 0.73 0.86 0.61 -c "timeSaveStop;" "part4" ; button -label "执行自动保存" -w 180 -h 28 -bgc 0.89 0.74 0.66 -c "timeSaveStart;" "part3" ; optionMenu "part2" ;

menuItem -label "save";

menuItem -label "saveAs";

optionMenu -e -v "saveAs" "part2" ;

intField -maxValue 120 -minValue 1 -v 10 -w 45 -h 25 "part1" ;

//--Arrange Controllers--//

formLayout -e

-af "text73" "left" 52

-af "text73" "top" 9

-af "separator25" "left" -2

-af "separator25" "top" 102

-af "separator24" "left" -2

-af "separator24" "top" 33

-af "part6" "left" 98

-af "part6" "top" 110

-af "part5" "left" 4

-af "part5" "top" 110

-af "part4" "left" 4

-af "part4" "top" 71

-af "part3" "left" 4

-af "part3" "top" 41

-af "part2" "left" 102

-af "part2" "top" 4

-af "part1" "left" 4

-af "part1" "top" 4

timeSaveLayout ;

showWindow timeSaveWin;

}

global proc timeSaveStart()

{

int $getV=`intField -q -v part1`;

int $minute=$getV*60;

string $sw=`optionMenu -q -v part2`;

timeSaveProc1 $sw $minute;

print "成功开启自动保存功能";

}

global proc timeSaveStop()

{

if(`objExists systemTime`==1)

{

select -r systemTime;

delete;

print "成功停止自动保存功能";

}

}

global proc addTimeSaveToshelf()

{

global string $gShelfTopLevel;

string $path=`internalVar -ubd`;

string $theShelf = `tabLayout -q -selectTab $gShelfTopLevel`;

setParent $theShelf;

shelfButton

-image1 ($path+"timeSave.xpm")

-command "timeSave";

}

global proc timeSaveVersionInfo ()

{

if((`window -ex timeSaveVersionInfo`)==1) deleteUI timeSaveVersionInfo;

window -w 305 -h 275 -s 1 -t " ★关于自动保存程序★" timeSaveVersionInfo; columnLayout ;

picture -image (`internalVar -ubd`+"timeSaveVersion.bmp");

separator -w 305 -h 8 ;

text -l " TimeSave V1.0 27/04/2004";

text -l " Author:LiuKuo & Copyright LiuKuo ";

text -l " 自动保存程序版本2.0 27/04/2004";

text -l " 作者:刘阔& 版权:刘阔";

separator -w 305 -h 8 ;

rowColumnLayout -numberOfColumns 3 -columnWidth 1 100 -columnWidth 2 90 -columnWidth 3 100; button -w 40 -l "确定" -align "center" -c ("deleteUI timeSaveVersionInfo;");

text -l "";

button -w 80 -l "使用帮助" -align "center" ;

showWindow timeSaveVersionInfo;

}

相关文档