diff --git a/objects/o_dialog_preference/Create_0.gml b/objects/o_dialog_preference/Create_0.gml index af5dced48..58dc761ed 100644 --- a/objects/o_dialog_preference/Create_0.gml +++ b/objects/o_dialog_preference/Create_0.gml @@ -468,7 +468,7 @@ event_inherited(); if(instanceof(_pref[2]) == "checkBox") params.halign = fa_center; - var th = _pref[2].drawParam(params); + var th = _pref[2].drawParam(params) ?? 0; yy += th + padd + ui(8); hh += th + padd + ui(8); @@ -547,7 +547,7 @@ event_inherited(); var widget_y = yy + hh - ui(4); var params = new widgetParam(widget_x, widget_y, widget_w, widget_h, val, {}, _m, sp_hotkey.x, sp_hotkey.y); - var th = _pref[2].drawParam(params); + var th = _pref[2].drawParam(params) ?? 0; hh += th + padd + ui(8); ind++; diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 3af813834..a7c47e8ec 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -101,9 +101,9 @@ globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER; - VERSION = 11510; + VERSION = 11501; SAVE_VERSION = 11500; - VERSION_STRING = "1.15.1"; + VERSION_STRING = "1.15.0.1"; BUILD_NUMBER = 11501; globalvar APPEND_MAP; diff --git a/scripts/nodeValue_drawer/nodeValue_drawer.gml b/scripts/nodeValue_drawer/nodeValue_drawer.gml index 46fc64e9d..3d1fc3f35 100644 --- a/scripts/nodeValue_drawer/nodeValue_drawer.gml +++ b/scripts/nodeValue_drawer/nodeValue_drawer.gml @@ -239,7 +239,8 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc break; } - widH = jun.editWidget.drawParam(param) - (TEXTBOX_HEIGHT * !lineBreak); + var _widH = jun.editWidget.drawParam(param) ?? 0; + widH = _widH - (TEXTBOX_HEIGHT * !lineBreak); } else if(jun.display_type == VALUE_DISPLAY.label) { draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub); diff --git a/scripts/node_composite/node_composite.gml b/scripts/node_composite/node_composite.gml index 6785202ba..c275dfe7a 100644 --- a/scripts/node_composite/node_composite.gml +++ b/scripts/node_composite/node_composite.gml @@ -300,7 +300,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var hover = noone; var amo = array_length(input_display_list); - var hov = PANEL_GRAPH._junction_hovering; + var hov = PANEL_GRAPH.value_focus; var ind = -1; if(hov != noone && struct_has(hov, "surface_index")) ind = hov.surface_index; @@ -365,7 +365,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) show_input_name = PANEL_GRAPH.pHOVER && point_in_rectangle(_mx, _my, xx - 8 * _s, yy + 20 * _s, xx + 8 * _s, yy + h * _s); show_output_name = PANEL_GRAPH.pHOVER && point_in_rectangle(_mx, _my, xx + (w - 8) * _s, yy + 20 * _s, xx + (w + 8) * _s, yy + h * _s); - var hov = PANEL_GRAPH._junction_hovering; + var hov = PANEL_GRAPH.value_focus; var ind = -1; if(hov != noone && struct_has(hov, "surface_index")) ind = hov.surface_index; @@ -414,7 +414,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var inamo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list); var _in = yy + ui(32) * _s; - var hov = PANEL_GRAPH._junction_hovering; + var hov = PANEL_GRAPH.value_focus; var ind = -1; if(hov != noone && struct_has(hov, "surface_index")) ind = hov.surface_index; diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 21a02b4be..8fd98c462 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -1685,7 +1685,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru else hover = distance_to_curve(mx, my, jx, jy, frx, fry, cx, cy, _s) < max(th * 2, 6); - if(PANEL_GRAPH._junction_hovering == noone) + if(PANEL_GRAPH.value_focus == noone) draw_line_shift_hover = hover; break; case 2 : @@ -1694,7 +1694,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru else hover = distance_to_elbow(mx, my, frx, fry, jx, jy, cx, cy, _s, value_from.drawLineIndex, drawLineIndex) < max(th * 2, 6); - if(PANEL_GRAPH._junction_hovering == noone) + if(PANEL_GRAPH.value_focus == noone) draw_line_shift_hover = hover; break; case 3 : @@ -1703,7 +1703,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru else hover = distance_to_elbow_diag(mx, my, frx, fry, jx, jy, cx, cy, _s, value_from.drawLineIndex, drawLineIndex) < max(th * 2, 6); - if(PANEL_GRAPH._junction_hovering == noone) + if(PANEL_GRAPH.value_focus == noone) draw_line_shift_hover = hover; break; } @@ -1713,7 +1713,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru var thicken = false; thicken |= PANEL_GRAPH.nodes_junction_d == self; - thicken |= _active && PANEL_GRAPH.junction_hovering == self && PANEL_GRAPH._junction_hovering == noone; + thicken |= _active && PANEL_GRAPH.junction_hovering == self && PANEL_GRAPH.value_focus == noone; thicken |= instance_exists(o_dialog_add_node) && o_dialog_add_node.junction_hovering == self; th *= thicken? 2 : 1; @@ -1769,6 +1769,67 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return hovering; } + static drawConnectionMouse = function(_mx, _my, ss, target) { + var drawCorner = type == VALUE_TYPE.action; + if(target != noone) { + _mx = target.x; + _my = target.y; + + drawCorner |= target.type == VALUE_TYPE.action; + } + + var corner = PREF_MAP[? "connection_line_corner"] * ss; + var th = PREF_MAP[? "connection_line_width"] * ss; + + var col = value_color(type); + draw_set_color(col); + + switch(PREF_MAP[? "curve_connection_line"]) { + case 0 : + draw_line_width(x, y, _mx, _my, th); + break; + case 1 : + if(drawCorner) { + if(type == VALUE_TYPE.action) + draw_line_curve_corner(_mx, _my, x, y, ss, th, col, col); + else + draw_line_curve_corner(x, y, _mx, _my, ss, th, col, col); + } else { + if(connect_type == JUNCTION_CONNECT.output) + draw_line_curve_color(_mx, _my, x, y,,, ss, th, col, col); + else + draw_line_curve_color(x, y, _mx, _my,,, ss, th, col, col); + } + break; + case 2 : + if(drawCorner) { + if(type == VALUE_TYPE.action) + draw_line_elbow_corner(_mx, _my, x, y, ss, th, col, col, corner); + else + draw_line_elbow_corner(x, y, _mx, _my, ss, th, col, col, corner); + } else { + if(connect_type == JUNCTION_CONNECT.output) + draw_line_elbow_color(x, y, _mx, _my,,, ss, th, col, col, corner); + else + draw_line_elbow_color(_mx, _my, x, y,,, ss, th, col, col, corner); + } + break; + case 3 : + if(drawCorner) { + if(type == VALUE_TYPE.action) + draw_line_elbow_diag_corner(_mx, _my, x, y, ss, th, col, col, corner); + else + draw_line_elbow_diag_corner(x, y, _mx, _my, ss, th, col, col, corner); + } else { + if(connect_type == JUNCTION_CONNECT.output) + draw_line_elbow_diag_color(x, y, _mx, _my,,, ss, th, col, col, corner); + else + draw_line_elbow_diag_color(_mx, _my, x, y,,, ss, th, col, col, corner); + } + break; + } + } + static isVisible = function() { if(!node.active) return false; diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 8d074f937..0d3d9834b 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -65,15 +65,15 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { node_focus = noone; junction_hovering = noone; - _junction_hovering = noone; add_node_draw_junc = false; add_node_draw_x_fix = 0; add_node_draw_y_fix = 0; add_node_draw_x = 0; add_node_draw_y = 0; - value_focus = noone; - value_dragging = noone; + value_focus = noone; + value_dragging = noone; + value_draggings = []; minimap_show = false; minimap_w = ui(160); @@ -520,7 +520,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { ds_list_add(nodes_select_list, node_hovering); } else { var _prevFocus = node_focus; - node_focus = node_hovering; + if(node_hovering != noone || value_focus == noone) + node_focus = node_hovering; if(node_focus) { if(instanceof(node_focus) == "Node_Frame") { @@ -561,7 +562,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { ds_list_clear(nodes_select_list); } } else { - ds_list_clear(nodes_select_list); + if(value_focus == noone) + ds_list_clear(nodes_select_list); if(DOUBLE_CLICK && !PANEL_INSPECTOR.locked) PANEL_INSPECTOR.inspecting = noone; @@ -794,7 +796,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { value_focus = val; } } - _junction_hovering = value_focus; for(var i = 0; i < ds_list_size(nodes_list); i++) nodes_list[| i].drawBadge(gr_x, gr_y, graph_s); @@ -809,40 +810,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(node_dragging) { node_focus = node_dragging; - // TODO: Mode node(s) into group. - //for(var i = 0; i < ds_list_size(nodes_list); i++) { //drag node to group - // var _node = nodes_list[| i]; - - // if(!_node.pointIn(gr_x, gr_y, mx, my, graph_s) || !variable_struct_exists(_node, "nodes")) - // continue; - - // var _recur = false; - // if(ds_list_size(nodes_select_list) == 0) { - // if(_node == node_dragging) _recur = true; - // } else { - // for(var j = 0; j < ds_list_size(nodes_select_list); j++) { - // var _n = nodes_select_list[| j]; - // if(_node == _n) _recur = true; - // } - // } - - // if(_recur) - // continue; - - // _node.drawActive(gr_x, gr_y, graph_s, 1); - // if(mouse_release(mb_left) && key_mod_press(ALT)) { - // if(ds_list_size(nodes_select_list) == 0) { - // _node.add(node_dragging); - // node_dragging.checkConnectGroup(); - // } else { - // for(var j = 0; j < ds_list_size(nodes_select_list); j++) - // _node.add(nodes_select_list[| j]); - // for(var j = 0; j < ds_list_size(nodes_select_list); j++) - // nodes_select_list[| j].checkConnectGroup(); - // } - // } - //} - if(ds_list_size(nodes_select_list) == 0) { // move single node var nx = node_drag_sx + (mouse_graph_x - node_drag_mx); var ny = node_drag_sy + (mouse_graph_y - node_drag_my); @@ -939,8 +906,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(point_distance(nodes_select_mx, nodes_select_my, mx, my) > 16) { draw_sprite_stretched_points(THEME.ui_selection, 0, nodes_select_mx, nodes_select_my, mx, my); - //ds_list_clear(nodes_select_list); - for(var i = 0; i < ds_list_size(nodes_list); i++) { var _node = nodes_list[| i]; if(instanceof(_node) == "Node_Frame") continue; @@ -1445,63 +1410,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { } } - var drawCorner = value_dragging.type == VALUE_TYPE.action; - if(target != noone) { - _mx = target.x; - _my = target.y; - - drawCorner |= target.type == VALUE_TYPE.action; - } - - var col = value_color(value_dragging.type); - var corner = PREF_MAP[? "connection_line_corner"] * graph_s; - draw_set_color(col); - var th = PREF_MAP[? "connection_line_width"] * graph_s; - switch(PREF_MAP[? "curve_connection_line"]) { - case 0 : - draw_line_width(xx, yy, _mx, _my, th); - break; - case 1 : - if(drawCorner) { - if(value_dragging.type == VALUE_TYPE.action) - draw_line_curve_corner(_mx, _my, xx, yy, graph_s, th, col, col); - else - draw_line_curve_corner(xx, yy, _mx, _my, graph_s, th, col, col); - } else { - if(value_dragging.connect_type == JUNCTION_CONNECT.output) - draw_line_curve_color(_mx, _my, xx, yy,,, graph_s, th, col, col); - else - draw_line_curve_color(xx, yy, _mx, _my,,, graph_s, th, col, col); - } - break; - case 2 : - if(drawCorner) { - if(value_dragging.type == VALUE_TYPE.action) - draw_line_elbow_corner(_mx, _my, xx, yy, graph_s, th, col, col, corner); - else - draw_line_elbow_corner(xx, yy, _mx, _my, graph_s, th, col, col, corner); - } else { - if(value_dragging.connect_type == JUNCTION_CONNECT.output) - draw_line_elbow_color(xx, yy, _mx, _my,,, graph_s, th, col, col, corner); - else - draw_line_elbow_color(_mx, _my, xx, yy,,, graph_s, th, col, col, corner); - } - break; - case 3 : - if(drawCorner) { - if(value_dragging.type == VALUE_TYPE.action) - draw_line_elbow_diag_corner(_mx, _my, xx, yy, graph_s, th, col, col, corner); - else - draw_line_elbow_diag_corner(xx, yy, _mx, _my, graph_s, th, col, col, corner); - } else { - if(value_dragging.connect_type == JUNCTION_CONNECT.output) - draw_line_elbow_diag_color(xx, yy, _mx, _my,,, graph_s, th, col, col, corner); - else - draw_line_elbow_diag_color(_mx, _my, xx, yy,,, graph_s, th, col, col, corner); - } - break; - } - + value_dragging.drawConnectionMouse(_mx, _my, graph_s, target); value_dragging.drawJunction(graph_s, value_dragging.x, value_dragging.y); if(target) target.drawJunction(graph_s, target.x, target.y); @@ -1534,15 +1443,18 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { value_dragging = noone; } - } else if(!value_dragging && value_focus && mouse_press(mb_left, pFOCUS) && !key_mod_press(ALT)) - value_dragging = value_focus; + } else if(!value_dragging && value_focus && mouse_press(mb_left, pFOCUS) && !key_mod_press(ALT)) { + value_dragging = value_focus; + value_draggings = []; + + if(ds_list_empty(nodes_select_list)) {} + } #region draw junction name var gr_x = graph_x * graph_s; var gr_y = graph_y * graph_s; - for(var i = 0; i < ds_list_size(nodes_list); i++) { + for(var i = 0; i < ds_list_size(nodes_list); i++) nodes_list[| i].drawJunctionNames(gr_x, gr_y, mx, my, graph_s); - } #endregion } diff --git a/scripts/pcx_ast/pcx_ast.gml b/scripts/pcx_ast/pcx_ast.gml index e1948846a..1c78f9456 100644 --- a/scripts/pcx_ast/pcx_ast.gml +++ b/scripts/pcx_ast/pcx_ast.gml @@ -6,10 +6,20 @@ global.FUNCTIONS[? "cos"] = [ ["radian"], function(val) { return cos(val[0]); } ]; global.FUNCTIONS[? "tan"] = [ ["radian"], function(val) { return tan(val[0]); } ]; + global.FUNCTIONS[? "arcsin"] = [ ["number"], function(val) { return arcsin(val[0]); } ]; + global.FUNCTIONS[? "arccos"] = [ ["number"], function(val) { return arccos(val[0]); } ]; + global.FUNCTIONS[? "arctan"] = [ ["number"], function(val) { return arctan(val[0]); } ]; + global.FUNCTIONS[? "abs"] = [ ["number"], function(val) { return abs(val[0]); } ]; global.FUNCTIONS[? "round"] = [ ["number"], function(val) { return round(val[0]); } ]; global.FUNCTIONS[? "ceil"] = [ ["number"], function(val) { return ceil(val[0]); } ]; global.FUNCTIONS[? "floor"] = [ ["number"], function(val) { return floor(val[0]); } ]; + global.FUNCTIONS[? "fract"] = [ ["number"], function(val) { return frac(val[0]); } ]; + global.FUNCTIONS[? "sign"] = [ ["number"], function(val) { return sign(val[0]); } ]; + + global.FUNCTIONS[? "min"] = [ ["number", "number"], function(val) { return min(array_safe_get(val, 0), array_safe_get(val, 1)); } ]; + global.FUNCTIONS[? "max"] = [ ["number", "number"], function(val) { return max(array_safe_get(val, 0), array_safe_get(val, 1)); } ]; + global.FUNCTIONS[? "clamp"] = [ ["number", "min = 0", "max = 1"], function(val) { return clamp(array_safe_get(val, 0), array_safe_get(val, 1, 0), array_safe_get(val, 2, 1)); } ]; global.FUNCTIONS[? "lerp"] = [ ["number_0", "number_1", "amount"], function(val) { return lerp(array_safe_get(val, 0), array_safe_get(val, 1), array_safe_get(val, 2)); } ]; @@ -41,6 +51,11 @@ return 0; } ]; + global.FUNCTIONS[? "string"] = [ ["value"], function(val) { return string(val[0]); } ]; + global.FUNCTIONS[? "number"] = [ ["value"], function(val) { return toNumber(val[0]); } ]; + global.FUNCTIONS[? "chr"] = [ ["number"], function(val) { return chr(val[0]); } ]; + global.FUNCTIONS[? "ord"] = [ ["char"], function(val) { return ord(val[0]); } ]; + globalvar PROJECT_VARIABLES; PROJECT_VARIABLES = {}; diff --git a/scripts/pcx_parse/pcx_parse.gml b/scripts/pcx_parse/pcx_parse.gml index 023ed3b34..51e6627cd 100644 --- a/scripts/pcx_parse/pcx_parse.gml +++ b/scripts/pcx_parse/pcx_parse.gml @@ -1,5 +1,5 @@ #region symbols - global.LOG_EXPRESSION = true; + global.LOG_EXPRESSION = false; global.EQUATION_PRES = ds_map_create(); global.EQUATION_PRES[? "+"] = 1;