SwapClips buttonset

Share your custom panels, brushes, papers... (you need to be registered to read posts in this section)
Post Reply
Svengali
Posts: 1552
Joined: 28 Dec 2006, 10:08

SwapClips buttonset

Post by Svengali »

SwapClips: Swap/Toggle between any two Project/Clip/Layer/Frames
SwapClips buttonset.png
SwapClips buttonset.png (17.01 KiB) Viewed 4521 times
Here is a very simple script assigned to a button that lets you Toggle between any two frames. I use it frequently when cutting and pasting copies of drawing parts. One frame is the SOURCE, the other the TARGET.

How The SwapClips Script Works
1. Reads previous PROJECT, CLIP, LAYER and FRAME info from CONFIG.INI file into four variables.
2. Reads the current PROJECT, CLIP, LAYER and FRAME, storing in another four variables.
3. Restores to previous PROJECT, CLIP, LAYER and FRAME.
4. Finally, saves current PROJECT, CLIP, LAYER and FRAME into the CONFIG.INI file.

It is simply a toggle between two frames , they can be in the SAME project and clip and layer, or from completely DIFFERENT projects, clips and/or layers.
If you move to a new project, clip, layer or frame, that becomes the new frame that the script reads in step two and saves in step four.
So, you can simply toggle between two frames, back and forth, then change SOURCE or TARGET frame at any time.


How I use the script/button:
During my drawing process, I often select, then stamp frames from my current AnimBrush. But that requires me to page through the AnimBrush frames every time I reload the AnimBrush.

I wanted the freedom to access and clip from a larger source library of stamp-able images.
The SwapClips script lets me have a SOURCE project open, with an unlimited collection of stamp-able images, from which to grab, in a few simple clicks using the SwapClips button.
To streamline the retrieval I have assigned the SwapClips button to a Shortcut key( T ) which acts as a toggle between SOURCE frame and TARGET frame. I have also assigned the Copy-It-Out button to an adjoining Shortcut key( R ) right next to the SwapClips Shortcut key which makes it quick and easy to retrieve any stamp-able image in four strokes.

To be clear, if I want a different SOURCE frame, I change to the new SOURCE frame when I am on the current SOURCE frame. If I want a different TARGET frame, I change to the new TARGET frame when I am on the current TARGET frame.

Code: Select all

// SwapClips.grg
// Svengali © 2020
// ( May ) 2020 - ver .1
//   Swaps between  different Frames, from the same or different Layers, from the  same or different Clips 
//   from the same or different projects:  
//   Stores Project/Clip/Layer/Frame information for the alternate frame in the SAME four strings 
//   under a single CONFIG.INI group name.

// each time you swap, the previous location is stored, consisting of info on  Project/clip/layer/frame.

//   for example, you might use clip/layer/frame ONE as an image source library from which to cut/copy images...
//  then use clip/layer/frame/ TWO... any individual frame where images are to be stamped...

Param none
ScriptName = "SwapClips"

tv_LockDisplay QUIET                                                        // suspend display during frame swaps

// ============== Read stored info for previous frame from user string ============================
        
tv_ReadUserString "SwapClips" "ProjectID"                                // read stored project ID
PreviousProjectID = result                                                // store as previous project ID

tv_ReadUserString "SwapClips" "ClipID"                                // read stored clip ID
PreviousClipID = result                                                        // store as previous clip ID

tv_ReadUserString "SwapClips" "LayerID"                                // read stored layer ID
PreviousLayerID = result                                                        // store as previous layer ID

tv_ReadUserString " SwapClips" "Frame"                                // read stored project frame
PreviousFrame = result                                                        // store as previous frame number

// =============== Acquire and store info for current frame in variables ===========================

tv_ProjectCurrentID                                                        // get ID for current project
NextProjectID = result                                                        // store as next project ID

tv_ClipCurrentID                                                                // get ID for current clip
NextClipID = result                                                        // store as next clip ID

tv_LayerCurrentID                                                                // get layer ID for current project
NextLayerID = result                                                        // store as next layer ID 

tv_ProjectCurrentFrame                                                        // get current project frame (not clip frame)
NextFrame = result                                                                // store as next frame number

// =============== Restore previous frame to be current ======================================

tv_ProjectSelect PreviousProjectID                                        // go to previous project
tv_ClipSelect PrevousClipID                                                // go to previous clip
tv_LayerSet PreviousLayerID                                                // go to previous layer
tv_ProjectCurrentFrame PreviousFrame                                        // go to previous project frame

// =============== Store current frame info in user string ======================================

tv_WriteUserString "SwapClips" "ProjectID" NextProjectID        // write out next project ID 
tv_WriteUserString "SwapClips" "ClipID" NextClipID                // write out next clip ID
tv_WriteUserString "SwapClips" "LayerID" NextLayerID                // write out next layer ID
tv_WriteUserString "SwapClips" "Frame" NextFrame                        // write out next frame number


 // =============== debug info for both swap frames =========================================
 
debug = 0                                                                        // debug = 1     nodebug  = 0
IF debug != 0
         Text = "Prev: ProjID="PreviousProjectID   "    ClipID="PreviousClipID " LayerID="PreviousLayerID " Frame=" PreviousFrame
         Text = Text"\nNext: ProjID="NextProjectID           "   ClipID="NextClipID         " LayerID="NextLayerID        " Frame=" NextFrame
         tv_LockDisplay Text                                                // display swap frames info
        FOR i = 1 to 500000                                                // pause timed loop
                tv_Nop
        END
END

 tv_UnLockDisplay                                                                // reactivate display
 tv_UpdateDisplay                                                                // refresh display
Attachments
SwapClips buttonset.tvpx
(250 KiB) Downloaded 337 times
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
User avatar
NathanOtano
Posts: 1187
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: SwapClips buttonset

Post by NathanOtano »

That's a really cool and usefull script, thanks!

It's funny but i see lots of flipping possibilities with this!
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
ScarlettReid
Posts: 1
Joined: 06 Nov 2020, 13:55

Re: SwapClips buttonset

Post by ScarlettReid »

Thank you for sharing your script. I tried it today, it really helped me make my project faster.
Post Reply