Page 1 of 1

put layers on center of canvas

Posted: 23 Apr 2014, 07:17
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?

Re: put layers on center of canvas

Posted: 23 Apr 2014, 08:43
by Elodie
Hmmm, looks like we do not have such a feature to do it easily.

I move your topic in Feature request :)

Re: put layers on center of canvas

Posted: 23 Apr 2014, 09:51
by Zetariver
OK. I will move them manually.

Re: put layers on center of canvas

Posted: 23 Apr 2014, 09:54
by Elodie
Yes, sorry :/

Re: put layers on center of canvas

Posted: 23 Apr 2014, 10:02
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.

Re: put layers on center of canvas

Posted: 23 Apr 2014, 10:47
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.

Re: put layers on center of canvas

Posted: 23 Apr 2014, 14:03
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

Re: put layers on center of canvas

Posted: 23 Apr 2014, 14:11
by Elodie
Hmmm, I probably missed something because I can't use your script Svengali :oops:

Re: put layers on center of canvas

Posted: 23 Apr 2014, 14:19
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

Re: put layers on center of canvas

Posted: 23 Apr 2014, 15:49
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' !

Re: put layers on center of canvas

Posted: 16 Dec 2014, 03:33
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.