top of page

Maya | Python | Camera Sequencer Trim

  • Writer: Max Liu
    Max Liu
  • May 14, 2020
  • 1 min read

Updated: Dec 24, 2024


1. Camera: Persp1

2. The frames used in Camera Sequencer are 20-39

3. We want to delete frames other than 20-39.



def trimAnim():
    # 1 List all shots
    listOfShots = cmds.sequenceManager(listShots=True)
    # 2 CutKey
    for eachShot in listOfShots:
        shotStartFrame = cmds.shot(eachShot, q=True, startTime=True)
        shotEndFrame = cmds.shot(eachShot, q=True, endTime=True)
        shotCameraName = cmds.shot(eachShot, q=True, currentCamera=True)
        print shotStartFrame, shotEndFrame, shotCameraName
        if shotStartFrame >= 0 :
            cmds.cutKey(shotCameraName, time=(0, shotStartFrame-1.0))

        cmds.cutKey(shotCameraName, time=(shotEndFrame+1.0, 1000))

Comments


bottom of page