Page 1 of 1
Save separate layers
Posted: 28 Sep 2006, 14:18
by Manuel
Here is the george script.
Use it at your own risk.
There is a path request at the start of the script.
Type a valid existing path.
Example : c:\
The layers are saved as avi
If you want another format you must edit the code.
Example :
if you want deep format change
Code: Select all
Extension = ".avi"
tv_SaveMode "AVI"
to
Code: Select all
Extension = ".dip"
tv_SaveMode "DEEP"
The layer's names are used for filename.
NO SPACE ALLOWED in the layer's name
Use different name for each layer.
If you find bugs, please report them here.
Thank you.
Posted: 28 Sep 2006, 15:37
by Manuel
If you don't want to type the path each time, open the script in a text editor and replace
Code: Select all
tv_ReqString "Enter Path (ending by \)"
path = result
by
d:\mypath\ must be a valid, existing directory.
This way, all the files will always be saved in the same directory.
Posted: 29 Sep 2006, 11:31
by Manuel
Here is a special version that save in QuickTime format with alpha.
Don't forget to set up the path variable in the script.
By default, it is set to "c:\" .
IMPORTANT
You will lose your current brush if you use the script!!!
Posted: 01 Oct 2006, 13:34
by malcooning
Manuel,
I kiss you. this script is perfect. works like a charm, and very smooth.
This should be embedded in the next release of tvpaint for certain.
Thank you for taking time to see to this script.
I wish I had the patience to learn the code and write my own scripts.
This will add a whole new dimension of tvpaint experince for me!
thank you millions.
A.
Posted: 05 Mar 2007, 09:42
by malcooning
hey Manuel,
I have tried to use SaveSeperateLayersAlpha.grg script in TVP pro, but something is not working right. When I run the script, it shows as if it is indeed exporting the layers, but no files are being added to the path that I put in the script (I made sure it ended with a \). I tried then the SaveSeparateLayers.grg, and after it brings the location request, it shows again as if it is exporting, but no files are written.
Can you please try the script in TVP pro?
cheers,
a.
Posted: 05 Mar 2007, 11:37
by Manuel
Restart TVPAP.
Check your export file format.
Export one layer by hand to see if it works.
No space in layer name and path, try root path (c:/ d:/ ...).
Try the script on standard resolution (/16 ?).
Script not tested on Mac.
Posted: 05 Mar 2007, 11:48
by malcooning
ah, of course, I made a mistake which was covered in September still...
The layer names - I didn't check for space in layer names...
it's fine now. Nowadays I'm not taking time to find the source of problems. I guess that life in London make me a bit impatient.
sorry to hassle you for this Manuel,
and thank you.
a.
Re: Save separate layers
Posted: 08 Apr 2013, 11:46
by fran125
Hello ,
I ve try your script on TVPaint 10.0.11 but it s don t work.
The script create image but without any information on.
In fact i think the script hide all layer during export and don t show anyone.
Sorry for my bad english and thanks for your sharing.
Re: Save separate layers
Posted: 08 Apr 2013, 12:00
by Fabrice
fran125 wrote:Hello ,
I ve try your script on TVPaint 10.0.11 but it s don t work.
The script create image but without any information on.
In fact i think the script hide all layer during export and don t show anyone.
Sorry for my bad english and thanks for your sharing.
Answering 6 years after the creation of the topic
Fran125, please introduce yourself, otherwise your message might be considered as spam.
If not spammer, please update your software to the lastest TVPaint Animation 10.0.17.
Re: Save separate layers
Posted: 20 Sep 2013, 17:10
by my1ironlung
hey dudes i uploaded a tweek of this script. it will now export into seperate folders named L01, L02, L03, if you create the folders and specify a root path. also no need to add back slashes, and instead of using the layer name for the image names, you can make your own name when you put in the shot number. we needed this for a more professional pipeline.
one thing i can't figure out is how to get the layers exporting a hold at the end of the layer, or how to specify a mark in mark out point. but whatever. great job on the original script.
Re: Save separate layers
Posted: 16 Oct 2014, 13:43
by my1ironlung
hello, well i guess no one cares anymore, but i updated this script, it now will only export the layers that you have turned on, any layers with visibility turned off will be skipped. it will however keep the naming order. for example if you have 3 layers, and layer 2 is turned off, it will export layer 1 and 3.
Again, make sure you have made folders for these layers: L01, L02, L03, enough for all your layers.
hope this helps someone out there.
harry
Re: Save separate layers
Posted: 09 Jun 2016, 23:57
by my1ironlung
I'm very excited to see that they have included a similar script in the latest TVP 11 version. it really makes me love this software, as it seems that tvpaint really takes these forums into account.
i've tweaked their script a bit for optimization. it doesn't export unnecessary blank frames at the end of the sequence for layers that end early, and i've changed the naming conventions a bit so it is easier to import these images into another compositing software and keep everything in order.
Be careful not to include backslashes or any weird symbols in your layer names, it might have a hard time making the directories.
so here's the script:
Code: Select all
#param none
tv_getpath "home" //path par defaut
srcFolder=result
tv_readuserstring "ExportDigital" "folder" srcFolder
srcFolder=result
//Ouverture du file requester
requester = FileRequester("<Select a folder to save in...",srcFolder,srcFile,"*.txt")
IF ( requester!=1 )
EXIT
END
tv_SaveMode "PNG" "b32"
tv_AlphaSaveMode NoPreMultiply
tv_layercurrentid
InitLayer = result
tv_layergetimage
InitImage = result
tv_firstimage
startingFrame= result
CurrentImage = startingFrame
tv_lastimage
LastImage = result
tv_clipcurrentid
ClipID = result
//tv_clipname ClipID
//ClipName = result
//these two lines above have been turned off, they identify the export by clip names.
//i've changed to project name below
tv_ProjectCurrentID
projectID = result
//tv_GetProjectName projectID
//ClipName = result
//tv_warn ClipName
tv_ReqString "hold up, what are we calling this? (ex: shot 1 = 'SH0010')."
ClipName=result
//run pre export sequence to create folders, folder paths and determine post behaviors ----------------------------------->
tv_LockDisplay "Initiating..."
layerRun = 1
layerCount = 0
WHILE ( layerRun == 1 )
tv_LayerGetID layerCount
layerID = result
IF ( CMP( layerID, "NONE" ) != 0 )
layerRun = 0
ELSE
//tv_Warn "layer " layerCount+1 " exists"
tv_LayerSet layerID
tv_LayerInfo
PARSE result layerDisplay a2 a3 layerName a5 imagePos imageEnd a7 a8 a9 dummy
IF ( CMP( layerDisplay, "OFF" ) == 0 )
// postBehavior test
tv_layerpostbehavior layerID
endBehavior = result
//tv_Warn "Layer" layerCount+1 "end behavior is " endBehavior"."
test = CMP(endBehavior, "none")
IF (test == 1)
layerBehavior[layerCount] = 0
ELSE
layerBehavior[layerCount] = 1
END //end endbehavior test
//-------------------------create folder,
numlayer = layerCount+1
foldername = pathname
IF ( numlayer < 10 )
foldername = foldername"L0"numlayer"_"layerName
folderpath[layerCount] = foldername"/"ClipName"_L0"numlayer"_"layerName
ELSE
foldername = foldername"L"numlayer"_"layerName
folderpath[layerCount] = foldername"/"ClipName"_L"numlayer"_"layerName
END
//tv_Warn "The folder path is " foldername
tv_WriteTextFile "Exists" '"'foldername'"'
exist = result
IF ( CMP( exist, "0" ) != 0 ) //Si le dossier n'existe pas
tv_WriteTextFile "MkDir" '"'foldername'"'
ELSE
END
// ---------------------end create folder
ELSE
END
layerCount = layerCount + 1
END
END
tv_UnLockDisplay
//end pre export sequence to create folders, folder paths and determine post behaviors ----------------------------------->
layerRun = 1
layerPos = 0
WHILE ( layerRun == 1 )
tv_LayerGetID layerPos
layerID = result
IF ( CMP( layerID, "NONE" ) == 0 )
//tv_Warn "layer " layerPos " is being run"
v3=layerPos+1
//v1 = layerPos+1+layerCount*CurrentImage
//v2 = layerCount*(LastImage+1)
tv_LayerSet layerID
tv_LayerInfo
PARSE result layerDisplay a2 a3 layerName a5 imagePos imageEnd a7 a8 a9 dummy
//tv_Warn "layer " layerPos " ending frame is" imageEnd
IF ( CMP( layerDisplay, "OFF" ) == 0 )
IF (layerBehavior[layerPos]==0)
endingFrame=imageEnd
ELSE
endingFrame= LastImage
END //end endbehavior test
CurrentImage = startingFrame
FOR CurrentImage = startingFrame TO endingFrame
exportImage=CurrentImage+1
tv_LockDisplay "Exporting... (layer "v3", image "exportImage" )"
tv_layerImage CurrentImage
IF ( exportImage < 10 )
finalPath = folderPath[layerPos]"_000"exportImage
ELSE
IF ( exportImage < 100 )
finalPath = folderPath[layerPos]"_00"exportImage
ELSE
IF ( exportImage < 1000 )
finalPath = folderPath[layerPos]"_0"exportImage
ELSE
finalPath = folderpath[layerPos]"_"exportImage
END // if<1000
END //if <100
END //if<10
tv_saveimage finalPath
//CurrentImage=CurrentImage+1
tv_UnLockDisplay
END //For current image
END // if layer is displayed
layerPos = layerPos + 1
ELSE //the layer doesn't exist
layerRun = 0
END // if layer exists
END //while layerRun=1
tv_layerSet InitLayer
tv_layerImage InitImage
//------------------------------------------
//
// FileRequester
//
// Function: open a file requester
//
// Call: FileRequester(title,path,file,pattern)
//
// Arguments:
// title = requester title
// path = default directory
// file = default filename
// pattern = default pattern
//
// Return: 0 if user clicks on Cancel
// 1 if user chooses a file. This
// function creates three global
// variables: fullpath ( path+name+
// extension ), pathname (path
// to choosen file), filename
// (name of choosen file without
// extension) and extension
// (extension of choosen file)
//
//------------------------------------------
FUNCTION FileRequester(title,path,file,pattern)
LOCAL point slash size titre
fullname = ""
fullpath = ""
pathname = ""
filename = ""
extension = ""
IF (CMP(pattern,0) == 1)
titre = "|"
ELSE
titre = "|"pattern
extension = CUT( pattern, 2, LEN( pattern ) )
END
IF (CMP(file,0) == 1)
titre = "|"titre
ELSE
titre = "|"file""titre
END
IF (CMP(path,0) == 1)
titre = "|"titre
ELSE
titre = "|"path""titre
END
IF (CMP(title,0) == 1)
titre = "Choose a file"titre
ELSE
titre = title""titre
END
tv_ReqFile titre
fullname = Result
size = LEN(fullname)
fullname = Replace(fullname,"\","/")
IF (CMP(fullname,"Cancel") == 1)
RETURN 0
END
fullpath = CUT( fullname, LEN(fullname) - LEN( extension ) + 1, LEN(fullname) )
IF ( CMP( fullpath, extension ) == 1 )
fullpath = fullname
fullname = CUT( fullname, 1, LEN(fullname) - LEN( extension ) )
ELSE
fullpath = fullname""extension
END
start = 1
stop = 1
WHILE ( start > 0 )
start = Find( fullname, "/", stop )
IF ( start > 0 )
stop = start +1
END
END
pathname = CUT( fullpath, 1, stop - 1 )
filename = CUT( fullname, stop + 1, LEN( fullname ) )
RETURN 1
END
//------------------------------------------
//
// Replace
//
// Function: replace each occurence of a
// substring into a string with
// another string
//
// Call: Replace(string,search,repl)
//
// Arguments:
// string = characters string
// search = substring to look for
// repl = replacement substring
//
// Return: result string after replacement
//
//------------------------------------------
FUNCTION Replace(string,search,repl)
LOCAL pos workstr str1 str2 size
pos = 1
workstr = string
size = LEN(search)
WHILE ((pos = FindString(workstr,search,pos)) > 0)
IF (pos == 1)
str1 = CUT(workstr,size+1,LEN(workstr))
workstr = repl""str1
pos = 0
ELSE
str1 = CUT(workstr,1,pos-1)
IF ((pos+size) < LEN(workstr))
str2 = CUT(workstr,pos+size,LEN(workstr))
workstr = str1""repl""str2
ELSE
workstr = str1""repl
END
END
pos = pos+LEN(repl)
END
RETURN workstr
END
//------------------------------------------
//
// FindString
//
// Function: find a substring into a string
// from a specified start position
//
// Call: FindString(string,search,start)
//
// Arguments:
// string = characters string
// search = substring to look for
// start = start position in string
// Return: start position of substring
// 0 if substring does not exist
// into string
// -1 if invalid start position
// (negative, null or higher
// than string length) or if
// substring is empty
//
//------------------------------------------
FUNCTION FindString(string,search,start)
LOCAL found j pos lastpos lstr lsrch
found = 0
lastpos = start
lstr = LEN(string)
lsrch = LEN(search)
IF (CMP(search,"") == 1)
RETURN -1
END
WHILE ((pos = Find(string,CHAR(search,1),lastpos)) > 0)
j = 1
found = 1
IF (j == lsrch)
RETURN pos
END
WHILE ((j < lsrch) && (found == 1))
IF ((pos+j) > lstr)
RETURN 0
ELSE
IF (CMP(CHAR(search,j+1),CHAR(string,pos+j)) == 0)
lastpos = pos+j
found = 0
END
END
j = j+1
END
IF (found == 1)
RETURN pos
END
END
RETURN pos
END
//------------------------------------------
//
// Find
//
// Function: find a character into a string
// from a specified start position
//
// Call: Find(string,car,start)
//
// Arguments:
// string = characters string
// car = character to look for
// start = start position in string
//
// Return: position of character
// 0 if character does not exist
// into string
// -1 if invalid position
// (negative, null or higher
// than string length)
//
//------------------------------------------
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
Re: Save separate layers
Posted: 10 Jun 2016, 04:44
by Elodie
my1ironlung wrote:I'm very excited to see that they have included a similar script in the latest TVP 11 version. it really makes me love this software, as it seems that tvpaint really takes these forums into account.
We do take in account our users' needs, both on these forums and in real life too (when we visit studios and schools, or during animation fairs like Annecy or CTN Expo
)
Thank you for sharing your own version of the script Btw