- Fix gradient alpha not loading.

This commit is contained in:
Tanasart 2024-07-27 12:10:34 +07:00
parent 48b0dda79e
commit 44a03c57df
36 changed files with 137 additions and 137 deletions

View file

@ -35,7 +35,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
inputs[| 11] = nodeValue("Scale over time", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11 );
inputs[| 12] = nodeValue("Color over lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) );
inputs[| 12] = nodeValue("Color over lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) );
inputs[| 13] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
.setDisplay(VALUE_DISPLAY.range, { linked : true });
@ -82,7 +82,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
inputs[| 27] = nodeValue("Spawn", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
inputs[| 28] = nodeValue("Random blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) );
inputs[| 28] = nodeValue("Random blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) );
inputs[| 29] = nodeValue("Directed from center", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Make particle move away from the spawn center.");

View file

@ -1,10 +1,9 @@
#region channels
function cola(color, alpha = 1) { INLINE return int64((color & 0xFFFFFF) + (round(alpha * 255) << 24)); }
function _cola(color, alpha) { INLINE return int64((color & 0xFFFFFF) + (alpha << 24)); }
function colda(color) { INLINE return real(color & 0xFFFFFF); }
function color_get_alpha(color) { INLINE return is_real(color)? 255 : (color & (0xFF << 24)) >> 24; }
function _color_get_alpha(color) { INLINE return is_real(color)? 1 : color_get_alpha(color) / 255; }
function color_get_alpha(color) { INLINE return (color & (0xFF << 24)) >> 24; }
function _color_get_alpha(color) { INLINE return color_get_alpha(color) / 255; }
function _color_get_red(color) { INLINE return color_get_red(color) / 255; }
function _color_get_green(color) { INLINE return color_get_green(color) / 255; }
@ -22,7 +21,7 @@
function make_color_hsva(h, s, v, a) { INLINE return _cola(make_color_hsv(h, s, v), a); }
function make_color_oklab(ok, a = 1) { #region
function make_color_oklab(ok, a = 1) {
INLINE
var k = new __vec3(ok[0], ok[1], ok[2]);
k.x = power(k.x, 3);
@ -35,31 +34,31 @@
rg.z = power(rg.z, 1 / 2.2) * 255;
return make_color_rgba(rg.x, rg.y, rg.z, a);
} #endregion
}
function make_color_srgba(rgb, a) { #region
function make_color_srgba(rgb, a) {
INLINE
var r = power(rgb[0], 1 / 2.2) * 255;
var g = power(rgb[1], 1 / 2.2) * 255;
var b = power(rgb[2], 1 / 2.2) * 255;
return int64(round(r) + (round(g) << 8) + (round(b) << 16) + (round(a) << 24));
} #endregion
}
function colorFromRGBArray(arr) { #region
function colorFromRGBArray(arr) {
var r = round(real(arr[0]) * 255);
var g = round(real(arr[1]) * 255);
var b = round(real(arr[2]) * 255);
return make_color_rgb(r, g, b);
} #endregion
}
function colorToArray(clr, alpha = false) { #region
function colorToArray(clr, alpha = false) {
INLINE
if(alpha) return [ _color_get_red(clr), _color_get_green(clr), _color_get_blue(clr), _color_get_alpha(clr) ];
return [ _color_get_red(clr), _color_get_green(clr), _color_get_blue(clr) ];
} #endregion
}
function paletteToArray(_pal) { #region
function paletteToArray(_pal) {
var _colors = array_create(array_length(_pal) * 4);
for(var i = 0; i < array_length(_pal); i++) {
_colors[i * 4 + 0] = _color_get_red(_pal[i]);
@ -69,24 +68,24 @@
}
return _colors;
} #endregion
}
#endregion
#region color spaces
function color_rgb(col) { #region
function color_rgb(col) {
INLINE
return [ color_get_red(col) / 255, color_get_green(col) / 255, color_get_blue(col) / 255 ];
} #endregion
}
function color_srgb(col) { #region
function color_srgb(col) {
INLINE
return [ power(color_get_red(col) / 255, 2.2), power(color_get_green(col) / 255, 2.2), power(color_get_blue(col) / 255, 2.2) ];
} #endregion
}
function color_hsv(col) { #region
function color_hsv(col) {
INLINE
return [ color_get_hue(col) / 255, color_get_saturation(col) / 255, color_get_value(col) / 255 ];
} #endregion
}
global.CVTMAT_RGB_OKLAB = new __mat3([ 0.4121656120, 0.2118591070, 0.0883097947,
0.5362752080, 0.6807189584, 0.2818474174,
@ -96,7 +95,7 @@
-3.3072168827, 2.6093323231, -0.7034763098,
0.2307590544, -0.3411344290, 1.7068625689 ]);
function color_oklab(col) { #region
function color_oklab(col) {
INLINE
var v = new __vec3(color_get_red(col) / 255, color_get_green(col) / 255, color_get_blue(col) / 255);
v.x = power(v.x, 2.2);
@ -109,17 +108,17 @@
ok.z = power(ok.z, 1 / 3);
return [ ok.x, ok.y, ok.z ];
} #endregion
}
#endregion
#region data
function colorBrightness(clr, normalize = true) { #region
function colorBrightness(clr, normalize = true) {
INLINE
var r2 = color_get_red(clr) / (normalize? 255 : 1);
var g2 = color_get_green(clr) / (normalize? 255 : 1);
var b2 = color_get_blue(clr) / (normalize? 255 : 1);
return 0.299 * r2 + 0.587 * g2 + 0.224 * b2;
} #endregion
}
function colorMultiplyRGB(c1, c2) {
INLINE
@ -181,32 +180,32 @@
// return make_color_rgba((r1 * r2) * 255, (g1 * g2) * 255, (b1 * b2) * 255, (a1 * a2) * 255);
}
function colorAdd(c1, c2) { #region
if(c1 == 0) return c2;
if(c2 == 0) return c1;
var r1 = color_get_red(c1);
var g1 = color_get_green(c1);
var b1 = color_get_blue(c1);
var r2 = color_get_red(c2);
var g2 = color_get_green(c2);
var b2 = color_get_blue(c2);
return make_color_rgb(min(r1 + r2, 255), min(g1 + g2, 255), min(b1 + b2, 255));
} #endregion
function colorAdd(c1, c2) {
if(c1 == 0) return c2;
if(c2 == 0) return c1;
var r1 = color_get_red(c1);
var g1 = color_get_green(c1);
var b1 = color_get_blue(c1);
var r2 = color_get_red(c2);
var g2 = color_get_green(c2);
var b2 = color_get_blue(c2);
return make_color_rgb(min(r1 + r2, 255), min(g1 + g2, 255), min(b1 + b2, 255));
}
#endregion
function color_diff_fast(c1, c2) { #region
function color_diff_fast(c1, c2) {
INLINE
return (abs(_color_get_red(c1) - _color_get_red(c2)) +
abs(_color_get_green(c1) - _color_get_green(c2)) +
abs(_color_get_blue(c1) - _color_get_blue(c2))
) / 3;
} #endregion
}
function color_diff_alpha(c1, c2) { #region
function color_diff_alpha(c1, c2) {
INLINE
return sqrt(sqr(_color_get_red(c1) - _color_get_red(c2)) +
@ -214,22 +213,22 @@ function color_diff_alpha(c1, c2) { #region
sqr(_color_get_blue(c1) - _color_get_blue(c2)) +
sqr(_color_get_alpha(c1) - _color_get_alpha(c2))
);
} #endregion
}
function color_diff(c1, c2) { #region
function color_diff(c1, c2) {
INLINE
return sqrt(sqr(_color_get_red(c1) - _color_get_red(c2)) +
sqr(_color_get_green(c1) - _color_get_green(c2)) +
sqr(_color_get_blue(c1) - _color_get_blue(c2))
);
} #endregion
}
#region merge
#macro merge_color merge_color_ext
#macro __merge_color merge_color
function merge_color_ext(c0, c1, t) { #region
function merge_color_ext(c0, c1, t) {
INLINE
if(is_real(c0)) return __merge_color(c0, c1, t);
@ -239,9 +238,9 @@ function color_diff(c1, c2) { #region
clamp(round(lerp(color_get_blue(c0), color_get_blue(c1), t)), 0, 255),
clamp(round(lerp(color_get_alpha(c0), color_get_alpha(c1), t)), 0, 255),
);
} #endregion
}
function merge_color_hsv(c0, c1, t) { #region
function merge_color_hsv(c0, c1, t) {
INLINE
if(is_real(c0)) return make_color_hsv(
clamp(round(lerp(color_get_hue(c0), color_get_hue(c1), t)), 0, 255),
@ -255,9 +254,9 @@ function color_diff(c1, c2) { #region
clamp(round(lerp(color_get_value(c0), color_get_value(c1), t)), 0, 255),
clamp(round(lerp(color_get_alpha(c0), color_get_alpha(c1), t)), 0, 255),
);
} #endregion
}
function merge_color_oklab(c0, c1, t) { #region
function merge_color_oklab(c0, c1, t) {
INLINE
var ok0 = color_oklab(c0);
@ -272,9 +271,9 @@ function color_diff(c1, c2) { #region
var a = is_real(c0)? 255 : clamp(round(lerp(color_get_alpha(c0), color_get_alpha(c1), t)), 0, 255);
return make_color_oklab(ok, a);
} #endregion
}
function merge_color_srgb(c0, c1, t) { #region
function merge_color_srgb(c0, c1, t) {
INLINE
var sr0 = color_srgb(c0);
@ -289,7 +288,7 @@ function color_diff(c1, c2) { #region
var a = is_real(c0)? 255 : clamp(round(lerp(color_get_alpha(c0), color_get_alpha(c1), t)), 0, 255);
return make_color_srgba(sr, a);
} #endregion
}
#endregion
#region sorting functions

View file

@ -8,15 +8,15 @@ enum GRADIENT_INTER {
global.gradient_sort_list = ds_priority_create();
function gradientKey(time, value) constructor { #region
function gradientKey(time, value) constructor {
self.time = time;
self.value = value;
static clone = function() { return new gradientKey(time, value); }
static serialize = function() { return { time, value }; }
} #endregion
}
function gradientObject(color = c_black) constructor { #region
function gradientObject(color = c_black) constructor {
static GRADIENT_LIMIT = 128;
if(is_array(color)) keys = [ new gradientKey(0, cola(color[0])), new gradientKey(1, cola(color[1])) ];
@ -39,7 +39,7 @@ function gradientObject(color = c_black) constructor { #region
cache();
}
static clone = function() { #region
static clone = function() {
var g = new gradientObject();
for( var i = 0, n = array_length(keys); i < n; i++ )
g.keys[i] = keys[i].clone();
@ -47,9 +47,9 @@ function gradientObject(color = c_black) constructor { #region
g.type = type;
return g;
} #endregion
}
static add = function(_addkey, _deleteDup = true) { #region
static add = function(_addkey, _deleteDup = true) {
if(array_length(keys) > GRADIENT_LIMIT) return;
if(array_length(keys) == 0) {
array_push(keys, _addkey);
@ -70,9 +70,9 @@ function gradientObject(color = c_black) constructor { #region
}
array_push(keys, _addkey);
} #endregion
}
static eval = function(position) { #region
static eval = function(position) {
var _len = array_length(keys);
if(_len == 0) return c_black;
if(_len == 1) return keys[0].value;
@ -99,9 +99,9 @@ function gradientObject(color = c_black) constructor { #region
}
return keys[array_length(keys) - 1].value; //after last color
} #endregion
}
static evalFast = function(position) { #region
static evalFast = function(position) {
INLINE
var _len = array_length(keys);
if(position <= keys[0].time) return keys[0].value;
@ -109,9 +109,9 @@ function gradientObject(color = c_black) constructor { #region
var _ind = round(position * cacheRes);
return caches[_ind];
} #endregion
}
static draw = function(_x, _y, _w, _h, _a = 1) { #region
static draw = function(_x, _y, _w, _h, _a = 1) {
var uniform_grad_blend = shader_get_uniform(sh_gradient_display, "gradient_blend");
var uniform_grad = shader_get_uniform(sh_gradient_display, "gradient_color");
var uniform_grad_time = shader_get_uniform(sh_gradient_display, "gradient_time");
@ -177,18 +177,18 @@ function gradientObject(color = c_black) constructor { #region
surface_reset_target();
draw_surface(surf, _x, _y);
} #endregion
}
static cache = function(res = 128) { #region
static cache = function(res = 128) {
cacheRes = res;
caches = array_verify(caches, cacheRes + 1);
keyLength = array_length(keys);
for( var i = 0; i <= cacheRes; i++ )
caches[i] = eval(i / cacheRes);
} #endregion
}
static toArray = function() { #region
static toArray = function() {
var _grad_color = [], _grad_time = [];
for(var i = 0; i < array_length(keys); i++) {
@ -203,9 +203,9 @@ function gradientObject(color = c_black) constructor { #region
}
return [ _grad_color, _grad_time ];
} #endregion
}
static lerpTo = function(target, amount) { #region
static lerpTo = function(target, amount) {
var grad = new gradientObject();
grad.keys = [];
grad.type = type;
@ -231,9 +231,9 @@ function gradientObject(color = c_black) constructor { #region
}
return grad;
} #endregion
}
static shader_submit = function() { #region
static shader_submit = function() {
var _grad = toArray();
var _grad_color = _grad[0];
var _grad_time = _grad[1];
@ -242,9 +242,9 @@ function gradientObject(color = c_black) constructor { #region
shader_set_f_array("gradient_color", _grad_color, GRADIENT_LIMIT * 4);
shader_set_f("gradient_time", _grad_time);
shader_set_i("gradient_keys", array_length(keys));
} #endregion
}
static clone = function() { #region
static clone = function() {
var g = new gradientObject();
g.keys = [];
g.type = type;
@ -253,18 +253,19 @@ function gradientObject(color = c_black) constructor { #region
g.keys[i] = keys[i].clone();
return g;
} #endregion
}
static serialize = function() { #region
var s = { type: type };
s.keys = [];
static serialize = function() {
var s = { type, keys: [] };
for( var i = 0, n = array_length(keys); i < n; i++ )
s.keys[i] = keys[i].serialize();
// print(s);
return json_stringify(s, false);
} #endregion
}
static deserialize = function(str) { #region
static deserialize = function(str) {
var s;
if(is_array(str)) {
@ -282,19 +283,20 @@ function gradientObject(color = c_black) constructor { #region
type = struct_try_get(s, "type");
keys = array_create(array_length(s.keys));
// print(s.keys);
for( var i = 0, n = array_length(s.keys); i < n; i++ ) {
var _time = real(s.keys[i].time);
var _value = real(s.keys[i].value);
_value = LOADING_VERSION < 11640 && !is_int64(_value)? cola(_value) : int64(_value);
var _time = s.keys[i].time;
var _value = s.keys[i].value;
keys[i] = new gradientKey(_time, _value);
}
return self;
} #endregion
} #endregion
}
}
function loadGradient(path) { #region
function loadGradient(path) {
if(path == "") return noone;
if(!file_exists_empty(path)) return noone;
@ -323,9 +325,9 @@ function loadGradient(path) { #region
file_text_close(_t);
return grad;
} #endregion
}
function shader_set_gradient(gradient, surface, range, junc) { #region
function shader_set_gradient(gradient, surface, range, junc) {
var use_map = junc.attributes.mapped && is_surface(surface);
shader_set_i("gradient_use_map", use_map);
@ -334,9 +336,9 @@ function shader_set_gradient(gradient, surface, range, junc) { #region
gpu_set_tex_filter_ext(t, true);
gradient.shader_submit();
} #endregion
}
function evaluate_gradient_map(_x, gradient, surface, range, junc, fast = false) { #region
function evaluate_gradient_map(_x, gradient, surface, range, junc, fast = false) {
var use_map = junc.attributes.mapped;
if(!use_map) return fast? gradient.evalFast(_x) : gradient.eval(_x);
@ -348,12 +350,12 @@ function evaluate_gradient_map(_x, gradient, surface, range, junc, fast = false)
var _sy = lerp(range[1], range[3], _x) * _sh;
return surface_getpixel_ext(surface, _sx, _sy);
} #endregion
}
globalvar GRADIENTS;
GRADIENTS = [];
function __initGradient() { #region
function __initGradient() {
GRADIENTS = [];
var path = DIRECTORY + "Gradients/"
@ -367,4 +369,4 @@ function __initGradient() { #region
file = file_find_next();
}
file_find_close();
} #endregion
}

View file

@ -33,7 +33,7 @@ function Node_FLIP_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[| 10] = nodeValue("Segments", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1);
inputs[| 11] = nodeValue("Color Over Velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white));
inputs[| 11] = nodeValue("Color Over Velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)));
inputs[| 12] = nodeValue("Velocity Map", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 10 ])
.setDisplay(VALUE_DISPLAY.range);

View file

@ -27,7 +27,7 @@ function Node_Blur_Simple(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
__init_mask_modifier(6); // inputs 10, 11,
inputs[| 12] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject([ c_black, c_white ]) )
inputs[| 12] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject([ cola(c_black), cola(c_white) ]) )
.setMappable(13);
inputs[| 13] = nodeValueMap("Gradient map", self);

View file

@ -3,7 +3,7 @@ function Node_Colorize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 1] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject([ c_black, c_white ]) )
inputs[| 1] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject([ cola(c_black), cola(c_white) ]) )
.setMappable(11);
inputs[| 2] = nodeValue("Gradient shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)

View file

@ -6,7 +6,7 @@ function Node_Edge_Shade(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
inputs[| 1] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
active_index = 1;
inputs[| 2] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject( [ c_black, c_white ] ))
inputs[| 2] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject( [ cola(c_black), cola(c_white) ] ))
.setMappable(3);
//////////////////////////////////////////////////////////////////////////////////

View file

@ -4,7 +4,7 @@ function Node_Gradient(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF )
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 1] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject([ c_black, c_white ]) )
inputs[| 1] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject([ cola(c_black), cola(c_white) ]) )
.setMappable(15);
inputs[| 2] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)

View file

@ -3,7 +3,7 @@ function Node_Gradient_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y,
batch_output = false;
setDimension(96);
inputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setVisible(true, true);
outputs[| 0] = nodeValue("Colors", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, [] )

View file

@ -9,13 +9,13 @@ function Node_Gradient_Out(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
.setDisplay(VALUE_DISPLAY.slider)
.rejectArray();
outputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.output, VALUE_TYPE.gradient, new gradientObject(c_white) );
outputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.output, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) );
outputs[| 1] = nodeValue("Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white);
_pal = -1;
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
static processData = function(_outSurf, _data, _output_index, _array_index) {
var pal = _data[0];
var pos = _data[1];
@ -24,9 +24,9 @@ function Node_Gradient_Out(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
if(_output_index == 0) return pal;
if(_output_index == 1) return pal.eval(pos);
return 0;
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return;
@ -44,5 +44,5 @@ function Node_Gradient_Out(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion
}
}

View file

@ -15,7 +15,7 @@ function Node_Gradient_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y,
inputs[| 3] = nodeValue("Interpolation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1)
.setDisplay(VALUE_DISPLAY.enum_button, [ "None", "RGB", "HSV", "OKLAB", "sRGB" ]);
outputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.output, VALUE_TYPE.gradient, new gradientObject(c_white) )
outputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.output, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
_pal = -1;

View file

@ -2,7 +2,7 @@ function Node_Gradient_Replace_Color(_x, _y, _group = noone) : Node_Processor(_x
name = "Gradient Replace";
setDimension(96, 48);;
inputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setVisible(true, true);
inputs[| 1] = nodeValue("Color from", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, array_clone(DEF_PALETTE))
@ -14,7 +14,7 @@ function Node_Gradient_Replace_Color(_x, _y, _group = noone) : Node_Processor(_x
inputs[| 3] = nodeValue("Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1)
.setDisplay(VALUE_DISPLAY.slider);
outputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.output, VALUE_TYPE.gradient, new gradientObject(c_white) );
outputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.output, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) );
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var gra = _data[0];

View file

@ -2,7 +2,7 @@ function Node_Gradient_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
name = "Gradient Shift";
setDimension(96);
inputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setVisible(true, true);
inputs[| 1] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
@ -13,7 +13,7 @@ function Node_Gradient_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
inputs[| 3] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 2, 0.01] });
outputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.output, VALUE_TYPE.gradient, new gradientObject(c_white) );
outputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.output, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) );
_pal = -1;

View file

@ -20,7 +20,7 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
.setDisplay(VALUE_DISPLAY.rotation)
.setMappable(15);
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setMappable(20);
inputs[| 6] = nodeValue("Gap color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black);

View file

@ -20,7 +20,7 @@ function Node_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.001] })
.setMappable(13);
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setMappable(17);
inputs[| 6] = nodeValue("Gap color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black);

View file

@ -20,7 +20,7 @@ function Node_Grid_Pentagonal(_x, _y, _group = noone) : Node_Processor(_x, _y, _
.setDisplay(VALUE_DISPLAY.rotation)
.setMappable(13);
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setMappable(14);
inputs[| 6] = nodeValue("Gap color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black);

View file

@ -20,7 +20,7 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
.setDisplay(VALUE_DISPLAY.rotation)
.setMappable(13);
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setMappable(17);
inputs[| 6] = nodeValue("Gap color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black);

View file

@ -339,9 +339,9 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inParent.setType(VALUE_TYPE.gradient);
outputs[| 0].setType(inParent.type);
inParent.animator = new valueAnimator(new gradientObject(c_white), inParent);
inParent.animator = new valueAnimator(new gradientObject(cola(c_white)), inParent);
inParent.def_val = new gradientObject(c_white);
inParent.def_val = new gradientObject(cola(c_white));
inParent.setDisplay(VALUE_DISPLAY._default);
break;

View file

@ -20,7 +20,7 @@ function Node_Herringbone_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y,
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.001] })
.setMappable(13);
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setMappable(18);
inputs[| 6] = nodeValue("Gap color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black);

View file

@ -12,7 +12,7 @@ function Node_Interpret_Number(_x, _y, _group = noone) : Node_Processor(_x, _y,
inputs[| 2] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ] )
.setDisplay(VALUE_DISPLAY.range);
inputs[| 3] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 3] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setMappable(4);
//////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -28,7 +28,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
inputs[| 9] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0);
inputs[| 10] = nodeValue("Color over length", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) );
inputs[| 10] = nodeValue("Color over length", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) );
inputs[| 11] = nodeValue("Width over length", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11);
@ -60,7 +60,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
inputs[| 23] = nodeValue("Texture scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 24] = nodeValue("Random Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) );
inputs[| 24] = nodeValue("Random Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) );
inputs[| 25] = nodeValue("Invert", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );

View file

@ -17,7 +17,7 @@ function Node_MK_Brownian(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[| 5] = nodeValue("Speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
.setDisplay(VALUE_DISPLAY.range);
inputs[| 6] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white));
inputs[| 6] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)));
inputs[| 7] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11);

View file

@ -38,7 +38,7 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| 12] = nodeValue("Wind", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 13] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 13] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
inputs[| 14] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11);

View file

@ -15,7 +15,7 @@ function Node_MK_Rain(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
inputs[| 4] = nodeValue("Raindrop length", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 5, 10 ])
.setDisplay(VALUE_DISPLAY.range);
inputs[| 5] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white));
inputs[| 5] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)));
inputs[| 6] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range);

View file

@ -12,7 +12,7 @@ function Node_MK_Saber(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
inputs[| 3] = nodeValue("Thickness", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2)
inputs[| 4] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white))
inputs[| 4] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)))
inputs[| 5] = nodeValue("Trace", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0);

View file

@ -11,7 +11,7 @@ function Node_Pixel_Cloud(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
inputs[| 3] = nodeValue("Strength map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 4] = nodeValue("Color over lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 4] = nodeValue("Color over lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setMappable(9);
inputs[| 5] = nodeValue("Distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1);

View file

@ -12,7 +12,7 @@ function Node_Pixel_Sampler(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
inputs[| 3] = nodeValue("Surfaces", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, [ noone ] )
.setArrayDepth(1);
inputs[| 4] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject([ c_black, c_white ]) )
inputs[| 4] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject([ cola(c_black), cola(c_white) ]) )
.setMappable(5);
inputs[| 5] = nodeValueMap("Gradient map", self);

View file

@ -53,7 +53,7 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
inputs[| 12] = nodeValue("Value Offset", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0);
inputs[| 13] = nodeValue("Color Over Sample", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white))
inputs[| 13] = nodeValue("Color Over Sample", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)))
.setMappable(27);
inputs[| 14] = nodeValue("Trim mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
@ -79,7 +79,7 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
inputs[| 23] = nodeValue("Smooth", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.slider);
inputs[| 24] = nodeValue("Color Over Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white))
inputs[| 24] = nodeValue("Color Over Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)))
.setMappable(29);
inputs[| 25] = nodeValue("Value range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ] )

View file

@ -20,7 +20,7 @@ function Node_Pytagorean_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.001] })
.setMappable(13);
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setMappable(18);
inputs[| 6] = nodeValue("Gap color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black);

View file

@ -20,7 +20,7 @@ function Node_Random_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.001] })
.setMappable(13);
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setMappable(17);
inputs[| 6] = nodeValue("Gap color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black);

View file

@ -313,7 +313,6 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
var cc = evaluate_gradient_map(i / (_amo - 1), _grad, _grad_map, _grad_range, inputs[| 14]);
var aa = _color_get_alpha(cc);
cc = colda(cc);
if(_an_use) {
cc = merge_color(cc, colorMultiply(cc, _an_bld), _inf);
aa += _an_alp * _inf;

View file

@ -44,7 +44,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
inputs[| 10] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6))
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 10].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
inputs[| 11] = nodeValue("Random blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 11] = nodeValue("Random blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setMappable(28);
inputs[| 12] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])

View file

@ -17,9 +17,9 @@ function Node_Strand_Render(_x, _y, _group = noone) : Node(_x, _y, _group) const
inputs[| 3] = nodeValue("Thickness over length", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11);
inputs[| 4] = nodeValue("Random color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white));
inputs[| 4] = nodeValue("Random color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)));
inputs[| 5] = nodeValue("Color over length", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white));
inputs[| 5] = nodeValue("Color over length", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)));
inputs[| 6] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6))
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });

View file

@ -15,7 +15,7 @@ function Node_Strand_Render_Texture(_x, _y, _group = noone) : Node(_x, _y, _grou
inputs[| 2] = nodeValue("Thickness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 8, 8 ])
.setDisplay(VALUE_DISPLAY.range, { linked : true });
inputs[| 3] = nodeValue("Random color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white));
inputs[| 3] = nodeValue("Random color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)));
inputs[| 4] = nodeValue("Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);

View file

@ -26,7 +26,7 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
inputs[| 6] = nodeValue("Coloring", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Alternate", "Palette", "Random" ]);
inputs[| 7] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
inputs[| 7] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white)) )
.setMappable(15);
inputs[| 8] = nodeValue("Color 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white);

View file

@ -27,7 +27,7 @@ function Node_Widget_Test(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[| 20] = nodeValue("buttonColor", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, 0) .setDisplay(VALUE_DISPLAY._default)
inputs[| 21] = nodeValue("buttonPalette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, array_clone(DEF_PALETTE)) .setDisplay(VALUE_DISPLAY.palette)
inputs[| 22] = nodeValue("buttonGradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white)) .setDisplay(VALUE_DISPLAY._default)
inputs[| 22] = nodeValue("buttonGradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(cola(c_white))) .setDisplay(VALUE_DISPLAY._default)
inputs[| 23] = nodeValue("pathArrayBox", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, []) .setDisplay(VALUE_DISPLAY.path_array, { filter: [ "image|*.png;*.jpg", "" ] })
inputs[| 24] = nodeValue("pathLoad", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") .setDisplay(VALUE_DISPLAY.path_load)