put layers on center of canvas

This section is dedicated to the feature & improvement requests (be sure what you are asking does not exist yet in TVPaint Animation ;) )
Post Reply
Zetariver
Posts: 77
Joined: 23 Dec 2013, 07:58

put layers on center of canvas

Post by Zetariver »

Hello. I want to put layers on center of canvas like this video.
As you can see, all layers are placed differently,circle A is on x 100 y 200, circle B is on x 200 y 250,circle C is on x 300 y 0, etc.
So I need to check positions of all layers If I use keyframer.Seems It's not a best solution.
What is the best way to do that in TVPaint?
Elodie
Posts: 13912
Joined: 06 Jan 2009, 09:53
Location: Metz

Re: put layers on center of canvas

Post by Elodie »

Hmmm, looks like we do not have such a feature to do it easily.

I move your topic in Feature request :)
Zetariver
Posts: 77
Joined: 23 Dec 2013, 07:58

Re: put layers on center of canvas

Post by Zetariver »

OK. I will move them manually.
Elodie
Posts: 13912
Joined: 06 Jan 2009, 09:53
Location: Metz

Re: put layers on center of canvas

Post by Elodie »

Yes, sorry :/
User avatar
furushil
Posts: 408
Joined: 12 Feb 2012, 21:02
Location: Berlin
Contact:

Re: put layers on center of canvas

Post by furushil »

I am not sure but if you import a png sequence all the pngs are aligned to the center of the canvas. So maybe if you have all circles as separate pngs you can import them into the project.
MAC OS 12.6.2 - TVpaint 11.7.1 PRO 64bit, Wacom Intuos Pro
Elodie
Posts: 13912
Joined: 06 Jan 2009, 09:53
Location: Metz

Re: put layers on center of canvas

Post by Elodie »

It would work only if the circles were orignally a image sequence.

If they were drawn in TVPaint, it's then more complex.
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: put layers on center of canvas

Post by Svengali »

This might do what you want:

Create a new action in a custom panel, then cut and paste this script into the embed George script command.

Code: Select all

    Param none
    ScriptName = "CenterAllLayers"

    tv_GetWidth
    Width = result
    CenterX = Width / 2 
    tv_GetHeight
    Height = result
    CenterY = Height / 2

    tv_LayerCurrentID
    OriginalLayer = result
    tv_LayerGetImage
    OriginalImage = result

    Counter = 0
    LayerID = ""
    For Counter = 0 to 1000
       tv_LayerGetID Counter
       LayerID = result
    //   tv_warn "counter = " Counter " layerid = " LayerID
 
       ExitFlag = CMP(LayerID,"none")
       IF ExitFlag == 1
          EXIT
       ELSE
          tv_LayerSet LayerID
          tv_BrushCut 0 0 Width Height 1 0
          tv_BrushRestore Reset 1 Optimize 1
          tv_Dot CenterX CenterY 0
       END
    END
    tv_LayerSet OriginalLayer
    tv_LayerImage OriginalImage


Sven
Last edited by Svengali on 23 Apr 2014, 23:58, edited 1 time in total.
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
Elodie
Posts: 13912
Joined: 06 Jan 2009, 09:53
Location: Metz

Re: put layers on center of canvas

Post by Elodie »

Hmmm, I probably missed something because I can't use your script Svengali :oops:
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: put layers on center of canvas

Post by Svengali »

Elodie wrote:Hmmm, I probably missed something because I can't use your script Svengali :oops:
I just tried it and it seems to work. What do you get when you try it?

Sven
Attachments
CenterAllLayers.tvpx
(78.5 KiB) Downloaded 1087 times
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
Elodie
Posts: 13912
Joined: 06 Jan 2009, 09:53
Location: Metz

Re: put layers on center of canvas

Post by Elodie »

Sorry I'm just too blond sometimes, I did a wrong copy paste :roll: :oops:

I confirm the script is working ;)

This is a really great one, thank you Sven' !
Zetariver
Posts: 77
Joined: 23 Dec 2013, 07:58

Re: put layers on center of canvas

Post by Zetariver »

Svengali wrote:This might do what you want:

Create a new action in a custom panel, then cut and paste this script into the embed George script command.

Code: Select all

    Param none
    ScriptName = "CenterAllLayers"

    tv_GetWidth
    Width = result
    CenterX = Width / 2 
    tv_GetHeight
    Height = result
    CenterY = Height / 2

    tv_LayerCurrentID
    OriginalLayer = result
    tv_LayerGetImage
    OriginalImage = result

    Counter = 0
    LayerID = ""
    For Counter = 0 to 1000
       tv_LayerGetID Counter
       LayerID = result
    //   tv_warn "counter = " Counter " layerid = " LayerID
 
       ExitFlag = CMP(LayerID,"none")
       IF ExitFlag == 1
          EXIT
       ELSE
          tv_LayerSet LayerID
          tv_BrushCut 0 0 Width Height 1 0
          tv_BrushRestore Reset 1 Optimize 1
          tv_Dot CenterX CenterY 0
       END
    END
    tv_LayerSet OriginalLayer
    tv_LayerImage OriginalImage


Sven

Sorry for my ridiculously late reply.
Your script works greatly. Thank you Svengali . I will use it.
Post Reply