Change line colour

A forum dedicated to George scripting questions
User avatar
schwarzgrau
Posts: 1238
Joined: 23 Jan 2012, 22:08
Location: Offenbach / Germany
Contact:

Re: Change line colour

Post by schwarzgrau »

I was annoyed that I always needed to recompute the layers instances, so I added the command. Maybe somebody else will find it useful.
All credits still go to Svengali and Mads.
Attachments
Acolor.tvpx
Fill your layer with A color.
(57.5 KiB) Downloaded 552 times
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Cintiq 22HD
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
INSTAGRAM
Elodie
Posts: 13912
Joined: 06 Jan 2009, 09:53
Location: Metz

Re: Change line colour

Post by Elodie »

Hey Marc, have you noticed you can now disable auto break on the layer of your choice ? Then, you don't need to recompute anything.
User avatar
schwarzgrau
Posts: 1238
Joined: 23 Jan 2012, 22:08
Location: Offenbach / Germany
Contact:

Re: Change line colour

Post by schwarzgrau »

Oh of course! Thank you for reminding me
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Cintiq 22HD
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
INSTAGRAM
User avatar
cgmodeler
Posts: 113
Joined: 23 Oct 2012, 23:59
Location: Mexico/France/Japan
Contact:

Re: Change line colour

Post by cgmodeler »

Just found this script while trying to get a custom AColor to work on a pixelmatrix but noticed that the pixelmatrix modifies the alpha and gives an awful white premult.

So in short, can anyone point me into the right direction on how to modify the script to work only on heads?? The script is no longer working if you don't have a selected frame, and this will avoid having to recompute or enable/disable the auto-break instance.

I tried using the tv_cmd Heads before the tv_rectFill:

Code: Select all

tv_SetDrawMode "color"								// assure that color mode is selected

tv_cmd Heads tv_RectFill 0 0 PWidth PHeight 0				// fill frame with APen color (excluding alpha area)

END
At the process part but got no luck.

Can anybody help me out here?

Thanks :D
www.cocoalopez.com
vimeo / 156794487
Desktop: TVP Pro 11.0.8 - 64bit Win 7 x64 48GB RAM - GTX1070 - Cintiq 27QHD Driver 6.3.29
User avatar
NathanOtano
Posts: 1208
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Change line colour

Post by NathanOtano »

When running your script use "tv_exposureinfo" http://wiki.tvpaint.com/index.php?title=Tv_Exposureinfo
And use the "IF..." operator to execute your action only if result is a head

To preserve alpha you need to activate alpha on the layer with a command, and deactivate it at the end of your script if you want alpha off afterward. With http://wiki.tvpaint.com/index.php?title=Tv_Preserve

But I see that your script doesn't run "on selection" kind of. If you want a proper script, you should detext selection, then iterate with the "while" or "for" operator on the images inside the selection :) look at the "layer run" code at the end of this page for exemple : http://wiki.tvpaint.com/index.php?title ... s_:_Layers

Scripts are not that hard, but there is no magical trick to go faster than writing every action :) maybe have a look at svengali's script to see how it looks like
But right now if you desactivate auto-exposure creation and activate alpha on your layer, it should work maybe?
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.
User avatar
cgmodeler
Posts: 113
Joined: 23 Oct 2012, 23:59
Location: Mexico/France/Japan
Contact:

Re: Change line colour

Post by cgmodeler »

Thanks a lot Nathan for pointing the way.

I fixed and added a few things to Svengali script to work properly with V11
For some reason the detection of non selected frames wasn't working on V11, perhaps it needed some extra "d d d " after parsing the result of the "tv_LayerInfo" but i'm not sure.

I'm attaching the modified version if anyone needs it.

It will remove the autobreak instances to avoid creating extra frames
If clicked will colorize only the current frame
When selecting several frames it will colorize only selected frames (without breaking instances)
MatteLayer.tvpx
(58 KiB) Downloaded 538 times
www.cocoalopez.com
vimeo / 156794487
Desktop: TVP Pro 11.0.8 - 64bit Win 7 x64 48GB RAM - GTX1070 - Cintiq 27QHD Driver 6.3.29
User avatar
NathanOtano
Posts: 1208
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Change line colour

Post by NathanOtano »

Awesome :) well done!
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.
User avatar
schwarzgrau
Posts: 1238
Joined: 23 Jan 2012, 22:08
Location: Offenbach / Germany
Contact:

Re: Change line colour

Post by schwarzgrau »

This is still something I would love to see as a build in feature:
Select one or several frames, press a button and get the content filled with your A/foreground color.
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Cintiq 22HD
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
INSTAGRAM
User avatar
cgmodeler
Posts: 113
Joined: 23 Oct 2012, 23:59
Location: Mexico/France/Japan
Contact:

Re: Change line colour

Post by cgmodeler »

schwarzgrau wrote: 24 Oct 2021, 15:43 This is still something I would love to see as a build in feature:
Select one or several frames, press a button and get the content filled with your A/foreground color.
You can map the script to a hotkey I used CTRL + Backspace (Almost like photoshop)
www.cocoalopez.com
vimeo / 156794487
Desktop: TVP Pro 11.0.8 - 64bit Win 7 x64 48GB RAM - GTX1070 - Cintiq 27QHD Driver 6.3.29
User avatar
schwarzgrau
Posts: 1238
Joined: 23 Jan 2012, 22:08
Location: Offenbach / Germany
Contact:

Re: Change line colour

Post by schwarzgrau »

Thank you. I already got that set up, but It would be great if this could be a regular feature.
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Cintiq 22HD
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
INSTAGRAM
kelanhordos
Posts: 94
Joined: 06 Aug 2019, 01:09
Contact:

Re: Change line colour

Post by kelanhordos »

Hello, this useful script was broken with v12, I've updated it to work. The change in v12 was to tv_preserve, it requires that "Alpha" no longer be written before the On/Off etc. parameter. Simple fix for any other scripts that might use the same command.

MatteLayer.tvpx
(58 KiB) Downloaded 83 times
PC: Windows 10/64 Pro - TUF Gaming H470-PRO, i9-10900F@ 2.8 GHz - 32Gb RAM
Tvpaint 12.0.1 Pro
Wacom Cintiq 16 Driver: 6.4.7-3
Post Reply