mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
- [Shift Array, Array Range] Is now array processor.
This commit is contained in:
parent
8658db47c9
commit
a7e0f92c28
7 changed files with 54 additions and 66 deletions
|
@ -1,4 +1,4 @@
|
|||
function Node_Array_Range(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
function Node_Array_Range(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Array Range";
|
||||
setDimension(96, 48);
|
||||
|
||||
|
@ -13,10 +13,10 @@ function Node_Array_Range(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
|
||||
outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []);
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) {
|
||||
var st = getInputData(0);
|
||||
var ed = getInputData(1);
|
||||
var stp = getInputData(2);
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var st = _data[0];
|
||||
var ed = _data[1];
|
||||
var stp = _data[2];
|
||||
var arr = [];
|
||||
|
||||
if(st == ed) {
|
||||
|
@ -28,14 +28,14 @@ function Node_Array_Range(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
array_push(arr, st + i * stp);
|
||||
}
|
||||
|
||||
outputs[| 0].setValue(arr);
|
||||
return arr;
|
||||
}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text);
|
||||
var str = getInputData(0);
|
||||
var edd = getInputData(1);
|
||||
var stp = getInputData(2);
|
||||
var str = getSingleValue(0);
|
||||
var edd = getSingleValue(1);
|
||||
var stp = getSingleValue(2);
|
||||
var arr = outputs[| 0].getValue();
|
||||
|
||||
var str = "";
|
||||
|
@ -49,7 +49,6 @@ function Node_Array_Range(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
}
|
||||
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
var ss = string_scale(str, bbox.w, bbox.h);
|
||||
draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0);
|
||||
draw_text_bbox(bbox, str);
|
||||
}
|
||||
}
|
|
@ -22,7 +22,6 @@ function Node_Array_Reverse(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
}
|
||||
|
||||
_arr = array_reverse(_arr);
|
||||
|
||||
outputs[| 0].setValue(_arr);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,26 +1,27 @@
|
|||
function Node_Array_Shift(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
function Node_Array_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Array Shift";
|
||||
setDimension(96, 32 + 24);
|
||||
|
||||
inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0)
|
||||
.setArrayDepth(99)
|
||||
.setVisible(true, true);
|
||||
|
||||
inputs[| 1] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
|
||||
outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0);
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) {
|
||||
var _arr = getInputData(0);
|
||||
var _shf = getInputData(1);
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _arr = _data[0];
|
||||
var _shf = _data[1];
|
||||
|
||||
inputs[| 0].setType(VALUE_TYPE.any);
|
||||
inputs[| 0].setType(VALUE_TYPE.any);
|
||||
outputs[| 0].setType(VALUE_TYPE.any);
|
||||
|
||||
if(!is_array(_arr)) return;
|
||||
if(!is_array(_arr)) return [];
|
||||
|
||||
if(inputs[| 0].value_from != noone) {
|
||||
var type = inputs[| 0].value_from.type;
|
||||
inputs[| 0].setType(type);
|
||||
inputs[| 0].setType(type);
|
||||
outputs[| 0].setType(type);
|
||||
}
|
||||
|
||||
|
@ -28,7 +29,7 @@ function Node_Array_Shift(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
for( var i = 0, n = array_length(_arr); i < n; i++ )
|
||||
arr[i] = array_safe_get(_arr, i - _shf,, ARRAY_OVERFLOW.loop);
|
||||
|
||||
outputs[| 0].setValue(arr);
|
||||
return arr;
|
||||
}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
function Node_Array_Split(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { #region
|
||||
function Node_Array_Split(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Array Split";
|
||||
setDimension(96, 0);
|
||||
|
||||
draw_padding = 4;
|
||||
|
||||
inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, [ ])
|
||||
inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, [])
|
||||
.setVisible(true, true);
|
||||
|
||||
outputs[| 0] = nodeValue("val 0", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0);
|
||||
|
@ -55,5 +55,4 @@ function Node_Array_Split(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
_ind++;
|
||||
}
|
||||
}
|
||||
|
||||
} #endregion
|
||||
}
|
|
@ -3,6 +3,7 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
setDimension(16, 16);
|
||||
|
||||
bg_spr = THEME.node_frame_bg;
|
||||
previewable = false;
|
||||
|
||||
size_dragging = false;
|
||||
size_dragging_w = w;
|
||||
|
@ -61,7 +62,7 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
mm_press = 0;
|
||||
mm_release = 0;
|
||||
|
||||
static move = function(_x, _y, _s) { #region
|
||||
static move = function(_x, _y, _s) {
|
||||
if(x == _x && y == _y) return;
|
||||
if(!LOADING) PROJECT.modified = true;
|
||||
|
||||
|
@ -70,9 +71,9 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
|
||||
if(inputs[| 5].setValue([ _x, _y ]))
|
||||
UNDO_HOLDING = true;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static button_reactive_update = function() { #region
|
||||
static button_reactive_update = function() {
|
||||
ml_press = lerp_float(ml_press , 0, 5);
|
||||
ml_release = lerp_float(ml_release, 0, 5);
|
||||
ml_double = lerp_float(ml_double, 0, 5);
|
||||
|
@ -88,9 +89,9 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
if(mouse_release(mb_right)) mr_release = 2;
|
||||
if(mouse_press(mb_middle)) mm_press = 2;
|
||||
if(mouse_release(mb_middle)) mm_release = 2;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static button_reactive = function(key) { #region
|
||||
static button_reactive = function(key) {
|
||||
switch(key) {
|
||||
case "left_mouse_click" : return clamp(ml_press, 0, 1);
|
||||
case "left_mouse_double_click" : return clamp(ml_double, 0, 1);
|
||||
|
@ -127,9 +128,9 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
if(string_length(key) == 1) return keyboard_check(ord(string_upper(key)));
|
||||
|
||||
return 0;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static draw_text_style = function(_x, _y, txt, _s, _mx, _my) { #region
|
||||
static draw_text_style = function(_x, _y, txt, _s, _mx, _my) {
|
||||
var _tx = _x;
|
||||
var index = 1;
|
||||
var _len = string_length(txt);
|
||||
|
@ -261,9 +262,9 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
}
|
||||
|
||||
return width;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static string_raw = function(txt) { #region
|
||||
static string_raw = function(txt) {
|
||||
var index = 1;
|
||||
var _len = string_length(txt);
|
||||
var _ch = "";
|
||||
|
@ -307,9 +308,9 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
}
|
||||
|
||||
return ss;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static line_update = function(txt, line_width = -1) { #region
|
||||
static line_update = function(txt, line_width = -1) {
|
||||
_prev_text = txt;
|
||||
_lines = [];
|
||||
|
||||
|
@ -344,13 +345,13 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
}
|
||||
|
||||
if(ss != "") array_push(_lines, ss);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static onValueUpdate = function(index = 0) { #region
|
||||
static onValueUpdate = function(index = 0) {
|
||||
if(index == 1 || index == 4) line_update(getInputData(1), getInputData(4));
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static preDraw = function(_x, _y, _s) { #region
|
||||
static preDraw = function(_x, _y, _s) {
|
||||
var xx = (x - 3) * _s + _x;
|
||||
var yy = y * _s + _y;
|
||||
var jun;
|
||||
|
@ -373,9 +374,9 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
jun.y = _iny;
|
||||
_iny += junction_draw_hei_y * _s;
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static drawNodeBase = function(xx, yy, mx, my, _s) { #region
|
||||
static drawNodeBase = function(xx, yy, mx, my, _s) {
|
||||
var color = getInputData(0);
|
||||
var txt = getInputData(1);
|
||||
if(txt == "") txt = "..."
|
||||
|
@ -437,9 +438,9 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
draw_scale = _s;
|
||||
w = ww + 8;
|
||||
h = hh + 8;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static drawJunctions = function(_x, _y, _mx, _my, _s) { #region
|
||||
static drawJunctions = function(_x, _y, _mx, _my, _s) {
|
||||
if(!active) return;
|
||||
|
||||
var hover = noone;
|
||||
|
@ -448,14 +449,14 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
for(var i = 0, n = array_length(inputDisplayList); i < n; i++) {
|
||||
var jun = inputDisplayList[i];
|
||||
|
||||
if(jun.drawJunction_fast(_s * 4, _mx, _my))
|
||||
if(jun.drawJunction_fast(_s, _mx, _my))
|
||||
hover = jun;
|
||||
}
|
||||
|
||||
return hover;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static drawNode = function(_x, _y, _mx, _my, _s) { #region
|
||||
static drawNode = function(_x, _y, _mx, _my, _s) {
|
||||
x = smooth? lerp_float(x, pos_x, 4) : pos_x;
|
||||
y = smooth? lerp_float(y, pos_y, 4) : pos_y;
|
||||
|
||||
|
@ -471,5 +472,5 @@ function Node_Display_Text(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
drawNodeBase(xx, yy, _mx, _my, _s);
|
||||
|
||||
return drawJunctions(xx, yy, _mx, _my, _s);
|
||||
} #endregion
|
||||
}
|
||||
}
|
|
@ -55,11 +55,11 @@ function Node_Normal_Light(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
|||
var _hei = _data[2];
|
||||
var _amb = _data[3];
|
||||
|
||||
var _light_pos = _data[4];
|
||||
var _light_ran = _data[5];
|
||||
var _light_int = _data[6];
|
||||
var _light_col = _data[7];
|
||||
var _light_typ = _data[8];
|
||||
var _light_pos = _data[ 4];
|
||||
var _light_ran = _data[ 5];
|
||||
var _light_int = _data[ 6];
|
||||
var _light_col = _data[ 7];
|
||||
var _light_typ = _data[ 8];
|
||||
var _light_hei = _data[10];
|
||||
|
||||
var _dim = surface_get_dimension(_data[0]);
|
||||
|
|
|
@ -323,20 +323,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
return self;
|
||||
}
|
||||
|
||||
static rejectArray = function() { #region
|
||||
accept_array = false;
|
||||
return self;
|
||||
} #endregion
|
||||
|
||||
static setArrayDepth = function(aDepth) { #region
|
||||
array_depth = aDepth;
|
||||
return self;
|
||||
} #endregion
|
||||
|
||||
static setArrayDynamic = function() { #region
|
||||
dynamic_array = true;
|
||||
return self;
|
||||
} #endregion
|
||||
static rejectArray = function() { accept_array = false; return self; }
|
||||
static setArrayDepth = function(aDepth) { array_depth = aDepth; return self; }
|
||||
static setArrayDynamic = function() { dynamic_array = true; return self; }
|
||||
|
||||
static rejectArrayProcess = function() { #region
|
||||
process_array = false;
|
||||
|
|
Loading…
Reference in a new issue