- [Gradient Selector] Fix selecting color with "Show on selector" on set alpha to zero.

This commit is contained in:
Tanasart 2024-05-05 11:48:39 +07:00
parent 60ab580249
commit 0f5c68c8c9
4 changed files with 8 additions and 188 deletions

View file

@ -24,6 +24,9 @@ function __particleObject() constructor {
scx = 1;
scy = 1;
x_history = [];
y_history = [];
surf = noone;
blend = c_white;
alp = 1;
@ -69,9 +72,6 @@ function __part(_node) : __particleObject() constructor {
turning = 0;
turnSpd = 0;
x_history = [];
y_history = [];
accel = 0;
spVec = [ 0, 0 ];

View file

@ -224,6 +224,7 @@ function colorSelector(onApply = noone) constructor {
draw_sprite_stretched_ext(s_ui_base_white, 0, col_x + ui(sat - 6), col_y + ui(256 - val - 6), ui(12), ui(12), current_color, 1);
else if(disp_mode == 1)
draw_sprite_stretched_ext(s_ui_base_white, 0, col_x + ui(hue - 6), col_y + ui(256 - sat - 6), ui(12), ui(12), current_color, 1);
} else {
if(disp_mode == 0) {
draw_sprite_stretched_ext(s_ui_base_white, 0, hue_x - ui(3), _sy - ui(6), ui(24), ui(10), make_color_hsv(hue, 255, 255), 1);
@ -253,6 +254,7 @@ function colorSelector(onApply = noone) constructor {
if(NODE_COLOR_SHOW_PALETTE) {
current_color = disp_mode == 0? surface_getpixel(color_surface, sat, 256 - val) :
surface_getpixel(color_surface, hue, 256 - sat);
current_color = cola(current_color, 1);
if(onApply != noone) onApply(current_color);
}
@ -274,6 +276,7 @@ function colorSelector(onApply = noone) constructor {
if(NODE_COLOR_SHOW_PALETTE) {
current_color = disp_mode == 0? surface_getpixel(color_surface, sat, 256 - val) :
surface_getpixel(color_surface, hue, 256 - sat);
current_color = cola(current_color, 1);
if(onApply != noone) onApply(current_color);
}

View file

@ -308,191 +308,6 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
static getInputAmount = function() { INLINE return input_fix_len + (ds_list_size(inputs) - input_fix_len) / data_length; }
//static getInputIndex = function(index) { #region
// INLINE
// if(index < input_fix_len) return index;
// return input_fix_len + (index - input_fix_len) * data_length;
//} #endregion
//static setHeight = function() { #region
// var _hi = ui(32);
// var _ho = ui(32);
// for( var i = 0; i < getInputAmount(); i++ )
// if(inputs[| getInputIndex(i)].isVisible())
// _hi += 24;
// for( var i = 0; i < ds_list_size(outputs); i++ )
// if(outputs[| i].isVisible())
// _ho += 24;
// h = max(min_h, (preview_surface && previewable)? 128 : 0, _hi, _ho);
//} #endregion
//static drawJunctions = function(_x, _y, _mx, _my, _s) { #region
// if(!active) return;
// var hover = noone;
// var amo = array_length(input_display_list);
// var hov = PANEL_GRAPH.value_focus;
// var ind = -1;
// if(hov != noone && struct_has(hov, "surface_index"))
// ind = hov.surface_index;
// for( var i = 0; i < getInputAmount(); i++ ) {
// var idx = getInputIndex(i);
// if(!inputs[| idx].isVisible()) continue;
// if(inputs[| idx].drawJunction(_s, _mx, _my, 1.5))
// hover = inputs[| idx];
// if(idx >= input_fix_len && inputs[| idx].hover_effect > 0) {
// var _px0 = 999999;
// var _py0 = 999999;
// var _px1 = -999999;
// var _py1 = -999999;
// var _drw = false;
// var _hov = inputs[| idx].hover_effect;
// for( var j = 1; j < data_length; j++ ) {
// if(!inputs[| idx + j].isVisible()) continue;
// _px0 = min( _px0, inputs[| idx + j].x );
// _py0 = min( _py0, inputs[| idx + j].y );
// _px1 = max( _px1, inputs[| idx + j].x );
// _py1 = max( _py1, inputs[| idx + j].y );
// _drw = true;
// }
// if(!_drw) continue;
// //if(_hov > 0.5) {
// // var pilx = _px0 - 16 * _s;
// // var pily = _py0 - 16 * _s;
// // var pilw = _px1 - _px0 + 32 * _s;
// // var pilh = _py1 - _py0 + 32 * _s;
// // draw_sprite_stretched_ext(THEME.node_bg_pill, 0, pilx, pily, pilw, pilh, COLORS._main_icon_dark, (_hov - 0.5) * 2);
// //}
// for( var j = 1; j < data_length; j++ ) {
// if(inputs[| idx + j].drawJunction(_s, _mx, _my, 1.5))
// hover = inputs[| idx + j];
// }
// }
// }
// for(var i = 0; i < ds_list_size(outputs); i++)
// if(outputs[| i].drawJunction(_s, _mx, _my))
// hover = outputs[| i];
// return hover;
//} #endregion
//static drawJunctionNames = function(_x, _y, _mx, _my, _s) { #region
// if(!active) return;
// var amo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list);
// var jun;
// var xx = x * _s + _x;
// var yy = y * _s + _y;
// show_input_name = PANEL_GRAPH.pHOVER && point_in_rectangle(_mx, _my, xx - 8 * _s, yy + 20 * _s, xx + 8 * _s, yy + h * _s);
// show_output_name = PANEL_GRAPH.pHOVER && point_in_rectangle(_mx, _my, xx + (w - 8) * _s, yy + 20 * _s, xx + (w + 8) * _s, yy + h * _s);
// var hov = PANEL_GRAPH.value_focus;
// var ind = -1;
// if(hov != noone && struct_has(hov, "surface_index"))
// ind = hov.surface_index;
// if(ind != -1) {
// for( var j = 1; j < data_length; j++ ) {
// if(ind + j >= ds_list_size(inputs)) break;
// inputs[| ind + j].drawNameBG(_s);
// }
// for( var j = 1; j < data_length; j++ ) {
// if(ind + j >= ds_list_size(inputs)) break;
// inputs[| ind + j].drawName(_s, _mx, _my);
// }
// } else if(show_input_name) {
// for( var i = 0; i < getInputAmount(); i++ ) {
// var idx = getInputIndex(i);
// if(idx == ind) continue;
// inputs[| idx].drawNameBG(_s);
// }
// for( var i = 0; i < getInputAmount(); i++ ) {
// var idx = getInputIndex(i);
// if(idx == ind) continue;
// inputs[| idx].drawName(_s, _mx, _my);
// }
// }
// if(show_output_name) {
// for(var i = 0; i < ds_list_size(outputs); i++)
// outputs[| i].drawNameBG(_s);
// for(var i = 0; i < ds_list_size(outputs); i++)
// outputs[| i].drawName(_s, _mx, _my);
// }
//} #endregion
//static preDraw = function(_x, _y, _s) { #region
// var xx = x * _s + _x;
// var yy = y * _s + _y;
// var jun;
// var inamo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list);
// var _in = yy + ui(32) * _s;
// var hov = PANEL_GRAPH.value_focus;
// var ind = -1;
// if(hov != noone && struct_has(hov, "surface_index"))
// ind = hov.surface_index;
// for( var i = 0; i < getInputAmount(); i++ ) {
// var idx = getInputIndex(i);
// jun = ds_list_get(inputs, idx, noone);
// if(jun == noone || is_undefined(jun)) continue;
// jun.x = xx;
// jun.y = _in;
// if(i >= input_fix_len) {
// jun.hover_effect = lerp_float(jun.hover_effect, ind == idx, 3);
// var sp = jun.hover_effect * 24;
// var sx = xx - sp * _s;
// var sy = _in;
// for( var j = 1; j < data_length; j++ ) {
// var _jun = ds_list_get(inputs, idx + j, noone);
// _jun.x = sx;
// _jun.y = sy;
// sy += sp * _s * _jun.isVisible();
// }
// }
// _in += 24 * _s * jun.isVisible();
// }
// var outamo = output_display_list == -1? ds_list_size(outputs) : array_length(output_display_list);
// xx = xx + w * _s;
// _in = yy + ui(32) * _s;
// for(var i = 0; i < outamo; i++) {
// var idx = getOutputJunctionIndex(i);
// jun = outputs[| idx];
// jun.x = xx;
// jun.y = _in;
// _in += 24 * _s * jun.isVisible();
// }
//} #endregion
static onValueFromUpdate = function(index) { #region
if(LOADING || APPENDING) return;

View file

@ -180,6 +180,8 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
inputs[| 7].setVisible(true);
inputs[| 8].setVisible(true);
inputs[| 9].setVisible(true);
inputs[| 12].setVisible(_path == noone);
inputs[| 20].setVisible(_path == noone);
inputs[| 13].setVisible(true);
inputs[| 15].setVisible(true);