duplicate layer and name + add extension
duplicate layer and name + add extension
Hi all,
I'm still working on tvp 10 and trying to figure out how to duplicate a layer, clear the heads and add a " _col" to the end of the duplicate name.
At the moment I'm using "duplicate the current layer and clear heads" button, but I'd like to learn how to take that a bit further and maybe learn something.
I understand that you can rename it with embedding this george command
tv_LayerRename 0 "_col"
But how to take the name of the original layer and add _col to the end with george?
I'm still working on tvp 10 and trying to figure out how to duplicate a layer, clear the heads and add a " _col" to the end of the duplicate name.
At the moment I'm using "duplicate the current layer and clear heads" button, but I'd like to learn how to take that a bit further and maybe learn something.
I understand that you can rename it with embedding this george command
tv_LayerRename 0 "_col"
But how to take the name of the original layer and add _col to the end with george?
Windows 10 (64 bit), 8gb ram, intel i5 10400f. TVpaint 11.7
- schwarzgrau
- Posts: 1238
- Joined: 23 Jan 2012, 22:08
- Location: Offenbach / Germany
- Contact:
Re: duplicate layer and name change
I guess writing the script, which you try to create and commenting it helps the most for understanding the basics.
I'm a beginner in George too, so I guess there is always a better way of doing it. Especially the part which turns autobreak off and back on doesn't seem that smart to me, but at least it works.
I'm a beginner in George too, so I guess there is always a better way of doing it. Especially the part which turns autobreak off and back on doesn't seem that smart to me, but at least it works.
Code: Select all
tv_LayerInfo
PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable layerSelection //get all informations about the current layer and parse them into variables
tv_LayerCurrentID //Get layer ID
NormID = result
layerlength = layerEnd - layerStart + 1 //Get layerlength
tv_LayerDuplicate layerName"_col" //duplicate layer and rename it
tv_LayerCurrentID
colID = result //Get layer ID color
tv_layerautobreakinstance colID off //Turn autobreak off
tv_LayerSelect layerStart layerlength //select all frames
tv_Clear //clear all frames
tv_layerautobreakinstance colID on //Turn autobreak back on
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Cintiq 22HD
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
INSTAGRAM
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
Re: duplicate layer and name + add extension
thanks for your answer, this naming thing seems like a reasonably good practise to do.
Even though it seems quite straight forward, it's still too far for me. I was looking for a simpler solution by tweaking the existing button in tvpaint, like this And my idea was simply to embed something small to make it work, like my first shoot in the dark :
tv_LayerCurrentID + "_col"
Obviously it didn't work... but you see, that was the idea what I was after. I'm looking something bitesize, and it feels it can't be that far. After all, the name is already there, and I can rename the layer with george.
Anyway, I'll try what your code does and try to understand it, maybe the answer is there!
Even though it seems quite straight forward, it's still too far for me. I was looking for a simpler solution by tweaking the existing button in tvpaint, like this And my idea was simply to embed something small to make it work, like my first shoot in the dark :
tv_LayerCurrentID + "_col"
Obviously it didn't work... but you see, that was the idea what I was after. I'm looking something bitesize, and it feels it can't be that far. After all, the name is already there, and I can rename the layer with george.
Anyway, I'll try what your code does and try to understand it, maybe the answer is there!
Windows 10 (64 bit), 8gb ram, intel i5 10400f. TVpaint 11.7
- schwarzgrau
- Posts: 1238
- Joined: 23 Jan 2012, 22:08
- Location: Offenbach / Germany
- Contact:
Re: duplicate layer and name + add extension
Hehe ok, if you stack your button this way and only want to rename the duplicated layer you need to embed this script
You need "tv_Layerinfo" to get your current layername saved in the variable "layerName".
Then you run "tv_LayerCurrentID" to get the ID, cause you need it for "tv_LayerRename". Wait... maybe you don't even need the ID. Maybe this one works too:
Sometimes 0 instead of an ID works like "there is no ID, just choose the current layer".
Code: Select all
tv_LayerInfo
PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable layerSelection //get all informations about the current layer and parse them into variables
tv_LayerCurrentID //Get layer ID
curlID = result
tv_LayerRename curlID layerName"_col" //Rename the layer
Then you run "tv_LayerCurrentID" to get the ID, cause you need it for "tv_LayerRename". Wait... maybe you don't even need the ID. Maybe this one works too:
Code: Select all
tv_LayerInfo
PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable layerSelection //get all informations about the current layer and parse them into variables
tv_LayerRename 0 layerName"_col" //Rename the layer
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Cintiq 22HD
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
INSTAGRAM
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
Re: duplicate layer and name + add extension
That did it, whoah!
Perfect, this was exactly what I was looking for. I had no idea you have to do this kind of PARSEing for all the variables on the layer. I suppose, that after this, I could call any of the named variables and they would carry the data from the previous layer..
Thats one massive step for me, thanks a lot, Schwarzgrau! I'm really hyped now
Perfect, this was exactly what I was looking for. I had no idea you have to do this kind of PARSEing for all the variables on the layer. I suppose, that after this, I could call any of the named variables and they would carry the data from the previous layer..
Thats one massive step for me, thanks a lot, Schwarzgrau! I'm really hyped now
Windows 10 (64 bit), 8gb ram, intel i5 10400f. TVpaint 11.7
- schwarzgrau
- Posts: 1238
- Joined: 23 Jan 2012, 22:08
- Location: Offenbach / Germany
- Contact:
Re: duplicate layer and name + add extension
Exactly! You always need to parse the result of a function somehow. In the case of the layerinformation you get a long string with all informations, seperated by a space. Parsing splits them everytime a space occurs and saves this part in one of the variables. After reading the sentence it sounds a lot more complicated than it is, but I guess you already got it.kariP wrote: Perfect, this was exactly what I was looking for. I had no idea you have to do this kind of PARSEing for all the variables on the layer. I suppose, that after this, I could call any of the named variables and they would carry the data from the previous layer..
Glad I could help.
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Cintiq 22HD
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
INSTAGRAM
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
Re: duplicate layer and name + add extension
A trick on parsing:
tv_LayerInfo
parse result d d d LayerName d
If a command returns lots of variables you can parse out just the info you want and use dummy variables for the rest - Above, I use the letter d as dummies for all the extraneous info.
And any other unwanted variables (and spaces) that follow the explicit variable you're retrieving can all be lumped into a single dummy variable which is thrown away, anyway.
sven
tv_LayerInfo
parse result d d d LayerName d
If a command returns lots of variables you can parse out just the info you want and use dummy variables for the rest - Above, I use the letter d as dummies for all the extraneous info.
And any other unwanted variables (and spaces) that follow the explicit variable you're retrieving can all be lumped into a single dummy variable which is thrown away, anyway.
sven
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
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
- schwarzgrau
- Posts: 1238
- Joined: 23 Jan 2012, 22:08
- Location: Offenbach / Germany
- Contact:
Re: duplicate layer and name + add extension
Nice trick, thank you Sven
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Cintiq 22HD
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
INSTAGRAM
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
Re: duplicate layer and name + add extension
I did some testing yesterday, trying to figure out what is needed on this PARSE result line. I found out that I had to have all the variables before the one I need, to maintain order. And one variable after the one I need. This trick is making this case even more clear and rememberable, thanks a lot.
Windows 10 (64 bit), 8gb ram, intel i5 10400f. TVpaint 11.7