Setting CutBrush operation parameters with GEORGE

A forum dedicated to George scripting questions
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Setting CutBrush operation parameters with GEORGE

Post by Svengali »

Is there a command in GEORGE which lets you read and set CutBrush Parameters:
i.e.

Smooth
AAliasing
Optimize
Display
Keep
BrushSmooth

I'm trying to guarantee that the tv_BrushCut command will capture the entire Display and not just the current layer. More than that, I'd like to check the status of the Display check box first, so it could be restored after making a cutbrush com-positing all the displayed layers in the x1,y1,x2,y2 designated area of the current image. Is this currently possible?

If not, I suppose it should be possible to merge all layers, then cut from the merged layer, then undo the merge?

EDIT: I'd still like to know if there is a way to read and set CutBrush parameters using GEORGE, but for my purposes, I was able to merge all layers, and use tv_BrushCut command and then undo the merge.
I also wanted to be able to use tv_SetActiveShape to CutFreeHand CutRect and CutPoly, but the merge and the undo both happen before I can actually cut a shape FreeHand, Rect or CutPoly. That is why a separate GEORGE command to read and set CutBrush parameters would be very helpful.

Thanks, Sven
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
User avatar
Mike
Posts: 1050
Joined: 16 Feb 2006, 08:58

Re: Setting CutBrush operation parameters with GEORGE

Post by Mike »

The doc is not up to date on the wiki.

Here is the full tv_cutbrush command:

Code: Select all

tv_cutbrush x1 y1 x2 y2 0|1 /*copy|cut*/ 0|1 /*image|anim*/ 0|1 /*display*/ 0|1 /*optimize*/
You can also set (and get back previous value(s)) when activating the shape:

Code: Select all

tv_setactiveshape cutrect [smooth 0-100] [aaliasing 0|1] [keep 0|1] [subpixel 0|1|2|3 /*none|medium|best|smart*/] [optimize 0|1] [display 0|1]
TVPaint Team
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Setting CutBrush operation parameters with GEORGE

Post by Svengali »

Thanks for the update, Mike. :)

Sven
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
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Setting CutBrush operation parameters with GEORGE

Post by NathanOtano »

A way to cut to brush the current selection? Even if we can't use george to manipulate selections?
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.
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Setting CutBrush operation parameters with GEORGE

Post by Svengali »

NathanOtano wrote:A way to cut to brush the current selection? Even if we can't use george to manipulate selections?
ShapeSelect:Copy To CustomBrush ?
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
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Setting CutBrush operation parameters with GEORGE

Post by NathanOtano »

Sorry, I was meaning with george. I found the brushcut function but it cuts without looking at the selection so I guess it's not possible.

I knew for the shortcut, thanks anyway!
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.
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Setting CutBrush operation parameters with GEORGE

Post by Svengali »

NathanOtano wrote:Sorry, I was meaning with george. I found the brushcut function but it cuts without looking at the selection so I guess it's not possible.
The two GEORGE commands that Mike revealed DO let you set parameter values as needed to capture cutbrushes or animbrushes that respect SELECTED AREAS. In fact, it is possible to capture selected, non-contiguous areas of an image to a brush (or capture from multiple-layers into a brush as shown below!) something that the standard cutbrush commands don't themselves permit. Wonderful possibilities here.
cutbrush of selected area(s) and layers.jpg
cutbrush of selected area(s) and layers.jpg (34.26 KiB) Viewed 2046 times
Sven
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
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Setting CutBrush operation parameters with GEORGE

Post by NathanOtano »

That's nice to read, i'm sorry but i don't fully understand.

I tried it all morning but can't make it working "inside" a script. Meaning that the "cut to brush" shortcut works with a selection, but I need to do that in a "toggle-like" script.

Basically what i want :
- I click one time and it selects the selection tool
- If i click and the selection tool is already selected, it cuts the selection to a brush and go back to freehandline tool

But the "tv_brushcut" (!not tv_cutbrush!) option doesn't cut only the selection. I can do it only with shortcuts on a button, that's limited while scripting.

I managed my shortcuts to do it differently directly with a cutbrush, inspired by your transform shortcuts. I'll try to share it this w-e.
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.
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Setting CutBrush operation parameters with GEORGE

Post by Svengali »

You're right.

The button command, Shape Select:Copy To CutBrush respects existing select areas and copies only those selected parts of the image into the CutBrush.

The tv_BrushCut command in George still ignores the select areas and instead, always grabs the whole frame (current layer or total Display). It would be VERY HELPFUL if tv_BrushCut in George was updated to respect existing select areas like the Shape Select:Copy To CutBrush button command now does. That would permit a single-toggle-button George script like you're trying to write. :?

To work now with this limitation, I've had to setup two buttons: the first gives me the select tool... while the second (as posted) captures the selected area into the CutBrush and then clears the selection.

sven
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
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Setting CutBrush operation parameters with GEORGE

Post by NathanOtano »

Svengali wrote:To work now with this limitation, I've had to setup two buttons: the first gives me the select tool... while the second (as posted) captures the selected area into the CutBrush and then clears the selection.

sven
I've done the same :) indeed it works quite well.

Thanks!
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.
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Setting CutBrush operation parameters with GEORGE

Post by Svengali »

Mike wrote:The doc is not up to date on the wiki.

Here is the full tv_cutbrush command:

Code: Select all

tv_cutbrush x1 y1 x2 y2 0|1 /*copy|cut*/ 0|1 /*image|anim*/ 0|1 /*display*/ 0|1 /*optimize*/
You can also set (and get back previous value(s)) when activating the shape:

Code: Select all

tv_setactiveshape cutrect [smooth 0-100] [aaliasing 0|1] [keep 0|1] [subpixel 0|1|2|3 /*none|medium|best|smart*/] [optimize 0|1] [display 0|1]
Mike,

Two additional requests to enhance the GEORGE commands that deal with CutBrush and AnimBrush:

1. Could the GEORGE tv_BrushCut command be updated to respect (capture only from within) selected areas of the image WHEN AND IF selections are present when capturing? This is already how the Shortcut command "Shape Select:Copy To CutBrush" works currently.

2. Could the GEORGE tv_GetActiveShape command be enhanced to return not only the name of the active shape, but all of the current states/settings for the SHAPE parameters as well?

Thanks again.
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
User avatar
Mike
Posts: 1050
Joined: 16 Feb 2006, 08:58

Re: Setting CutBrush operation parameters with GEORGE

Post by Mike »

Svengali wrote: 2. Could the GEORGE tv_GetActiveShape command be enhanced to return not only the name of the active shape, but all of the current states/settings for the SHAPE parameters as well?
Maybe you can use

Code: Select all

tv_getactivetool [force]
which returns all the settings of the current tool ?
('force' is to be able to get the settings of tool which are not for drawing: filling/select/...)
TVPaint Team
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Setting CutBrush operation parameters with GEORGE

Post by Svengali »

Mike wrote:
Svengali wrote: 2. Could the GEORGE tv_GetActiveShape command be enhanced to return not only the name of the active shape, but all of the current states/settings for the SHAPE parameters as well?
Maybe you can use

Code: Select all

tv_getactivetool [force]
which returns all the settings of the current tool ?
('force' is to be able to get the settings of tool which are not for drawing: filling/select/...)
Actually, the command tv_AreaInit BACKUP provides all the shape info that I needed... I just thought it might make sense to get all that additional shape info directly, through something like a tv_GetActiveShape force command or something similar.

Sven
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
User avatar
Mike
Posts: 1050
Joined: 16 Feb 2006, 08:58

Re: Setting CutBrush operation parameters with GEORGE

Post by Mike »

In fact, the shapes and the tools are 2 different objects.
The shapes are inside the main panel => without any settings (that's why tv_getactiveshape only returns the name of the shape, and if george was not made more than 20 years ago, tv_setactiveshape should only set the new shape and not the settings of the tool it used)
The tools are inside the tools panel => with all their settings, so it's the tool which should set/get all its settings (that's why tv_getactivetool should be used to return all the settings)
It's to be coherent with the concept shape/tool

And BTW, when you use "tv_AreaInit BACKUP", the current shape (and so its attached tool) will be changed if the shape is not a filling or select shapes, instead of "tv_getactivetool force" which didn't change the current shape (and so the current tool)

I know it's not as clean as that for every george commands, but hope it enlightens a little bit :)
TVPaint Team
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Setting CutBrush operation parameters with GEORGE

Post by Svengali »

Mike wrote:In fact, the shapes and the tools are 2 different objects.
The shapes are inside the main panel => without any settings (that's why tv_getactiveshape only returns the name of the shape, and if george was not made more than 20 years ago, tv_setactiveshape should only set the new shape and not the settings of the tool it used)
The tools are inside the tools panel => with all their settings, so it's the tool which should set/get all its settings (that's why tv_getactivetool should be used to return all the settings)
It's to be coherent with the concept shape/tool

And BTW, when you use "tv_AreaInit BACKUP", the current shape (and so its attached tool) will be changed if the shape is not a filling or select shapes, instead of "tv_getactivetool force" which didn't change the current shape (and so the current tool)

I know it's not as clean as that for every george commands, but hope it enlightens a little bit :)
Thanks for the clarification Mike, which explains some mysterious script results I never understood.
For example, here is a short script I often use to analyze current shape/tool parameters... note that at the end of the script I found I had to restore tool and shape, but I never knew why they changed when all I did was try to look at their parameters. :?
Spoiler : :

Code: Select all

//	ShapeToolInfo.grg
//  Svengali© 2013 - All Rights Reserved

//  Report the active shape-type and tool-type ... with their comprehensive parameter names and parameter values
   
// version 0.4  modified August 14, 2013

Param none
ScriptName = 'ShapeToolInfo'


tv_GetActiveShape
Shape = result
tv_GetActiveTool											// check which tool is active and get parameters
ToolInfo = result											// get all tool parameters so they can be restored
parse result ToolType d										// parse out type of tool

tv_AreaInit backup											// get current shape info
ShapeInfo = result


Clip = 0
IF CMP(ToolType,"tv_restoreBrush")							// if tool is restorebrush then parse break toolinfo into two parts
	ToolLength = LEN(ToolInfo)
	Word = ""
	FOR i = 1 to ToolLength									// look for point in toolinfo string where it will break into two strings
		Letter = Char(ToolInfo,i)
		IF CMP(Letter," ")
			Word = ""
		ELSE
			Word = CONCAT(Word, Letter)
		END
		IF CMP(Word, "subpixel")
			Clip = i - 8									// set break before subpixel parameter
			ToolInfo1 = CUT(ToolInfo,1,Clip)				// includes parameters up to subpixel
			ToolInfo2 = Cut(ToolInfo,Clip,ToolLength)		// includes parameters subpixel and after
		END
	END	
END

tv_cmd ToolInfo												// MUST restore all tool's parameters to what they were
tv_SetActiveShape Shape										// MUST restore shape to function type (GetActiveTool disables function)

tv_warn "[SHAPE INFO] = " ShapeInfo							// report: shape type and shape info
IF Clip > 0
	tv_warn "[Tool Info 1] = " ToolInfo1					// report: first half of brushrestore info
	tv_warn "[Tool Info 2] = " ToolInfo2					// report: second half of brushrestore info
ELSE	
	tv_warn "[TOOL INFO] = " ToolInfo						// report: tool type and all tool info
END



Sven
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