question about tv_brushRestore tv_loadBrushAnim

A forum dedicated to George scripting questions
Post Reply
spyderheart
Posts: 124
Joined: 22 Jan 2013, 03:11

question about tv_brushRestore tv_loadBrushAnim

Post by spyderheart »

Hi all.
I'm working with tv_brushrestore and tv_savebrushanim/tv_loadbrushanim in order to store and later reload a custom brush. Can anyone help with the proper way to retrieve the settings. The wiki entry is not that clear so here is how I would expect it to work:

Code: Select all

//store tool settings
tv_brushrestore backup
toolinfo = result

brushfile = "~/Library/tvpaint animation 11/default/brush storage/b000000.png"
tv_saveMode "PNG"
tv_savebrushAnim '"'brushfile'"'

...

//reload settings:
tv_cmd toolinfo "OR" tv_brushrestore toolinfo

tv_loadBrushAnim '"'brushfile'"'
Unfortunately, this gives unstable results especially when tv_loadbrushAnim is also at play. The first few settings are sometimes correct but it loses track and many of the settings don't get reloaded. My intuition is that it is a parsing problem with the arguments stored in "toolinfo". My workaround is to make it all very explicit and this seems to work:

Code: Select all

PARSE toolinfo tv_restorebrush mode modeVAL width widthVAL height heightVAL step stepVAL opacity opacityVAL size sizeVAL shift shiftVAL position positionVAL jitter jitterVAL angle angleVAL stamp stampVAL handle handleXVAL handleYVAL origine origineXVal origineYVAL rotate rotateVAL flip_x flip_xVAL flip_y flip_yVAL optimize optimizeVAL opaque opaqueVAL border borderVAL border_color bcR bcG bcB dry dryVAL screenwrap screenwrapVAL projection projectionVAL subpixel subpixelVAL anim animVAL animinvert animinvertVAL smear smearVAL wetprofile wetProfileVAL copacity copacityVAL csize csizeVAL cjitter cjitterVAL cangle cangleVAL cshift cshiftVAL csmear csmearVAL

	tv_restorebrush mode modeVAL
	tv_restorebrush width widthVAL 
	tv_restorebrush height heightVAL 
	tv_restorebrush step stepVAL 
	tv_restorebrush opacity opacityVAL 
	tv_restorebrush size sizeVAL 
	tv_restorebrush shift shiftVAL 
	tv_restorebrush position positionVAL 
	tv_restorebrush jitter jitterVAL 
	tv_restorebrush angle angleVAL 
	tv_restorebrush stamp stampVAL 
	tv_restorebrush handle handleXVAL handleYVAL 
	tv_restorebrush origine origineXVal origineYVAL 
	tv_restorebrush rotate rotateVAL 
	tv_restorebrush flip_x flip_xVAL 
	tv_restorebrush flip_y flip_yVAL 
	tv_restorebrush optimize optimizeVAL 
	tv_restorebrush opaque opaqueVAL 
	tv_restorebrush border borderVAL 
	tv_restorebrush border_color bcR bcG bcB 
	tv_restorebrush dry dryVAL 
	tv_restorebrush screenwrap screenwrapVAL 
	tv_restorebrush projection projectionVAL 
	tv_restorebrush subpixel subpixelVAL 
	tv_restorebrush anim animVAL 
	tv_restorebrush animinvert animinvertVAL 
	tv_restorebrush smear smearVAL 
	tv_restorebrush wetprofile wetProfileVAL 
	tv_restorebrush copacity copacityVAL 
	tv_restorebrush csize csizeVAL 
	tv_restorebrush cjitter cjitterVAL 
	tv_restorebrush cangle cangleVAL 
	tv_restorebrush cshift cshiftVAL 
	tv_restorebrush csmear csmearVAL 
Now the tradeoff is that everytime I use this method there is a quick "Applying changes..." pop up dialog that appears and disappears for each time tv_restorebrush is called. Not only is it a little annoying but it seems much slower than necessary. There is probably a "right way" to use tv_restorebrush that I am not understanding from the wiki article. Does anyone know it?

Thanks folks :)
David
--------------------------------------------------------
TVPaint 11.7 Standard
System: 64GB RAM // 3 TB SSD // Core i7 8700K // NVIDIA GTX 1080// Windows 10 Home
spyderheart
Posts: 124
Joined: 22 Jan 2013, 03:11

Re: question about tv_brushRestore tv_loadBrushAnim

Post by spyderheart »

Some further testing has shown that even the second method has bugs. For example, some of the connection settings would be set correctly but the profile curve was ignored. This points to how it deals with parsing and quotes so changing the last few lines to :

Code: Select all

tv_restorebrush wetprofile '""wetProfileVAL'"" 
tv_restorebrush copacity '"'copacityVAL'"" 
tv_restorebrush csize '"'csizeVAL'"' 
tv_restorebrush cjitter '"'cjitterVAL'"' 
tv_restorebrush cangle '"'cangleVAL'"' 
tv_restorebrush cshift '"'cshiftVAL'"' 
tv_restorebrush csmear '"'csmearVAL'"' 
This seems to have helped. This is most likely since items like csizeVAL have the form " 7; 1 0 0 2 0 1 1 ". The quotes are part of the result string so they probably needed to be made explicit using the extra quotes around the '"'csizeVAL'"' term.
This is a clue, but i still haven't found a foolproof way to do it through a single tv_restorebrush command.
David
--------------------------------------------------------
TVPaint 11.7 Standard
System: 64GB RAM // 3 TB SSD // Core i7 8700K // NVIDIA GTX 1080// Windows 10 Home
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: question about tv_brushRestore tv_loadBrushAnim

Post by Svengali »

wrong thread...
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
Post Reply