Can George check if we're in Project or Clip: Timeline tab? Topic is solved

A forum dedicated to George scripting questions
Post Reply
User avatar
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Can George check if we're in Project or Clip: Timeline tab?

Post by Lukas »

Can George check if we're in Project or Timeline tab?

-> I've got some tools that would benefit a lot if I could let them behave differently considering the current project/timeline view. Can I check what tab is currently active?
  • Lukas Sketch Panel
  • TVPaint Pro 11.7.3
  • MacBook Pro 2018 macOS Ventura 13.4.1 + PC Windows 10
  • Wacom Cintiq 27QHD + Wacom Intuos4
  • YouTube.com/@ClubBaboo
  • YouTube.com/@FrameOrder
User avatar
Thierry
Site Admin
Posts: 2780
Joined: 07 Jan 2013, 08:28

Re: Can George check if we're in Project or Clip: Timeline tab?

Post by Thierry »

I don't think you can check which tab is active.

You can force which tab to open with tv_MenuShow "project/clip" but that's as far as what's possible.
We might add this in the future, but no guarentee & priority.
User avatar
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Re: Can George check if we're in Project or Clip: Timeline tab?

Post by Lukas »

Ok thank you. Understandable

+1 from me for the feature request in that case! :)

Some examples I would immediately use that are currently impossible (I think):
  • Create a shortcut that toggles between Project / Clip: Timeline tabs
  • Create shortcuts to cycle trough - or choose presets of - color groups for the currently selected layers / selected clips depending on tab.
  • Create a shortcut to rename current layer / current clip depending on tab.
  • Create a shortcut to disable light table for all layers in current clip / all layers in all clips depending on tab
And more actually...

Expanding the George API with seemingly small additions goes a long way
  • Lukas Sketch Panel
  • TVPaint Pro 11.7.3
  • MacBook Pro 2018 macOS Ventura 13.4.1 + PC Windows 10
  • Wacom Cintiq 27QHD + Wacom Intuos4
  • YouTube.com/@ClubBaboo
  • YouTube.com/@FrameOrder
User avatar
NathanOtano
Posts: 1208
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Can George check if we're in Project or Clip: Timeline tab?

Post by NathanOtano »

What I would do maybe is to check modifiers at the beginning of your script so if "shift" is pressed it's for clips, and if not it's for layers. That way even if you are in the wrong view you always get the right behaviour. For lisibility, I guess you could use tv_menushow as suggested by Thierry to "see" the behaviour
I use a lot of clip shortcuts in my timeline view for exemple. I would not like a shortcut to do two different things, but I guess it's a matter of taste :)
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.
User avatar
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Re: Can George check if we're in Project or Clip: Timeline tab?

Post by Lukas »

Yeah I understand.

Actually even standard TVPaint functions sometimes do something different depending on the tab. For example, the default shortcut for down arrow: "Layer: Go Down":
  • Behaviour in Clip: Timeline: Go to next layer
  • Behaviour in Project view: Go to next clip
I recently discovered I lost this behaviour myself, because I use custom up/down buttons that skip locked layers :( I'll probably switch back to the regular shortcuts to get it back. Losing the skip locked layer function... It's a loss either way.

There's a bunch more that would just make sense:
  • Shortcut for new layer/clip
  • Shortcut to set color group for layer/clip
  • Shortcut to rename layer/clip
  • Etc. etc.
I believe it's a conventional paradigm.
  • Lukas Sketch Panel
  • TVPaint Pro 11.7.3
  • MacBook Pro 2018 macOS Ventura 13.4.1 + PC Windows 10
  • Wacom Cintiq 27QHD + Wacom Intuos4
  • YouTube.com/@ClubBaboo
  • YouTube.com/@FrameOrder
User avatar
NathanOtano
Posts: 1208
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Can George check if we're in Project or Clip: Timeline tab?

Post by NathanOtano »

You can also in one button put a script, then a shortcut, then a script etc. I had some cases where I would use both on a single button cause it would be too hard to script a function a shortcut was doing really well

For your skipped locked layer, you could script something that goes up to your last locked layer then use the layerdown shortcut for ex
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.
User avatar
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Re: Can George check if we're in Project or Clip: Timeline tab?

Post by Lukas »

Lukas wrote: 26 Mar 2024, 09:33[...]
  • Create a shortcut that toggles between Project / Clip: Timeline tabs
[...]
Well at least I got this to work.

Code: Select all

ScriptName = "toggle_project_clip_view"
tv_ReadUserString ScriptName "State" "clip"
State = result
IF CMP(State, "clip")
	State = "project"
ELSE
	State = "clip"
END
tv_menushow State
tv_WriteUserString ScriptName "State" State
I guess other scripts could read the state too. But the state could be 'wrong' if the user clicks the Tabs instead of toggling with the button/shortcut. So in some cases that could lead to wrong actions (renaming clip instead of layer). I might use this for other scripts though, and force users to use my button instead of the tabs (or face the consequences I guess).
  • Lukas Sketch Panel
  • TVPaint Pro 11.7.3
  • MacBook Pro 2018 macOS Ventura 13.4.1 + PC Windows 10
  • Wacom Cintiq 27QHD + Wacom Intuos4
  • YouTube.com/@ClubBaboo
  • YouTube.com/@FrameOrder
User avatar
NathanOtano
Posts: 1208
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Can George check if we're in Project or Clip: Timeline tab?

Post by NathanOtano »

Nice idea to retain states of menus I like it
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.
User avatar
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Re: Can George check if we're in Project or Clip: Timeline tab?

Post by Lukas »

I've added some buttons to my panel to toggle between clip thumbnails and layers instead of the tabs. Of course, using the default tabs (so don't use those) confuses the scripts because there's no way to get state of the timeline panel via George. (Again, please add this to the George API)

These work great! And they behave differently based on the interface situation :)
  • <Numpad 0> Toggle Project/Clip View
  • <Cmd A> Select All Layers/Clips
  • <Cmd J> Duplicate Layer/Clip
  • <Cmd N> New Layer/Clip
  • <Cmd R> Rename Selected Layers/Clips
  • <`> Select Color Group Preset for Layers/Clips
  • <(Shift) Z> Cycle Color Group Preset for Layers/Clips
To be honest, I think TVPaint be able to do this out of the box. It's very basic functionality :) I'd be happy to learn that a TVPaint updates makes these scripts obsolete.
  • Lukas Sketch Panel
  • TVPaint Pro 11.7.3
  • MacBook Pro 2018 macOS Ventura 13.4.1 + PC Windows 10
  • Wacom Cintiq 27QHD + Wacom Intuos4
  • YouTube.com/@ClubBaboo
  • YouTube.com/@FrameOrder
User avatar
D.T. Nethery
Posts: 4225
Joined: 27 Sep 2006, 19:19

Re: Can George check if we're in Project or Clip: Timeline tab?

Post by D.T. Nethery »

Lukas wrote: 24 Apr 2024, 07:04 To be honest, I think TVPaint be able to do this out of the box. It's very basic functionality . I'd be happy to learn that a TVPaint updates makes these scripts obsolete.
I agree. There have been some amazing scripts and custom panels contributed by users over the years that are part of my regular set of tools now (such as Mads Juul's Rename Instances script and his Batch Rename Clips, the many useful scripts by Nathan Otano, Svengali's scripts, and your scripts/custom panels , Lukas) which have functions that seem as if they should be incorporated directly into the TVPaint interface, not only as optional add-on scripts. Many users of TVPaint (or potential users, trying out the trial version) don't visit this forum regularly (or not at all) , so they are usually unaware of the marvelous additions that are available to increase the functionality of TVPaint's workflow. I have demonstrated these scripts to my clients or students over the years and they act as if I am some sort of "wizard" for having access to these amazing tools. "How did you do that? Where did you find this?!" I just smile and say: "No, I'm not the wizard; the wizard(s) are the clever people who write these scripts. I'm just sharing them with you. Have fun. (and go look at Content Sharing on the TVPaint forum) "

Animator, TVPaint Beta-Tester, Animation Educator and Consultant.
MacOS 12.7.1 Monterey , Mac Mini (2018) , 3.2 GHz 6-Core Intel Core i7,
16 GB RAM , TVPaint PRO 11.7.1 - 64bit , Wacom Cintiq 21UX 2nd Gen.
,Wacom Intuos Pro 5 , Wacom driver version 6.3.39-1
User avatar
NathanOtano
Posts: 1208
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Can George check if we're in Project or Clip: Timeline tab?

Post by NathanOtano »

TVPaint forum is indeed a treasure cave hehe :)
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.
Post Reply