Script_Maya.py 文件源码

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

项目:3D_Software_and_Python 作者: p4vv37 项目源码 文件源码
def create_and_animate_trees():
    """
    Function uses the create_palm() support function to create and animate some palm trees.
    It was created to show how to create basic geometry objects, use instances and use modificators.
    """

    palm1 = create_palm(diameter=1.3, segs_num=20, leafs_num=9, bending=34, id_num=1, anim_start=11, anim_end=26)
    palm2 = create_palm(diameter=1.6, segs_num=20, leafs_num=9, bending=34, id_num=2, anim_start=40, anim_end=45)
    palm3 = create_palm(diameter=1.1, segs_num=18, leafs_num=9, bending=24, id_num=3, anim_start=20, anim_end=35)
    palm4 = create_palm(diameter=1.1, segs_num=24, leafs_num=9, bending=24, id_num=4, anim_start=25, anim_end=40)

    cmds.currentTime(55) # The removal of history had strange effect when it was applied before tree animation
    # Next line is intended to avoid a bug. If the history has to be deleted with a cmds.delete function. If it
    # would not be modified then the bend modifictor would have to be moved wit an object or it would affect an object
    # in different ways then desired during a changes in its position. The problem is, that during that an evaluation
    # of commands may take some time and the removing of history resulted in not deformed mesh or a partialy
    # deformed mesh. This is why cmds.refresh() ommand was used.
    cmds.refresh(f=True)

    cmds.delete(palm1, ch=True)
    cmds.rotate(0.197, 105, 0.558, palm1, absolute=True)  # Rotate the palm
    cmds.move(-8.5, -4.538, 18.1, palm1, absolute=True)  # Position the palm
    cmds.parent(palm1, 'land', relative=True) # Rename it

    cmds.delete(palm2, ch=True)
    cmds.rotate(-16.935, 74.246, -23.907, palm2)
    cmds.move(29.393, -3.990, 4.526, palm2)
    cmds.parent(palm2, 'land', relative=True)

    cmds.delete(palm3, ch=True)
    cmds.move(24.498, -3.322, 36.057, palm3)
    cmds.rotate(0.023, 0.248, -1.950, palm3)
    cmds.parent(palm3, 'land', relative=True)

    cmds.delete(palm4, ch=True)
    cmds.move(4.353, -1.083, 22.68, palm4)
    cmds.rotate(-150, -102.569, 872.616, palm4)
    cmds.parent(palm4, 'land', relative=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号