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.