MAYA中 快速Bake物体关键帧
转载请备注信息:转自WOOVR博客在项目制作过程中,我们时常需要烘培一些物体的动画信息,使用MAYA自带的BS(BakeSimulation),总需要跑一遍时间轴如果遇到的场景、动画简单还好,但若是场景过大,绑定较卡,这样BAKE会非常耗时,于是利用MAYA自带的BAKE命令写了个小工具,后台执行,无需逐帧跑时间轴。#!/usr/bin/python# -*- coding: utf-...
·
转载请备注信息:转自WOOVR博客
在项目制作过程中,我们时常需要烘培一些物体的动画信息,使用MAYA自带的BS(BakeSimulation),总需要跑一遍时间轴
如果遇到的场景、动画简单还好,但若是场景过大,绑定较卡,这样BAKE会非常耗时,于是利用MAYA自带的BAKE命令写了个小工具,后台执行,无需逐帧跑时间轴。
#!/usr/bin/python
# -*- coding: utf-8 -*-
#developed by WOOVR 20190528, Free to use and modify
from maya.cmds import *
import os
import sys
# GUI
def quickBakeUI():
win = 'quickBake_win'
if window( win, exists = True ):
deleteUI( win )
window(win, title =u"快速BAKE物体", sizeable = False)
columnLayout( adj = True, columnAttach = ['both', 1] )
separator( style = 'in' )
checkBox( win + '__fromCurFrame_ChB', align = 'left', label = 'Start from Current Frame', value = 0 )
radioButtonGrp( win + '__range_RBG',
labelArray2 = ['Playback Range', 'Custom Range'],
numberOfRadioButtons = 2,
select = 1,
onCommand1 = 'intFieldGrp( "' + win + '__range_IFG", edit = True, enable1 = False, enable2 = False )',
onCommand2 = 'intFieldGrp( "' + win + '__range_IFG", edit = True, enable1 = True, enable2 = True )' )
intFieldGrp( win + '__range_IFG', label = '', numberOfFields = 2, columnWidth = (1, 24), value1 = playbackOptions( q = True, min = True ), value2 = playbackOptions( q = True, max = True ), enable1 = False, enable2 = False )
sep2 = separator( style = 'in' )
rowLayout( numberOfColumns = 2, columnWidth2 = [ 172, 40 ], columnAlign2 = [ 'center', 'center' ] )
button( label = 'Bake',
width = 220,
command = 'quickBake_cmd()' )
setParent( '..' )
# PROGRESS BAR
#progressBar( 'ark_instToGeo_progBar1', width = 220, height = 15, isInterruptable = True )
#progressBar( 'ark_instToGeo_progBar2', width = 220, height = 15, isInterruptable = True )
showWindow( win )
window( win, edit = True, width = 228, height = 143 )
def quickBake_cmd():
win = 'quickBake_win'
Bake_Grp=ls( selection=True )
start=intFieldGrp( win + '__range_IFG', q = True, value1 = True )
end=intFieldGrp( win + '__range_IFG', q = True, value2 = True )
fromCurFrame = checkBox( win + '__fromCurFrame_ChB', q = True, value = True )
currentFrame = currentTime( q = True )
rangeSpecified = radioButtonGrp( win + '__range_RBG', q = True, select = True )-1
print rangeSpecified
print start
print end
Timeline_startFrame= playbackOptions( q = True, min = True )
Timeline_endFrame=playbackOptions( q = True, max = True )
print Timeline_endFrame
if not Bake_Grp:
error( u'请选择要BAKE的物体' )
elif fromCurFrame > 0 and rangeSpecified==0:
print u'从当前帧开始BAKE'
bakeResults(Bake_Grp,t=(currentFrame,Timeline_endFrame),sb=1)
elif rangeSpecified==0:
bakeResults(Bake_Grp,t=(Timeline_startFrame,Timeline_endFrame),sb=1)
elif rangeSpecified>0:
start=intFieldGrp( win + '__range_IFG', q = True, value1 = True )
end=intFieldGrp( win + '__range_IFG', q = True, value2 = True )
bakeResults(Bake_Grp,t=(start,end),sb=1)
else:
print u'从设置的帧开始BAKE'
start=intFieldGrp( win + '__range_IFG', q = True, value1 = True )
end=intFieldGrp( win + '__range_IFG', q = True, value2 = True )
bakeResults(Bake_Grp,t=(start,end),sb=1)
def main():
quickBakeUI()
if __name__ == '__main__':
main()
更多推荐
已为社区贡献1条内容
所有评论(0)