Fantasi
Fantasi

Reputation: 3

get Attr from Maya shotlist

I want to get the information from the fields in the shotlist (in the camera sequencer). The shotname I've solved:

test = cmds.getAttr('shot1.sn')
print test

But the rest.. I'm stuck. When I try to call the other arguments like startTime I get all kinds of errors depending of how I try to do it.

Upvotes: -1

Views: 619

Answers (1)

Green Cell
Green Cell

Reputation: 4783

Welcome to SO, Fantasi.

You're giving a very vague question, so in return you're going to get a very vague answer.

You can get a list of your shots by using cmds.listConnections on your sequencer object. After, use a for loop and get a shot's info by using cmds.getAttr like this:

shots = cmds.listConnections("sequencer1", type="shot") or []  # Get a list of all shots from the sequencer.

for shot in shots:
    shot_name = cmds.getAttr("{}.shotName".format(shot))  # Query shot's name.
    start_frame = cmds.getAttr("{}.startFrame".format(shot))  # Query shot's start frame.
    end_frame = cmds.getAttr("{}.endFrame".format(shot))  # Query shot's end frame.
    print shot_name, start_frame, end_frame  # Print out shot's info.

Example output of a sequencer with 2 shots:

Output:

shot 1.0 50.0

shotEnd 51.0 120.0

If you're unsure about the shot object's attribute names then you can find them here.

If you still have problems I suggest you paste the error message from the Script Editor so we can diagnose what's wrong.

Upvotes: 1

Related Questions