GEORGE : tv_imageGetBound layerID iPosition

This section is dedicated to the feature & improvement requests (be sure what you are asking does not exist yet in TVPaint Animation ;) )
Post Reply
User avatar
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18

GEORGE : tv_imageGetBound layerID iPosition

Post by Mads Juul »

I woulld like a George Command wich could return the bounding box of an given image of a given layer in the current clip
So if I had a drawing like this:
tv_imageGetBound00000.png
tv_imageGetBound00000.png (55.57 KiB) Viewed 20117 times
And a george script like this

Code: Select all

tv_imageGetBound layerID iPosition
bound = result // Returns 131 115 379 455 with this image
tv_rect bound
Would produce his result
tv_imageGetBound00001.png
tv_imageGetBound00001.png (55.57 KiB) Viewed 20117 times
If I had a blue pen as selected tool
-Mads
Last edited by Mads Juul on 30 Oct 2014, 10:33, edited 2 times in total.
User avatar
ZigOtto
Posts: 4102
Joined: 17 Feb 2006, 22:50
Location: south-Petazonia

Re: GEORGE : tv_imageGetBound

Post by ZigOtto »

+1

+ to get a "Marching Ants" bounding box with tv_SelectRect Bound
tv_imageGetBound02.png
tv_imageGetBound02.png (57.73 KiB) Viewed 20105 times
Elodie
Posts: 13912
Joined: 06 Jan 2009, 09:53
Location: Metz

Re: GEORGE : tv_imageGetBound

Post by Elodie »

Ok, let's todolist this.
User avatar
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18

Re: GEORGE : tv_imageGetBound

Post by Mads Juul »

Elodie wrote:Ok, let's todolist this.
cool :D
ZigOtto wrote:+1
tv_SelectRect Bound
Is there A George Command like this?
I dont think it is possible to manipulate the Selection with George. Or?
Elodie
Posts: 13912
Joined: 06 Jan 2009, 09:53
Location: Metz

Re: GEORGE : tv_imageGetBound

Post by Elodie »

No, I don't think so, that's why I am about to todolist all the content of this conversation ^^
User avatar
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18

Re: GEORGE : tv_imageGetBound

Post by Mads Juul »

2XCool :D
User avatar
ZigOtto
Posts: 4102
Joined: 17 Feb 2006, 22:50
Location: south-Petazonia

Re: GEORGE : tv_imageGetBound

Post by ZigOtto »

madsjuul wrote:
ZigOtto wrote:+1
tv_SelectRect Bound
Is there A George Command like this?
I dont think it is possible to manipulate the Selection with George. Or?
I was completing your feature request with mine which is in the same family,
so just a future request added to yours. :wink:
Elodie wrote:... that's why I am about to todolist all the content of this conversation ^^
3xcool ! :)
User avatar
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18

Re: GEORGE : tv_imageGetBound

Post by Mads Juul »

I'm Looking forward to the tv_imageGetBound Feature!
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: GEORGE : tv_imageGetBound

Post by Svengali »

madsjuul wrote:I'm Looking forward to the tv_imageGetBound Feature!
Until then here's a George version you can adapt...

Code: Select all

// tvImageBound.grg
// Svengali©2014 - All Rights Reserved
// Version .02 - May 14, 2014 - Draw and undraw bounding box around drawing

Param none

tv_GetActiveTool
OriginalTool = result							// store tool
parse result ToolType d							// get tool type

IF CMP(ToolType,"tv_restorebrush")
	tv_BrushToClipboard								// store CutBrush
END
tv_GetAPen
APen = result									// store APen color
tv_GetWidth
Width = result									// get project dimensions
tv_GetHeight
Height = result

tv_UndoOpenStack								// suspend undo stack
tv_BrushCut 0 0 Width Height 0					// grab a copy of the current image

tv_BrushRestore OptimizeSource 1				// get pixels' bounding box


tv_GetActiveTool								// get info on the CutBrush from the current image
parse result d d d d Width1 d Height1 d d d d d d d d d d d d d d d d d d d d origineX origineY d

tv_setAPen 200 0 0								// set APen to red

x1 = origineX - 1									// get upper left X corner of CutBrush within project
y1 = origineY - 1									// get upper left Y corner of CutBrush within project
x2 = origineX + Width1							// calculate lower right X corner of CutBrush within project
y2 = origineY + Height1							// calculate lower right Y corner of CutBrush within project

tv_Propelling RESET 1							// select single pixel tool

tv_Rect x1 y1 x2 y2								// draw red bounding box rectangle

tv_WaitButton 1									// wait for mouse LMB down click

IF CMP(ToolType,"tv_restorebrush")
	tv_BrushFromClipboard						// retrieve original CutBrush
END

tv_UndoCloseStack								// reinstate undo stack
tv_Undo											// remove red bounding box
tv_UpdateUndo									// reinstate original image

tv_SetAPen APen									// reset original APen color
tv_cmd OriginalTool								// restore original Tool
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
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18

Re: GEORGE : tv_imageGetBound

Post by Mads Juul »

Yes thank. But I made my own script like that a couple of yars ago. But it is slow and there is problems attached with it. If i got a custombrush before i run the script, how to getcit back after. For instance. And I cant call it on another instance on another layer. What if I wanted to find the imagebound on an entire layer? Then it gets slow. But thankt you anyways svend. Maybe your script is better than mine I will look into it. But i still look forward to the george sunction :D
Post Reply