Script_Maya.py 文件源码

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

项目:3D_Software_and_Python 作者: p4vv37 项目源码 文件源码
def change_hierarchy_and_animate():
    """
    Function modifies the hierarchy of scene and creates some final animations, that ware not possible to create earlier.
    It also creates cameras and lights.
    """
    cmds.lookThru( 'perspView', 'RenderCamera1') # Change the perspective viewport to the render camera.

    top_locator = cmds.spaceLocator() # Parent for all the elemements that will rotate together
    objects_list = ['land', 'water', 'cloud', 'shark', ]

    for obj in objects_list:
        cmds.parent(obj, top_locator)

    cmds.setKeyframe(top_locator, attribute='rotateY', v=20, time=260, itt="plateau", ott="plateau")
    cmds.setKeyframe(top_locator, attribute='rotateY', v=0, time=0, itt="linear", ott="linear")

    dome_light = cmds.polySphere(r=500) # This sphere is a substitute of a skylight in 3Ds Max
    cmds.polyNormal(dome_light, normalMode=0) # The normals have to point to inside

    cmds.setAttr(dome_light[0]+".miDeriveFromMaya", 0) # Enable changes in object render settings
    cmds.setAttr(dome_light[0]+".miVisible", 0) # This object will be invisible to camera
    cmds.setAttr(dome_light[0]+".miShadow", 0) # And will not affect shadows
    cmds.rename(dome_light[0], "dome_light")

    area_light = cmds.shadingNode('areaLight', asLight=True)
    cmds.scale(25, 25, 25, area_light, absolute=True)
    cmds.move(-230.59, 178.425, 99.192, area_light)
    cmds.rotate(0, -68.929, -37.987, area_light)

    cmds.setAttr(area_light+".intensity", 120000.0)
    cmds.setAttr(area_light+".areaLight", 1)
    cmds.setAttr(area_light+".areaType", 1)
    cmds.setAttr(area_light+".decayRate", 2)
    cmds.setAttr(area_light+".areaHiSamples", 64)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号