How can I grab the color from the current layer ONLY? Topic is solved

Please use this part to report bugs & errors, ask questions & "How to..."
Post Reply
User avatar
Animationriver
Posts: 258
Joined: 02 Jul 2017, 09:04
Location: Moscow
Contact:

How can I grab the color from the current layer ONLY?

Post by Animationriver »

Hello!
This question is very important to me for my work.
I am using an eyedropper in Photoshop. There is a mode for capturing color through all layers.
There is a mode for capturing color from the current layer.
Q:
I WORK in TVpoint 11.5!!!
WHEN ALL LAYERS ARE VISIBLE.
How can I grab the color from the current layer ONLY?
Is it possible to create such an option as in PHOTOSHOP?

I have attached a video:
Attachments
color.mp4
CURRENT LAYER ONLY
(11.51 MiB) Downloaded 785 times
www.youtube.com/c/animationriver
MAC OS Sierra 10.12.6 64 bits , MacBook Pro (Retina, 15-inch, Mid 2014)
2.8 GHz Intel Core i7, 16 GB Memory , TVPaint PRO 11.5.2 64bit
NVIDIA GeForce GT 750M 2048 Мb
Wacom Cintiq 27 QHD Touch - Wacom Intuos Pro 5 - driver version 6.3.37-2
User avatar
D.T. Nethery
Posts: 4225
Joined: 27 Sep 2006, 19:19

Re: How can I grab the color from the current layer ONLY?

Post by D.T. Nethery »

I agree with you , this would be a useful function to have for the color picker (eyedropper) tool in TVPaint.

The topic should probably be moved to Feature & Improvement requests forum.

Animator, TVPaint Beta-Tester, Animation Educator and Consultant.
MacOS 12.7.1 Monterey , Mac Mini (2018) , 3.2 GHz 6-Core Intel Core i7,
16 GB RAM , TVPaint PRO 11.7.1 - 64bit , Wacom Cintiq 21UX 2nd Gen.
,Wacom Intuos Pro 5 , Wacom driver version 6.3.39-1
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: How can I grab the color from the current layer ONLY?

Post by Svengali »

You can make a custom button to do this using the following embedded GEORGE script:

Code: Select all

tv_GetWidth
Width = result
tv_GetHeight
Height = result
ExitFlag = 0
tv_LockMouse 4
While ExitFlag == 0
     tv_WaitButton
     parse result ButtonState X Y
     IF ButtonState == 3 || ButtonState == 4 || X < 0|| X > Width || Y < 0 || Y > Height 
         ExitFlag = 1
     ELSE
          tv_GetPixel X Y
          parse result R G B A
          IF A > 0
               tv_SetAPen R G B A
 //          tv_warn "pixel color = " R G B A
          END
     END
END
tv_UnLockMouse
The button will sample the RGBA value of the current layer/current pixel and set the APen color.
Click RMB to exit. Or if your stylus is setup, hold down the lower switch on the barrel and click the tip.

1st Update to script: you may also just click outside the Project window to exit.
2nd Update to script: added arrow + question mark cursor while selecting layer color reverting to normal cursor on exit.

sven
Last edited by Svengali on 10 Dec 2020, 08:37, edited 2 times 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
tribute27
Posts: 65
Joined: 28 Aug 2015, 18:57

Re: How can I grab the color from the current layer ONLY?

Post by tribute27 »

Svengali wrote: 09 Dec 2020, 19:53 You can make a custom button to do this using the following embedded GEORGE script:

Code: Select all

ExitFlag = 0
While ExitFlag == 0
     tv_WaitButton
     parse result ButtonState X Y
     IF ButtonState == 3 || ButtonState == 4
         ExitFlag = 1
     ELSE
          tv_GetPixel X Y
          parse result R G B A
          IF A > 0
               tv_SetAPen R G B A
 //          tv_warn "pixel color = " R G B A
          END
     END
END
The button will sample the RGBA value of the current layer/current pixel and set the APen color.
Click RMB to exit. Or if your stylus is setup, hold down the lower switch on the barrel and click the tip.


sven

this is amazing, thank you!
Windows 10 64-bit | AMD Ryzen 9 5950x | TVPaint Animation 11 Pro WIBU (11.7.1-64 bits) | Wacom Cintiq Pro 27
User avatar
Animationriver
Posts: 258
Joined: 02 Jul 2017, 09:04
Location: Moscow
Contact:

Re: How can I grab the color from the current layer ONLY?

Post by Animationriver »

Svengali wrote: 09 Dec 2020, 19:53 You can make a custom button to do this using the following embedded GEORGE script:

Code: Select all

tv_GetWidth
Width = result
tv_GetHeight
Height = result
ExitFlag = 0
tv_LockMouse 4
While ExitFlag == 0
     tv_WaitButton
     parse result ButtonState X Y
     IF ButtonState == 3 || ButtonState == 4 || X < 0|| X > Width || Y < 0 || Y > Height 
         ExitFlag = 1
     ELSE
          tv_GetPixel X Y
          parse result R G B A
          IF A > 0
               tv_SetAPen R G B A
 //          tv_warn "pixel color = " R G B A
          END
     END
END
tv_UnLockMouse
The button will sample the RGBA value of the current layer/current pixel and set the APen color.
Click RMB to exit. Or if your stylus is setup, hold down the lower switch on the barrel and click the tip.

1st Update to script: you may also just click outside the Project window to exit.
2nd Update to script: added arrow + question mark cursor while selecting layer color reverting to normal cursor on exit.

sven

This is genius! Sven!
Thank you!
I made a button on a custom panel. And it works.

When you paint, you want to have such a button on the WACOM ExpressKey.
Or a button on the stylus.
Make it a hotkey.

I can make a hotkey for the eyedropper.
But the eyedropper tool is not your "miracle script button".

How would you do this if you needed to?
I don't know how to do it.
www.youtube.com/c/animationriver
MAC OS Sierra 10.12.6 64 bits , MacBook Pro (Retina, 15-inch, Mid 2014)
2.8 GHz Intel Core i7, 16 GB Memory , TVPaint PRO 11.5.2 64bit
NVIDIA GeForce GT 750M 2048 Мb
Wacom Cintiq 27 QHD Touch - Wacom Intuos Pro 5 - driver version 6.3.37-2
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: How can I grab the color from the current layer ONLY?

Post by Svengali »

Animationriver wrote: 11 Dec 2020, 00:22 How would you do this if you needed to?
Its easy.
Let's say you named your custom panel "ColorStuff" and in the panel you put your button named "LayerPixPick".

Open the Configure Keyboard Shortcuts panel. In the Search box type "LayerPixPick" which will show you The Custom Panel name... click on "(+) ColorStuff" and select the "LayerPixPick" button name which will highlight.
Pick a shortcut key you want to assign the button to, let's say "Shift P", and OK, to save the Shortcuts list. From there you link Shift P to a button on your device or stylus like it was any other shortcut key.

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
Animationriver
Posts: 258
Joined: 02 Jul 2017, 09:04
Location: Moscow
Contact:

Re: How can I grab the color from the current layer ONLY?

Post by Animationriver »

Svengali wrote: 11 Dec 2020, 03:38
Animationriver wrote: 11 Dec 2020, 00:22 How would you do this if you needed to?
Its easy.
Let's say you named your custom panel "ColorStuff" and in the panel you put your button named "LayerPixPick".

Open the Configure Keyboard Shortcuts panel. In the Search box type "LayerPixPick" which will show you The Custom Panel name... click on "(+) ColorStuff" and select the "LayerPixPick" button name which will highlight.
Pick a shortcut key you want to assign the button to, let's say "Shift P", and OK, to save the Shortcuts list. From there you link Shift P to a button on your device or stylus like it was any other shortcut key.

sven
I sincerely thank you for your help and support!
This is a very good job on your part.
Thank you for not leaving me in a difficult situation.

I completely solved my question with your help. :D :D :D :D :D :!:
www.youtube.com/c/animationriver
MAC OS Sierra 10.12.6 64 bits , MacBook Pro (Retina, 15-inch, Mid 2014)
2.8 GHz Intel Core i7, 16 GB Memory , TVPaint PRO 11.5.2 64bit
NVIDIA GeForce GT 750M 2048 Мb
Wacom Cintiq 27 QHD Touch - Wacom Intuos Pro 5 - driver version 6.3.37-2
User avatar
Animationriver
Posts: 258
Joined: 02 Jul 2017, 09:04
Location: Moscow
Contact:

Re: How can I grab the color from the current layer ONLY?

Post by Animationriver »

Svengali wrote: 09 Dec 2020, 19:53 You can make a custom button to do this using the following embedded GEORGE script:

Code: Select all

tv_GetWidth
Width = result
tv_GetHeight
Height = result
ExitFlag = 0
tv_LockMouse 4
While ExitFlag == 0
     tv_WaitButton
     parse result ButtonState X Y
     IF ButtonState == 3 || ButtonState == 4 || X < 0|| X > Width || Y < 0 || Y > Height 
         ExitFlag = 1
     ELSE
          tv_GetPixel X Y
          parse result R G B A
          IF A > 0
               tv_SetAPen R G B A
 //          tv_warn "pixel color = " R G B A
          END
     END
END
tv_UnLockMouse
The button will sample the RGBA value of the current layer/current pixel and set the APen color.
Click RMB to exit. Or if your stylus is setup, hold down the lower switch on the barrel and click the tip.

1st Update to script: you may also just click outside the Project window to exit.
2nd Update to script: added arrow + question mark cursor while selecting layer color reverting to normal cursor on exit.

sven
Hello!
I am very happy to be lucky enough to receive a new tool.
But I have to reset the instrument.
I do a tap outside the picture field, after capturing the color

Do you know how to make an addition to the script. So that after the color is captured, the instrument automatically switches to STROKE [D] mode.
In other words, I want: functionality like a standard eyedropper tool.
Thanks for the opportunity.
www.youtube.com/c/animationriver
MAC OS Sierra 10.12.6 64 bits , MacBook Pro (Retina, 15-inch, Mid 2014)
2.8 GHz Intel Core i7, 16 GB Memory , TVPaint PRO 11.5.2 64bit
NVIDIA GeForce GT 750M 2048 Мb
Wacom Cintiq 27 QHD Touch - Wacom Intuos Pro 5 - driver version 6.3.37-2
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: How can I grab the color from the current layer ONLY?

Post by Svengali »

Yes, its a small change to make it return to your active tool after choosing a color, with one problem:
If you choose a background pixel (one which has zero alpha value) the color is returned as black.
So, the following script traps when you click on a background pixel or as might happen, you are not on the layer you think you are on.
The script warns that no color was found (instead of making your APen black).
In that case you might have to confirm that you are on the layer you think you are AND/OR click again to sample the color.

Simply replace the other embedded script with the following:

Code: Select all

tv_LockMouse 4
tv_WaitButton
parse result ButtonState X Y
tv_GetPixel X Y
parse result R G B A
tv_UnLockMouse
IF A > 0
    tv_SetAPen R G B A
ELSE
     tv_warn "no pixel color found"
END
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
Animationriver
Posts: 258
Joined: 02 Jul 2017, 09:04
Location: Moscow
Contact:

Re: How can I grab the color from the current layer ONLY?

Post by Animationriver »

Svengali wrote: 13 Dec 2020, 00:59 Yes, its a small change to make it return to your active tool after choosing a color, with one problem:
If you choose a background pixel (one which has zero alpha value) the color is returned as black.
So, the following script traps when you click on a background pixel or as might happen, you are not on the layer you think you are on.
The script warns that no color was found (instead of making your APen black).
In that case you might have to confirm that you are on the layer you think you are AND/OR click again to sample the color.

Simply replace the other embedded script with the following:

Code: Select all

tv_LockMouse 4
tv_WaitButton
parse result ButtonState X Y
tv_GetPixel X Y
parse result R G B A
tv_UnLockMouse
IF A > 0
    tv_SetAPen R G B A
ELSE
     tv_warn "no pixel color found"
END
sven
You are my savior!
You are just a genius!
I don't know how you do it!
But I am sincerely grateful to you for your knowledge. And responsiveness!
If I could watch video tutorials on how to write a script. Then I probably would be able to do it and help just like you.
Thank you, sven!
www.youtube.com/c/animationriver
MAC OS Sierra 10.12.6 64 bits , MacBook Pro (Retina, 15-inch, Mid 2014)
2.8 GHz Intel Core i7, 16 GB Memory , TVPaint PRO 11.5.2 64bit
NVIDIA GeForce GT 750M 2048 Мb
Wacom Cintiq 27 QHD Touch - Wacom Intuos Pro 5 - driver version 6.3.37-2
Post Reply