Support SFMLab on Patreon

KeyFrame Mover

Warning: BETA content

This file is marked as "BETA" which means that the contents might be unfinished, outdated or incompatible with the most recent version of Source Filmmaker.


Description

this is an experimental script that creates a shortcut within SFM that selects key frames to the right of the mouse and shifts them over either a frame forward or back. The main use for this is to help with timing on frames.
This video should explain it better.

(https://www.youtube.com/watch?v=pelWCdbBg3o)

https://i.imgur.com/BhxNMn0.gifv

How to install

  1. extract the files cv2.pyd, mousemacro.py*, numpy* and numpy-1.10.1.dist-info to "SourceFilmmaker\game\sdktools\python\global\lib\site-packages\"

  2. extract KeyFrameMover.py and the two images to "SourceFilmmaker\game\platform\scripts\sfm\"

  3. now here you can either copy every line in KeyFrameMover.py and past it into sfm_init.py or just rename KeyFrameMover.py to sfm_init.py if nothing important is in it.

  4. it should work now the next time SFM starts be sure to check the console or script editor for errors.

How to use

  1. This script has three shortcut keys, which can be change at end of the script file.

1) shift forward ".": all bookmark keys on screen and to the right of the mouse will get selected and shift over a frame to the right, or any already selected frames will shift

2) shift back ",":all bookmark keys on screen and to the right of the mouse will get selected and shift over a frame to the left, or any already selected frames will shift

3) re-scale "/": this one controls how far in pixels the keys move. use this after changing zoom level to get smoother shifts.

How this script works

This script uses the OpenCV library in order to work

first it takes a screenshot of the window
then it uses a template img to find all the bookmarks on screen and records each one positions to the right of the mouse. from there the script moves the mouse to each key selecting it then just uses middle click to drag the keys over.
There is a simpler way to do this in sfm with only python but due to an unfixed bug it will crash SFM if you do it with a GUI.

feel free to modify the script for your own use
if you find any bugs or have suggestions message me in the comments below.



Comments

LordAardvark

So, it's shift-click-drag? The tech behind it is neat, don't get me wrong. I'm just not sure if this was a bit of a reinvention of the wheel.

LordAardvark posted 1 year, 6 months ago

Hi_im_a_Weeaboo

so uuuuuuuuuuh, could you repeat the stuff were you said the stuff

Hi_im_a_Weeaboo posted 1 year, 6 months ago

msu355

@LordAardvark, yea pretty much. This script just condenses those steps into a hotkey.

msu355 posted 1 year, 6 months ago

LordAardvark

Also, you say that it works by taking a screenshot and then doing some image analysis against a template. How does the program handle non-standard configurations? Like, for example, having the viewport take up the entire right side of the screen, and having the timeline be embedded in the animation-set pane? **[Like this](https://my.mixtape.moe/mjnetk.png)** I felt so dirty putting that layout together, but I've seen people use similarly esoteric configurations, so I think it's a legitimate question.

LordAardvark posted 1 year, 6 months ago

msu355

@LordAardvark, as long as all the keyframes you want to move are on screen and the keys have some space between them it should work.

msu355 posted 1 year, 6 months ago

LordAardvark

Impressive, then. I am very interested in the tech behind this. If there was a way to get some raw drawing onto the screen, then this could be used for things like labeling and color-coding keyframes. Both features I often find myself wishing SFM had.

LordAardvark posted 1 year, 6 months ago

radroachhd

Nice work!!!

radroachhd posted 1 year, 6 months ago

Commonsaltwar

does it work?

Commonsaltwar posted 1 year, 6 months ago


Leave a reply

You need to be logged in to leave a comment.

Support SFMLab on Patreon