Page 1 of 1
Duplicate Layer with layer name + 1? - BUG REPORT
Posted: 13 Feb 2018, 09:46
by Sewie
So I have a shortcut assigned for duplicating a layer and structure and renaming the layer and it looks like this in the Configure Keyboard Shortcuts Panel:
- LPM_002.PNG (1.23 KiB) Viewed 33785 times
My Layer Preset Manager is set like this:
- LPM_001.PNG (16.58 KiB) Viewed 33785 times
And it kinda works, it duplicates the structure (with instances empty) and adds a new layer with the same name. But what I would really like, is if it added the new layer with an incremental number. For example my layer is named "Sketch 01", I press my shortcut key and TVP adds a layer named "Sketch 02". I press the shortcut key again, "Sketch 03", etc into oblivion.
(Or for that matter: "Sketch" > shortcut key > "Sketch 01" > shortcut key > "Sketch 02", etc into oblivion)
This should be possible, shouldn't it...? If so, the the big question is... But how??
Does anybody have any advice?
Re: Duplicate Layer with layer name + 1?
Posted: 13 Feb 2018, 19:23
by Animark
I use an action
0 Key:Layer:Duplicate Instances
1 Embedded George Script
2 End
And the george script is:
tv_LayerCurrentID
curID = result
tv_LayerInfo curID
PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable layerSelection
newName = layerName"_COL"
tv_LayerRename curID newName
It duplicates a layer, clears the instances and adds "_COL" to the name of the layer. I use it to make new layers for coloring.
MyLayer
MyLayer_COL
MyLayer_COL_COL
...
I think, I've found the script somewhere here in the forum. It don't gives incremental numbers, but adds something to the name. So, maybe it helps a bit to find a way to get incremental numbers.
Re: Duplicate Layer with layer name + 1?
Posted: 14 Feb 2018, 12:12
by kariP
I tried this and I think there's something wrong.
%cln %i should (in my logic) give out
sketch 0
sketch 1
sketch 2
...
But instead it gives
sketch 0
sketch 0 0
sketch 0 0 0
- Screen Shot 2018-02-14 at 13.46.53.png (60.04 KiB) Viewed 33730 times
Sewie, is this also what happens with your setup?
Re: Duplicate Layer with layer name + 1?
Posted: 14 Feb 2018, 13:10
by Sewie
Yes, it is weird.
When I press "Create Layer" in the Layer Preset Manager it adds the zeros, but when I press the shortcut key it just adds a new layer with the same exact name and structure. It didn't do that before I opened it... Also, I can't seem to add a shortcut through the Layer Preset Manager.
What is happening...?
Re: Duplicate Layer with layer name + 1?
Posted: 16 Feb 2018, 20:10
by Svengali
kariP wrote: ↑14 Feb 2018, 12:12
%cln %i should (in my logic) give out
I think you must
remove the blank between %cln and %i.
What I get is:
existing Layername becomes
Layername_0
subsequent, new Layername becomes
Layername_1
Layername_2
etc.
Sven
Re: Duplicate Layer with layer name + 1?
Posted: 16 Feb 2018, 21:06
by Sewie
It doesn't work for me, Sven.
I get:
Layername (original layer)
subsequent, new Layername becomes
Layername0
Layername00
Layername000
etc.
Also, I can't seem to assign a shortcut key through the layer preset manager.
Re: Duplicate Layer with layer name + 1?
Posted: 16 Feb 2018, 21:18
by Svengali
Sewie, you are right, I tested it again trying numerous variations and, indeed, it doesn't work as advertised. Too bad, it promises to be very useful...
Wait a minute, try this:
%cln_%i
the underscore parser must be essential... nope, underscore isn't necessary, works with a space: %cln %i
In the end, I think you MUST always go back and re-select the ORIGINAL layer, then the increment seems to work...
Sven
Re: Duplicate Layer with layer name + 1?
Posted: 17 Feb 2018, 09:59
by Sewie
Sven, this does not work for me. I don't know what you've done but if I follow your post I get the strangest results. Perhaps you can add screenshots or something??
Adding an underscore leaves me with.
Layername (original layer)
subsequent, new Layername becomes
Layername_0
Layername_0_0
Layername_0_0_0
I'm going to add that this is a bug in the thread title, perhaps the developers will notice. Because we are running circles here.
Edit;
Wait, I see now what you mean. You have to go back and re-select the original layer before adding a new layer or duplicating, every time. Only then will TVP add an incremental number. I don't see how that is practical in everyday use, so I still think this is a BUG. Either in the software's code or in the team's interpretation of the users workflow.
The problem with not being able to create a shortcut through the Layer Preset Manager remains. (Also a bug I, believe.)
Re: Duplicate Layer with layer name + 1? - BUG REPORT
Posted: 17 Feb 2018, 10:23
by Svengali
That's it... but I think the complication is in making the duplication routine KNOW that the correct root is used in generating increments.
I never took a close look at the New layer options before. In fact, it took me a while to discover how to edit and delete new-layer-definition rules I'd messed up! Once you understand the rules, it is potentially a very useful function for layer manipulation!
Sven
Re: Duplicate Layer with layer name + 1? - BUG REPORT
Posted: 17 Feb 2018, 10:31
by Sewie
Thanks Sven, I see what you mean.
So if this is what the code does now:
1- takes the original layer name as the root name for the layer to be created.
2- next, the entire list of existing layers is searched to find the HIGHEST existing incremented name.
3- finally, another incremental layer is created using a number ONE HIGHER that the highest existing layer with the same root.
Then the solution would be to replace step 1, and instead take the selected layer as the name for the layer to be created? I'm not a coder but hopefully we are offering the team part of a solution for this particular problem.
Re: Duplicate Layer with layer name + 1? - BUG REPORT
Posted: 17 Feb 2018, 13:13
by Animark
I know, it's another thing, but it was inspired by this discussion.
It's my first george-script ever and it just covers the base idea of numbering layers. It works fine for my personal use, but it has some limitations. You get an error message, if the last letter of the layers name is not a number. And it will only increase the last number of the name, so after number 19 you'll get 110, 111, ....
Parts of the script are taken from this posting:
http://forum.tvpaint.com/viewtopic.php?f=34&t=10294
How to use:
1. The script just gives new layer names. The duplicating of a layer is done by (Key:Layer:Duplicate Instances)
2. The layers name has to have a number as the last letter
- doubleLayerPlusNumber.JPG (39.15 KiB) Viewed 33595 times
Re: Duplicate Layer with layer name + 1? - BUG REPORT
Posted: 19 Feb 2018, 14:06
by Animationriver
Big Thanks!!!
Re: Duplicate Layer with layer name + 1? - BUG REPORT
Posted: 20 Feb 2018, 10:26
by Sewie
Thanks, Animark.
That will help for now, though I'd much rather see the bugs in the Layer Management Panel fixed without the addition of yet another custom panel. These things have a tendency of multiplying faster than vermin.
Re: Duplicate Layer with layer name + 1? - BUG REPORT
Posted: 06 Mar 2023, 14:19
by D.T. Nethery
Sewie wrote: ↑17 Feb 2018, 09:59
You have to go back and re-select the original layer before adding a new layer or duplicating, every time. Only then will TVP add an incremental number. I don't see how that is practical in everyday use, so
I still think this is a BUG. Either in the software's code or in the team's interpretation of the users workflow.
The problem with not being able to create a shortcut through the Layer Preset Manager remains. (Also a bug I, believe.)
Sewie wrote: ↑20 Feb 2018, 10:26
Thanks, Animark. That will help for now,
though I'd much rather see the bugs in the Layer Management Panel fixed without the addition of yet another custom panel.
Bump.
The bug reported by Sewie (see his first post above) about the naming/numbering structure in Layer Presets has not been addressed. The scripting tips posted by Svengali and the custom panel posted by Animark present workarounds for the problem , but as Sewie points out , the proliferation of custom panels as workarounds to accomplish what should be built-in to the software can be overwhelming.
Would it be possible to fix this issue with the Layer Presets panel?