Manual Avançado Do TV Paint 10
Manual Avançado Do TV Paint 10
Customized panels
Adding an action
In the lesson 7, we have seen how to create a custom panel and how to save bryshes and colors
inside. However, custom panels may also contain actions such as functions, scripts, etc... Their
icons and information may be changed also.
Adding an action is done using the panel at the bottom left of this page :
* Using the first two text fields you may define a name and in-line help comment for your future
customized function .
* The buttons and menus List, Tool and A color allow you to choose the icon corresponding to the
action you will create.
* The numbered lines are the actions to be carried out one after the other when you click on the
icon corresponding to your function.
Several possibilities are available if you decide to create an action. You can :
* Select a shortcut in the numerous program functions. (see previous page)
* Select an FX-Bin file stored in the FX-stack to re-use it.
* Open Plug-in allows you to place a button to fast-start plugins. (they will be introduced and
explained in the next section of this lesson)
* Open panel allows you to create dependencies between your panels, i.e. you may display
secondary panels from the main panel, for example. This may be useful for organizing your custom
brushes or the contents of your various Bins.
Once your buttons are created in the custom panel, other options become available:
* With a simple selection in your custom panel you may cut or copy the icons/actions that you have
just created. You simply use the menu described above to « paste » your icons/actions later.
* With a right click on an icon/action in the custom panel, you may edit, duplicate or delete it.
The Canon Plug-in is available only if you have selected it during the installation
process of the software. It is available only on PC computers at this time.
The Color Factory plug-in allows you to modify the values of the R,G,B and Alpha channels of the
selected images, thanks to mathematical formulas. (ie : R,G,B and Alpha values of the pixels of
your images)
Based on the additive color principle, all colors are mixture of red, green and blue
(more or less dark) in exact proportions.
Each color can be broken up in various ways depending on the color system. For
example, the Slider tab of the Color Picker panel gives the numerical values of the A
color in the R,G,B and H,S,L color systems.
Each text field of the Color Factory panel describes one component (R,G,B or Alpha) and can
contain a mathematical formula. The new values of those components will be computed using the
formulas you have entered (the Alpha component indicates the opacity of the pixels).
The variables that you can use in your formulas are listed in the table below (all in lower case) :
The variables :
r Value of the Red component of the pixel
g Value of the Green component of the pixel
b Value of the Blue component of the pixel
a Value of the Alpha component of the pixel
x x coordinate of the pixel
y y coordinate of the pixel
w Width of the current project
h Height of the current project
And here are listed the arithmetic operators :
Arithmetic Operators Examples :
+ add 18 + 3 = 21
– subtract 18 – 6 = 12
* multiply 18 * 3 = 54
/ divide 18 / 3 = 6
It is possible to use parentheses ( ) in order to set priorities in your computations. If you don't use
them, the Color Factory plug-in will evaluate the operations from the left to the right.
For instance : 1+2*3 = 9 1+(2*3) = 7
* Below, the red and blue components of the landscape have been inverted : the sky turned into
orange and the road turned from red to blue. The green component stay unchanged.
* The Color Factory plug-in can also be used to create nice color gradients. Therefore, the
formulas on the right panel below are more complicated.
* Below, simple additions have been done with the red and green color channels inverted.
* Here is the last example : an opacity gradient from the top right to the bottom left of the image.
The Canon plug-in allows the user to retrieve photos from a Canon digital camera and to put them
directly into a TVPaint Animation layer.
This plug-in is very convenient for the animator who want to work in stop-motion directly with the
software.
Here are the steps to use the Canon Plug-in with TVPaint Animation :
* What is required :
- The Canon driver of your camera must be correctly installed in your system. (Microsoft Windows
only at this time)
- You should have a compatible Canon camera (see the list in Appendix) powered and plugged into
an USB port of your computer.
- You have to set your camera in playback mode. Don't use the shooting mode as it does not allow
you to manage your camera via the computer.
It is advised always to close your Video Grabber and Video Canon panels before
quitting the software.
The DirectShow Plug-in provides support for USB, SCSI, FireWire, ... compatible hardwares.
(in theory all Windows Driver Mode (WDM) compatible hardwares)
Generally speaking, an oscilloscope is an electrical equipment which allows you to monitor and
measure periodic signal voltages. If it is calibrated in order to receive video signals, it is also called
WaveForm monitor. In the audiovisual environment, they are often used to check if the transmitted
video signal has its characteristics in conformity with the applicable broadcasting rules.
Our WaveForm Plug-in allows the audiovisual professionals to use their classical tools.
Thanks to this Plug-in, it is now easy to check the integrity of a signal, manage calibration and
colorimetric adjustments, control the validity of numerical signals, ...
The popup menu allows you either to select :
* A Composite WaveForm monitor
* A VectorScope
* A Component WaveForm monitor
The monitors at you disposal in this WaveForm Plug-in act as if all layers of the
current picture where merged.
Here are some options relative to the different displays at your disposal :
* The Composite WaveForm monitor can use luminance and/or chrominance signal(s).
* The VectorScope can use two calibration sets : 75 % and 100 %
* The Component WaveForm monitor can use the R,G,B or Y,U,V systems.
George is a programming language which allows you to use the numerous tools of TVPaint
Animation. Every program written in this language is called “George Script”. Other softwares use
sometimes the word “Macro” instead of “Script”.
A George Script allows you to execute specific TVPaint Animation command such as :
Create a new layer, draw a circle on this area, save the current project, add a bookmark, etc…
Those Scripts are usually created to save some time when executing a repetitive task is needed.
Experienced programmers use TVPaint Animation commands in order to create “.dll ” plug-ins
Some George Scripts are available as example with the software, but you can also create your
own scripts and/or exchange them with members of the TVPaint Community. (You can access the
TVPaint forum here: http://www.tvpaint.com/forum/)
After installing TVPaint Animation on your computer, George Scripts are located in the directory:
C:/program files/TVPaint Animation/George Windows.
Applications/TVPaint Animation/Contents/Ressource/George/ Apple OS-X.
Those George Scripts are in fact usual ASCII text files and have a “.grg” extension.
It is possible to edit or create them with any text editor like Notepad from Microsoft Windows or
Text Edit from Mac OS-X.
The scripts are in theory working on the both standards PC and Macintosh, whatever the computer
used to create them.
To use one of the George Scripts at your disposal, just follow the
steps below:
_ open a custom panel
_ create a new button on this panel
_ select the action: -Set script- for this button
_ select a file with a “.grg” extension in the file requester
Once finished, if you click on the just created button, the George
Script will then be launched.
At every moment, you can stop the execution of a George Script by using the
[Esc] key.
A window, indicating on which line the execution of the script was stopped,
should popup.
Once a George Script has finished its programmed tasks, the Undo option of the TVPaint
Animation main panel allows you to cancel all the changes it has generated.
Often, George Scripts need an action from the user in order to be launched. For instance :
The George Script named “long.grg” waits for a segment to be drawn on screen and finally returns
its length.
The George Script called “clock.grg” waits for a circle to be drawn on screen and finally draws a
clock inside this one.
The George Script called “button Z.grg” waits for a rectangle to be drawn on screen and returns a
bevelled button inside it
A few George Scripts don’t need any action from the user to be started: it’s the case with the
George Script called ”Zsurface.grg”.
Above: the results of the scripts: button Z, Long, Clock, Zsurface and Polystar
A few George Script are more complicated and some requesters may appear.
It is the case with the George Script called Polystar.grg : during its execution, a first requester asks
you to specify how many vertices should be drawn. If you apply your script on an animated layer
(after selecting all its frames), a second and third requesters will ask you more informations (see
below)
The George language is not particularly fast, but it is flexible and very easy to use. On many
points, George is comparable to the Pascal language or other well known programming language.
However it’s not aimed at developing heavyweight applications as are for example the C or C++
languages. George is first and foremost a scripting language.
George needs classical instruction to structure the scripts: tests, loops, computation, conditional
events, etc… For a better readability, all the instructions will be written in green in this manual.
For example :
If, Else, End, For, Do, Until, While, … for conditionals tests
Cos, Sin, Tan, Rnd, … for computations
You can also call in your scripts TVPaint Animation commands, which call specific tools of the
software.
They can be differentiated from the classical George instruction because they all begin with the
« tv_ » prefix. (They will be written in blue color)
For instance :
* The command tv_LayerCreate allows you to create a new layer.
* The command tv_SaveBrushAnim saves the current brush on the hard drive.
* It is possible to change the colors of the bin tab thanks to the tv_SetPalette command
* Etc… (You will find in appendix the complete instruction and command listings of the George
Language.)
All TVPaint Animation commands need their own arguments and return some values as answer.
For example, the tv_LayerCreate command needs a name for the layer that you want to create.
This command returns some information regarding your layer: opacity, number of pictures, place of
the timeline,… So you can reuse or modify them.
It would be too long to enumerate here the arguments and the return values of each George
command. All those parameters are fully explained in the developper kit (SDK) of TVPaint
Animation. The SDK is available on demand at the email address: tvpaint@tvpaint.fr
Since approximatively 10 years, all the softwares using the TVPaint technology offers
a scripting language.
Here are some informations regarding the compatibility between those scripting
language : If you upgraded to TVP Animation, your old scripts should still work.
However, some recent commands (for instance: TV_AddBookmarks) are not
available in older products using the TVPaint Technology. (Aura, Mirage,…)
The program on the next page comes from the file clock.grg. It allows you to draw a clock
displaying the current time on the project window.
We suggest you create a button assigned to this script in a custom panel, as explained previously.
After this operation, it should be easy for you to test this George Script in the project window.
Once this stage is passed, you can try to edit the George Script, to modify it and to test it again in
TVPaint Animation. This should help you learn the basics of the George Language.
The best way to get used to George scripts is probably to try the example programs
that come with TVPaint Animation.
Study them and make small alterations to them, then run them and see the effects of your
changes.
if cmp(command,"Circle")==0
tv_Warn "This program needs the coordinates of a circle !"
exit
// If there are no coordinates for a circle, warn the user and end the program.
End
t=time
parse t h m s
// Fetches the hours (h), minutes (m) and seconds (s) of the current time.
m=m+s/60
// The seconds can slightly alter the minutes arm of the clock.
tv_Pen r/30 // Selects a pen proportional to the clock size.
tv_Circle x y r // Draws the outline of the clock.
ang=360/12
d=r-(r/10)
#for i=0 to 360-ang step ang
// Loop to draw the 12 hour markers on the clock
#a=cos(i)*d
#b=sin(i)*d
tv_Dot x+a y-b 0
#end
Commands Description
Here are some information regarding the commands that you can find on the previous page :
Below, each command will be followed by the syntax of the variables it requires.
For example, to draw a straight line from one point to another, you must give the coordinates of the
start point then the end point.
To summarize :
[ ] Variables inside square brackets are optional.
/ The “/” symbol separates several options of which only one is used.
For instance, 0/1 means either 0 or 1.
tv_Circle x y r [0/1]
This command allows you to draw a circle with a radius r and a center located on the pixel with
(x,y) coordinates. The [0/1] parameter indicates that you can use either the left [0] or the right [1]
mouse button.
Of course, the circle will be drawn on the current image on the current layer.
tv_Dot x y [0/1]
this command allows you to use the current tool (airbrush, pen, custombrush,…) on the pixel with
(x,y) coordinates, in the current image on the current layer.
The [0/1] parameter indicates that you can use either the left [0] or the right [1] mouse button.
tv_Warn text
This command displays a popup dialog box containing the character string text and an “ok” button.
The character string must be surrounded by quotation marks.
tv_Pen size
This command allows you to select the pen tool with its current parameters (drawing mode,
opacity, power, ...) and change its size.
You should always remember that a George Script will use TVP Animation as it finds
it, i.e. with the functions and options that are currently set.
For instance, if you want to draw a red line with a George Script, the script needs to
be told more than just the line coordinates. Unless you explicitly tell it to use a red
color, your script will go ahead and use the current color when the script is run,
whatever it may be.
Similarly, if when you run the script it is in the Behind or Colorize drawing mode, you
won’t exactly be getting the clean line you were hoping for.
1°) A sharp character # at the beginning of a line will not affect the execution of the script.
For instance, the line :
Pause 20
#Pause 20
2°) You can use only one instruction or command on the same line. For instance, if you use the
following line in a script :
3°) Everything on a line that is after a double slash // is ignored. They are only
comments that have been put into the script to make it more understandable and readable by
humans. For instance, the line :
// Pause 20
TVP Animation sees no difference between uppercase and lowercase letters. For
instance, TV_layercreate, tV_LaYeRcReAtE, tv_LAYERCREATE are all exactly
the same command.
MyNumber=10
Answer=false
The George language use a few reserved variables in order to work correctly. You
can use them as you wish, but it is not advised to modify them.
That is the case with the two variables « Time » and « Result » (encountered in the
clock.grg script above) which contains respectively the current time and the
results of the last used TVP Animation command.
The « = » operator is an assignment operator and allows to assign a given value to the variable of
your choice. For example :
MyNumberOfLayers=5
The « == » operator is an comparison operator between two variables, usually used during
conditional tests. For example :
if a==5
The comparison operator is not appropriate if want to know if two non numerical variables are
equal. For this, you need to use the instruction cmp, as shown in the clock.grg script above :
if cmp(command,"Circle")==0
The instruction Parse allows you to split up a character string into smaller character strings
Usually, each George Script begins with the Param instruction. It allows you to choose which
action will have to be done by the user in order to start the script execution : drawing a circle, a
segment, a rectangle ...
Param None
allows the George Script to be executed without waiting for an user action.
Param Single
Parse result command x y button
allows you to execute a George Script after a simple mouse click on the project window.
- The character string « single» will be assigned to the variable called
command if a point is drawn on the screen.
- The point coordinates will be assigned to the variables x and y.
- The button selected by the user to draw the point will be assigned to
the variable called button. (1 for RMB, 0 for LMB).
Param Line
Parse result command x1 y1 x2 y2 button
The George Script will be launched only if a segment is drawn on the project window.
- The character string « Line » will be assigned to the variable called
command if a line is drawn on the screen.
- The coordinates of the points at the ends of the segment will be
assigned to the variables x1 y1 and x2 y2 ( see opposite )
- The button selected by the user to draw the line will be assigned to the
variable called button. (1 for RMB, 0 for LMB).
Param Circle
Parse result command x y r button
The George Script will be launched only if a circle is drawn on the project window.
- The character string « Circle » will be assigned to the variable called
command if a circle is drawn on the screen.
- The coordinates of the circle center will be assigned to the variables x
and y.
- The radius of the circle will be assigned to the variable r.
- The button selected by the user to draw the circle will be assigned to
the variable called button. (1 for RMB, 0 for LMB).
Param Rectangle
Parse result command x1 y1 x2 y2 button
The George Script will be launched only if a rectangle is drawn on the project window.
- The character string « Rectangle » will be assigned to the variable
called command if a rectangle is drawn on the screen.
- The coordinates of the points at the ends of the rectangle will be
assigned to the variables x1 y1 and x2 y2 ( see opposite )
- The button selected by the user to draw the rectangle will be assigned
to the variable called button. (1 for RMB, 0 for LMB).
Param Freehand
Parse result command x y button
The George Script will be launched only if a freehand curve is drawn on the project window.
It is important to know how to use the character strings because they usually plays a part in
numerous situations.
For example, in the following script lines, a loop allows to load the projects :
D:/cartoon3.tvp, D:/cartoon4.tvp, ... ... ... D:/cartoon15.tvp, D:/cartoon16.tvp.
For number=3 to 16
NameOfTheFile="D:/cartoon"number'.tvp'
tv_loadproject NameOfTheFile
End
As shown above, you will have to use simple quotation marks ('...') or double quotation marks (''...'')
in order to differentiate variables from character strings.
It is possible to use the Concat instruction to join end to end character strings
and/or variables. The following lines have the same effect :
NameOfTheFile=number'.jpg'
NameOfTheFile=Concat(number,.jpg)
If you need to use simple quotation marks ('...') or double quotation marks (''...'') in your character
strings, you must surround them with the other quotation marks at your disposal, as shown in the
example below :
Print ' My prefered animation program is " TVP Animation " '
// will surround the name of the software with double quotation marks.
Print " My prefered animation program is ' TVP Animation ' "
// will surround the name of the software with single quotation marks.
The arrays
As in other programming languages, George can create and use arrays with one, two or more
dimensions.
To create an array, you only need to add parentheses or square brackets after the name of a
variable. You can use either parentheses or square brackets.
For instance,
MyArray(i) or MyArray[i] represent the same array with one dimension.
MyArray(i,j) or MyArray[i,j] represent the same array with two dimensions.
MyArray(i,j,k) or MyArray[i,j,k] represent the same array with three dimensions.
And so on ...
With the George language, it is not necessary to indicate or declare the dimension
or the number of elements before using an array.
In the exemple below, an array called color with one dimension was created.
It contains four elements : "Magenta", "Cyan", "Yellow" and "Black"
We used a loop to display its content.
color[1]="Magenta"
color[2]="Cyan"
color[3]="Yellow"
color[4]="Black"
For i=1 To 4
Let's assume that you are writing a script which needs some instructions, conditional tests, etc ...
to be executed several times. (For instance, a script which tests the pixel's colors several time and
acts differently depending on the obtained results. )
Copying the same lines several time in a George Script can quickly become fastidious. It doesn't
make the things easier when you need to check or modify your script.
That's the reason why writing procedures and functions is very convenient :
* A function is a set of instructions and commands which allows you to execute a precise task
inside a George Script. The functions are independent from the remainder of the George Script
and are located at the end of the script.
The part of a George Script which distinguish itself from the function(s) will be called “main part of
the script”. All the functions are available at any moment in order to be used by the Main part of
the script. A function can receive parameters and always returns a result.
Param Single
Parse result command abscissa ordinate button
tv_warn TestBlackColor(abscissa,ordinate)
Function TestBlackColor(x,y)
Local r g b alpha sum
tv_getpixel x y
Parse result r g b alpha
If alpha<>0
sum=r+g+b
If sum==0
Return " the pixel's color is black "
Else
Return " the pixel's color is NOT black "
End
Else
Return " the pixel is transparent "
End
End
The line :
tv_warn TestBlackColor(abscissa,ordinate)
Can be replaced by the two following lines :
Answer=TestBlackColor(abscissa,ordinate)
tv_warn Answer
Here is the syntax of the instructions relative to the procedures and functions :
Functions and procedures must always be located after the main part of your script.
Calling a function or a procedure in the main part of your script can be done by
writing its name and the needed variables between parenthesis, separated by comas.
Return Result
This instruction allows you to specify the result of your function and to make it available in the main
part of the script. It could be a character string, a numerical value, a boolean value, etc ...
In the main part of your script, it is possible to save it into a variable, and after to re-use it.
This instruction is optional. If you don't use it, you have created a procedure instead of a function.
End
This instruction is needed to finish your function or procedure.
The functions and procedures written in George language can be recursive. In other
words, a function can call itself. It allows you to create more sophisticated scripts.
For instance, drawing a fractal curve can be done thanks to a recursive script
(see below)
> >
We have just seen in the last chapter that it was possible to create your own George functions and
procedures.
This may be taken even further as you can store your functions and procedures in «.grg» files and
you can re-use them in other scripts written in George.
In other words, you can create your own libraries.
To insert one of your libraries in a George Script, you only have to write the following line in your
script :
#Include "MyLibrary.grg"
The instruction #Include will search the file called MyLibrary.grg in the directory containing the
current George Script or in the root directory of TVPaint Animation.
The following line allows you to specify a more precise access path, from the base directory :
#Include "MyFolderOfLibraries/MyLibrary.grg"
Please read the Initialization File section in the appendix of this user-manual if you
want to change the root directory of TVP Animation.
They are called Basic.grg and Advanced.grg and are related to character strings management.
To make them available in the George Scripts
# Include "include/basic.grg"
given with the software, you only need to add the
# Include "include/advanced.grg" opposite lines at the end of those scripts :
At startup, the first thing that TVPaint Animation does (after displaying the main toolbox, but
before giving control to the user) is to run the Startup.grg script (which should be in the same
directory as the other scripts).
When there is no Startup.grg file, nothing will happen. Otherwise, you have at your disposal a
startup file that gets run every time you load TVPaint Animation.
If, for example, you rename the Logo.grg file to Startup.grg, it will load the TVPaint Développement
logo to screen every time you run TVPaint Animation.
You could also, thanks to a simple George script, define all your preferred parameters. For
instance : load a project from your harddrive, change the current colors, add some layers to your
project, etc…
As explained before, George is not the only program that can send commands to TVPaint
Animation.
Any other program could theoretically do so. Examples using an Excel script, a C program or other
languages are certainly conceivable.
Besides, it is possible for experienced users or third-party companies to create Plug-ins that can be
used with TVPaint Animation.
Those Plug-ins allows you to add customized tools to the software like effects on pictures, new
drawing modes, new tools or new functions.
The Plug-in may be in the « .dll » (Dynamic Link Library) file format, which can be obtained thanks
to a compiler. « .dll » files are not readable in a text editor, unlike the classical George Scripts.
For more details about this subject, please visit the TVPaint Developpement forum. You can also
ask us the development kit (also called SDK) at the email address : tvpaint@tvpaint.fr
This kit contains source codes for interface functions, documentation and some detailed plug-in
examples.
Adding arguments
You can add arguments to the execution of TVPaint Animation. These arguments are :
- images (just write the path and file name),
- scripts (syntax: script=PathAndFileName.grg),
- george commands (syntax: cmd=GeorgeCommand).
For example :
TVPaint Animation.exe "MyImage" "script=MyScriptPathAndName.grg"
"cmd=MyGeorgeCommand"
Each time the content of the image changes, a new image is added in the animation of the
Drawing Recorder.
The original image which was drawn, while the Drawing Recorder was
running, 3 letters with 3 different tools.
The animation, based on the original image, created thanks to the drawing recorder.
The Drawing Recorder panel is very simple, three buttons and a preview.
This custom panel allows you to record easily your TVPaint Animation interface. This is really
useful, especially to create tuorials. This panel can be found in the menu Custom panelsî.
The first button is used to start the record, whereas the second allows to stop and generate an
images sequence into the TVPaint Animation's timeline.