Hotkey to change clone offset frame

Hi, I’m doing a lot of frame by frame removal right now and am looking for a way to make a hotkey to change the source frame offset in the clone tool menu. would like a key to move one frame forward and one frame back (would change offset source frame only, not the timeline frame). Any tips on how to make this work?

Thank you!

To change the clone source frame offset, you need to use the paint.setState() method:

paint.setState('Clone.frame:0', value)

There are two clone sources available, so use either ‘Clone.frame:0’ or ‘Clone.frame:1’.

To query the current source frame state, you do this:

value = paint.getState('Clone.frame:0')

So to move the source frame offset forward or backward by one, add this code to keybinds.py:

def adjustCloneFrame(offset):
    value = paint.getState('Clone.frame:0')
    paint.setState('Clone.frame:0', value + offset)

fx.bind("Shift+Ctrl+2", callMethod(adjustCloneFrame, -1))
fx.bind("Shift+Ctrl+3", callMethod(adjustCloneFrame, 1))
1 Like

Thank you! This is exactly what Im looking for, however I’m getting this error when I put in keybinds.py:

Traceback (most recent call last):
  File "/Library/Application Support/Adobe/Common/Plug-ins/7.0/MediaCore/BorisFX/Silhouette 2021.5/silhouette.app/Contents/Resources/scripts/keybinds.py", line 10, in _return_func
    return func(*args, **kwargs)
  File "/Library/Application Support/Adobe/Common/Plug-ins/7.0/MediaCore/BorisFX/Silhouette 2021.5/silhouette.app/Contents/Resources/scripts/keybinds.py", line 470, in adjustCloneFrame
    value = paint.getState('Clone.frame:0')
NameError: name 'paint' is not defined

any idea why? I changed the bind to Shift+J and Shift+k respectively, because it wasn’t doing anything when I had the binds as you set them

Thanks for your help!

Sorry - replace it with “fx.paint”.

BTW - your request has inspired me to add a new feature to our upcoming 2022.5 release. Soon you’ll be able to paste startup script code directly into the Scripting Preferences page, without having to edit the keybinds.py file or add more script paths.

2 Likes