Set Shot Name within a Sequence

Does anyone know if there’s a way to set a shot name within an open sequence via the python API? By shot name I mean the token that can be used to drive other things (i.e. Rename Shot)

I’ve had a look through the documentation and I can’t seem to find a way but it’s more than likely I’ve missed something.

1 Like

I’ve done some digging and there’s something called “token_name” but it seems to only work on a clip and not a segment. When I run it on a clip it returns the name and not the shot name so I guess that’s a dead-end.

PySegments do have a shot_name attribute that you can use to get or set the shot name of a segment.

In the long form (assuming that you want to get the shot name of the first segment of the first sequence in the Sequences reel of the lone reel group in the Desktop):

Thanks Fred. I’ll see where I get with that. It seems like a pretty complicated way to get to and set a token that people are using to drive a lot of other things though.

@fredwarren I’ve had a quick play around and I’m a bit stumped. Is there a way to get all those indexes for the selected segment? Everything I try I hit a wall. That said, it’s like throwing darts at a board over here.

You can use help() instead of print() on the command i gave you earlier but without the [0].shot_name at the end (the command should end with .segments)

I completely misread what Fredric wrote.

If you’re iterating over items in clips:
setattr(item, ‘shot_name’, VALUE)

Note that there are easier ways to get to that attribute. It depends on what you are trying to do. I gave you the long form so you have a better idea of where it is and what is available.

If you are building a custom action then the segment will be returned by the selection in the Timeline.
If you are setting a hook or using the python console then you can “bypass” the long form by using