I am trying to make a simple script to remove a 1 frame slate from a clip when right clicking through the media hub or when right clicking on the desktop. I would also like the clip’s handles to me consolidated to zero once the 1 frame has been removed. After playing around with chatgpt and looking at the documentation I can’t seem to get anything working. Any and all help is very much appreciated!
You might be better off buying a hungry python and sending it to the people that make the slates that you’re trying to remove.
No kidding, bones me every time I need to replace media into a sequence!
This is a perfect example of why we need Macros. @sam.marrocco added the feature into a larger feature request about 7 years ago. Perhaps it’s a good time to make a new request for just the macros. Now that the text module has been revamped, maybe this will be my new mission. @fredwarren
you can set the positioner on the clip using the clips current_time attribute:
<YourPyClip>.current_time = flame.PyTime(1001) #or whatever frame is the first actual frame, you can do this with timecode too
then use cut() to make an edit at that frame and flame.delete() to remove the newly created slate segment:
<YourPyClip>.cut()
flame.delete(<YourPyClip>.versions[0].tracks[0].segments[0])
the next part is a little messy but I don’t think it’s possible to consolidate handles directly with the API, but we can use execute_shortcut() to trigger the keyboard shortcut, which will launch the dialog box that asks you how many handles you want. I don’t think bypassing this dialog is possible using the API alone
flame.execute_shortcut('Consolidate Handles')
that’s the basic logic as I see it, there might be a simpler way but the execute_shortcut trick is the only way I can think to do the consolidation.
Macros: upvote here: Autodesk Feedback Community
upvoted!
it’s not as big a deal now, but you would have hated macros on a realtime broadcast system.
just sayin’
What is a “real-time broadcast system?”
one of those old flames used for news and sports
broadcast, where resources were so tight you couldn’t record macros because they would steal proc cycles.
Hi hi,
Perhaps a workflow for you…
- install my Set In and Out Marks script available on the Logik Portal
- select all of the slated clips
- right click selected slated clips > Edit… > Set In and Out Marks
- set the in mark to frame 2
- create an empty sequence
- grab all of the clips with in marks in the Media Panel and drop them into the sequence
- select all the segments in the sequence
- right click selected segments > Commit > Consolidate Handles down to 0
- match those all back out again
Side note - I thought Splice Reel would do it, but it ignores the in points.
I would be worried I would need that slate data later… Maybe instead of Consolidate at step #6 instead Match out with match options set to Preserve Handles. So you could just tuck away all of those slates.
Hope this helps!
You can build these macros with python by creating a custom action and assigning a shortcut to it.
IMO, the future of this is not to create macros, but to write “delete the first frame of the selected clips” in a prompt.
Not meaning to highjack the thread, but a macro shouldn’t need any special knowledge. I’ve written a few very simple python scripts and they take a long time because I’m not immersed in that language. Anyone can make a macro. You click a button tha says “record”, you make a series of key strokes, then hit “stop”. Generally when one wants to make one, it’s a spur of the moment thing and you don’t want to spend the afternoon trying to figure it out. I used to use them extensively in Photoshop, and even the archaic CMX 3600 had the capabilities.
What you are describing here is immensely hard to implement and operate. Just to start with, you would need to make sure that all ui components are the same as when you recorded the macro. Then, the macro could be easily broken between releases as we are making changes to the functions name, the ui, shortcuts descriptions, etc. A CMX3600 didn’t have multiple environments with multiple panels and buttons that can be displayed or not based on conditions and version of the software that do not have the same buttons as others…
We tried using macros a way back to help automate our testing and it simply wasn’t working.
The chances of this feature being implemented are close to none.
Was it called Vapour? I vaguely remember a then-new product announcement. But then it actually became vapourware.
What you are describing here is immensely hard to implement and operate
That’s why I’m asking you.
the macro could be easily broken between releases as we are making changes to the functions name, the ui, shortcuts descriptions, etc.
Macros are not meant to be long-lived. When using one repeatedly, the state of the application needs to be the same each time at the start. That’s a given. I think you are thinking of them in a more complex situation than is required.
The chances of this feature being implemented are close to none.
To the optimist, this means it’s possible.
Frost and vapor…
Hilarious but no I meant flames hooked into broadcast situations, being controlled like video decks.
This is turning into a bigger controversy than the Astronomer CEO getting caught cheating on his wife at the Coldplay concert
Its ok. It’s the flame community: a tiny macrocosm.
this is what I have so far, but when I place this into shared python folder nothing happens:
import flame
def trim_and_consolidate(selection):
for item in selection:
if isinstance(item, flame.PySegment):
clip = item
duration = clip.source_out - clip.source_in + 1
if duration <= 1:
print(f"Clip too short to trim: {clip.name}")
continue
# Trim the first frame
clip.source_in += 1
clip.in_point += 1
# Consolidate handles
clip.handle_head = 0
clip.handle_tail = 0
print(f"Trimmed first frame and set handles to zero: {clip.name}")
else:
print(f"Skipped unsupported type: {type(item)}")
def is_visible(selection):
return any(isinstance(item, flame.PySegment) for item in selection)
def get_media_panel_custom_ui_actions():
return [
{
'name': 'Trim Tools',
'actions': [
{
'name': 'Trim First Frame + Zero Handles',
'isVisible': is_visible,
'execute': trim_and_consolidate,
'minimumVersion': '2025.2'
}
]
}
]