mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
Palette, gradient array fixes
This commit is contained in:
parent
1539540928
commit
40187887b4
19 changed files with 254 additions and 144 deletions
|
@ -189,6 +189,7 @@
|
|||
{"name":"VFX","order":134,"path":"folders/nodes/icons/VFX.yy",},
|
||||
{"name":"panels","order":2,"path":"folders/panels.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":"context menu","order":5,"path":"folders/panels/context menu.yy",},
|
||||
{"name":"graph","order":1,"path":"folders/panels/graph.yy",},
|
||||
|
@ -246,7 +247,6 @@
|
|||
{"name":"button","order":34,"path":"folders/widgets/button.yy",},
|
||||
{"name":"rotator","order":35,"path":"folders/widgets/rotator.yy",},
|
||||
{"name":"text","order":36,"path":"folders/widgets/text.yy",},
|
||||
{"name":"collection","order":11,"path":"folders/panels/collection.yy",},
|
||||
],
|
||||
"ResourceOrderSettings": [
|
||||
{"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",},
|
||||
|
|
|
@ -220,6 +220,7 @@
|
|||
{"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":"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":"context menu","folderPath":"folders/panels/context menu.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":"rotator","folderPath":"folders/widgets/rotator.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": [
|
||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",},
|
||||
|
|
|
@ -35,8 +35,17 @@ function draw_tooltip_color(clr) {
|
|||
}
|
||||
|
||||
function draw_tooltip_palette(clr) {
|
||||
var ww = min(ui(160), ui(32) * array_length(clr));
|
||||
var hh = ui(32);
|
||||
if(array_empty(clr)) return;
|
||||
|
||||
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 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, 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) {
|
||||
var gh = ui(32);
|
||||
if(!is_array(clr)) clr = [ clr ];
|
||||
|
||||
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 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, 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) {
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION;
|
||||
|
||||
LATEST_VERSION = 11500;
|
||||
VERSION = 11601;
|
||||
VERSION = 11602;
|
||||
SAVE_VERSION = 11600.1;
|
||||
VERSION_STRING = "1.16.0.1";
|
||||
BUILD_NUMBER = 11601;
|
||||
VERSION_STRING = "1.16.0.2";
|
||||
BUILD_NUMBER = 11602;
|
||||
|
||||
globalvar APPEND_MAP;
|
||||
APPEND_MAP = ds_map_create();
|
||||
|
|
|
@ -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
|
||||
var type = getInputData(12);
|
||||
if(preview_draw != (type == 0)) {
|
||||
preview_draw = (type == 0);
|
||||
will_setHeight = true;
|
||||
}
|
||||
|
||||
if(type == 0) return;
|
||||
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
if(bbox.h < 1) return;
|
||||
|
||||
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
|
||||
}
|
|
@ -1256,7 +1256,11 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
|
||||
if(previewable) {
|
||||
if(preview_draw) drawPreview(xx, yy, _s);
|
||||
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 {
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_ext(THEME.preview_hide, 0, bbox.xc, bbox.yc, _s, _s, 0, c_white, 0.25);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
function Node_Gradient_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Gradient Data";
|
||||
|
||||
w = 96;
|
||||
|
||||
inputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
|
||||
|
@ -39,12 +38,19 @@ function Node_Gradient_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y,
|
|||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
if(bbox.h < 1) return;
|
||||
|
||||
var grad = getInputData(0);
|
||||
if(is_array(grad)) {
|
||||
if(array_length(grad) == 0) return;
|
||||
grad = grad[0];
|
||||
var grad = inputs[| 0].getValue();
|
||||
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;
|
||||
}
|
||||
|
||||
grad.draw(bbox.x0, bbox.y0, bbox.w, bbox.h);
|
||||
if(_h != min_h) will_setHeight = true;
|
||||
min_h = _h;
|
||||
} #endregion
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
function Node_Gradient_Out(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Gradient";
|
||||
|
||||
w = 96;
|
||||
|
||||
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;
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var pal = _data[0];
|
||||
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 == 1) return pal.eval(pos);
|
||||
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);
|
||||
if(bbox.h < 1) return;
|
||||
|
||||
var grad = getSingleValue(0);
|
||||
grad.draw(bbox.x0, bbox.y0, bbox.w, bbox.h);
|
||||
var grad = outputs[| 0].getValue();
|
||||
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
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
function Node_Gradient_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Palette to Gradient";
|
||||
|
||||
w = 96;
|
||||
|
||||
inputs[| 0] = nodeValue("Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE )
|
||||
|
@ -20,12 +19,12 @@ function Node_Gradient_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y,
|
|||
|
||||
_pal = -1;
|
||||
|
||||
static step = function() {
|
||||
static step = function() { #region
|
||||
var usePos = array_safe_get(current_data, 1);
|
||||
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 pos_use = _data[1];
|
||||
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));
|
||||
grad.keys = array_create(len);
|
||||
|
||||
//print("Process gradient");
|
||||
for( var i = 0; i < len; i++ ) {
|
||||
var clr = pal[i];
|
||||
var pos = pos_use? array_safe_get(_pos, i, 0) : i / len;
|
||||
|
||||
grad.keys[i] = new gradientKey(pos, clr);
|
||||
//print($" {i} = {pos} : {clr}");
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
|
@ -51,18 +48,25 @@ function Node_Gradient_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y,
|
|||
}
|
||||
|
||||
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);
|
||||
if(bbox.h < 1) return;
|
||||
|
||||
var grad = outputs[| 0].getValue();
|
||||
if(is_array(grad)) {
|
||||
if(array_length(grad) == 0) return;
|
||||
grad = grad[0];
|
||||
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;
|
||||
}
|
||||
|
||||
grad.draw(bbox.x0, bbox.y0, bbox.w, bbox.h);
|
||||
}
|
||||
if(_h != min_h) will_setHeight = true;
|
||||
min_h = _h;
|
||||
} #endregion
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
function Node_Gradient_Replace_Color(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Gradient Replace";
|
||||
|
||||
w = 96;
|
||||
|
||||
inputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
|
||||
|
@ -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) );
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var gra = _data[0];
|
||||
var pfr = _data[1];
|
||||
var pto = _data[2];
|
||||
|
@ -46,18 +45,25 @@ function Node_Gradient_Replace_Color(_x, _y, _group = noone) : Node_Processor(_x
|
|||
graO.type = gra.type;
|
||||
|
||||
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);
|
||||
if(bbox.h < 1) return;
|
||||
|
||||
var grad = outputs[| 0].getValue();
|
||||
if(is_array(grad)) {
|
||||
if(array_length(grad) == 0) return;
|
||||
grad = grad[0];
|
||||
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;
|
||||
}
|
||||
|
||||
grad.draw(bbox.x0, bbox.y0, bbox.w, bbox.h);
|
||||
}
|
||||
if(_h != min_h) will_setHeight = true;
|
||||
min_h = _h;
|
||||
} #endregion
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
function Node_Gradient_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Gradient Shift";
|
||||
|
||||
w = 96;
|
||||
|
||||
inputs[| 0] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) )
|
||||
|
@ -18,7 +17,7 @@ function Node_Gradient_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
|
|||
|
||||
_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 sft = _data[1];
|
||||
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;
|
||||
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);
|
||||
if(bbox.h < 1) return;
|
||||
|
||||
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
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
function Node_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Palette";
|
||||
|
||||
w = 96;
|
||||
|
||||
inputs[| 0] = nodeValue("Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE)
|
||||
|
@ -16,7 +15,7 @@ function Node_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
["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 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);
|
||||
|
||||
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);
|
||||
if(bbox.h < 1) return;
|
||||
|
||||
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
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
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";
|
||||
w = 96;
|
||||
|
||||
|
@ -295,34 +295,33 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node(_x, _y, _group) con
|
|||
return [];
|
||||
} #endregion
|
||||
|
||||
static extractPalettes = function() { #region
|
||||
var _surf = getInputData(0);
|
||||
var _size = getInputData(1);
|
||||
var _seed = getInputData(2);
|
||||
var _algo = getInputData(3);
|
||||
var res = [];
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _surf = _data[0];
|
||||
var _size = _data[1];
|
||||
var _seed = _data[2];
|
||||
var _algo = _data[3];
|
||||
|
||||
if(is_surface(_surf)) {
|
||||
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);
|
||||
return extractPalette(_surf, _algo, _size, _seed);
|
||||
} #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
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
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
|
||||
}
|
|
@ -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, [ ] )
|
||||
.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 pfr = _data[1];
|
||||
var pto = _data[2];
|
||||
|
@ -49,14 +49,26 @@ function Node_Palette_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _
|
|||
}
|
||||
|
||||
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);
|
||||
if(bbox.h < 1) return;
|
||||
|
||||
var pal = outputs[| 0].getValue();
|
||||
if(array_length(pal) && is_array(pal[0])) return;
|
||||
drawPalette(pal, bbox.x0, bbox.y0, bbox.w, bbox.h);
|
||||
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
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
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";
|
||||
|
||||
w = 96;
|
||||
|
||||
inputs[| 0] = nodeValue("Palette in", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE )
|
||||
|
@ -26,14 +25,14 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
0, 1, 3, 2,
|
||||
]
|
||||
|
||||
static step = function() {
|
||||
static step = function() { #region
|
||||
var _typ = getInputData(1);
|
||||
|
||||
inputs[| 3].setVisible(_typ == 10);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
sort_string = "";
|
||||
static customSort = function(c) {
|
||||
static customSort = function(c) { #region
|
||||
var len = string_length(sort_string);
|
||||
var val = power(256, len - 1);
|
||||
var res = 0;
|
||||
|
@ -58,13 +57,13 @@ function Node_Palette_Sort(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) {
|
||||
var _arr = getInputData(0);
|
||||
var _ord = getInputData(1);
|
||||
var _rev = getInputData(2);
|
||||
sort_string = getInputData(3);
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _arr = _data[0];
|
||||
var _ord = _data[1];
|
||||
var _rev = _data[2];
|
||||
sort_string = _data[3];
|
||||
if(!is_array(_arr)) return;
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
if(bbox.h < 1) return;
|
||||
|
||||
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
|
||||
}
|
|
@ -70,7 +70,6 @@
|
|||
|
||||
function noti_warning(str, icon = noone, ref = noone) {
|
||||
if(TEST_ERROR) return {};
|
||||
show_debug_message("WARNING: " + str);
|
||||
if(PANEL_MAIN == 0) return;
|
||||
|
||||
if(PANEL_MENU) {
|
||||
|
@ -79,10 +78,14 @@
|
|||
}
|
||||
|
||||
if(!ds_list_empty(STATUSES) && STATUSES[| ds_list_size(STATUSES) - 1].txt == str) {
|
||||
STATUSES[| ds_list_size(STATUSES) - 1].amount++;
|
||||
return STATUSES[| ds_list_size(STATUSES) - 1];
|
||||
var noti = 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);
|
||||
ds_list_add(STATUSES, noti);
|
||||
ds_list_add(WARNING, noti);
|
||||
|
|
|
@ -967,13 +967,16 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
for(var i = 0; i < ds_list_size(nodes_list); i++) {
|
||||
var _node = nodes_list[| i];
|
||||
if(is_instanceof(_node, Node_Frame)) continue;
|
||||
try {
|
||||
var val = _node.drawNode(gr_x, gr_y, mx, my, graph_s, display_parameter);
|
||||
|
||||
if(val) {
|
||||
if(key_mod_press(SHIFT))
|
||||
TOOLTIP = [ val.getValue(), val.type ];
|
||||
value_focus = val;
|
||||
}
|
||||
} catch(e) {
|
||||
log_warning("NODE DRAW", exception_print(e));
|
||||
}
|
||||
}
|
||||
|
||||
for(var i = 0; i < ds_list_size(nodes_list); i++)
|
||||
|
|
|
@ -444,13 +444,8 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
#endregion
|
||||
|
||||
#region notification
|
||||
var warning_amo = 0;
|
||||
for( var i = 0; i < ds_list_size(WARNING); i++ )
|
||||
warning_amo += WARNING[| i].amount;
|
||||
|
||||
var error_amo = 0;
|
||||
for( var i = 0; i < ds_list_size(ERRORS); i++ )
|
||||
error_amo += ERRORS[| i].amount;
|
||||
var warning_amo = ds_list_size(WARNING);
|
||||
var error_amo = ds_list_size(ERRORS);
|
||||
|
||||
if(hori) {
|
||||
var nx0 = _mx + ui(24);
|
||||
|
|
Loading…
Reference in a new issue