Page 1 of 1

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

Posted: 09 Dec 2020, 04:26
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:

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

Posted: 09 Dec 2020, 17:51
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.

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

Posted: 09 Dec 2020, 19:53
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

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

Posted: 09 Dec 2020, 20:41
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!

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

Posted: 11 Dec 2020, 00:22
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.

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

Posted: 11 Dec 2020, 03:38
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

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

Posted: 11 Dec 2020, 11:42
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 :!:

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

Posted: 12 Dec 2020, 23:39
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.

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

Posted: 13 Dec 2020, 00:59
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

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

Posted: 13 Dec 2020, 03:22
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!