[Addon] [v1.2] ColorRamp Dropper - easily select color values for ColorRamp nodes

Hi everyone,

[EDIT: v1.2 released, see below]

I just released the first version of a new addon which I have been asked for:
It adds a panel to the Node Editor Properties with the ability to quickly select multiple color values from the UI and put them into a ColorRamp Node.


[gif credits: http://www.tynaud.com/]

Download URL
https://raw.githubusercontent.com/qwenger/BAddons/master/Node_ColorRampDropper/node_colorramp_dropper.py

Installation
Simply install the addon in the standard way. A panel is shown in the Node Editor properties if the editor contains a node tree.

Screenshots

UI:

Created/updated node:

Usage
General: press on the “Draw ColorRamp Dropper Path” button (or choose it from the spacebar menu); the mouse cursor switches to eyedropper; draw a path with the mouse in any of the window’s spaces; confirm. Selected values get dropped into a ColorRamp.

Options

Use Active Node: If the active (i.e. highlit in yellow - not orange - in the default theme) node is of type ColorRamp, selected values get dropped to that colorramp. Else (or if this option is unchecked), a new ColorRamp node gets created and used.

Use Interval: Drop the selected values in a subinterval of the (0.0 - 1.0) range of the ColorRamp.

Erase Existing Keys: Remove previous values before dropping the new ones. If Use Interval is checked, there is additionally the possibility to remove previous values of the used subinterval only.

Path Type: The drawn path can consist of straight segments (Polyline) or curves (Cubic Spline).

Use Intermediate Points: Oversample the path by additionally selecting intermediate values. The Path Type/Cubic Spline mode is only useful with a nonzero amount of oversamples.

Free-Hand Drawing: Draw the whole path in a single stroke instead of multiple clicks (similarly to the Grease Pencil).

Use Segments Length: Dropped values into the ColorRamp get distributed with respect to their real distances from the selecting process instead of regularly spaced.

Keep Memory: Whether surnumerary (b/c of the 32 limit) values should be kept in memory or discarded.

Keys Alpha: Alpha to be used for new values.

Show Values: Display RGB values on screen while drawing the path. Allows a precise selection.

Controls

Escape: cancel
Return: confirm the select values, end drawing
Middle mouse / wheel click: switch path type
Wheel up/down: change amount of oversamples

Normal mode:
Left click: start drawing/select the current value under the eyedropper
Right click: deselect the last value/cancel (when no value is selected)

Free-hand mode:
Left click: start drawing
Left click, released: confirm the select values, end drawing
Right click: cancel

Known limitations

  • Returned RGB values are directly (up to the gamma) taken from the screen’s pixels; thus the alpha is only defined by the Keys Alpha option
  • Maximal amount of values in a ColorRamp is limited to 32 by Blender

Of course, C&Cs & suggestions are welcome.
Thanks!

UPDATES
v1.1

  • more controls in the drawing phase: mouse wheel up/down for changing the amount of oversamples of the path, middle mouse/ mouse wheel click for switching the path type
  • amount of oversamples and path type are displayed in the current space (bottom left) while in the drawing phase.

v1.2

  • overflows (more than 32 values) are transparently handled instead of yielding an error message; a checkbutton makes it possible to choose whether values in excess should be kept in memory or not
  • some tweaks.
1 Like

Tested, just awesome :slight_smile: Really usefull idea, well implemented. Maybe just small improvement: Having the possibility to change options after the path has been drawn like for most operators. You have created a great addon collection by the way.

So nice, thank you!

Do you know if it’s possible to make the dropper pick any color from the screen (not just within blender)?

@Matpi,
Thanks you to share your work with us. Very good idea.
Congratulations.

TRADUCTION FRANCAISE:


========================================================================
Usage:

Appuyez sur le bouton  "Draw ColorRamp Dropper Path"
Le curseur de la souris passe en outils pipette;
Tracer un chemin avec la souris dans l'une des fenĂȘtres de Blender;
et Confirmer!
Les valeurs copiées sont transférées dans un noeud "ColorRamp".


========================================================================
Options:

UTILISEZ LE NƒUD ACTIF:
    Coché: Si le noeud actif est un noeud de type ColorRamp,
    les valeurs sélectionnées sont copiées sur ce noeud.
    
    Non coché: Un nouveau noeud ColorRamp est créé 
    et affublé des valeurs copiées.

UTILISATION DE SOUS-INTERVAL:
    Coller les valeurs sélectionnées dans un sous-interval de la 
    plage générale (0-1) du noeud ColorRamp.

EFFACER LES CLÉS EXISTANTES:
    Supprime les valeurs précédentes avant d'y copier les nouvelles.
    
    Si UTILISATION DE SOUS-INTERVAL: il existe en outre la possibilité 
    d'éliminer uniquement les valeurs précédentes du sous-interval 
    utilisé.

TYPE DE CHEMIN:
    Le chemin tracé peut consister en:
        - segments droits (Polyline) 
        - courbes (Cubic Spline).

UTILISEZ LES POINTS INTERMÉDIAIRES:
    Alonger le chemin en copiant en outre les valeurs intermédiaires.
     
    Le type "Cubic Spline" n'est utile qu'avec une quantité non nul 
    de sur-Ă©chantillonnage.

DESSIN À MAIN LIBRE:
    Dessinez le chemin complet en un seul coup au lieu 
    de plusieurs clics (de la mĂȘme maniĂšre que le crayon gras).

LONGUEUR DES SEGMENTS A UTILISER
    Les valeurs copiées dans le noeud ColorRamp sont distribuées 
    par rapport à leurs distances réelles:
        - à partir du processus de sélection 
        - au lieu d'ĂȘtre rĂ©guliĂšrement espacĂ©es.

CONSERVER EN MÉMOIRE:
    Les valeurs en plus (du nbre max. de 32) doivent ĂȘtre 
    conservées en mémoire ou inutilisées.

KEYS ALPHA:
    Couleur à utiliser pour l'Alpha des clés, cad la transparence.


AFFICHER LES VALEURS:
    Affiche les valeurs RVB sur l'Ă©cran tout en dessinant le chemin. 
    Permet une sélection précise!


========================================================================
Raccourcies:

ESCAPE: Annule.
ENTER: Confirme les valeurs sélectionnées.

CLIC SUR LA MOLETTE DE LA SOURIS: Change le type de chemin.
ROULER VERS LE HAUT / BAS: Change la quantité de sur-échantillonnage.



========================================================================
Mode normal:
    CLIC GAUCHE: Commence à dessiner / sélectionnez les valeurs 
    sous la pipette.
    CLIC DROIT: Désélectionne la derniÚre valeur ou annule
    (lorsque aucune valeur n'est sélectionnée).

Mode mains libres:
    CLIC GAUCHE 1: Commence le segment.
    CLIC GAUCHE 2 RELÂCHÉ: Confirme les valeurs sĂ©lectionnĂ©es.
    CLIC DROIT: Annuler


========================================================================
Limites connues:
    Les valeurs RVB copiés sont directement (selon gamma) prises à 
    partir des pixels de l'écran donc l'alpha n'est défini que par 
    l'option KEYS ALPHA.

    La quantité maximale de valeurs dans un ColorRamp est limitée à 32 
    par Blender.

@matali: thank you. It is actually (by design) difficult to allow the user to have access to the panel after having drawn the path. Still, it is perfectly doable to have some more shortcuts at draw time to modify (some of) the parameters. The version 1.1 I just released (same link as before, check first post for details) adds this.
About my addons collection, well some of the addons still need more work/updating, but yes I hope to extend it further. I hope it can be helpful.

@burnin: thank you too. This unfortunately is not a trivial task, as Blender only has access to its own “region” on the screen (moreover, events in Blender are really location-bound, so the place the cursor is at is quite relevant). A workaround is to take a screenshot and to open the resulting image in the UV/Image Editor. This could be automated with Python, but sadly there is no standard & cross-platform tool/library to do that (meaning, it would be necessary to install some more Python dependencies, etc.).
If this really is something that matters, though, I can consider writing another addon dedicated to screenshot grabing and displayal in the UV/Image Editor. Would’nt be too hard, I guess.

@Spirou4D: thanks! I hope my work can be useful to someone. :wink:

Assumed it could be something alike
 :rolleyes:
Thanks for explanation.
Also good suggestion/idea for a workaround.
An add-on (+shortcut) to automate a screen capture, or an automated “courier” to call an app, make custom selectable capture, save and import
 could be very handy.

e.g.
personal workflow:

  • Blender running

  • call/run IrfanView:

  • press: “C” (Capture); “5” (Custom rectangle/region capture); Enter

[INDENT=2]- Click to Start (select region)
[/INDENT]
[INDENT=2]- Click to Capture (loaded to Irfan)
[/INDENT]

  • press: “Ctrl+S” (save to
 original/arbitrary/temp folder/Clipboard01.*)

  • import to Blender options:

A) Open Image in UV/Image editor
or
B) File Import > ‘Images as Planes’

I wish i could
 :o

I just released the version 1.2 (handles overflows, see OP).

@burnin: ok, if I have some time I’ll look into that. :slight_smile:

Up, added a nice description GIF by the original requester. :wink:

Up, just added a gif animation showing basic use of the addon. Thanks to the original requester.

This is very cool, I am using it in the compositor window below my painting window and copy’paste the curve into the ‘use gradient’ for painting. Since I use the nodes in the compositor to store my gradients, this is a very welcome tool, thank you very much!

@Craig Jones: thanks for your feedback. Glad to see that my addon is useful for you.
As you describe, I first thought about extending my addon to other colorramps in Blender, but then found out that copy-pasting between them works as well, so that it is ok to have it for colorramps in nodes only. Plus, this is a convenient way to save colorramps, as you can have “as many” nodes as you want. :slight_smile:

Yes, I use the node editor to store my color ramps and my curves from different places - just easy to copy/paste into a new one, name it, and then save it inside a group of collected nodes.

This addon is very helpful for gathering color ramps from photos or previous artworks, thank you for this!

Thanks , nide addon for procedural materials :eyebrowlift:

Thankyou!

This is a real time saver! :smiley:

very nice work

Usefull thing. Thanks for good job

Although I tried and did not like the Substance Painter interface, I thought the color-gradient picker was cool, so this is also cool! Thanks!

This is very useful! Thank you very much!

I have a question about a feature request - but if you don’t think it possible, I might try to do it myself as an addition.

I would like to be able to select a color ramp gradient, copy/paste to the gradient in the Tex Brush, and then generate a palette from the stops in the gradient. Long way is to paint with the gradient brush across canvas and set it to Repeat mode, and then once they are on the canvas I can color pick from the stops in the stroke one at a time to get swatches. I am looking at the different addons that touch color ramps or generate them to see how I might go about it.

Hi, the gif above isn’t viewable anymore. I am on version 3.0 and I can’t seem to locate the addon in the node editor properties. Please let me know if the addon works with 3.0? Thanks.