Move cursor if not on a frame

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

Move cursor if not on a frame

Post by Lukas »

the image I attached shows what I'm trying to do...hopefully :)

I'm making some buttons that travel to the layers I need to go to often, so I don't have to manually find the layers (working on some projects with lots of layers), they work great, but now I only need to move the time-cursor if its next to the actual frames of the particular layer.

Is it possible with george?
Attachments
movemovestay.png
movemovestay.png (23.33 KiB) Viewed 642 times
  • 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
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Re: Move cursor if not on a frame

Post by Lukas »

Nevermind, I figured it out :)

Code: Select all

tv_LayerGetImage
CurrentFrame = result
tv_FirstImage
FirstFrame = result
tv_LastImage
LastFrame = result

IF CurrentFrame < FirstFrame
tv_LayerImage FirstFrame
END
IF CurrentFrame > LastFrame
tv_LayerImage LastFrame
END
  • 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
Fabrice
Posts: 10077
Joined: 17 Jul 2007, 15:00
Contact:

Re: Move cursor if not on a frame

Post by Fabrice »

that said, do you know the following shortcut [,] (click anywhere on your image, assuming there are several layers involved : you should be able to select the layer you want)
Fabrice Debarge
User avatar
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Re: Move cursor if not on a frame

Post by Lukas »

Yes I do, it's a lovely shortcut :) But it only works if the layers are in the display, I often want to go somewhere even if its a hidden layer etc.

But I needed some more specific buttons. I'm working on a project for a long period, with 3 characters. And I made 3 buttons to jump to the specific character's line art and hide all other layers.

Code: Select all

// this button would expose and go to the layer called "vader lijn" which is in colorgroup 2, but still show the background (which I've set to 20% opacity with another button

group = 2 // Character's colorgroup
BGgroup = 9 // Background's colorgroup
character = vader // Name of character
line = lijn // Dutch translation
color = kleur // Dutch translation
shadow = schaduw // Dutch translation
detail = detail // Dutch translation

tv_layercolor hide Display 1
tv_layercolor hide Timeline 1
tv_layercolor hide Display 2
tv_layercolor hide Timeline 2
tv_layercolor hide Display 3
tv_layercolor hide Timeline 3
tv_layercolor hide Display 4
tv_layercolor hide Timeline 4
tv_layercolor hide Display 5
tv_layercolor hide Timeline 5
tv_layercolor hide Display 6
tv_layercolor hide Timeline 6
tv_layercolor hide Display 7
tv_layercolor hide Timeline 7
tv_layercolor hide Display 8
tv_layercolor hide Timeline 8
tv_layercolor hide Display 9
tv_layercolor hide Timeline 9
tv_layercolor hide Display 10
tv_layercolor hide Timeline 10
tv_layercolor hide Display 11
tv_layercolor hide Timeline 11
tv_layercolor hide Display 12
tv_layercolor hide Timeline 12 // hide alles

tv_layercolor show Display group
tv_layercolor show Timeline group
tv_layercolor show Display BGgroup

tv_LayerCurrentID
Beginlayer = result

layerRun = 1
layerPos = 0
WHILE layerRun	
	tv_LayerGetID layerPos	
	lid = result	
	IF CMP(lid,"NONE")==0		
		
		// START RUN ON LAYER 

tv_LayerInfo lid
PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable layerSelection
PARSE layerName word1 word2 word3 word4

tv_layercolor get lid
GroupColor = result
IF CMP(GroupColor, group)
      IF CMP(word2, color)
            tv_LayerDisplay lid Off
      END
      IF CMP(word2, detail)
            tv_LayerDisplay lid Off
      END
      IF CMP(word2, shadow)
            tv_LayerDisplay lid Off
      END
      IF CMP(word1, character)
            IF CMP(word2, line)
            Targetlayer = lid // found character line art
            END
      END
END
		// END RUN ON LAYER
		layerPos = layerPos+1	
	ELSE		
		layerRun = 0
	END
END

tv_layerSet Targetlayer // zet alle kleur detail en schaduw uit en ga naar vader lijn laag

tv_LayerGetImage
CurrentFrame = result
tv_FirstImage
FirstFrame = result
tv_LastImage
LastFrame = result

IF CurrentFrame < FirstFrame
tv_LayerImage FirstFrame
END
IF CurrentFrame > LastFrame
tv_LayerImage LastFrame
END // Go to start or end frame if neccesary
I did the same thing for props / FX / BG etc.

Every character has its layer this way:

Father line
Father shadow
Father detail
Father color

The second word is kind of like a secondary group... :) So for example, I can turn off ALL color layers in the entire project etc.

I'll try to share the whole panel when I can got the code less project specific.
Attachments
visibilitypanel.png
visibilitypanel.png (38.42 KiB) Viewed 619 times
  • 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
Post Reply