Palette, gradient array fixes

This commit is contained in:
Tanasart 2023-12-10 08:48:10 +07:00
parent 1539540928
commit 40187887b4
19 changed files with 254 additions and 144 deletions

View file

@ -189,6 +189,7 @@
{"name":"VFX","order":134,"path":"folders/nodes/icons/VFX.yy",}, {"name":"VFX","order":134,"path":"folders/nodes/icons/VFX.yy",},
{"name":"panels","order":2,"path":"folders/panels.yy",}, {"name":"panels","order":2,"path":"folders/panels.yy",},
{"name":"animation","order":9,"path":"folders/panels/animation.yy",}, {"name":"animation","order":9,"path":"folders/panels/animation.yy",},
{"name":"collection","order":11,"path":"folders/panels/collection.yy",},
{"name":"colors","order":4,"path":"folders/panels/colors.yy",}, {"name":"colors","order":4,"path":"folders/panels/colors.yy",},
{"name":"context menu","order":5,"path":"folders/panels/context menu.yy",}, {"name":"context menu","order":5,"path":"folders/panels/context menu.yy",},
{"name":"graph","order":1,"path":"folders/panels/graph.yy",}, {"name":"graph","order":1,"path":"folders/panels/graph.yy",},
@ -246,7 +247,6 @@
{"name":"button","order":34,"path":"folders/widgets/button.yy",}, {"name":"button","order":34,"path":"folders/widgets/button.yy",},
{"name":"rotator","order":35,"path":"folders/widgets/rotator.yy",}, {"name":"rotator","order":35,"path":"folders/widgets/rotator.yy",},
{"name":"text","order":36,"path":"folders/widgets/text.yy",}, {"name":"text","order":36,"path":"folders/widgets/text.yy",},
{"name":"collection","order":11,"path":"folders/panels/collection.yy",},
], ],
"ResourceOrderSettings": [ "ResourceOrderSettings": [
{"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",}, {"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",},

View file

@ -220,6 +220,7 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"panels","folderPath":"folders/panels.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"panels","folderPath":"folders/panels.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"_others","folderPath":"folders/panels/_others.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"_others","folderPath":"folders/panels/_others.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"animation","folderPath":"folders/panels/animation.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"animation","folderPath":"folders/panels/animation.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"collection","folderPath":"folders/panels/collection.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"colors","folderPath":"folders/panels/colors.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"colors","folderPath":"folders/panels/colors.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"context menu","folderPath":"folders/panels/context menu.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"context menu","folderPath":"folders/panels/context menu.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"graph","folderPath":"folders/panels/graph.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"graph","folderPath":"folders/panels/graph.yy",},
@ -281,7 +282,6 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"button","folderPath":"folders/widgets/button.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"button","folderPath":"folders/widgets/button.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"rotator","folderPath":"folders/widgets/rotator.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"rotator","folderPath":"folders/widgets/rotator.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"text","folderPath":"folders/widgets/text.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"text","folderPath":"folders/widgets/text.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"collection","folderPath":"folders/panels/collection.yy",},
], ],
"IncludedFiles": [ "IncludedFiles": [
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",},

View file

@ -35,8 +35,17 @@ function draw_tooltip_color(clr) {
} }
function draw_tooltip_palette(clr) { function draw_tooltip_palette(clr) {
var ww = min(ui(160), ui(32) * array_length(clr)); if(array_empty(clr)) return;
var hh = ui(32);
var ph = ui(32);
if(!is_array(clr[0])) clr = [ clr ];
var pal_len = 0;
for( var i = 0, n = array_length(clr); i < n; i++ )
pal_len = max(pal_len, array_length(clr[i]));
var ww = min(ui(160), ui(32) * pal_len);
var hh = array_length(clr) * ph;
var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16)));
var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16)));
@ -44,12 +53,19 @@ function draw_tooltip_palette(clr) {
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16));
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16));
drawPalette(clr, mx + ui(8), my + ui(8), ui(ww), ui(hh)); var _y = my + ui(8);
for( var i = 0, n = array_length(clr); i < n; i++ ) {
drawPalette(clr[i], mx + ui(8), _y, ui(ww), ph);
_y += ph;
}
} }
function draw_tooltip_gradient(clr) { function draw_tooltip_gradient(clr) {
var gh = ui(32);
if(!is_array(clr)) clr = [ clr ];
var ww = ui(160); var ww = ui(160);
var hh = ui(32); var hh = array_length(clr) * gh;
var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16))); var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16)));
var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16))); var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16)));
@ -57,7 +73,11 @@ function draw_tooltip_gradient(clr) {
draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 3, mx, my, ww + ui(16), hh + ui(16));
draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16)); draw_sprite_stretched(THEME.textbox, 0, mx, my, ww + ui(16), hh + ui(16));
clr.draw(mx + ui(8), my + ui(8), ui(ww), ui(hh)); var _y = my + ui(8);
for( var i = 0, n = array_length(clr); i < n; i++ ) {
clr[i].draw(mx + ui(8), _y, ui(ww), gh);
_y += gh;
}
} }
function draw_tooltip_surface_array(surf) { function draw_tooltip_surface_array(surf) {

View file

@ -25,10 +25,10 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION; globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION;
LATEST_VERSION = 11500; LATEST_VERSION = 11500;
VERSION = 11601; VERSION = 11602;
SAVE_VERSION = 11600.1; SAVE_VERSION = 11600.1;
VERSION_STRING = "1.16.0.1"; VERSION_STRING = "1.16.0.2";
BUILD_NUMBER = 11601; BUILD_NUMBER = 11602;
globalvar APPEND_MAP; globalvar APPEND_MAP;
APPEND_MAP = ds_map_create(); APPEND_MAP = ds_map_create();

View file

@ -173,14 +173,30 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var type = getInputData(12); var type = getInputData(12);
if(preview_draw != (type == 0)) {
preview_draw = (type == 0);
will_setHeight = true;
}
if(type == 0) return; if(type == 0) return;
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return; if(bbox.h < 1) return;
var pal = outputs[| 1].getValue(); var pal = outputs[| 1].getValue();
if(array_length(pal) && is_array(pal[0])) return; if(array_empty(pal)) return;
if(!is_array(pal[0])) pal = [ pal ];
drawPalette(pal, bbox.x0, bbox.y0, bbox.w, bbox.h); var _h = array_length(pal) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(pal);
for( var i = 0, n = array_length(pal); i < n; i++ ) {
drawPalette(pal[i], bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion } #endregion
} }

View file

@ -1256,7 +1256,11 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
if(previewable) { if(previewable) {
if(preview_draw) drawPreview(xx, yy, _s); if(preview_draw) drawPreview(xx, yy, _s);
onDrawNode(xx, yy, _mx, _my, _s, PANEL_GRAPH.node_hovering == self, PANEL_GRAPH.getFocusingNode() == self); try {
onDrawNode(xx, yy, _mx, _my, _s, PANEL_GRAPH.node_hovering == self, PANEL_GRAPH.getFocusingNode() == self);
} catch(e) {
log_warning("NODE onDRAW", exception_print(e));
}
} else { } else {
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
draw_sprite_ext(THEME.preview_hide, 0, bbox.xc, bbox.yc, _s, _s, 0, c_white, 0.25); draw_sprite_ext(THEME.preview_hide, 0, bbox.xc, bbox.yc, _s, _s, 0, c_white, 0.25);

View file

@ -1,7 +1,6 @@
function Node_Gradient_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { function Node_Gradient_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Gradient Data"; name = "Gradient Data";
w = 96;
w = 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(c_white) )
.setVisible(true, true); .setVisible(true, true);
@ -39,12 +38,19 @@ function Node_Gradient_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y,
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return; if(bbox.h < 1) return;
var grad = getInputData(0); var grad = inputs[| 0].getValue();
if(is_array(grad)) { if(!is_array(grad)) grad = [ grad ];
if(array_length(grad) == 0) return; var _h = array_length(grad) * 32;
grad = grad[0];
var _y = bbox.y0;
var gh = bbox.h / array_length(grad);
for( var i = 0, n = array_length(grad); i < n; i++ ) {
grad[i].draw(bbox.x0, _y, bbox.w, gh);
_y += gh;
} }
grad.draw(bbox.x0, bbox.y0, bbox.w, bbox.h); if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion } #endregion
} }

View file

@ -1,7 +1,6 @@
function Node_Gradient_Out(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { function Node_Gradient_Out(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Gradient"; name = "Gradient";
w = 96;
w = 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(c_white) );
@ -15,7 +14,7 @@ function Node_Gradient_Out(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
_pal = -1; _pal = -1;
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var pal = _data[0]; var pal = _data[0];
var pos = _data[1]; var pos = _data[1];
@ -24,13 +23,25 @@ function Node_Gradient_Out(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
if(_output_index == 0) return pal; if(_output_index == 0) return pal;
if(_output_index == 1) return pal.eval(pos); if(_output_index == 1) return pal.eval(pos);
return 0; return 0;
} } #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return; if(bbox.h < 1) return;
var grad = getSingleValue(0); var grad = outputs[| 0].getValue();
grad.draw(bbox.x0, bbox.y0, bbox.w, bbox.h); if(!is_array(grad)) grad = [ grad ];
} var _h = array_length(grad) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(grad);
for( var i = 0, n = array_length(grad); i < n; i++ ) {
grad[i].draw(bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion
} }

View file

@ -1,7 +1,6 @@
function Node_Gradient_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { function Node_Gradient_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Palette to Gradient"; name = "Palette to Gradient";
w = 96;
w = 96;
inputs[| 0] = nodeValue("Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE ) inputs[| 0] = nodeValue("Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE )
.setDisplay(VALUE_DISPLAY.palette) .setDisplay(VALUE_DISPLAY.palette)
@ -20,12 +19,12 @@ function Node_Gradient_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y,
_pal = -1; _pal = -1;
static step = function() { static step = function() { #region
var usePos = array_safe_get(current_data, 1); var usePos = array_safe_get(current_data, 1);
inputs[| 2].setVisible(usePos, usePos); inputs[| 2].setVisible(usePos, usePos);
} } #endregion
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var pal = _data[0]; var pal = _data[0];
var pos_use = _data[1]; var pos_use = _data[1];
var _pos = _data[2]; var _pos = _data[2];
@ -35,13 +34,11 @@ function Node_Gradient_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y,
var len = min(128, array_length(pal)); var len = min(128, array_length(pal));
grad.keys = array_create(len); grad.keys = array_create(len);
//print("Process gradient");
for( var i = 0; i < len; i++ ) { for( var i = 0; i < len; i++ ) {
var clr = pal[i]; var clr = pal[i];
var pos = pos_use? array_safe_get(_pos, i, 0) : i / len; var pos = pos_use? array_safe_get(_pos, i, 0) : i / len;
grad.keys[i] = new gradientKey(pos, clr); grad.keys[i] = new gradientKey(pos, clr);
//print($" {i} = {pos} : {clr}");
} }
switch(type) { switch(type) {
@ -51,18 +48,25 @@ function Node_Gradient_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y,
} }
return grad; return grad;
} } #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return; if(bbox.h < 1) return;
var grad = outputs[| 0].getValue(); var grad = outputs[| 0].getValue();
if(is_array(grad)) { if(!is_array(grad)) grad = [ grad ];
if(array_length(grad) == 0) return; var _h = array_length(grad) * 32;
grad = grad[0];
var _y = bbox.y0;
var gh = bbox.h / array_length(grad);
for( var i = 0, n = array_length(grad); i < n; i++ ) {
grad[i].draw(bbox.x0, _y, bbox.w, gh);
_y += gh;
} }
grad.draw(bbox.x0, bbox.y0, bbox.w, bbox.h); if(_h != min_h) will_setHeight = true;
} min_h = _h;
} #endregion
} }

View file

@ -1,7 +1,6 @@
function Node_Gradient_Replace_Color(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { function Node_Gradient_Replace_Color(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Gradient Replace"; name = "Gradient Replace";
w = 96;
w = 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(c_white) )
.setVisible(true, true); .setVisible(true, true);
@ -17,7 +16,7 @@ function Node_Gradient_Replace_Color(_x, _y, _group = noone) : Node_Processor(_x
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(c_white) );
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var gra = _data[0]; var gra = _data[0];
var pfr = _data[1]; var pfr = _data[1];
var pto = _data[2]; var pto = _data[2];
@ -46,18 +45,25 @@ function Node_Gradient_Replace_Color(_x, _y, _group = noone) : Node_Processor(_x
graO.type = gra.type; graO.type = gra.type;
return graO; return graO;
} } #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return; if(bbox.h < 1) return;
var grad = outputs[| 0].getValue(); var grad = outputs[| 0].getValue();
if(is_array(grad)) { if(!is_array(grad)) grad = [ grad ];
if(array_length(grad) == 0) return; var _h = array_length(grad) * 32;
grad = grad[0];
var _y = bbox.y0;
var gh = bbox.h / array_length(grad);
for( var i = 0, n = array_length(grad); i < n; i++ ) {
grad[i].draw(bbox.x0, _y, bbox.w, gh);
_y += gh;
} }
grad.draw(bbox.x0, bbox.y0, bbox.w, bbox.h); if(_h != min_h) will_setHeight = true;
} min_h = _h;
} #endregion
} }

View file

@ -1,7 +1,6 @@
function Node_Gradient_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { function Node_Gradient_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Gradient Shift"; name = "Gradient Shift";
w = 96;
w = 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(c_white) )
.setVisible(true, true); .setVisible(true, true);
@ -18,7 +17,7 @@ function Node_Gradient_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
_pal = -1; _pal = -1;
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var pal = _data[0]; var pal = _data[0];
var sft = _data[1]; var sft = _data[1];
var lop = _data[2]; var lop = _data[2];
@ -43,13 +42,25 @@ function Node_Gradient_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
_outSurf.type = pal.type; _outSurf.type = pal.type;
return _outSurf; return _outSurf;
} } #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return; if(bbox.h < 1) return;
var grad = outputs[| 0].getValue(); var grad = outputs[| 0].getValue();
grad.draw(bbox.x0, bbox.y0, bbox.w, bbox.h); if(!is_array(grad)) grad = [ grad ];
} var _h = array_length(grad) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(grad);
for( var i = 0, n = array_length(grad); i < n; i++ ) {
grad[i].draw(bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion
} }

View file

@ -1,7 +1,6 @@
function Node_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { function Node_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Palette"; name = "Palette";
w = 96;
w = 96;
inputs[| 0] = nodeValue("Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE) inputs[| 0] = nodeValue("Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE)
.setDisplay(VALUE_DISPLAY.palette); .setDisplay(VALUE_DISPLAY.palette);
@ -16,7 +15,7 @@ function Node_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
["Trim", true], 1 ["Trim", true], 1
]; ];
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var pal = _data[0]; var pal = _data[0];
var ran = _data[1]; var ran = _data[1];
@ -28,15 +27,26 @@ function Node_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
ar[i - st] = array_safe_get(pal, i); ar[i - st] = array_safe_get(pal, i);
return ar; return ar;
} } #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return; if(bbox.h < 1) return;
var pal = outputs[| 0].getValue(); var pal = outputs[| 0].getValue();
if(array_length(pal) && is_array(pal[0])) return; if(array_empty(pal)) return;
if(!is_array(pal[0])) pal = [ pal ];
drawPalette(pal, bbox.x0, bbox.y0, bbox.w, bbox.h); var _h = array_length(pal) * 32;
} var _y = bbox.y0;
var gh = bbox.h / array_length(pal);
for( var i = 0, n = array_length(pal); i < n; i++ ) {
drawPalette(pal[i], bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion
} }

View file

@ -1,6 +1,6 @@
function Node_Palette_Extract(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { function Node_Palette_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Palette Extract"; name = "Palette Extract";
w = 96; w = 96;
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
@ -295,34 +295,33 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node(_x, _y, _group) con
return []; return [];
} #endregion } #endregion
static extractPalettes = function() { #region static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var _surf = getInputData(0); var _surf = _data[0];
var _size = getInputData(1); var _size = _data[1];
var _seed = getInputData(2); var _seed = _data[2];
var _algo = getInputData(3); var _algo = _data[3];
var res = [];
if(is_surface(_surf)) { return extractPalette(_surf, _algo, _size, _seed);
res = extractPalette(_surf, _algo, _size, _seed);
} else if(is_array(_surf)) {
res = array_create(array_length(_surf));
for( var i = 0, n = array_length(_surf); i < n; i++ )
res[i] = extractPalette(_surf[i], _algo, _size, _seed);
}
outputs[| 0].setValue(res);
} #endregion } #endregion
static onInspector1Update = function() { extractPalettes(); triggerRender(); }
static onValueUpdate = function() { extractPalettes(); }
static onValueFromUpdate = function() { extractPalettes(); }
static update = function() { extractPalettes(); }
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return; if(bbox.h < 1) return;
drawPalette(outputs[| 0].getValue(), bbox.x0, bbox.y0, bbox.w, bbox.h); var pal = outputs[| 0].getValue();
if(array_empty(pal)) return;
if(!is_array(pal[0])) pal = [ pal ];
var _h = array_length(pal) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(pal);
for( var i = 0, n = array_length(pal); i < n; i++ ) {
drawPalette(pal[i], bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion } #endregion
} }

View file

@ -23,7 +23,7 @@ function Node_Palette_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, [ ] ) outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, [ ] )
.setDisplay(VALUE_DISPLAY.palette); .setDisplay(VALUE_DISPLAY.palette);
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var pal = _data[0]; var pal = _data[0];
var pfr = _data[1]; var pfr = _data[1];
var pto = _data[2]; var pto = _data[2];
@ -49,14 +49,26 @@ function Node_Palette_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _
} }
return palo; return palo;
} } #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return; if(bbox.h < 1) return;
var pal = outputs[| 0].getValue(); var pal = outputs[| 0].getValue();
if(array_length(pal) && is_array(pal[0])) return; if(array_empty(pal)) return;
drawPalette(pal, bbox.x0, bbox.y0, bbox.w, bbox.h); if(!is_array(pal[0])) pal = [ pal ];
}
var _h = array_length(pal) * 32;
var _y = bbox.y0;
var gh = bbox.h / array_length(pal);
for( var i = 0, n = array_length(pal); i < n; i++ ) {
drawPalette(pal[i], bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion
} }

View file

@ -1,7 +1,6 @@
function Node_Palette_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { function Node_Palette_Sort(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Sort Palette"; name = "Sort Palette";
w = 96;
w = 96;
inputs[| 0] = nodeValue("Palette in", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE ) inputs[| 0] = nodeValue("Palette in", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE )
.setDisplay(VALUE_DISPLAY.palette) .setDisplay(VALUE_DISPLAY.palette)
@ -26,14 +25,14 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) constr
0, 1, 3, 2, 0, 1, 3, 2,
] ]
static step = function() { static step = function() { #region
var _typ = getInputData(1); var _typ = getInputData(1);
inputs[| 3].setVisible(_typ == 10); inputs[| 3].setVisible(_typ == 10);
} } #endregion
sort_string = ""; sort_string = "";
static customSort = function(c) { static customSort = function(c) { #region
var len = string_length(sort_string); var len = string_length(sort_string);
var val = power(256, len - 1); var val = power(256, len - 1);
var res = 0; var res = 0;
@ -58,13 +57,13 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) constr
} }
return res; return res;
} } #endregion
static update = function(frame = CURRENT_FRAME) { static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var _arr = getInputData(0); var _arr = _data[0];
var _ord = getInputData(1); var _ord = _data[1];
var _rev = getInputData(2); var _rev = _data[2];
sort_string = getInputData(3); sort_string = _data[3];
if(!is_array(_arr)) return; if(!is_array(_arr)) return;
var _pal = array_clone(_arr); var _pal = array_clone(_arr);
@ -85,16 +84,27 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) constr
if(_rev) _pal = array_reverse(_pal); if(_rev) _pal = array_reverse(_pal);
outputs[| 0].setValue(_pal); return _pal;
} } #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
if(bbox.h < 1) return; if(bbox.h < 1) return;
var pal = outputs[| 0].getValue(); var pal = outputs[| 0].getValue();
if(array_length(pal) && is_array(pal[0])) return; if(array_empty(pal)) return;
if(!is_array(pal[0])) pal = [ pal ];
drawPalette(pal, bbox.x0, bbox.y0, bbox.w, bbox.h); var _h = array_length(pal) * 32;
} var _y = bbox.y0;
var gh = bbox.h / array_length(pal);
for( var i = 0, n = array_length(pal); i < n; i++ ) {
drawPalette(pal[i], bbox.x0, _y, bbox.w, gh);
_y += gh;
}
if(_h != min_h) will_setHeight = true;
min_h = _h;
} #endregion
} }

View file

@ -14,13 +14,13 @@
} }
function notification(type, str, icon = noone, color = c_ui_blue_dkgrey, life = -1) constructor { function notification(type, str, icon = noone, color = c_ui_blue_dkgrey, life = -1) constructor {
self.type = type; self.type = type;
self.txt = str; self.txt = str;
self.icon = icon; self.icon = icon;
self.color = color; self.color = color;
self.life_max = life; self.life_max = life;
self.life = life; self.life = life;
self.onClick = noone; self.onClick = noone;
self.tooltip = ""; self.tooltip = "";
@ -70,7 +70,6 @@
function noti_warning(str, icon = noone, ref = noone) { function noti_warning(str, icon = noone, ref = noone) {
if(TEST_ERROR) return {}; if(TEST_ERROR) return {};
show_debug_message("WARNING: " + str);
if(PANEL_MAIN == 0) return; if(PANEL_MAIN == 0) return;
if(PANEL_MENU) { if(PANEL_MENU) {
@ -79,10 +78,14 @@
} }
if(!ds_list_empty(STATUSES) && STATUSES[| ds_list_size(STATUSES) - 1].txt == str) { if(!ds_list_empty(STATUSES) && STATUSES[| ds_list_size(STATUSES) - 1].txt == str) {
STATUSES[| ds_list_size(STATUSES) - 1].amount++; var noti = STATUSES[| ds_list_size(STATUSES) - 1];
return STATUSES[| ds_list_size(STATUSES) - 1];
noti.amount++;
noti.life = noti.life_max;
return noti;
} }
show_debug_message("WARNING: " + str);
var noti = new notification(NOTI_TYPE.warning, str, icon, c_ui_orange, PREFERENCES.notification_time); var noti = new notification(NOTI_TYPE.warning, str, icon, c_ui_orange, PREFERENCES.notification_time);
ds_list_add(STATUSES, noti); ds_list_add(STATUSES, noti);
ds_list_add(WARNING, noti); ds_list_add(WARNING, noti);

View file

@ -967,12 +967,15 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
for(var i = 0; i < ds_list_size(nodes_list); i++) { for(var i = 0; i < ds_list_size(nodes_list); i++) {
var _node = nodes_list[| i]; var _node = nodes_list[| i];
if(is_instanceof(_node, Node_Frame)) continue; if(is_instanceof(_node, Node_Frame)) continue;
var val = _node.drawNode(gr_x, gr_y, mx, my, graph_s, display_parameter); try {
var val = _node.drawNode(gr_x, gr_y, mx, my, graph_s, display_parameter);
if(val) { if(val) {
if(key_mod_press(SHIFT)) if(key_mod_press(SHIFT))
TOOLTIP = [ val.getValue(), val.type ]; TOOLTIP = [ val.getValue(), val.type ];
value_focus = val; value_focus = val;
}
} catch(e) {
log_warning("NODE DRAW", exception_print(e));
} }
} }

View file

@ -444,13 +444,8 @@ function Panel_Menu() : PanelContent() constructor {
#endregion #endregion
#region notification #region notification
var warning_amo = 0; var warning_amo = ds_list_size(WARNING);
for( var i = 0; i < ds_list_size(WARNING); i++ ) var error_amo = ds_list_size(ERRORS);
warning_amo += WARNING[| i].amount;
var error_amo = 0;
for( var i = 0; i < ds_list_size(ERRORS); i++ )
error_amo += ERRORS[| i].amount;
if(hori) { if(hori) {
var nx0 = _mx + ui(24); var nx0 = _mx + ui(24);