chain_maker.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:ChainMaker 作者: XJZeng 项目源码 文件源码
def __init__(self, curve_sel, vertex_list, chain_geo):
        self.curve_sel = curve_sel
        self.verts = vertex_list
        self.chain_geo = chain_geo
        self.find_length = Find_Out()

        self.link_length = self.find_length.edge_length(self.verts)
        self.chain_length = self.find_length.curve_length(self.curve_sel)
        self.link_total = int(self.chain_length/self.link_length)
        self.motion_path_name = str(self.chain_geo) + '_Path'

        cmds.pathAnimation(self.chain_geo, name = self.motion_path_name, fractionMode = True, follow= True, followAxis = 'x', 
                upAxis = 'y', worldUpType = 'object', startTimeU = 1, endTimeU = self.link_total, c = self.curve_sel)

        cmds.setKeyframe(self.motion_path_name + '.frontTwist', v = 0.0, t = 1 )
        cmds.setKeyframe(self.motion_path_name + '.frontTwist', v = 60.0*self.link_total, t = self.link_total )

        cmds.keyTangent(self.motion_path_name + '.uValue', itt = 'linear', ott = 'linear' )
        cmds.keyTangent(self.motion_path_name + '.frontTwist', itt = 'linear', ott = 'linear')

        cmds.snapshot( self.chain_geo, constructionHistory=True, startTime=1, endTime = self.link_total, increment=1, update = 'animCurve', 
                name = str(self.chain_geo) + '_snapShot' )

        self.chain_group = cmds.group( em=True, name=str(self.chain_geo) + '_geo_grp' )

        self.chain_list = cmds.listRelatives(str(self.chain_geo + '_snapShotGroup'))

        for dummy_geo in self.chain_list:
            cmds.delete(icn = True, ch = True)
            cmds.parent(dummy_geo, self.chain_group)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号