Optimize terrain generation

This commit is contained in:
MakhamDev 2023-10-27 18:55:31 +07:00
parent dd5603e38a
commit 211615b8ab
49 changed files with 344 additions and 214 deletions

View file

@ -678,6 +678,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_textbox_code_line.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/widget",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_textbox.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/widget",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_widget_highlight.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/widget",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"meta.json","CopyToMask":-1,"filePath":"datafiles/data/themes/default",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"values.json","CopyToMask":-1,"filePath":"datafiles/data/themes/default",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"tooltip.zip","CopyToMask":3035426170322551022,"filePath":"datafiles/data",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"0 introduction.png","CopyToMask":-1,"filePath":"datafiles/Getting started",},

Binary file not shown.

View file

@ -193,7 +193,7 @@ event_inherited();
for( var i = 0; i < ds_list_size(_new_list); i++ ) {
var _in = _new_list[| i].inputs;
for( var j = 0; j < ds_list_size(_in); j++ ) {
if(_in[| j].value_from == noone)
if(_in[| j].isLeaf())
ds_list_add(_inputs, _in[| j]);
}

View file

@ -384,14 +384,32 @@ event_inherited();
themes = [];
var f = file_find_first(DIRECTORY + "themes/*", fa_directory);
while(f != "") {
if(directory_exists(DIRECTORY + "themes/" + f))
array_push(themes, f);
var _path = $"{DIRECTORY}themes/{f}";
if(directory_exists(_path)) {
var _metaPath = _path + "/meta.json";
if(!file_exists(_metaPath)) {
var _item = new scrollItem(f, THEME.circle);
_item.spr_blend = COLORS._main_accent;
_item.tooltip = "Theme made for earlier version.";
array_push(themes, _item);
} else {
var _meta = json_load_struct(_metaPath);
var _item = new scrollItem(_meta.name, _meta.version >= VERSION? noone : THEME.circle);
_item.data = f;
_item.spr_blend = COLORS._main_accent;
if(_meta.version < VERSION)
_item.tooltip = "Theme made for earlier version.";
array_push(themes, _item);
}
}
f = file_find_next();
}
file_find_close();
sb_theme = new scrollBox(themes, function(index) {
var thm = themes[index]
var thm = themes[index].data;
if(PREF_MAP[? "theme"] == thm) return;
PREF_MAP[? "theme"] = thm;
PREF_SAVE();

View file

@ -75,7 +75,11 @@ event_inherited();
var hovering = "";
for(var i = 0; i < array_length(data); i++) {
var txt = data[i];
var _val = data[i];
var txt = is_instanceof(_val, scrollItem)? _val.name : _val;
var _spr = is_instanceof(_val, scrollItem) && _val.spr;
var _tol = is_instanceof(_val, scrollItem) && _val.tooltip != "";
var clickable = !string_starts_with(txt, "-");
if(!clickable)
txt = string_delete(txt, 1, 1);
@ -92,23 +96,25 @@ event_inherited();
if(sc_content.hover && point_in_rectangle(_m[0], _m[1], 0, _ly + 1, _dw, _ly + hght - 1)) {
selecting = i;
hovering = data[i];
if(_tol) TOOLTIP = _val.tooltip;
}
if(selecting == i) {
draw_sprite_stretched_ext(THEME.textbox, 3, 0, _ly, _dw, hght, COLORS.dialog_menubox_highlight, 1);
if(sc_content.active && (mouse_press(mb_left) || keyboard_check_pressed(vk_enter))) {
initVal = array_find(scrollbox.data, txt);
initVal = array_find(scrollbox.data, _val);
instance_destroy();
}
}
}
draw_set_text(f_p0, align, fa_center, clickable? COLORS._main_text : COLORS._main_text_sub);
if(align == fa_center)
draw_text_cut(_dw / 2, _ly + hght / 2, txt, _dw);
else if(align == fa_left)
draw_text_cut(ui(8), _ly + hght / 2, txt, _dw);
if(align == fa_center) draw_text_cut(_dw / 2, _ly + hght / 2, txt, _dw);
else if(align == fa_left) draw_text_cut(ui(8) + _spr * hght, _ly + hght / 2, txt, _dw);
if(_spr) draw_sprite_ext(_val.spr, 0, ui(8) + hght / 2, _ly + hght / 2, 1, 1, 0, _val.spr_blend, 1);
_ly += hght;
_h += hght;
@ -118,7 +124,7 @@ event_inherited();
UNDO_HOLDING = true;
if(hovering != "")
scrollbox.onModify(array_find(scrollbox.data, hovering));
else
else if(initVal > -1)
scrollbox.onModify(initVal);
UNDO_HOLDING = false;
}

View file

@ -1,5 +1,6 @@
/// @description init
event_inherited();
scrollbox.onModify(initVal);
if(initVal > -1)
scrollbox.onModify(initVal);
scrollbox.open = false;

View file

@ -6,6 +6,34 @@ function NodeModule(parent) constructor {
load_map = -1;
load_scale = false;
static isLeaf = function() { #region
for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) {
var _inp = inputs[| i];
if(!_inp.isLeaf()) return false;
}
return true;
} #endregion
static drawConnections = function(params = {}, _inputs = []) { #region
for(var i = 0; i < ds_list_size(inputs); i++) {
var jun = inputs[| i];
if(jun.isLeaf()) continue;
if(!jun.value_from.node.active) continue;
if(!jun.isVisible()) continue;
if(i >= 0) array_push(_inputs, jun);
}
} #endregion
static isRendered = function() { #region //Check if every input is ready (updated)
for(var j = 0; j < ds_list_size(inputs); j++)
if(!inputs[| j].isRendered()) return false;
return true;
} #endregion
static resetCache = function() { #region
for( var i = 0; i < ds_list_size(inputs); i++ ) {
if(!is_instanceof(inputs[| i], NodeValue)) continue;

View file

@ -22,7 +22,7 @@ function Node_Fluid(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) {
var _input = inputs[| i];
if(_input.value_from == noone) continue;
if(_input.isLeaf()) continue;
if(!is_instanceof(_input.value_from.node, Node_Fluid)) continue;
_input.value_from.node.cachedPropagate();

View file

@ -90,7 +90,7 @@ function __3dObject() constructor {
static build = function(_buffer = VB, _vertex = vertex, counts = object_counts) { #region
if(is_array(_buffer)) {
for( var i = 0, n = array_length(_buffer); i < n; i++ )
vertex_delete_buffer(_buffer[i])
if(_buffer[i] != noone) vertex_delete_buffer(_buffer[i])
} else if(_buffer != noone) vertex_delete_buffer(_buffer);
if(array_empty(_vertex)) return noone;

View file

@ -1,4 +1,5 @@
function __3dTerrain() : __3dObject() constructor {
VB = [ noone ];
VF = global.VF_POS_NORM_TEX_COL;
render_type = pr_trianglelist;
@ -60,8 +61,22 @@ function __3dTerrain() : __3dObject() constructor {
var _in = 0;
var _vt = vertex[0];
if(VB[0]) vertex_delete_buffer(VB[0]);
VB[0] = vertex_create_buffer();
vertex_begin(VB[0], VF);
for( var i = 0; i < subdivision; i++ )
for( var j = 0; j < subdivision; j++ ) {
var u0 = (i + 0) / subdivision;
var u1 = (i + 1) / subdivision;
var v0 = (j + 0) / subdivision;
var v1 = (j + 1) / subdivision;
var x0 = -0.5 + u0;
var x1 = -0.5 + u1;
var y0 = -0.5 + v0;
var y1 = -0.5 + v1;
var _i0 = j * (subdivision + 1) + i;
var _i1 = j * (subdivision + 1) + i + 1;
var _i2 = (j + 1) * (subdivision + 1) + i;
@ -72,18 +87,30 @@ function __3dTerrain() : __3dObject() constructor {
var _h2 = heights[_i2];
var _h3 = heights[_i3];
_vt[_in + 0].z = _h0;
_vt[_in + 1].z = _h3;
_vt[_in + 2].z = _h1;
var _n = new __vec3(x1 - x0, y0 - y0, _h1 - _h0)
.cross(new __vec3(x0 - x0, y1 - y0, _h2 - _h0))
.normalize();
_vt[_in + 3].z = _h0;
_vt[_in + 4].z = _h2;
_vt[_in + 5].z = _h3;
_vt[_in + 0].z = _h0; _vt[_in + 0].nx = _n.x; _vt[_in + 0].ny = _n.y; _vt[_in + 0].nz = _n.z;
_vt[_in + 1].z = _h3; _vt[_in + 1].nx = _n.x; _vt[_in + 1].ny = _n.y; _vt[_in + 1].nz = _n.z;
_vt[_in + 2].z = _h1; _vt[_in + 2].nx = _n.x; _vt[_in + 2].ny = _n.y; _vt[_in + 2].nz = _n.z;
_vt[_in + 3].z = _h0; _vt[_in + 3].nx = _n.x; _vt[_in + 3].ny = _n.y; _vt[_in + 3].nz = _n.z;
_vt[_in + 4].z = _h2; _vt[_in + 4].nx = _n.x; _vt[_in + 4].ny = _n.y; _vt[_in + 4].nz = _n.z;
_vt[_in + 5].z = _h3; _vt[_in + 5].nx = _n.x; _vt[_in + 5].ny = _n.y; _vt[_in + 5].nz = _n.z;
vertex_add_vntc(VB[0], _vt[_in + 0]);
vertex_add_vntc(VB[0], _vt[_in + 1]);
vertex_add_vntc(VB[0], _vt[_in + 2]);
vertex_add_vntc(VB[0], _vt[_in + 3]);
vertex_add_vntc(VB[0], _vt[_in + 4]);
vertex_add_vntc(VB[0], _vt[_in + 5]);
_in += 6;
}
VB = build();
vertex_end(VB[0]);
}
onParameterUpdate = initModel;

View file

@ -26,10 +26,10 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
VERSION = 11553;
VERSION = 11560;
SAVE_VERSION = 11550;
VERSION_STRING = "1.15.5.3";
BUILD_NUMBER = 11553;
VERSION_STRING = "1.15.6";
BUILD_NUMBER = 11560;
globalvar APPEND_MAP;
APPEND_MAP = ds_map_create();

View file

@ -57,11 +57,12 @@ function Node_3D_Mesh_Terrain(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _gr
array_copy(_h, 0, _hia, 0, min(array_length(_h), array_length(_hia)));
}
if(CURRENT_FRAME == 0) object.initModel();
object.checkParameter({ subdivision: _sub });
object.updateHeight(_h);
object.materials = [ _mat ];
object.initModel();
setTransform(object, _data);
return object;

View file

@ -114,7 +114,7 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
_l[| i].setVisible(i < ds_list_size(_l) - 1);
array_push(input_display_list, i);
if(i >= input_fix_len && _l[| i].value_from == noone)
if(i >= input_fix_len && _l[| i].isLeaf())
extra = false;
}
array_insert(input_display_list, 1, array_adjust_tool);

View file

@ -54,7 +54,7 @@ function Node_Array_Add(_x, _y, _group = noone) : Node(_x, _y, _group) construct
static update = function(frame = CURRENT_FRAME) {
var _arr = getInputData(0);
if(inputs[| 0].value_from == noone) {
if(inputs[| 0].isLeaf()) {
inputs[| 0].setType(VALUE_TYPE.any);
outputs[| 0].setType(VALUE_TYPE.any);
return;

View file

@ -13,7 +13,7 @@ function Node_Array_Length(_x, _y, _group = noone) : Node(_x, _y, _group) constr
static update = function(frame = CURRENT_FRAME) {
var _arr = getInputData(0);
inputs[| 0].setType(inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type);
inputs[| 0].setType(inputs[| 0].isLeaf()? VALUE_TYPE.any : inputs[| 0].value_from.type);
if(!is_array(_arr) || array_length(_arr) == 0) {
outputs[| 0].setValue(0);

View file

@ -51,7 +51,7 @@ function Node_Array_Zip(_x, _y, _group = noone) : Node(_x, _y, _group) construct
static update = function(frame = CURRENT_FRAME) {
var _arr = getInputData(0);
if(inputs[| 0].value_from == noone) {
if(inputs[| 0].isLeaf()) {
inputs[| 0].setType(VALUE_TYPE.any);
outputs[| 0].setType(VALUE_TYPE.any);
return;
@ -66,7 +66,7 @@ function Node_Array_Zip(_x, _y, _group = noone) : Node(_x, _y, _group) construct
var val = [];
for( var i = 0; i < ds_list_size(inputs) - 1; i += data_length ) {
val[i] = getInputData(i);
inputs[| i].setType(inputs[| i].value_from == noone? inputs[| i].value_from.type : VALUE_TYPE.any);
inputs[| i].setType(inputs[| i].isLeaf()? inputs[| i].value_from.type : VALUE_TYPE.any);
if(!is_array(val[i])) {
val[i] = [ val[i] ];
continue;

View file

@ -100,7 +100,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, by, _w, _h, COLORS.node_composite_bg_blend, 1);
var index = inputs[| 2].value_from == noone? inputs[| 2].is_anim : 2;
var index = inputs[| 2].isLeaf()? inputs[| 2].is_anim : 2;
draw_sprite_ui_uniform(THEME.animate_clock, index, abx, lb_y, 1, index == 2? COLORS._main_accent : c_white, 0.8);
if(_hover && point_in_circle(_m[0], _m[1], abx, lb_y, ui(10))) {
draw_sprite_ui_uniform(THEME.animate_clock, index, abx, lb_y, 1, index == 2? COLORS._main_accent : c_white, 1);

View file

@ -39,7 +39,7 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
bx += bs + ui(4);
var jun = inputs[| 2];
var index = jun.value_from == noone? jun.is_anim : 2;
var index = jun.isLeaf()? jun.is_anim : 2;
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover,, THEME.animate_clock, index, index == 2? COLORS._main_accent : COLORS._main_icon) == 2)
jun.setAnim(!jun.is_anim);

View file

@ -40,7 +40,7 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct
outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []);
outputs[| 1] = nodeValue("Bool", self, JUNCTION_CONNECT.output, VALUE_TYPE.boolean, false);
static step = function() {
static step = function() { #region
var _mode = getInputData(5);
inputs[| 0].setVisible(_mode == 1, _mode == 1);
@ -49,9 +49,12 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct
inputs[| 6].setVisible(_mode == 0, _mode == 0);
inputs[| 7].setVisible(_mode == 2, _mode == 2);
inputs[| 8].setVisible(_mode == 2, _mode == 2);
}
inputs[| 3].setType(inputs[| 3].isLeaf()? VALUE_TYPE.any : inputs[| 3].value_from.type);
inputs[| 4].setType(inputs[| 4].isLeaf()? VALUE_TYPE.any : inputs[| 4].value_from.type);
} #endregion
static update = function(frame = CURRENT_FRAME) {
static update = function(frame = CURRENT_FRAME) { #region
var _true = getInputData(3);
var _fals = getInputData(4);
@ -64,9 +67,6 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct
var _txt1 = getInputData(7);
var _txt2 = getInputData(8);
inputs[| 3].setType(inputs[| 3].value_from == noone? VALUE_TYPE.any : inputs[| 3].value_from.type);
inputs[| 4].setType(inputs[| 4].value_from == noone? VALUE_TYPE.any : inputs[| 4].value_from.type);
var res = false;
switch(_mode) {
@ -95,9 +95,9 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct
}
outputs[| 1].setValue(res);
}
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var val = outputs[| 1].getValue();
var frm = val? inputs[| 3] : inputs[| 4];
var to = outputs[| 0];
@ -107,5 +107,5 @@ function Node_Condition(_x, _y, _group = noone) : Node(_x, _y, _group) construct
draw_set_alpha(0.5);
draw_line_width(frm.x, frm.y, to.x, to.y, _s * 4);
draw_set_alpha(1);
}
} #endregion
}

View file

@ -284,8 +284,14 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
var _hi = ui(junction_draw_pad_y);
var _ho = ui(junction_draw_pad_y);
for( var i = 0; i < ds_list_size(inputs); i++ )
if(inputs[| i].isVisible()) _hi += 24;
for( var i = 0; i < ds_list_size(inputs); i++ ) {
var _inp = inputs[| i];
if(is_instanceof(_inp, NodeValue) && _inp.isVisible()) _hi += 24;
if(is_instanceof(_inp, NodeModule)) {
for( var j = 0, m = ds_list_size(_inp.inputs); j < m; j++ )
if(_inp.inputs[| j].isVisible()) _hi += 24;
}
}
for( var i = 0; i < ds_list_size(outputs); i++ )
if(outputs[| i].isVisible()) _ho += 24;
@ -364,8 +370,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
return noone;
} #endregion
static getInput = function(junc = noone) { #region
for( var i = 0; i < ds_list_size(inputs); i++ ) {
static getInput = function(junc = noone, shift = input_fix_len) { #region
for( var i = shift; i < ds_list_size(inputs); i++ ) {
if(!inputs[| i].visible) continue;
if(inputs[| i].value_from != noone) continue;
if(junc != noone && !inputs[| i].isConnectable(junc, true)) continue;
@ -379,8 +385,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
return display_name == ""? name : "[" + name + "] " + display_name;
} #endregion
static addInput = function(junctionFrom) { #region
var targ = getInput(junctionFrom);
static addInput = function(junctionFrom, shift = input_fix_len) { #region
var targ = getInput(junctionFrom, shift);
if(targ == noone) return;
targ.setFrom(junctionFrom);
@ -450,13 +456,16 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
static _triggerCheck = function() { #region
for( var i = 0; i < ds_list_size(inputs); i++ ) {
if(inputs[| i].type != VALUE_TYPE.trigger) continue;
if(!is_instanceof(inputs[| i].editWidget, buttonClass)) continue;
var _in = inputs[| i];
if(!is_instanceof(_in, NodeValue)) continue;
var trig = inputs[| i].getValue();
if(trig && !inputs[| i].display_data.output) {
inputs[| i].editWidget.onClick();
inputs[| i].setValue(false);
if(_in.type != VALUE_TYPE.trigger) continue;
if(!is_instanceof(_in.editWidget, buttonClass)) continue;
var trig = _in.getValue();
if(trig && !_in.display_data.output) {
_in.editWidget.onClick();
_in.setValue(false);
}
}
@ -615,27 +624,23 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
if(_clearCache) clearInputCache();
} #endregion
static isLeaf = function() { #region
for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) {
var _inp = inputs[| i];
if(!_inp.isLeaf()) return false;
}
return true;
} #endregion
static isRenderActive = function() { return renderActive || (PREF_MAP[? "render_all_export"] && PROJECT.animator.rendering); }
static isRenderable = function(log = false) { #region //Check if every input is ready (updated)
if(!active) return false;
if(!isRenderActive()) return false;
//if(group && struct_has(group, "iterationStatus") && group.iterationStatus() == ITERATION_STATUS.complete) return false;
for(var j = 0; j < ds_list_size(inputs); j++) {
var _in = inputs[| j];
if( _in.type == VALUE_TYPE.node) continue;
var val_from = _in.value_from;
if( val_from == noone) continue;
if(!val_from.node.active) continue;
if(!val_from.node.isRenderActive()) continue;
if(!val_from.node.rendered) {
LOG_LINE_IF(global.FLAG.render == 1, $"Node {INAME} is not renderable because input {val_from.node.internalName} is not rendered ({val_from.node.rendered})");
return false;
}
}
for(var j = 0; j < ds_list_size(inputs); j++)
if(!inputs[| j].isRendered()) return false;
return true;
} #endregion
@ -990,23 +995,24 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
else if(i == -2) jun = inspectInput2;
else jun = inputs[| i];
if(jun.value_from == noone) continue;
if(is_instanceof(jun, NodeModule)) {
jun.drawConnections(params, _inputs);
continue;
}
if(jun.isLeaf()) continue;
if(!jun.value_from.node.active) continue;
if(!jun.isVisible()) continue;
if(i >= 0)
array_push(_inputs, jun);
if(i >= 0) array_push(_inputs, jun);
}
var len = array_length(_inputs);
for( var i = 0; i < len; i++ )
_inputs[i].drawLineIndex = 1 + (i > len / 2? (len - 1 - i) : i) * 0.5;
for(var i = st; i < ds_list_size(inputs); i++) {
var jun;
if(i == -1) jun = inspectInput1;
else if(i == -2) jun = inspectInput2;
else jun = inputs[| i];
for( var i = 0, n = array_length(_inputs); i < n; i++ ) {
var jun = _inputs[i];
var hov = jun.drawConnections(params);
if(hov) hovering = hov;
@ -1212,7 +1218,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
if(branch_drawing) return;
branch_drawing = true;
for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) {
if(inputs[| i].value_from == noone) continue;
if(inputs[| i].isLeaf()) continue;
inputs[| i].value_from.node.drawBranch();
}
} #endregion
@ -1250,7 +1256,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
for(var j = 0; j < ds_list_size(jun.value_to); j++) {
var _vt = jun.value_to[| j];
if(_vt.value_from == noone) break;
if(_vt.isLeaf()) break;
if(_vt.value_from.node != self) break;
_vt.removeFrom(false);
@ -1258,7 +1264,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
if(!_merge) continue;
for( var k = 0; k < ds_list_size(inputs); k++ ) {
if(inputs[| k].value_from == noone) continue;
if(inputs[| k].isLeaf()) continue;
if(_vt.setFrom(inputs[| k].value_from)) break;
}
}
@ -1394,7 +1400,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
for(var i = 0; i < ds_list_size(inputs); i++) {
var _in = inputs[| i];
if(_in.value_from == noone) continue;
if(_in.isLeaf()) continue;
if(_in.value_from.node.group == group) continue;
var input_node = noone;
@ -1472,7 +1478,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) {
var _inp = inputs[| i];
if(_inp.is_anim && _inp.value_from == noone) {
if(_inp.is_anim && _inp.isLeaf()) {
_cur_anim = true;
break;
}

View file

@ -99,7 +99,7 @@ function dynaSurf_output_getNextNode() { #region
var _to = junc.value_to[| j];
if(!_to.node.isRenderActive()) continue;
if(!_to.node.active || _to.value_from == noone)
if(!_to.node.active || _to.isLeaf())
continue;
if(_to.value_from.node != group)
continue;

View file

@ -12,7 +12,7 @@ function Node_Feedback_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y
cache_value = -1;
static update = function(frame = CURRENT_FRAME) {
if(inputs[| 0].value_from == noone) return;
if(inputs[| 0].isLeaf()) return;
if(CURRENT_FRAME == TOTAL_FRAMES - 1) {
cache_value = noone;
return;

View file

@ -45,7 +45,7 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
if(!_to.node.isRenderActive()) continue;
//printIf(global.FLAG.render, "Value to " + _to.name);
if(!_to.node.active || _to.value_from == noone) {
if(!_to.node.active || _to.isLeaf()) {
//printIf(global.FLAG.render, "no value from");
continue;
}

View file

@ -26,7 +26,7 @@ function Node_Iterate_Each(_x, _y, _group = noone) : Node_Iterator(_x, _y, _grou
}
static onStep = function() {
var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type;
var type = inputs[| 0].isLeaf()? VALUE_TYPE.any : inputs[| 0].value_from.type;
inputs[| 0].setType(type);
}

View file

@ -28,7 +28,7 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Iterator(_x, _y, _gr
}
static onStep = function() {
var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type;
var type = inputs[| 0].isLeaf()? VALUE_TYPE.any : inputs[| 0].value_from.type;
inputs[| 0].setType(type);
}

View file

@ -36,7 +36,7 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr
static getNextNodes = function() { return getNextNodesExternal(); }
static onStep = function() { #region
var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type;
var type = inputs[| 0].isLeaf()? VALUE_TYPE.any : inputs[| 0].value_from.type;
inputs[| 0].setType(type);
} #endregion

View file

@ -18,14 +18,14 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group
static step = function() {
if(!variable_struct_exists(group, "iterated")) return;
var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type;
var type = inputs[| 0].isLeaf()? VALUE_TYPE.any : inputs[| 0].value_from.type;
inputs[| 0].setType(type);
group.outputs[| 0].setType(type);
outputs[| 0].setType(type);
}
static cloneValue = function(_prev_val, _val) {
if(inputs[| 0].value_from == noone) return _prev_val;
if(inputs[| 0].isLeaf()) return _prev_val;
var is_surf = inputs[| 0].value_from.type == VALUE_TYPE.surface;
var _new_val = [];
@ -38,7 +38,7 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group
}
static update = function(frame = CURRENT_FRAME) {
if(inputs[| 0].value_from == noone) {
if(inputs[| 0].isLeaf()) {
group.iterationUpdate();
return;
}

View file

@ -18,13 +18,13 @@ function Node_Iterator_Filter_Output(_x, _y, _group = noone) : Node(_x, _y, _gro
static step = function() {
if(!variable_struct_exists(group, "iterated")) return;
var type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type;
var type = inputs[| 0].isLeaf()? VALUE_TYPE.any : inputs[| 0].value_from.type;
inputs[| 0].setType(type);
group.outputs[| 0].setType(type);
}
static update = function(frame = CURRENT_FRAME) {
if(inputs[| 0].value_from == noone) {
if(inputs[| 0].isLeaf()) {
group.iterationUpdate();
return;
}

View file

@ -8,7 +8,7 @@ function Node_Iterator_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y
inputs[| 0].setFrom_condition = function(_valueFrom) {
if(instanceof(_valueFrom.node) != "Node_Iterator_Input") return true;
if(inputs[| 1].value_from == noone) return true;
if(inputs[| 1].isLeaf()) return true;
if(inputs[| 1].value_from.node == _valueFrom.node) {
noti_warning("setFrom: Immediate cycle disallowed",, self);
return false;
@ -22,7 +22,7 @@ function Node_Iterator_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y
inputs[| 1].setFrom_condition = function(_valueFrom) {
if(instanceof(_valueFrom.node) != "Node_Iterator_Input") return true;
if(inputs[| 0].value_from == noone) return true;
if(inputs[| 0].isLeaf()) return true;
if(inputs[| 0].value_from.node == _valueFrom.node) {
noti_warning("setFrom: Immediate cycle disallowed",, self);
return false;
@ -42,7 +42,7 @@ function Node_Iterator_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y
}
static cloneValue = function(_prev_val, _val) {
if(inputs[| 0].value_from == noone) return _prev_val;
if(inputs[| 0].isLeaf()) return _prev_val;
var is_surf = inputs[| 0].value_from.type == VALUE_TYPE.surface;
var _new_val;
@ -54,7 +54,7 @@ function Node_Iterator_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y
}
static update = function(frame = CURRENT_FRAME) {
if(inputs[| 0].value_from == noone) {
if(inputs[| 0].isLeaf()) {
group.iterationUpdate();
return;
}

View file

@ -86,7 +86,7 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con
var cont = {};
if(inputs[| 1].value_from == noone) {
if(inputs[| 1].isLeaf()) {
for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) {
var _key = getInputData(i + 0);
var _val = getInputData(i + 1);
@ -104,7 +104,7 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con
static step = function() {
for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
var inp = inputs[| i + 1];
var typ = inp.value_from == noone? VALUE_TYPE.any : inp.value_from.type;
var typ = inp.isLeaf()? VALUE_TYPE.any : inp.value_from.type;
inp.setType(typ);
}
}

View file

@ -80,7 +80,7 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
}
static getState = function() {
if(inputs[| 3].value_from == noone)
if(inputs[| 3].isLeaf())
return lua_state;
return inputs[| 3].value_from.node.getState();
}

View file

@ -46,7 +46,7 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc
}
static getState = function() {
if(inputs[| 2].value_from == noone) return lua_state;
if(inputs[| 2].isLeaf()) return lua_state;
return inputs[| 2].value_from.node.getState();
}

View file

@ -74,7 +74,7 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
}
static getState = function() {
if(inputs[| 3].value_from == noone)
if(inputs[| 3].isLeaf())
return lua_state;
return inputs[| 3].value_from.node.getState();
}

View file

@ -11,7 +11,7 @@ function Node_Module_Test(_x, _y, _group = noone) : Node(_x, _y, _group) constru
outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
input_display_list = [ 0 ];
//input_display_list = [ 0 ];
setIsDynamicInput(1);

View file

@ -59,7 +59,7 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
inputs[| 4].setVisible(false);
break;
case 1 :
if(inputs[| 0].value_from == noone) {
if(inputs[| 0].isLeaf()) {
w = 160;
min_h = 96;
}
@ -67,7 +67,7 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
inputs[| 4].setVisible(true);
break;
case 2 :
if(inputs[| 0].value_from == noone) {
if(inputs[| 0].isLeaf()) {
w = 128;
min_h = 128;
}
@ -332,7 +332,7 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
w = 96;
min_h = 80;
if(disp == 1 && inputs[| 0].value_from == noone && inputs[| 1].value_from == noone) {
if(disp == 1 && inputs[| 0].isLeaf() && inputs[| 1].isLeaf()) {
w = 160;
min_h = 160;
}
@ -616,7 +616,7 @@ function Node_Vector_Split(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
outputs[| 3] = nodeValue("w", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
static step = function() { #region
if(inputs[| 0].value_from == noone) return;
if(inputs[| 0].isLeaf()) return;
var type = VALUE_TYPE.float;
if(inputs[| 0].value_from.type == VALUE_TYPE.integer)
type = VALUE_TYPE.integer;

View file

@ -3,16 +3,16 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
w = 32;
h = 32;
auto_height = false;
auto_height = false;
junction_shift_y = 16;
previewable = false;
previewable = false;
isHovering = false;
hover_scale = 0;
isHovering = false;
hover_scale = 0;
hover_scale_to = 0;
hover_alpha = 0;
hover_alpha = 0;
bg_spr = THEME.node_pin_bg;
bg_spr = THEME.node_pin_bg;
bg_sel_spr = THEME.node_pin_bg_active;
inputs[| 0] = nodeValue("In", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 )
@ -20,25 +20,29 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
outputs[| 0] = nodeValue("Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0);
static step = function() {
if(inputs[| 0].value_from == noone) return;
static step = function() { #region
if(inputs[| 0].isLeaf()) return;
inputs[| 0].setType(inputs[| 0].value_from.type);
outputs[| 0].setType(inputs[| 0].value_from.type);
outputs[| 0].value_from = inputs[| 0].value_from;
inputs[| 0].color_display = inputs[| 0].value_from.color_display;
outputs[| 0].color_display = inputs[| 0].color_display;
}
} #endregion
static pointIn = function(_x, _y, _mx, _my, _s) {
static update = function() { #region
var _val = getInputData(0);
outputs[| 0].setValue(_val);
} #endregion
static pointIn = function(_x, _y, _mx, _my, _s) { #region
var xx = x * _s + _x;
var yy = y * _s + _y;
return point_in_circle(_mx, _my, xx, yy, _s * 24);
}
} #endregion
static preDraw = function(_x, _y, _s) {
static preDraw = function(_x, _y, _s) { #region
var xx = x * _s + _x;
var yy = y * _s + _y;
@ -47,11 +51,11 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
outputs[| 0].x = xx;
outputs[| 0].y = yy;
}
} #endregion
static drawJunctionNames = function(_x, _y, _mx, _my, _s) {}
static drawJunctions = function(_x, _y, _mx, _my, _s) {
static drawJunctions = function(_x, _y, _mx, _my, _s) { #region
isHovering = false;
var hover = noone;
var xx = x * _s + _x;
@ -67,9 +71,9 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
hover = outputs[| 0];
return hover;
}
} #endregion
static drawNode = function(_x, _y, _mx, _my, _s) {
static drawNode = function(_x, _y, _mx, _my, _s) { #region
if(group != PANEL_GRAPH.getCurrentContext()) return;
var xx = x * _s + _x;
@ -98,5 +102,5 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
}
return drawJunctions(_x, _y, _mx, _my, _s);
}
} #endregion
}

View file

@ -31,7 +31,7 @@ function Node_Sequence_Anim(_x, _y, _group = noone) : Node(_x, _y, _group) const
_ord[i] = i;
}
if(_hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h) && inputs[| 2].value_from == noone) {
if(_hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h) && inputs[| 2].isLeaf()) {
draw_sprite_stretched(THEME.button, mouse_click(mb_left, _focus)? 2 : 1, _x, _y, _w, _h);
if(mouse_press(mb_left, _focus))
dialogPanelCall(new Panel_Array_Sequence(self));

View file

@ -58,7 +58,7 @@ function Node_Strand_Render_Texture(_x, _y, _group = noone) : Node(_x, _y, _grou
return;
if(!is_array(_str))
_str = [ _str ];
if(inputs[| 4].value_from == noone)
if(inputs[| 4].isLeaf())
return;
if(!is_array(_tex)) _tex = [ _tex ];

View file

@ -56,7 +56,7 @@ function Node_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
static step = function() {
for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
var inp = inputs[| i + 1];
var typ = inp.value_from == noone? VALUE_TYPE.any : inp.value_from.type;
var typ = inp.isLeaf()? VALUE_TYPE.any : inp.value_from.type;
inp.setType(typ);
}
}

View file

@ -4,7 +4,6 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
w = 96;
inputs[| 0] = nodeValue("Index", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" )
.setVisible(true, true)
.rejectArray();
@ -12,16 +11,16 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| 1] = nodeValue("Default value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 )
.setVisible(false, true);
static createNewInput = function() {
static createNewInput = function() { #region
var index = ds_list_size(inputs);
inputs[| index + 0] = nodeValue("Case", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" );
inputs[| index + 1] = nodeValue("value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 )
.setVisible(false, true);
.setVisible(false, false);
array_push(input_display_list, index + 0);
array_push(input_display_list, index + 1);
}
} #endregion
outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0);
@ -33,7 +32,7 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
if(!LOADING && !APPENDING) createNewInput();
static refreshDynamicInput = function() {
static refreshDynamicInput = function() { #region
var _in = ds_list_create();
for( var i = 0; i < input_fix_len; i++ )
@ -45,6 +44,7 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
if(getInputData(i) != "") {
ds_list_add(_in, inputs[| i + 0]);
ds_list_add(_in, inputs[| i + 1]);
inputs[| i + 1].setVisible(false, true);
array_push(input_display_list, i + 0);
array_push(input_display_list, i + 1);
@ -61,9 +61,9 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs = _in;
createNewInput();
}
} #endregion
static onValueFromUpdate = function(index) {
static onValueFromUpdate = function(index) { #region
if(LOADING || APPENDING) return;
inputs[| 1].setType(inputs[| 1].value_from? inputs[| 1].value_from.type : VALUE_TYPE.any);
@ -73,9 +73,9 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
if(inputs[| i + 1].value_from != noone)
inputs[| i + 1].setType(inputs[| i + 1].value_from.type);
}
}
} #endregion
static onValueUpdate = function(index = 0) {
static onValueUpdate = function(index = 0) { #region
if(index < input_fix_len) return;
if(LOADING || APPENDING) return;
@ -83,9 +83,18 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| index + 1].name = getInputData(index) + " value";
refreshDynamicInput();
}
} #endregion
static update = function(frame = CURRENT_FRAME) {
static step = function() { #region
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
var _inp = inputs[| i + 1];
if(_inp.isLeaf()) continue;
_inp.setType(_inp.value_from.type);
}
} #endregion
static update = function(frame = CURRENT_FRAME) { #region
var sele = getInputData(0);
var _res = getInputData(1);
@ -102,9 +111,9 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
}
outputs[| 0].setValue(_res);
}
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var frm = inputs[| 1];
var sele = getInputData(0);
var _res = getInputData(1);
@ -121,9 +130,7 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
draw_set_alpha(0.5);
draw_line_width(frm.x, frm.y, to.x, to.y, _s * 4);
draw_set_alpha(1);
}
} #endregion
static doApplyDeserialize = function() {
refreshDynamicInput();
}
static doApplyDeserialize = function() { refreshDynamicInput(); }
}

View file

@ -501,7 +501,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
}
#region path
if(inputs[| 2].is_anim && inputs[| 2].value_from == noone && !inputs[| 2].sep_axis) {
if(inputs[| 2].is_anim && inputs[| 2].isLeaf() && !inputs[| 2].sep_axis) {
var posInp = inputs[| 2];
var allPos = posInp.animator.values;
var ox, oy, nx, ny;

View file

@ -16,12 +16,12 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
insp2UpdateTooltip = "Create tunnel out";
insp2UpdateIcon = [ THEME.tunnel, 0, c_white ];
static onInspector2Update = function() {
static onInspector2Update = function() { #region
var _node = nodeBuild("Node_Tunnel_Out", x + 128, y);
_node.inputs[| 0].setValue(getInputData(0));
}
} #endregion
static onDrawNodeBehind = function(_x, _y, _mx, _my, _s) {
static onDrawNodeBehind = function(_x, _y, _mx, _my, _s) { #region
var xx = _x + x * _s;
var yy = _y + y * _s;
@ -50,17 +50,17 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
k = ds_map_find_next(TUNNELS_OUT, k);
}
}
} #endregion
static update = function(frame = CURRENT_FRAME) { onValueUpdate(); }
static resetMap = function() {
static resetMap = function() { #region
var _key = getInputData(0);
TUNNELS_IN_MAP[? node_id] = _key;
TUNNELS_IN[? _key] = inputs[| 1];
}
} #endregion
static checkDuplicate = function() {
static checkDuplicate = function() { #region
var _key = getInputData(0);
var amo = ds_map_size(TUNNELS_IN_MAP);
var k = ds_map_find_first(TUNNELS_IN_MAP);
@ -80,9 +80,9 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
noti_remove(error_notification);
error_notification = noone;
}
}
} #endregion
static onValueUpdate = function(index = -1) {
static onValueUpdate = function(index = -1) { #region
var _key = getInputData(0);
resetMap();
@ -102,23 +102,23 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
}
if(index == 0) { RENDER_ALL_REORDER }
}
} #endregion
static step = function() {
static step = function() { #region
var _key = getInputData(0);
value_validation[VALIDATION.error] = error_notification != noone;
if(inputs[| 1].value_from == noone) {
if(inputs[| 1].isLeaf()) {
inputs[| 1].setType(VALUE_TYPE.any);
inputs[| 1].display_type = VALUE_DISPLAY._default;
} else {
inputs[| 1].setType(inputs[| 1].value_from.type);
inputs[| 1].display_type = inputs[| 1].value_from.display_type;
}
}
} #endregion
static getNextNodes = function() {
static getNextNodes = function() { #region
var nodes = [];
var nodeNames = [];
var _key = getInputData(0);
@ -143,23 +143,23 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
LOG_BLOCK_END();
LOG_BLOCK_END();
return nodes;
}
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text);
var str = string(getInputData(0));
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);
}
} #endregion
static onClone = function() { onValueUpdate(0); }
static postConnect = function() { onValueUpdate(0); }
static onDestroy = function() {
static onDestroy = function() { #region
if(error_notification != noone)
noti_remove(error_notification);
}
} #endregion
}

View file

@ -13,22 +13,22 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc
insp2UpdateTooltip = "Goto tunnel in";
insp2UpdateIcon = [ THEME.tunnel, 1, c_white ];
static onInspector2Update = function() {
static onInspector2Update = function() { #region
var _key = getInputData(0);
if(!ds_map_exists(TUNNELS_IN, _key)) return;
var _node = TUNNELS_IN[? _key].node;
graphFocusNode(_node);
}
} #endregion
static isRenderable = function() {
static isRenderable = function() { #region
var _key = getInputData(0);
if(!ds_map_exists(TUNNELS_IN, _key)) return false;
return TUNNELS_IN[? _key].node.rendered;
}
} #endregion
static onDrawNodeBehind = function(_x, _y, _mx, _my, _s) {
static onDrawNodeBehind = function(_x, _y, _mx, _my, _s) { #region
var xx = _x + x * _s;
var yy = _y + y * _s;
@ -51,17 +51,17 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc
var toy = yy + h * _s / 2;
draw_line_dashed(frx, fry, tox, toy, 8 * _s, 16 * _s, current_time / 10);
draw_set_alpha(1);
}
} #endregion
static onValueUpdate = function(index = -1) {
static onValueUpdate = function(index = -1) { #region
var _key = getInputData(0);
TUNNELS_OUT[? node_id] = _key;
if(index == 0) { RENDER_ALL_REORDER }
}
} #endregion
static step = function() {
static step = function() { #region
var _key = getInputData(0);
if(ds_map_exists(TUNNELS_IN, _key)) {
outputs[| 0].setType(TUNNELS_IN[? _key].type);
@ -70,23 +70,23 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc
outputs[| 0].setType(VALUE_TYPE.any);
outputs[| 0].display_type = VALUE_DISPLAY._default;
}
}
} #endregion
static update = function(frame = CURRENT_FRAME) {
static update = function(frame = CURRENT_FRAME) { #region
var _key = getInputData(0);
if(ds_map_exists(TUNNELS_IN, _key))
outputs[| 0].setValue(TUNNELS_IN[? _key].getValue());
}
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text);
var str = string(getInputData(0));
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);
}
} #endregion
static onClone = function() { onValueUpdate(0); }

View file

@ -1793,6 +1793,18 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return true;
} #endregion
static isLeaf = function() { gml_pragma("forceinline"); return value_from == noone; }
static isRendered = function() { #region
if(type == VALUE_TYPE.node) return true;
if( value_from == noone) return true;
if(!value_from.node.active) return true;
if(!value_from.node.isRenderActive()) return true;
return value_from.node.rendered;
} #endregion
static setFrom = function(_valueFrom, _update = true, checkRecur = true, log = false) { #region
//print($"Connecting {_valueFrom.name} to {name}");
@ -1899,7 +1911,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} #endregion
static checkConnection = function(_remove_list = true) { #region
if(value_from == noone) return;
if(isLeaf()) return;
if(value_from.node.active) return;
removeFrom(_remove_list);
@ -1932,23 +1944,23 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var _angle = argument_count > 8? argument[ 8] : 0;
var _scale = argument_count > 9? argument[ 9] : 1;
var _spr = argument_count > 10? argument[10] : THEME.anchor_selector;
return preview_overlay_scalar(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _angle, _scale, _spr);
return preview_overlay_scalar(isLeaf(), active, _x, _y, _s, _mx, _my, _snx, _sny, _angle, _scale, _spr);
case VALUE_DISPLAY.rotation :
var _rad = argument_count > 8? argument[ 8] : 64;
return preview_overlay_rotation(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _rad);
return preview_overlay_rotation(isLeaf(), active, _x, _y, _s, _mx, _my, _snx, _sny, _rad);
case VALUE_DISPLAY.vector :
var _spr = argument_count > 8? argument[8] : THEME.anchor_selector;
var _sca = argument_count > 9? argument[9] : 1;
return preview_overlay_vector(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _spr);
return preview_overlay_vector(isLeaf(), active, _x, _y, _s, _mx, _my, _snx, _sny, _spr);
case VALUE_DISPLAY.area :
var _flag = argument_count > 8? argument[8] : 0b0011;
return preview_overlay_area(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _flag, struct_try_get(display_data, "onSurfaceSize"));
return preview_overlay_area(isLeaf(), active, _x, _y, _s, _mx, _my, _snx, _sny, _flag, struct_try_get(display_data, "onSurfaceSize"));
case VALUE_DISPLAY.puppet_control :
return preview_overlay_puppet(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny);
return preview_overlay_puppet(isLeaf(), active, _x, _y, _s, _mx, _my, _snx, _sny);
}
return -1;
@ -2029,7 +2041,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} #endregion
static drawConnections = function(params = {}) { #region
if(value_from == noone) return noone;
if(isLeaf()) return noone;
if(!value_from.node.active) return noone;
if(!isVisible()) return noone;
@ -2313,7 +2325,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
for(var j = 0; j < ds_list_size(value_to); j++) {
var _to = value_to[| j];
if(!_to.node.active || _to.value_from == noone) continue;
if(!_to.node.active || _to.isLeaf()) continue;
if(_to.value_from != self) continue;
array_push(to, _to);

View file

@ -44,6 +44,7 @@
str = string(str);
show_debug_message("STATUS: " + str);
if(PANEL_MAIN == 0) return;
if(flash && PANEL_MENU) {
PANEL_MENU.noti_flash = 1;
@ -70,6 +71,7 @@
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) {
PANEL_MENU.noti_flash = 1;
@ -99,6 +101,7 @@
function noti_error(str, icon = noone, ref = noone) {
if(TEST_ERROR) return {};
show_debug_message("ERROR: " + str);
if(PANEL_MAIN == 0) print(str);
var noti = new notification(NOTI_TYPE.error, str, icon, c_ui_red);
ds_list_add(STATUSES, noti);

View file

@ -494,7 +494,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
for( var j = 0, m = ds_list_size(_node.inputs); j < m; j++ ) {
var _input = _node.inputs[| j];
if(_input.value_from == noone) continue;
if(_input.isLeaf()) continue;
if(!ds_exists(_input.value_from.node, nodes_select_list)) continue;
_input.color = color;
@ -1165,7 +1165,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var _mx = mx;
var _my = my;
var target = noone;
var _addInput = false;
if(value_focus && value_focus != value_dragging && value_focus.connect_type != value_dragging.connect_type)
target = value_focus;
@ -1182,9 +1181,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
}
}
if(target != noone && target.value_from == noone && target.connect_type == JUNCTION_CONNECT.input && target.node.auto_input)
_addInput = true;
var _mmx = target != noone? target.x : _mx;
var _mmy = target != noone? target.y : _my;
@ -1192,11 +1188,14 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
connection_draw_target = target;
value_dragging.drawJunction(graph_s, value_dragging.x, value_dragging.y);
if(target)
target.drawJunction(graph_s, target.x, target.y);
if(target) target.drawJunction(graph_s, target.x, target.y);
if(mouse_release(mb_left)) { // CONNECT junction
if(target != noone) {
var _addInput = false;
if(target.isLeaf() && target.connect_type == JUNCTION_CONNECT.input && target.node.auto_input)
_addInput = true;
if(value_dragging.connect_type == JUNCTION_CONNECT.input) {
if(array_empty(value_draggings))
value_dragging.setFrom(target);
@ -1204,16 +1203,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
for( var i = 0, n = array_length(value_draggings); i < n; i++ )
value_draggings[i].setFrom(target);
}
} else if(!_addInput) {
} else if(_addInput && !array_empty(value_draggings)) {
for( var i = 0, n = array_length(value_draggings); i < n; i++ )
target.node.addInput(value_draggings[i]);
} else
target.setFrom(value_dragging);
} else { //addInput
if(array_empty(value_draggings))
target.node.addInput(value_dragging);
else {
for( var i = 0, n = array_length(value_draggings); i < n; i++ )
target.node.addInput(value_draggings[i]);
}
}
} else {
if(value_dragging.connect_type == JUNCTION_CONNECT.input)
value_dragging.removeFrom();
@ -2060,7 +2054,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
break;
}
if(!key_mod_press(SHIFT) && node && struct_has(DRAGGING, "from") && DRAGGING.from.value_from == noone) {
if(!key_mod_press(SHIFT) && node && struct_has(DRAGGING, "from") && DRAGGING.from.isLeaf()) {
for( var i = 0; i < ds_list_size(node.outputs); i++ )
if(DRAGGING.from.setFrom(node.outputs[| i])) break;
}

View file

@ -115,7 +115,7 @@ function __sortGraph(_list, _nodeList) { #region
for( var i = 0, n = ds_list_size(_node.inputs); i < n; i++ ) {
var _in = _node.inputs[| i];
if(_in.value_from == noone) continue;
if(_in.isLeaf()) continue;
if(_in.value_from.node.topoSorted) continue;
array_push(_childs, _in.value_from.node);

View file

@ -1,3 +1,13 @@
function scrollItem(name, spr = noone) constructor {
self.name = name;
self.data = name;
self.spr = spr;
self.spr_ind = 0;
self.spr_blend = c_white;
tooltip = "";
}
function scrollBox(_data, _onModify, update_hover = true) : widget() constructor {
onModify = _onModify;
data_list = _data;
@ -46,7 +56,9 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor
else data = data_list;
if(is_array(_val)) return 0;
var _text = is_string(_val)? _val : array_safe_get(data, _val);
if(is_real(_val)) _val = array_safe_get(data, _val);
var _text = is_instanceof(_val, scrollItem)? _val.name : _val;
curr_text = _text;
w = _w;
@ -84,15 +96,16 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor
}
var _arw = sprite_get_width(arrow_spr) + ui(8);
var _spr = is_instanceof(_val, scrollItem) && _val.spr;
draw_set_text(font, align, fa_center, COLORS._main_text);
draw_set_alpha(0.5 + 0.5 * interactable);
if(align == fa_center)
draw_text(_x + (w - _arw) / 2, _y + _h / 2 - ui(2), _text);
else if(align == fa_left)
draw_text(_x + ui(8), _y + _h / 2 - ui(2), _text);
if(align == fa_center) draw_text(_x + (w - _arw) / 2, _y + _h / 2 - ui(2), _text);
else if(align == fa_left) draw_text(_x + ui(8) + _spr * _h, _y + _h / 2 - ui(2), _text);
draw_set_alpha(1);
if(_spr) draw_sprite_ext(_val.spr, 0, _x + ui(8) + _h / 2, _y + _h / 2, 1, 1, 0, _val.spr_blend, 1);
draw_sprite_ui_uniform(arrow_spr, arrow_ind, _x + w - _arw / 2, _y + _h / 2, 1, COLORS._main_icon, 0.5 + 0.5 * interactable);
if(WIDGET_CURRENT == self)

View file

@ -54,11 +54,20 @@ function __getGraphicList() {
function loadGraphic(theme = "default") {
var sprDef = __getGraphicList();
var path = _sprite_path("./graphics.json", theme);
var _metaP = $"{DIRECTORY}Themes/{theme}/meta.json";
if(!file_exists(_metaP))
noti_warning("Loading theme made for older version.");
else {
var _meta = json_load_struct(_metaP);
if(_meta[$ "version"] < VERSION)
noti_warning("Loading theme made for older version.");
}
var path = _sprite_path("./graphics.json", theme);
print($"Loading theme {theme}");
if(!file_exists(path)) {
noti_status("Theme not defined at " + path + ", rollback to default theme.");
print("Theme not defined at " + path + ", rollback to default theme.");
return;
}
@ -70,8 +79,8 @@ function loadGraphic(theme = "default") {
for( var i = 0, n = array_length(graphics); i < n; i++ ) {
var key = graphics[i];
if(struct_has(THEME, key) && sprite_exists(THEME[$ key]))
sprite_delete(THEME[$ key]);
//if(struct_has(THEME, key) && sprite_exists(THEME[$ key]))
// sprite_delete(THEME[$ key]);
if(struct_has(sprStr, key)) {
str = sprStr[$ key];