I'm looking for a command to automatically change layer names from "Man" to "Man Color" and "Woman" to "Woman Color"
Is there a way to do it with an embedded George script?
Also, what's the best resource to learn some George scripting?
Rename layer automatically
Rename layer automatically
Last edited by Lukas on 08 May 2013, 09:36, edited 1 time in total.
- 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
Re: Rename layer automatically
A quick introduction to George
this code will rename layer.
When using George, using whitespaces is a little cumbersome among other things Because of the PARAM function which splits string into variable at each whitespace, for this reason this script calls the new layer
"man_COLOR" instead of "man COLOR"
here with explaination and link yo the George WIKI
http://wiki.tvpaint.fr/index.php?title= ... rCurrentID
http://wiki.tvpaint.fr/index.php?title=Tv_LayerInfo
http://wiki.tvpaint.fr/index.php?title=PARSE
http://wiki.tvpaint.fr/index.php?title=Tv_LayerRename
http://wiki.tvpaint.fr/index.php?title=Tv_LayerRename
Here is a introdiction to George
http://wiki.tvpaint.fr/index.php?title=George
here is a list of Commands
http://wiki.tvpaint.fr/index.php?title= ... _Reference
List of George instructions
http://wiki.tvpaint.fr/index.php?title= ... _Reference
and is any question please ask at the forum for George
http://forum.tvpaint.com/viewforum.php?f=34
-Mads
P.S A nice function to use to see whats going on in your script is 'tv_warn'
http://wiki.tvpaint.fr/index.php?title=Tv_Warn
this code will rename layer.
Code: Select all
tv_LayerCurrentID
curID = result
tv_LayerInfo curID
PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable layerSelection
newName = layerName"_COLOR"
tv_LayerRename curID newName
"man_COLOR" instead of "man COLOR"
here with explaination and link yo the George WIKI
Code: Select all
tv_LayerCurrentID
// the function 'tv_LayerCurrentID' gets the layer id of the current layer and stores it automatically in a variable called 'result' I need the layer id for the functions 'tv_LayerInfo' and 'tv_LayerRename'
Code: Select all
curID = result
//create a new vareiabel and store the value of 'result' in it bacause 'result' is used to store the return valueof the different functions in GEORGE
Code: Select all
tv_LayerInfo curID
// tv_LayerInfo is a function that returns info about the layer and stores it in the varable called "result"
Code: Select all
PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable layerSelection
// Wath PARSE , I split the input variable (here result) every time there is a whitespace and stores them in the new vaiable
Code: Select all
newName = layerName" COLOR"
// I create a new variable from the current name
Code: Select all
tv_LayerRename curID newName
// I rename layer with the function 'tv_layerRename'
Here is a introdiction to George
http://wiki.tvpaint.fr/index.php?title=George
here is a list of Commands
http://wiki.tvpaint.fr/index.php?title= ... _Reference
List of George instructions
http://wiki.tvpaint.fr/index.php?title= ... _Reference
and is any question please ask at the forum for George
http://forum.tvpaint.com/viewforum.php?f=34
-Mads
P.S A nice function to use to see whats going on in your script is 'tv_warn'
http://wiki.tvpaint.fr/index.php?title=Tv_Warn
Re: Rename layer automatically
Wow, thanks for your time Mads! My brain is consuming as much as possible
- 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
Re: Rename layer automatically
I thought it was fine, but I'm having some trouble with using _ instead of a space
I'm trying to somehow seperate colored layers (so I can toggle all colored layers' visibility with 1 button)
I'm trying to learn by just doing it, so bear with me...
I thought if I named all my layers
- guy line
- guy color
- girl line
- girl color
etc
I could somehow use something like this
(allthough I have no idea yet how to run and use this for all layers in a project...but i'll get there :p)
Is there a way to get around using "_" and use a space anyway, or is this just not gonna work this way?
I'm trying to somehow seperate colored layers (so I can toggle all colored layers' visibility with 1 button)
I'm trying to learn by just doing it, so bear with me...
I thought if I named all my layers
- guy line
- guy color
- girl line
- girl color
etc
I could somehow use something like this
Code: Select all
tv_LayerInfo
PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable layerSelection
PARSE layerName word1 word2 word3 word4
IF CMP(word2, color)
tv_LayerDisplay LayerID Off
ELSE
tv_LayerDisplay LayerID On
END
Is there a way to get around using "_" and use a space anyway, or is this just not gonna work this 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