2022-12-27 04:00:50 +01:00
|
|
|
function Node_Number(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
|
2022-01-13 05:24:03 +01:00
|
|
|
name = "Number";
|
2022-11-18 03:20:31 +01:00
|
|
|
color = COLORS.node_blend_number;
|
2022-01-13 05:24:03 +01:00
|
|
|
previewable = false;
|
|
|
|
|
|
|
|
w = 96;
|
|
|
|
min_h = 32 + 24 * 1;
|
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
2022-01-19 03:05:13 +01:00
|
|
|
.setVisible(true, true);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
outputs[| 0] = nodeValue("Number", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-01-01 02:06:02 +01:00
|
|
|
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
2023-01-25 06:49:00 +01:00
|
|
|
var __ax = inputs[| 0].getValue();
|
|
|
|
if(is_array(__ax)) return;
|
|
|
|
|
2023-01-01 02:06:02 +01:00
|
|
|
inputs[| 0].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
|
|
|
}
|
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
function process_data(_output, _data, _output_index, _array_index = 0) {
|
2022-01-13 05:24:03 +01:00
|
|
|
return _data[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
static onDrawNode = function(xx, yy, _mx, _my, _s) {
|
2022-11-18 03:20:31 +01:00
|
|
|
draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text);
|
2023-01-01 02:06:02 +01:00
|
|
|
var str = string(outputs[| 0].getValue());
|
2023-01-04 02:30:04 +01:00
|
|
|
|
|
|
|
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);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-27 04:00:50 +01:00
|
|
|
function Node_Vector2(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
|
2022-01-13 05:24:03 +01:00
|
|
|
name = "Vector2";
|
2022-11-18 03:20:31 +01:00
|
|
|
color = COLORS.node_blend_number;
|
2022-01-13 05:24:03 +01:00
|
|
|
previewable = false;
|
|
|
|
|
|
|
|
w = 96;
|
|
|
|
min_h = 32 + 24 * 2;
|
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 0] = nodeValue("x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
2022-01-19 03:05:13 +01:00
|
|
|
.setVisible(true, true);
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 1] = nodeValue("y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
2022-01-19 03:05:13 +01:00
|
|
|
.setVisible(true, true);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
outputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0 ])
|
2023-01-01 02:06:02 +01:00
|
|
|
.setDisplay(VALUE_DISPLAY.vector);
|
|
|
|
|
|
|
|
drag_type = 0;
|
|
|
|
drag_mx = 0;
|
|
|
|
drag_my = 0;
|
|
|
|
drag_sx = 0;
|
|
|
|
drag_sy = 0;
|
2023-01-25 06:49:00 +01:00
|
|
|
|
2023-01-01 02:06:02 +01:00
|
|
|
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
|
|
|
var __ax = inputs[| 0].getValue();
|
|
|
|
var __ay = inputs[| 1].getValue();
|
2023-01-25 06:49:00 +01:00
|
|
|
|
|
|
|
if(is_array(__ax) || is_array(__ay)) return;
|
2023-01-01 02:06:02 +01:00
|
|
|
|
|
|
|
var _ax = __ax * _s + _x;
|
|
|
|
var _ay = __ay * _s + _y;
|
|
|
|
var _val;
|
|
|
|
|
|
|
|
draw_sprite_ui_uniform(THEME.anchor_selector, 0, _ax, _ay);
|
|
|
|
|
|
|
|
if(drag_type) {
|
|
|
|
draw_sprite_ui_uniform(THEME.anchor_selector, 1, _ax, _ay);
|
|
|
|
var _nx = value_snap((drag_sx + (_mx - drag_mx) - _x) / _s, _snx);
|
|
|
|
var _ny = value_snap((drag_sy + (_my - drag_my) - _y) / _s, _sny);
|
|
|
|
if(key_mod_press(CTRL)) {
|
|
|
|
_val[0] = round(_nx);
|
|
|
|
_val[1] = round(_ny);
|
|
|
|
} else {
|
|
|
|
_val[0] = _nx;
|
|
|
|
_val[1] = _ny;
|
|
|
|
}
|
|
|
|
|
|
|
|
var s0 = inputs[| 0].setValue(_val[0]);
|
|
|
|
var s1 = inputs[| 1].setValue(_val[1]);
|
|
|
|
|
|
|
|
if(s0 || s1)
|
|
|
|
UNDO_HOLDING = true;
|
|
|
|
|
|
|
|
if(mouse_release(mb_left)) {
|
|
|
|
drag_type = 0;
|
|
|
|
UNDO_HOLDING = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(point_in_circle(_mx, _my, _ax, _ay, 8)) {
|
|
|
|
hover = 1;
|
|
|
|
draw_sprite_ui_uniform(THEME.anchor_selector, 1, _ax, _ay);
|
|
|
|
if(mouse_press(mb_left, active)) {
|
|
|
|
drag_type = 1;
|
|
|
|
drag_mx = _mx;
|
|
|
|
drag_my = _my;
|
|
|
|
drag_sx = _ax;
|
|
|
|
drag_sy = _ay;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
function process_data(_output, _data, _output_index, _array_index = 0) {
|
2022-01-13 05:24:03 +01:00
|
|
|
var vec = [ _data[0], _data[1] ];
|
|
|
|
return vec;
|
|
|
|
}
|
|
|
|
|
|
|
|
static onDrawNode = function(xx, yy, _mx, _my, _s) {
|
2022-11-18 03:20:31 +01:00
|
|
|
draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text);
|
2023-01-01 02:06:02 +01:00
|
|
|
var vec = outputs[| 0].getValue();
|
|
|
|
var str = string(vec[0]) + "\n" + string(vec[1]);
|
2023-01-04 02:30:04 +01:00
|
|
|
|
|
|
|
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);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-27 04:00:50 +01:00
|
|
|
function Node_Vector3(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
|
2022-01-13 05:24:03 +01:00
|
|
|
name = "Vector3";
|
2022-11-18 03:20:31 +01:00
|
|
|
color = COLORS.node_blend_number;
|
2022-01-13 05:24:03 +01:00
|
|
|
previewable = false;
|
|
|
|
|
|
|
|
w = 96;
|
|
|
|
min_h = 32 + 24 * 3;
|
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 0] = nodeValue("x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
2022-01-19 03:05:13 +01:00
|
|
|
.setVisible(true, true);
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 1] = nodeValue("y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
2022-01-19 03:05:13 +01:00
|
|
|
.setVisible(true, true);
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 2] = nodeValue("z", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
2022-01-19 03:05:13 +01:00
|
|
|
.setVisible(true, true);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
outputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0 ])
|
2022-01-13 05:24:03 +01:00
|
|
|
.setDisplay(VALUE_DISPLAY.vector);
|
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
function process_data(_output, _data, _output_index, _array_index = 0) {
|
2022-01-13 05:24:03 +01:00
|
|
|
var vec = [ _data[0], _data[1], _data[2] ];
|
|
|
|
return vec;
|
|
|
|
}
|
|
|
|
|
|
|
|
static onDrawNode = function(xx, yy, _mx, _my, _s) {
|
2022-11-18 03:20:31 +01:00
|
|
|
draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text);
|
2023-01-01 02:06:02 +01:00
|
|
|
var vec = outputs[| 0].getValue();
|
|
|
|
var str = string(vec[0]) + "\n" + string(vec[1]) + "\n" + string(vec[2]);
|
2023-01-04 02:30:04 +01:00
|
|
|
|
|
|
|
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);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-27 04:00:50 +01:00
|
|
|
function Node_Vector4(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
|
2022-01-13 05:24:03 +01:00
|
|
|
name = "Vector4";
|
2022-11-18 03:20:31 +01:00
|
|
|
color = COLORS.node_blend_number;
|
2022-01-13 05:24:03 +01:00
|
|
|
previewable = false;
|
|
|
|
|
|
|
|
w = 96;
|
|
|
|
min_h = 32 + 24 * 4;
|
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 0] = nodeValue("x", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
2022-01-19 03:05:13 +01:00
|
|
|
.setVisible(true, true);
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 1] = nodeValue("y", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
2022-01-19 03:05:13 +01:00
|
|
|
.setVisible(true, true);
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 2] = nodeValue("z", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
2022-01-19 03:05:13 +01:00
|
|
|
.setVisible(true, true);
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 3] = nodeValue("w", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
2022-01-19 03:05:13 +01:00
|
|
|
.setVisible(true, true);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
outputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0, 0 ])
|
2022-01-13 05:24:03 +01:00
|
|
|
.setDisplay(VALUE_DISPLAY.vector);
|
2023-01-25 06:49:00 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
function process_data(_output, _data, _output_index, _array_index = 0) {
|
2022-01-13 05:24:03 +01:00
|
|
|
var vec = [ _data[0], _data[1], _data[2], _data[3] ];
|
|
|
|
return vec;
|
|
|
|
}
|
|
|
|
|
|
|
|
static onDrawNode = function(xx, yy, _mx, _my, _s) {
|
2022-11-18 03:20:31 +01:00
|
|
|
draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text);
|
2023-01-01 02:06:02 +01:00
|
|
|
var vec = outputs[| 0].getValue();
|
|
|
|
var str = string(vec[0]) + "\n" + string(vec[1]) + "\n" + string(vec[2]) + "\n" + string(vec[3]);
|
2023-01-04 02:30:04 +01:00
|
|
|
|
|
|
|
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);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-27 04:00:50 +01:00
|
|
|
function Node_Vector_Split(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
|
2023-01-25 06:49:00 +01:00
|
|
|
name = "Vector Split";
|
2022-11-18 03:20:31 +01:00
|
|
|
color = COLORS.node_blend_number;
|
2022-01-13 05:24:03 +01:00
|
|
|
previewable = false;
|
|
|
|
|
|
|
|
w = 96;
|
|
|
|
min_h = 32 + 24 * 4;
|
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
inputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 0 ])
|
2022-01-19 03:05:13 +01:00
|
|
|
.setDisplay(VALUE_DISPLAY.vector)
|
|
|
|
.setVisible(true, true);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
outputs[| 0] = nodeValue("x", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
|
|
|
|
outputs[| 1] = nodeValue("y", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
|
|
|
|
outputs[| 2] = nodeValue("z", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
|
|
|
|
outputs[| 3] = nodeValue("w", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
function process_data(_output, _data, _output_index, _array_index = 0) {
|
|
|
|
return array_safe_get(_data[0], _output_index);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static onDrawNode = function(xx, yy, _mx, _my, _s) {
|
2022-11-18 03:20:31 +01:00
|
|
|
draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text);
|
2022-01-13 05:24:03 +01:00
|
|
|
var str = string(outputs[| 0].getValue()) + "\n" + string(outputs[| 1].getValue())
|
|
|
|
+ "\n" + string(outputs[| 2].getValue()) + "\n" + string(outputs[| 3].getValue());
|
2023-01-04 02:30:04 +01:00
|
|
|
|
|
|
|
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);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
}
|