automatic PNG export

A forum dedicated to George scripting questions
User avatar
Eric Scholl
Posts: 1303
Joined: 04 Apr 2011, 14:40

Re: automatic PNG export

Post by Eric Scholl »

idragosani wrote:I am getting dynamic link errors when trying this on Linux:

$ /usr/share/tvpaint-developpement/tvp-animation-10-pro/tvp-animation-10-pro ~/Projects/animations/Tales\ from\ the\ Perilous\ Quill/Episode_1/the_birthday_party.tvpp cmd="tv_SaveMode PNG" cmd="tv_AlphaSaveMode NoPreMultiply" cmd="tv_Background NONE" cmd="tv_SaveSequence ./file.png"

nOS::GetProcAddress() : Cannot load symbols: /usr/share/tvpaint-developpement/tvp-animation-10-pro/plugins/saver/FFmpeg.so: undefined symbol: CreateSaverFormatnOS::GetProcAddress() : Cannot load symbols: /usr/share/tvpaint-developpement/tvp-animation-10-pro/plugins/saver/FFmpeg.so: undefined symbol: CreateSaverFormat2

Same happens if I use a script on the command-line instead.

Exporting works fine if I do it through the GUI.
Hi idragosani,

Actually, the message isn't really an error. So it doesn't affect TVPaint.
What happens when you type only this command :

$ /usr/share/tvpaint-developpement/tvp-animation-10-pro/tvp-animation-10-pro ~/Projects/animations/Tales\ from\ the\ Perilous\ Quill/Episode_1/the_birthday_party.tvpp

Does it load the project correctly ?
User avatar
idragosani
Posts: 987
Joined: 06 May 2008, 00:39
Location: Germantown MD
Contact:

Re: automatic PNG export

Post by idragosani »

Yeah, the project loads just fine, just can't get the command itself to run
Brett W. McCoy -- http://www.brettwmccoy.com
TVP Pro 10 : Intel i7 2600 3.4 GHz : 8GB RAM : Ubuntu Studio 14.04 : Cintiq 21UX
User avatar
Mike
Posts: 1050
Joined: 16 Feb 2006, 08:58

Re: automatic PNG export

Post by Mike »

Can you write your command line (with the 4 commands) on your console (and not copy/paste it) to see what happens ?

What happens if you remove the 4 commands and use a simple command instead after the project name (like cmd="tv_warn blablabla") ?
TVPaint Team
User avatar
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Re: automatic PNG export

Post by Lukas »

We're also looking for a solution to get exporting away from the animator, and give it to the server.
  • 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
User avatar
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Re: automatic PNG export

Post by Lukas »

Mike wrote:You can use this commands as an embedded george script in a custom panel:

//------------------------------------------------------------------------------------
tv_SaveMode "PNG"
tv_AlphaSaveMode "NoPreMultiply"
tv_Background "NONE"
bg = result

tv_SaveSequence "C:/Users/XXX/Desktop/dir/file.png"

tv_Background bg
//------------------------------------------------------------------------------------

To choose the path, you can do several embedded george scripts which contain their own path, or use the command tv_ReqFile to open the browser to select the file to save
Can I somehow use this to export a TIFF sequence using the name of the clip as filename. And using the Point in + Point out as the mark in and mark out of the sequence?
I'd also want it to use the Camera view with no conversion (so it uses camera framerate and resolution).

Nothing I've tried works. It doesn't generate any files. I've been looking at the george wiki but some help would be appreciated.
  • 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
User avatar
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Re: automatic PNG export

Post by Lukas »

anyone?
  • 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
User avatar
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18

Re: automatic PNG export

Post by Mads Juul »

Lukas wrote:anyone?
Hi Lukas Try This

Code: Select all

PARAM none

tv_saveMode "TIFF"
ext = ".tif"
tv_AlphaSaveMode "None"
tv_Background "COLOR"



tv_GetProjectName
projectpath = result

tv_WriteTextFile "Exists" projectpath
testPath = result
IF CMP(testPath,projectpath)==0
	tv_warn "TVP PROJECT IS NOT SAVED"
ELSE
	projectpath = Replace(projectpath,'\','/')
	strlen = LEN(projectpath)
	last = LastPos(projectpath,"/")
	projectdir = LeftString(projectpath,last-1)
	projectname = RightString(projectpath,strlen-last)
	strlen = LEN(projectname)
	last = LastPos(projectname,".")
	IF CMP(last,"0")==1
		projectbase = projectname
	ELSE
		projectbase = LeftString(projectname,last-1)
	END
	saveDir = projectdir"/"projectbase
	tv_WriteTextFile "Remove" saveDir
	tv_WriteTextFile "MkDir" saveDir
	//get clip in
	tv_markIn clip
	PARSE result frame state
	IF CMP(state,"set ")==1
		inpoint = frame
	ELSE
		tv_firstImage
		inpoint = result
	END
	//Get Clip Out
	tv_markOut clip
	PARSE result frame state
	IF CMP(state,"set ")==1
		outpoint = frame
	ELSE
		tv_LastImage
		outpoint = result
	END
	//findProjectinout
	tv_layerImage inpoint
	tv_projectcurrentframe
	projIN = result
	tv_projectcurrentframe projIN
	
	tv_layerImage outpoint
	tv_projectcurrentframe
	projOUT = result
	tv_projectcurrentframe projOUT
	tv_clipname
	clipName = result
	tv_startFrame
	startFrame = inpoint+result
	renderFile = saveDir"/"clipName"_000"startFrame""ext
	tv_projectsavesequence renderFile projIN projOUT "camera"
	
END





//{{{ Find
//------------------------------------------
//
//	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
//}}}

//{{{ FirstPos(string,car)
//------------------------------------------
//
//	FirstPos
//
//	Function: find first occurence of a
//			  character into a string
//
//	Call: FirstPos(string,car)
//
//	Arguments:
//		string = characters string
//		car    = character to look for
//
//	Return: position of character
//			or 0 id character does not
//			exist into string.
//
//------------------------------------------

FUNCTION FirstPos(string,car)
	RETURN Find(string,car,1)
END
//}}}

//{{{ LastPos(string,car)
//------------------------------------------
//
//	LastPos
//
//	Function: find last occurence of a
//			  character into a string
//
//	Call: LastPos(string,car)
//
//	Arguments:
//		string = characters string
//		car    = character to look for
//
//	Return: position of character
//			or 0 if character does not
//			exist into string.
//
//------------------------------------------

FUNCTION LastPos(string,car)
	LOCAL loop  myChar 
	pos = LEN(string)
	loop = 1
	WHILE loop
		myChar = CHAR(string,pos)
		
		IF CMP(myChar,car) == 1
			loop =0
		ELSE
			pos = pos-1
		END
		IF pos<1
			loop=0
		END
	END
	RETURN pos
END
//}}}

//{{{ FindString(string,search,start)
//------------------------------------------
//
//	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
//}}}

//{{{ LeftString(string,number)
//------------------------------------------
//
//	LeftString
//
//	Function: extract a substring beginning
//            at the start of a string
//			   
//	Call: LeftString(string,number)
//
//	Arguments:
//		string  = characters string
//		number  = number of character to
//			      extract from string
//
//	Return: result substring
//			or 0 if number is negative
//          or null.
//
//------------------------------------------

FUNCTION LeftString(string,number)
	LOCAL size
	size = LEN(string)
	
	IF (number > 0)
		IF (number > size)
			number = size
		END
		RETURN CUT(string,1,number)
	END
	RETURN 0
END
//}}}

//{{{ RightString(string,number)
//------------------------------------------
//
//	RightString
//
//	Function: extract a substring ending
//            at the end of a string
//
//	Call: RightString(string,number)
//
//	Arguments:
//		string  = characters string
//		number  = number of character to
//			      extract from string
//
//	Return: result substring
//			or 0 if number is negative
//          or null.
//
//------------------------------------------

FUNCTION RightString(string,number)
	LOCAL size
	size = LEN(string)
	
	IF (number > 0)
		IF (number > size)
			number = size
		END
		RETURN CUT(string,size-number+1,size)
	END
	RETURN 0
END
//}}}

//{{{ MidString(string,first,size)
//------------------------------------------
//
//	MidString
//
//	Function: extract a substring from a
//			  string
//
//	Call: MidString(string,first,size)
//
//	Arguments:
//		string  = characters string
//		first   = start position in string
//				  cha�ne
//		size    = number of characters
//
//	Return: result substring
//			or 0 if number or first are
//          negatives or null.
//
//------------------------------------------

FUNCTION MidString(string,first,size)
	LOCAL ln
	ln = LEN(string)
	
	IF ((first > 0) && (size > 0))
		IF ((first+size-1) > ln)
			size = ln-first+1
		END
		RETURN CUT(string,first,first+size-1)
	END
	RETURN 0
END
//}}}

//{{{ Replace
//------------------------------------------
//
//	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
//}}}


User avatar
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Re: automatic PNG export

Post by Lukas »

madsjuul wrote:Hi Lukas Try This
Wow! Thanks a lot Madsjuul! That's a lot to wrap my head around :)

I've put it in an embedded george script in a button, but so far all I'm getting is "TVP PROJECT IS NOT SAVED".

This gives me a path though, so I'm not sure what's going on.

Code: Select all

tv_GetProjectName
#print result
I don't understand what this part does:

Code: Select all

tv_WriteTextFile "Exists" projectpath
testPath = result
  • 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
User avatar
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18

Re: automatic PNG export

Post by Mads Juul »

Lukas wrote: I've put it in an embedded george script in a button, but so far all I'm getting is "TVP PROJECT IS NOT SAVED".
The script should work the way that it creates a folder in the same fplder as the tvpp file is saved, and the folder have the same name as the tvpp file. So if the tvpp file is not saved somewhere the script will not work.

But here it is probably the filepath with whitespace issue. see below
Lukas wrote: I don't understand what this part does:

Code: Select all

tv_WriteTextFile "Exists" projectpath
testPath = result
We can check if a folder/ files exists with the command tv_WriteTextFile "Exists" filePath
I check if the project path to the tvpp file exists to see if the tvpp project is saved and there by there is a folder I can save the TIFF.

If the filePath exists the goerge command will return the filepath if not it will return nothing.(I think)
http://wiki.tvpaint.fr/index.php?title=Tv_WriteTextFile

I can see i forgot to enclose the filePath with '"' to make it work with filepath that have white spaces inside
Here is a new version.

Code: Select all

PARAM none

tv_saveMode "TIFF"
ext = ".tif"
tv_AlphaSaveMode "None"
tv_Background "COLOR"


tv_GetProjectName
projectpath = result

tv_WriteTextFile "Exists" '"'projectpath'"'
testPath = result

IF CMP(testPath,projectpath)==0
	tv_warn "TVP PROJECT IS NOT SAVED"
ELSE
	tv_layerGetImage
	startImage = result
	
	projectpath = Replace(projectpath,'\','/')
	strlen = LEN(projectpath)
	last = LastPos(projectpath,"/")
	projectdir = LeftString(projectpath,last-1)
	projectname = RightString(projectpath,strlen-last)
	strlen = LEN(projectname)
	last = LastPos(projectname,".")
	IF CMP(last,"0")==1
		projectbase = projectname
	ELSE
		projectbase = LeftString(projectname,last-1)
	END
	saveDir = projectdir"/"projectbase
	tv_WriteTextFile "Remove" '"'saveDir'"'
	tv_WriteTextFile "MkDir" '"'saveDir'"'
	//get clip in
	tv_markIn clip
	PARSE result frame state
	IF CMP(state,"set ")==1
		inpoint = frame
	ELSE
		tv_firstImage
		inpoint = result
	END
	//Get Clip Out
	tv_markOut clip
	PARSE result frame state
	IF CMP(state,"set ")==1
		outpoint = frame
	ELSE
		tv_LastImage
		outpoint = result
	END
	//findProjectinout
	tv_layerImage inpoint
	tv_projectcurrentframe
	projIN = result
	tv_projectcurrentframe projIN
	
	tv_layerImage outpoint
	tv_projectcurrentframe
	projOUT = result
	tv_projectcurrentframe projOUT
	tv_clipname
	clipName = result
	tv_startFrame
	startFrame = inpoint+result
	renderFile = saveDir"/"clipName"_000"startFrame""ext
	tv_projectsavesequence '"'renderFile'"' projIN projOUT "camera"
	
	tv_layerImage startImage
END





//{{{ Find
//------------------------------------------
//
//	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
//}}}

//{{{ FirstPos(string,car)
//------------------------------------------
//
//	FirstPos
//
//	Function: find first occurence of a
//			  character into a string
//
//	Call: FirstPos(string,car)
//
//	Arguments:
//		string = characters string
//		car    = character to look for
//
//	Return: position of character
//			or 0 id character does not
//			exist into string.
//
//------------------------------------------

FUNCTION FirstPos(string,car)
	RETURN Find(string,car,1)
END
//}}}

//{{{ LastPos(string,car)
//------------------------------------------
//
//	LastPos
//
//	Function: find last occurence of a
//			  character into a string
//
//	Call: LastPos(string,car)
//
//	Arguments:
//		string = characters string
//		car    = character to look for
//
//	Return: position of character
//			or 0 if character does not
//			exist into string.
//
//------------------------------------------

FUNCTION LastPos(string,car)
	LOCAL loop  myChar 
	pos = LEN(string)
	loop = 1
	WHILE loop
		myChar = CHAR(string,pos)
		
		IF CMP(myChar,car) == 1
			loop =0
		ELSE
			pos = pos-1
		END
		IF pos<1
			loop=0
		END
	END
	RETURN pos
END
//}}}

//{{{ FindString(string,search,start)
//------------------------------------------
//
//	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
//}}}

//{{{ LeftString(string,number)
//------------------------------------------
//
//	LeftString
//
//	Function: extract a substring beginning
//            at the start of a string
//			   
//	Call: LeftString(string,number)
//
//	Arguments:
//		string  = characters string
//		number  = number of character to
//			      extract from string
//
//	Return: result substring
//			or 0 if number is negative
//          or null.
//
//------------------------------------------

FUNCTION LeftString(string,number)
	LOCAL size
	size = LEN(string)
	
	IF (number > 0)
		IF (number > size)
			number = size
		END
		RETURN CUT(string,1,number)
	END
	RETURN 0
END
//}}}

//{{{ RightString(string,number)
//------------------------------------------
//
//	RightString
//
//	Function: extract a substring ending
//            at the end of a string
//
//	Call: RightString(string,number)
//
//	Arguments:
//		string  = characters string
//		number  = number of character to
//			      extract from string
//
//	Return: result substring
//			or 0 if number is negative
//          or null.
//
//------------------------------------------

FUNCTION RightString(string,number)
	LOCAL size
	size = LEN(string)
	
	IF (number > 0)
		IF (number > size)
			number = size
		END
		RETURN CUT(string,size-number+1,size)
	END
	RETURN 0
END
//}}}

//{{{ MidString(string,first,size)
//------------------------------------------
//
//	MidString
//
//	Function: extract a substring from a
//			  string
//
//	Call: MidString(string,first,size)
//
//	Arguments:
//		string  = characters string
//		first   = start position in string
//				  cha�ne
//		size    = number of characters
//
//	Return: result substring
//			or 0 if number or first are
//          negatives or null.
//
//------------------------------------------

FUNCTION MidString(string,first,size)
	LOCAL ln
	ln = LEN(string)
	
	IF ((first > 0) && (size > 0))
		IF ((first+size-1) > ln)
			size = ln-first+1
		END
		RETURN CUT(string,first,first+size-1)
	END
	RETURN 0
END
//}}}

//{{{ Replace
//------------------------------------------
//
//	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
//}}}


User avatar
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18

Re: automatic PNG export

Post by Mads Juul »

I put in some comments so it is easier to understand

Code: Select all

PARAM none

tv_saveMode "TIFF"
ext = ".tif"
tv_AlphaSaveMode "None"
tv_Background "COLOR"


tv_GetProjectName
projectpath = result

tv_WriteTextFile "Exists" '"'projectpath'"'
testPath = result

IF CMP(testPath,projectpath)==0
	tv_warn "TVP PROJECT IS NOT SAVED"
ELSE
	// Save Current Frame So I CAN SET IT AT THE END OF SCRIPT
	tv_layerGetImage
	startImage = result
	
	// MAKINFG THE SCRIPT WORK ON WINDOWS AND MAC , Windows has directory seperated by \ and mac and linux with /
	projectpath = Replace(projectpath,'\','/')
	strlen = LEN(projectpath)
	last = LastPos(projectpath,"/")
	// Getting the directory where the TVPP file is saved
	projectdir = LeftString(projectpath,last-1)
	// getting the name of the tvpp file without the path
	projectname = RightString(projectpath,strlen-last)
	// getting the name of the tvpp file without ".tvpp"
	strlen = LEN(projectname)
	last = LastPos(projectname,".")
	IF CMP(last,"0")==1
		projectbase = projectname
	ELSE
		projectbase = LeftString(projectname,last-1)
	END
	// Create the dir with the TIFF is saved in
	saveDir = projectdir"/"projectbase
	// First I remove it or delete it so old files will be deleted!!
	tv_WriteTextFile "Remove" '"'saveDir'"'
	// now I create again
	tv_WriteTextFile "MkDir" '"'saveDir'"'
	
	// Here I get the in point and out point of the clip if the maeks is disabled I get the clip in out instead
	//get clip in
	tv_markIn clip
	PARSE result frame state
	IF CMP(state,"set ")==1
		inpoint = frame
	ELSE
		tv_firstImage
		inpoint = result
	END
	//Get Clip Out
	tv_markOut clip
	PARSE result frame state
	IF CMP(state,"set ")==1
		outpoint = frame
	ELSE
		tv_LastImage
		outpoint = result
	END
	
	//findProjectinout
	// Because I have to use tv_projectsavesequence to use the camera out I have to get the clip in and out in the project timeline
	// for this I use tv_projectcurrentframe
	tv_layerImage inpoint
	tv_projectcurrentframe
	projIN = result
	tv_projectcurrentframe projIN
	tv_layerImage outpoint
	tv_projectcurrentframe
	projOUT = result
	tv_projectcurrentframe projOUT
	
	// getting the name of the current clip to file prefix
	tv_clipname
	clipName = result
	tv_startFrame
	startFrame = inpoint+result
	// setting the name of the first file
	renderFile = saveDir"/"clipName"_000"startFrame""ext
	// saving the TIFF
	tv_projectsavesequence '"'renderFile'"' projIN projOUT "camera"
	// setting the current frame again
	tv_layerImage startImage
END





//{{{ Find
//------------------------------------------
//
//	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
//}}}

//{{{ FirstPos(string,car)
//------------------------------------------
//
//	FirstPos
//
//	Function: find first occurence of a
//			  character into a string
//
//	Call: FirstPos(string,car)
//
//	Arguments:
//		string = characters string
//		car    = character to look for
//
//	Return: position of character
//			or 0 id character does not
//			exist into string.
//
//------------------------------------------

FUNCTION FirstPos(string,car)
	RETURN Find(string,car,1)
END
//}}}

//{{{ LastPos(string,car)
//------------------------------------------
//
//	LastPos
//
//	Function: find last occurence of a
//			  character into a string
//
//	Call: LastPos(string,car)
//
//	Arguments:
//		string = characters string
//		car    = character to look for
//
//	Return: position of character
//			or 0 if character does not
//			exist into string.
//
//------------------------------------------

FUNCTION LastPos(string,car)
	LOCAL loop  myChar 
	pos = LEN(string)
	loop = 1
	WHILE loop
		myChar = CHAR(string,pos)
		
		IF CMP(myChar,car) == 1
			loop =0
		ELSE
			pos = pos-1
		END
		IF pos<1
			loop=0
		END
	END
	RETURN pos
END
//}}}

//{{{ FindString(string,search,start)
//------------------------------------------
//
//	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
//}}}

//{{{ LeftString(string,number)
//------------------------------------------
//
//	LeftString
//
//	Function: extract a substring beginning
//            at the start of a string
//			   
//	Call: LeftString(string,number)
//
//	Arguments:
//		string  = characters string
//		number  = number of character to
//			      extract from string
//
//	Return: result substring
//			or 0 if number is negative
//          or null.
//
//------------------------------------------

FUNCTION LeftString(string,number)
	LOCAL size
	size = LEN(string)
	
	IF (number > 0)
		IF (number > size)
			number = size
		END
		RETURN CUT(string,1,number)
	END
	RETURN 0
END
//}}}

//{{{ RightString(string,number)
//------------------------------------------
//
//	RightString
//
//	Function: extract a substring ending
//            at the end of a string
//
//	Call: RightString(string,number)
//
//	Arguments:
//		string  = characters string
//		number  = number of character to
//			      extract from string
//
//	Return: result substring
//			or 0 if number is negative
//          or null.
//
//------------------------------------------

FUNCTION RightString(string,number)
	LOCAL size
	size = LEN(string)
	
	IF (number > 0)
		IF (number > size)
			number = size
		END
		RETURN CUT(string,size-number+1,size)
	END
	RETURN 0
END
//}}}

//{{{ MidString(string,first,size)
//------------------------------------------
//
//	MidString
//
//	Function: extract a substring from a
//			  string
//
//	Call: MidString(string,first,size)
//
//	Arguments:
//		string  = characters string
//		first   = start position in string
//				  cha�ne
//		size    = number of characters
//
//	Return: result substring
//			or 0 if number or first are
//          negatives or null.
//
//------------------------------------------

FUNCTION MidString(string,first,size)
	LOCAL ln
	ln = LEN(string)
	
	IF ((first > 0) && (size > 0))
		IF ((first+size-1) > ln)
			size = ln-first+1
		END
		RETURN CUT(string,first,first+size-1)
	END
	RETURN 0
END
//}}}

//{{{ Replace
//------------------------------------------
//
//	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
//}}}


When we have made a script we are satisfied with we should not forget to share it :-)
User avatar
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Re: automatic PNG export

Post by Lukas »

It works!

Sweet! :) This is gonna help us a lot, thanks so much!

Do you use something like this yourself? Or did you write it all because of this thread?
  • 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
User avatar
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Re: automatic PNG export

Post by Lukas »

edit: delete me
Last edited by Lukas on 28 May 2013, 09:02, 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
User avatar
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18

Re: automatic PNG export

Post by Mads Juul »

Lukas wrote:It works!

Sweet! :) This is gonna help us a lot, thanks so much!

Do you use something like this yourself? Or did you write it all because of this thread?
Your Welcome
I use it alot ;-) So it is a path work of script bits from Scripts I have made.

I have made TVPX file and Shared Here
http://forum.tvpaint.com/viewtopic.php?f=11&t=6876
User avatar
Lukas
Posts: 526
Joined: 14 Jan 2011, 11:15
Contact:

Re: automatic PNG export

Post by Lukas »

To get files ready for exporting I want them all to have:
  • clipname (so they won't be rendered as untitled)
  • inpoint
  • outpoint
  • camera set to 1920*1080 on 25 fps
To name clips I use this, which seems to work:

Code: Select all

tv_clipname
oldclipname = result
IF CMP(oldclipname, Untitled)
tv_ReqString "Please rename clip|Sc01_shot01"
newclipname = result

IF CMP (newclipname, Cancel)
newclipname = oldclipname
END

tv_clipname ClipID newclipname
ELSE
#print oldclipname
END
But I can't seem to check if there's an outpoint available, what am I doing wrong? Somehow this 'CMP(OutState, set)' doesn't do anything.

Code: Select all

tv_markout
parse result frame OutState
IF CMP(OutState, set)
#PRINT yep outstate is set
ELSE
#PRINT nope outstate is not available, please set it
END
And I have no idea how to find anything on the camera, is that even 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
User avatar
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18

Re: automatic PNG export

Post by Mads Juul »

Lukas wrote: But I can't seem to check if there's an outpoint available, what am I doing wrong? Somehow this 'CMP(OutState, set)' doesn't do anything.

Code: Select all

tv_markout
parse result frame OutState
IF CMP(OutState, set)
#PRINT yep outstate is set
ELSE
#PRINT nope outstate is not available, please set it
END
Ahh the syntax has change. It Should be changed in the WIKI use tv_markOut "clip" to get the state of Clip Mark out
Use tv_markOut "project" for Project I think

Lukas wrote: And I have no idea how to find anything on the camera, is that even possible?
You cannot change the Global Camera setting with George. But you can read it with
http://wiki.tvpaint.fr/index.php?title=Tv_CameraInfo
You can read write the placement and,scale and rotation with
http://wiki.tvpaint.fr/index.php?title= ... EnumPoints
tv_CameraEnumPoints 0. return the first Camera pomt.

This means you cannot render out you project TIFF in another size than you camera.
I mean if you have a camera wich is 1024X576 you cannot render it out in 1920X1080
Would you like to do this?
-Mads



mads
Post Reply