Remembering an Animbrush with George

A forum dedicated to George scripting questions
Post Reply
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Remembering an Animbrush with George

Post by NathanOtano »

Ok... :)

So I need to remember my current tool, do something else with the cutbrush possibilities, and the load back my tool. I can make it work excpet for the images of Animbrushes.

I understand how to save and load the tool settings, but I don't find a way to automatically Save and Load the same set of images of my animbrush.

The tv_brushtoclipboard works only for 1 image.
The tv_savebrushanim and tv_loadbrushanim commands are supposed to do the job, but I have two questions :

Is there a way to always have the good path to save my brush? For exemple my computer in "C:\Windows\Temp" but what about somebody with "D:\Windows\Temp"?
And is there a way to return how much images I have in my animbrush? so when I use the tv_loadanimbrush command I can specify how much image i want to load.

I need to be able to save my tool emporary, any tool including animbrush, and each time erasing the previous temporary saved animbrush is there is one. I don't know if there is a quicker way to do it.

Sometimes I wish that tvpaint have a specific brush file that can save all you brush, settings and eventual images, in one file.

Nathan
Last edited by NathanOtano on 26 Feb 2016, 09:07, edited 1 time in total.
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
User avatar
Mike
Posts: 1050
Joined: 16 Feb 2006, 08:58

Re: Remembering an Animbrush with Geroge

Post by Mike »

NathanOtano wrote: Is there a way to always have the good path to save my brush? For exemple my computer in "C:\Windows\Temp" but what about somebody with "D:\Windows\Temp"?
Maybe tv_gettemppath
NathanOtano wrote:And is there a way to return how much images I have in my animbrush?
*see post below*
TVPaint Team
User avatar
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18

Re: Remembering an Animbrush with Geroge

Post by Mads Juul »

NathanOtano wrote:And is there a way to return how much images I have in my animbrush?
What about this :

Code: Select all

tv_BrushInfo 
PARSE result brushWidth brushHeight brushXoffset brushYoffset brushAnimFrames brushUnknown
tv_warn brushAnimFrames
http://wiki.tvpaint.fr/index.php?title=Tv_BrushInfo

If you have saved the animbrush to files in a folder you can count them

something like

Code: Select all

FUNCTION folder_getFiles(folderPath)
	LOCAL  slash i loop j file number length
	tv_readtextfile 0 '"'folderPath'"'
	i=0
	loop=1
	j=0
	WHILE loop
		tv_readtextfile i '"'folderPath'"'
		file = result
		IF CMP(file,"EOF")==1
			loop=0
		ELSE
			PARSE file number file
			filelist(j)=file
			filepath(j)=folderPath"\"file
			j=j+1
		END
		i=i+1
	END
	result=j
	return j
END
this function will return the number of files in the folder.
I this what you are thinking about?

-Mads
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Remembering an Animbrush with George

Post by NathanOtano »

Ah! Missed this tv_brushinfo command too, thanks a lot for your help.

In fact I think I'll remember the number of frames that i had on my brush when I temporary store and export the brush, instead of counting it in the folder. And then I'll use it when I'll reload it to specify the number of frames.
Cause because I'm always exporting my brush with the same temporary name, If there is less frames than the last exported brush, I'll have the first frames corresponding to my last brush but the last frames corresponding to the old one that were not erased by the new one.

Thanks again! I think I'll make a great use of your second script too.

Nathan
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
Post Reply