Question about layer batch operation
Question about layer batch operation
Question again today.
I always make lots of layers and I separate main color layers and shadow color layers.
Shadow layers are always supposed to have a word "shadow" in its layer name.
For example, names of my layers are something like this
arm_color_main
arm_color_shadow
leg_color_main
leg_color_shadow
body_color_main
body_color_shadow
And I have a question. Is it possible to change opacity of all layers whose layer name has a word "shadow" at once? If it's possible what function will do the trick? If I can do that via george script It will save tons of time.
I always make lots of layers and I separate main color layers and shadow color layers.
Shadow layers are always supposed to have a word "shadow" in its layer name.
For example, names of my layers are something like this
arm_color_main
arm_color_shadow
leg_color_main
leg_color_shadow
body_color_main
body_color_shadow
And I have a question. Is it possible to change opacity of all layers whose layer name has a word "shadow" at once? If it's possible what function will do the trick? If I can do that via george script It will save tons of time.
- Paul Fierlinger
- Posts: 8100
- Joined: 03 May 2008, 12:05
- Location: Pennsylvania USA
- Contact:
Re: Question about layer batch operation
If you give all shadow layers the same layer color, all that needs to be done is to go up into the "Group" folder to the far left of the button with the word "New", select Display Current Group (assuming that a shadow layer is your current active layer). Then dim the transparency on that layer and all the other selected ones will follow.
Paul
http://www.slocumfilm.com
Desktop PC Win10-Pro -64 bit OS; 32.0 GB RAM
Processor: i7-2600 CPU@3.40GHz
AMD FirePro V7900; Intuos4 Wacom tablet
http://www.slocumfilm.com
Desktop PC Win10-Pro -64 bit OS; 32.0 GB RAM
Processor: i7-2600 CPU@3.40GHz
AMD FirePro V7900; Intuos4 Wacom tablet
Re: Question about layer batch operation
It works, but I always use layer group to separate body parts, and it's easy to find where those layers are in layer panel,
like layer group Red for head,layer group Blue for body, layer group Green for arms,etc etc.
Anyway, thank you for your advice.
like layer group Red for head,layer group Blue for body, layer group Green for arms,etc etc.
Anyway, thank you for your advice.
Re: Question about layer batch operation
Code: Select all
PARAM none
loop= 1
i= 0
WHILE loop
tv_LayerGetID i
curLID= result
IF CMP(curLID,"NONE")==0
tv_layerSet curLID
tv_LayerInfo
PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable layerSelection
var(3) = none
// PLEASE NOTICE WE USE NEWPARSE
NewParse(layerName,"_")
IF CMP(var(3),"shadow")==1
tv_LayerDensity 25
END
i= i+1
ELSE
loop=0
END
END
To find the 3rd part I use the function NewParse.
http://wiki.tvpaint.fr/index.php?title= ... divider.29
To make use of this you have to include the basic and advanced functions found here
http://wiki.tvpaint.fr/index.php?title= ... es_:_Basic
http://wiki.tvpaint.fr/index.php?title= ... :_Advanced
Re: Question about layer batch operation
Thank you. It looks great. Thank you for your effort.
But, I get this error
Execution ERROR
NewParse(layerName,"_")
NewParse function won't work correctly. What it the problem?
But, I get this error
Execution ERROR
NewParse(layerName,"_")
NewParse function won't work correctly. What it the problem?
Re: Question about layer batch operation
As I wrote you need to include the basic and advanced procedures which i linked to in my previous post,
You can read about inclusion here
http://wiki.tvpaint.fr/index.php?title=George#INCLUDE
You can read about procedures here
Http://wiki.tvpaint.fr/index.php?title= ... Procedures
That means the newparse procedures wont work unless you make it availeble in your scrpit either simple by copy and paste the prcefure at the end of the script together with the other procedures which newparse is dependable of . Or by having the procedures in a file and then include the file in your scipt with an include comand at the end.
-Mads
You can read about inclusion here
http://wiki.tvpaint.fr/index.php?title=George#INCLUDE
You can read about procedures here
Http://wiki.tvpaint.fr/index.php?title= ... Procedures
That means the newparse procedures wont work unless you make it availeble in your scrpit either simple by copy and paste the prcefure at the end of the script together with the other procedures which newparse is dependable of . Or by having the procedures in a file and then include the file in your scipt with an include comand at the end.
-Mads
Re: Question about layer batch operation
Oh sorry. I thought newparse works independently and added function newparse alone. It works fine now. Thank your.madsjuul wrote:That means the newparse procedures wont work unless you make it availeble in your scrpit either simple by copy and paste the prcefure at the end of the script together with the other procedures which newparse is dependable of . Or by having the procedures in a file and then include the file in your scipt with an include comand at the end.
-Mads
And I tried to include advanced.grg and basic.grg, but it won't work(so I added newparse function to your script.).
I got this error
ERROR: main program can't be truncated
OK
and
LINE XX
ERROR: undeterminated main program limits.
#INCLUDE "my script path"
OK
LINE XX is the end line number where I put #include.
It seems #include can't work correctly.What should I do to work it?
Re: Question about layer batch operation
If you examine the NewParse Procedure You will see that the FIND() Procedure (I highlighted it with red) is not part of the native proceduresZetariver wrote: Oh sorry. I thought newparse works independently and added function newparse alone.
http://wiki.tvpaint.fr/index.php?title= ... _Reference
So you would have to add is as well. to make it work. I think the rest of the functions CMP CUT and LEN is native
FUNCTION NewParse(string,divider)
LOCAL pos i workstr size
i = 0
pos = 1
workstr = string
IF ((CMP(workstr,"") == 0) && (CMP(divider,"") == 0) && (CMP(workstr,divider) == 0))
WHILE ((pos = Find(workstr,divider,1)) > 0)
IF ((pos != 1) && (pos != LEN(workstr)))
i = i+1
var(i) = CUT(workstr,1,pos-1)
workstr = CUT(workstr,pos+1,LEN(workstr))
ELSE
IF (pos == 1)
IF (pos != LEN(workstr))
workstr = CUT(workstr,2,LEN(workstr))
ELSE
workstr = ""
END
ELSE
workstr = CUT(workstr,pos,LEN(workstr))
END
END
END
if (CMP(workstr,0) == 0)
i = i+1
var(i) = workstr
END
END
RETURN i
END
Re: Question about layer batch operation
Always put #include at the end of the scriptZetariver wrote: It seems #include can't work correctly.What should I do to work it?
But start with making a smiple include script
Somthing like this containing only one script
Code: Select all
FUNCTION sayHello()
tv_warn "Hello World"
END
then make another script like this
Code: Select all
PARAM none
sayHello()
#INCLUDE "functions.grg"
and if works start adding functions from advanged.grgr og Basic-grg to the functions.grg script
and see if it at some point breaks
-Mads
Re: Question about layer batch operation
I checked and helloWorld.grg works fine, so my path setting is right.
I put NewParse and Find functions together this way and named it "test.grg" and included it in your script and it works fine.
but if I separate them like this
basic.grg
advanced.grg
and include those basic.grg and advanced.grg, that same error message pops up,
saying "undeterminated main program limits".
I think those basic.grg and advanced.grg does not reference each other's functions?
I put NewParse and Find functions together this way and named it "test.grg" and included it in your script and it works fine.
Code: Select all
FUNCTION Find(string,car,start)
LOCAL i size
i = start
size = LEN(string)
IF ((start <= 0) || (start > size) || (CMP(car,"") == 1))
RETURN -1
END
DO
IF (CMP(CHAR(string,i),car) == 1)
RETURN i
END
UNTIL ((i=i+1) > size)
RETURN 0
END
FUNCTION NewParse(string,divider)
LOCAL pos i workstr size
i = 0
pos = 1
workstr = string
IF ((CMP(workstr,"") == 0) && (CMP(divider,"") == 0) && (CMP(workstr,divider) == 0))
WHILE ((pos = Find(workstr,divider,1)) > 0)
IF ((pos != 1) && (pos != LEN(workstr)))
i = i+1
var(i) = CUT(workstr,1,pos-1)
workstr = CUT(workstr,pos+1,LEN(workstr))
ELSE
IF (pos == 1)
IF (pos != LEN(workstr))
workstr = CUT(workstr,2,LEN(workstr))
ELSE
workstr = ""
END
ELSE
workstr = CUT(workstr,pos,LEN(workstr))
END
END
END
if (CMP(workstr,0) == 0)
i = i+1
var(i) = workstr
END
END
RETURN i
END
but if I separate them like this
basic.grg
Code: Select all
FUNCTION Find(string,car,start)
LOCAL i size
i = start
size = LEN(string)
IF ((start <= 0) || (start > size) || (CMP(car,"") == 1))
RETURN -1
END
DO
IF (CMP(CHAR(string,i),car) == 1)
RETURN i
END
UNTIL ((i=i+1) > size)
RETURN 0
END
Code: Select all
FUNCTION NewParse(string,divider)
LOCAL pos i workstr size
i = 0
pos = 1
workstr = string
IF ((CMP(workstr,"") == 0) && (CMP(divider,"") == 0) && (CMP(workstr,divider) == 0))
WHILE ((pos = Find(workstr,divider,1)) > 0)
IF ((pos != 1) && (pos != LEN(workstr)))
i = i+1
var(i) = CUT(workstr,1,pos-1)
workstr = CUT(workstr,pos+1,LEN(workstr))
ELSE
IF (pos == 1)
IF (pos != LEN(workstr))
workstr = CUT(workstr,2,LEN(workstr))
ELSE
workstr = ""
END
ELSE
workstr = CUT(workstr,pos,LEN(workstr))
END
END
END
if (CMP(workstr,0) == 0)
i = i+1
var(i) = workstr
END
END
RETURN i
END
saying "undeterminated main program limits".
I think those basic.grg and advanced.grg does not reference each other's functions?
Re: Question about layer batch operation
I came to thinbk of maybeyou can't include 2 include scripts at one point.
This will not work
But years ago I collected the two files basic and Advanced in one file so I have not had this problems
-Mads
This will not work
Code: Select all
PARAM none
sayHello()
#INCLUDE basic.grg
#INCLUDE advanced.grg
-Mads
Re: Question about layer batch operation
I didn't know 2 include does not work. Thank you for checking it.
Anyway, thank you for your script again.
I will use your nice opacity control script.
Your script teaches me how to handle layer elements in TVPaint and It will save tons of time for me.
Anyway, thank you for your script again.
I will use your nice opacity control script.
Your script teaches me how to handle layer elements in TVPaint and It will save tons of time for me.
Re: Question about layer batch operation
You are welcome. Glad I could help.
Re: Question about layer batch operation
I can see it has been discussed before
http://forum.tvpaint.com/viewtopic.php? ... ude#p29015
http://forum.tvpaint.com/viewtopic.php? ... ude#p29015