diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index d2dc8e146..4fd5d7611 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -75,7 +75,6 @@ {"name":"audio","order":19,"path":"folders/nodes/data/audio.yy",}, {"name":"compose","order":14,"path":"folders/nodes/data/compose.yy",}, {"name":"armature","order":5,"path":"folders/nodes/data/compose/armature.yy",}, - {"name":"feedback","order":7,"path":"folders/nodes/data/iterate/feedback.yy",}, {"name":"filter","order":1,"path":"folders/nodes/data/filter.yy",}, {"name":"colors","order":4,"path":"folders/nodes/data/filter/colors.yy",}, {"name":"combine","order":1,"path":"folders/nodes/data/filter/combine.yy",}, @@ -90,6 +89,7 @@ {"name":"group","order":6,"path":"folders/nodes/data/group.yy",}, {"name":"network","order":16,"path":"folders/nodes/data/IO/network.yy",}, {"name":"iterate","order":9,"path":"folders/nodes/data/iterate.yy",}, + {"name":"feedback","order":7,"path":"folders/nodes/data/iterate/feedback.yy",}, {"name":"for each","order":1,"path":"folders/nodes/data/iterate/for each.yy",}, {"name":"for filter","order":3,"path":"folders/nodes/data/iterate/for filter.yy",}, {"name":"for sort","order":5,"path":"folders/nodes/data/iterate/for sort.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 3408ab22f..360853037 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -98,7 +98,6 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"audio","folderPath":"folders/nodes/data/audio.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"compose","folderPath":"folders/nodes/data/compose.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"armature","folderPath":"folders/nodes/data/compose/armature.yy",}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"feedback","folderPath":"folders/nodes/data/iterate/feedback.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"filter","folderPath":"folders/nodes/data/filter.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"blur","folderPath":"folders/nodes/data/filter/blur.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"colors","folderPath":"folders/nodes/data/filter/colors.yy",}, @@ -115,6 +114,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"IO","folderPath":"folders/nodes/data/IO.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"network","folderPath":"folders/nodes/data/IO/network.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"iterate","folderPath":"folders/nodes/data/iterate.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"feedback","folderPath":"folders/nodes/data/iterate/feedback.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"for each","folderPath":"folders/nodes/data/iterate/for each.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"for filter","folderPath":"folders/nodes/data/iterate/for filter.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"for sort","folderPath":"folders/nodes/data/iterate/for sort.yy",}, diff --git a/scripts/__node_iterator/__node_iterator.gml b/scripts/__node_iterator/__node_iterator.gml index 0f3a3f360..de9a34e07 100644 --- a/scripts/__node_iterator/__node_iterator.gml +++ b/scripts/__node_iterator/__node_iterator.gml @@ -31,7 +31,7 @@ function Node_Iterator(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) static outputNextNode = function() { LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, "Get next node from Loop output"); + LOG_IF(global.FLAG.render, "[outputNextNode] Get next node from Loop output"); var _nodes = []; for( var i = 0; i < ds_list_size(nodes); i++ ) { // check if every node is updated @@ -43,6 +43,7 @@ function Node_Iterator(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) } if(willRestart) { + LOG_IF(global.FLAG.render, $"Restart"); resetRender(); willRestart = false; } @@ -53,7 +54,7 @@ function Node_Iterator(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) //LOG_IF(global.FLAG.render, "Loop restart: iteration " + string(group.iterated)); _nodes = array_append(_nodes, __nodeLeafList(getNodeList())); } else if(_ren == ITERATION_STATUS.complete) { //Go out of loop - //LOG_IF(global.FLAG.render, "Loop completed"); + //LOG_IF(global.FLAG.render, "Loop completed get next node external"); setRenderStatus(true); _nodes = getNextNodesExternal(); } @@ -75,7 +76,6 @@ function Node_Iterator(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) for( var i = 0; i < ds_list_size(nodes); i++ ) // check if every node is updated if(!nodes[| i].rendered) return; - willRestart = true; var maxIter = getIterationCount(); iterated++; @@ -87,6 +87,7 @@ function Node_Iterator(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) render_time = get_timer() - loop_start_time; } else if(iterated < maxIter) { LOG_LINE_IF(global.FLAG.render, $"------------------< Iteration update: {iterated} / {maxIter} [RESTART] >------------------"); + willRestart = true; } } } \ No newline at end of file diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index bba7178f2..426da8082 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -54,6 +54,9 @@ ] static cleanup = function() { + if(!ds_map_empty(nodeMap)) + array_map(ds_map_keys_to_array(nodeMap), function(_key, _ind) { nodeMap[? _key].active = false; }); + ds_list_destroy(nodes); ds_map_destroy(nodeMap); ds_map_destroy(nodeNameMap); @@ -70,12 +73,12 @@ globalvar PROJECT_VARIABLES; PROJECT_VARIABLES = ds_map_create(); - PROJECT_VARIABLES[? "frame"] = [ function() { return PROJECT.animator.current_frame; }]; - PROJECT_VARIABLES[? "progress"] = [ function() { return PROJECT.animator.current_frame / PROJECT.animator.frames_total; }]; - PROJECT_VARIABLES[? "frameTotal"] = [ function() { return PROJECT.animator.frames_total; }]; - PROJECT_VARIABLES[? "fps"] = [ function() { return PROJECT.animator.framerate; }]; - PROJECT_VARIABLES[? "time"] = [ function() { return PROJECT.animator.current_frame / PROJECT.animator.framerate; }]; - PROJECT_VARIABLES[? "name"] = [ function() { return filename_name_only(PROJECT.path); }]; + PROJECT_VARIABLES[? "frame"] = function() { return PROJECT.animator.current_frame; }; + PROJECT_VARIABLES[? "progress"] = function() { return PROJECT.animator.current_frame / PROJECT.animator.frames_total; }; + PROJECT_VARIABLES[? "frameTotal"] = function() { return PROJECT.animator.frames_total; }; + PROJECT_VARIABLES[? "fps"] = function() { return PROJECT.animator.framerate; }; + PROJECT_VARIABLES[? "time"] = function() { return PROJECT.animator.current_frame / PROJECT.animator.framerate; }; + PROJECT_VARIABLES[? "name"] = function() { return filename_name_only(PROJECT.path); }; #endregion #region main @@ -89,10 +92,10 @@ globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER; - VERSION = 1147; - SAVE_VERSION = 1448.1; + VERSION = 11470; + SAVE_VERSION = 11470; VERSION_STRING = "1.14.7"; - BUILD_NUMBER = 114600; + BUILD_NUMBER = 11470; globalvar APPEND_MAP; APPEND_MAP = ds_map_create(); diff --git a/scripts/gradients_function/gradients_function.gml b/scripts/gradients_function/gradients_function.gml index e98e8c5c9..9cf88035a 100644 --- a/scripts/gradients_function/gradients_function.gml +++ b/scripts/gradients_function/gradients_function.gml @@ -14,6 +14,8 @@ function gradientKey(time, value) constructor { } function gradientObject(color = c_black) constructor { + static GRADIENT_LIMIT = 128; + if(is_array(color)) keys = [ new gradientKey(0, color[0]), new gradientKey(1, color[1]) ]; else @@ -22,15 +24,15 @@ function gradientObject(color = c_black) constructor { static clone = function() { var g = new gradientObject(); - for( var i = 0, n = array_length(keys); i < n; i++ ) { + for( var i = 0, n = array_length(keys); i < n; i++ ) g.keys[i] = keys[i].clone(); - } g.type = type; return g; } static add = function(_addkey, _deleteDup = true) { + if(array_length(keys) > GRADIENT_LIMIT) return; if(array_length(keys) == 0) { array_push(keys, _addkey); return; @@ -85,8 +87,10 @@ function gradientObject(color = c_black) constructor { var _grad_color = []; var _grad_time = []; - - for(var i = 0; i < array_length(keys); i++) { + + var len = min(128, array_length(keys)); + + for(var i = 0; i < len; i++) { if(keys[i].value == undefined) return; _grad_color[i * 4 + 0] = color_get_red(keys[i].value) / 255; @@ -96,14 +100,14 @@ function gradientObject(color = c_black) constructor { _grad_time[i] = keys[i].time; } - if(array_length(keys) == 0) { + if(len == 0) { draw_sprite_stretched_ext(s_fx_pixel, 0, _x, _y, _w, _h, c_white, _a) } else { shader_set(sh_gradient_display); shader_set_uniform_i(uniform_grad_blend, type); - shader_set_uniform_f_array_safe(uniform_grad, _grad_color); + shader_set_uniform_f_array_safe(uniform_grad, _grad_color, GRADIENT_LIMIT * 4); shader_set_uniform_f_array_safe(uniform_grad_time, _grad_time); - shader_set_uniform_i(uniform_grad_key, array_length(keys)); + shader_set_uniform_i(uniform_grad_key, len); draw_sprite_stretched_ext(s_fx_pixel, 0, _x, _y, _w, _h, c_white, _a) shader_reset(); diff --git a/scripts/locale_data/locale_data.gml b/scripts/locale_data/locale_data.gml index 5ede0cb23..6cb8cca45 100644 --- a/scripts/locale_data/locale_data.gml +++ b/scripts/locale_data/locale_data.gml @@ -33,6 +33,8 @@ } function __txtx(key, def = "") { + gml_pragma("forceinline"); + if(struct_has(LOCALE.word, key)) return LOCALE.word[$ key] if(struct_has(LOCALE.ui, key)) @@ -43,6 +45,8 @@ } function __txt(txt, prefix = "") { + gml_pragma("forceinline"); + var key = string_lower(txt); key = string_replace_all(key, " ", "_"); @@ -50,18 +54,24 @@ } function __txt_node_name(node, def = "") { + gml_pragma("forceinline"); + if(struct_has(LOCALE.node, node)) return LOCALE.node[$ node].name; return def; } function __txt_node_tooltip(node, def = "") { + gml_pragma("forceinline"); + if(struct_has(LOCALE.node, node)) return LOCALE.node[$ node].tooltip; return def; } function __txt_junction_name(node, type, index, def = "") { + gml_pragma("forceinline"); + if(!struct_has(LOCALE.node, node)) return def; @@ -73,6 +83,8 @@ } function __txt_junction_tooltip(node, type, index, def = "") { + gml_pragma("forceinline"); + if(!struct_has(LOCALE.node, node)) return def; diff --git a/scripts/nodeValue_drawer/nodeValue_drawer.gml b/scripts/nodeValue_drawer/nodeValue_drawer.gml index 4d45b806c..109d844f8 100644 --- a/scripts/nodeValue_drawer/nodeValue_drawer.gml +++ b/scripts/nodeValue_drawer/nodeValue_drawer.gml @@ -200,7 +200,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc if(_focus) jun.express_edit.register(_scrollPane); var wd_h = jun.express_edit.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.expression, _m); - widH = lineBreak? wd_h : 0; + widH = wd_h - (TEXTBOX_HEIGHT * !lineBreak); } else if(jun.editWidget) { jun.editWidget.setFocusHover(_focus, _hover); diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index d8fa6be7f..00c8d55ed 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -178,20 +178,25 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc } static getNextNodesExternal = function() { //get node connected to the parent object + LOG_IF(global.FLAG.render, $"Checking next node external for {internalName}"); + LOG_BLOCK_START(); + var nodes = []; for( var i = 0; i < ds_list_size(outputs); i++ ) { var _ot = outputs[| i]; + var _tos = _ot.getJunctionTo(); - for(var j = 0; j < ds_list_size(_ot.value_to); j++) { - var _to = _ot.value_to[| j]; + for( var j = 0, n = array_length(_tos); j < n; j++ ) { + var _to = _tos[j]; var _node = _to.node; - if(!_node.isRenderActive()) continue; + LOG_IF(global.FLAG.render, $"Checking node {_node.internalName} : {_node.isRenderable()}"); + if(!_node.isRenderable()) continue; - if(_node.active && _to.value_from != noone && _to.value_from.node == group && _node.isRenderable()) - array_push(nodes, _to.node); + array_push(nodes, _to.node); } } + LOG_BLOCK_END(); return nodes; } @@ -199,18 +204,16 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static setRenderStatus = function(result) { LOG_BLOCK_START(); LOG_IF(global.FLAG.render, $"Set render status for {internalName} : {result}"); - LOG_BLOCK_END(); rendered = result; - if(result) { - var siz = ds_list_size(outputs); - for( var i = custom_output_index; i < siz; i++ ) { - var _o = outputs[| i]; - if(_o.from.rendered) continue; + if(result) + for( var i = custom_output_index, n = ds_list_size(outputs); i < n; i++ ) { + var _o = outputs[| i]; + if(_o.from.rendered) continue; - rendered = false; - break; - } + LOG_IF(global.FLAG.render, $"Set fail because {_o.from.internalName} is not rendered."); + rendered = false; + break; } if(rendered) @@ -218,6 +221,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc if(!result && group != noone) group.setRenderStatus(result); + LOG_BLOCK_END(); } static exitGroup = function() {} @@ -441,7 +445,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc LOG_IF(global.FLAG.render, $"Reset Render for {internalName}"); for( var i = 0; i < ds_list_size(nodes); i++ ) { - //LOG_IF(global.FLAG.render, $"Reset Render for {nodes[| i].internalName}"); + LOG_IF(global.FLAG.render, $"Reseting {nodes[| i].internalName}"); nodes[| i].resetRender(); } diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index db8f0e70b..f8932eea2 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -437,8 +437,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x if( val_from == noone) continue; if(!val_from.node.active) continue; if(!val_from.node.isRenderActive()) continue; - if(!val_from.node.rendered && !val_from.node.update_on_frame) { - LOG_LINE_IF(global.FLAG.render, $"Node {internalName} is not renderable because input {val_from.node.internalName} is not rendered"); + if!(val_from.node.rendered || val_from.node.update_on_frame) { + LOG_LINE_IF(global.FLAG.render, $"Node {internalName} is not renderable because input {val_from.node.internalName} is not rendered ({val_from.node.rendered})"); return false; } } diff --git a/scripts/node_functions/node_functions.gml b/scripts/node_functions/node_functions.gml index dba51397d..b5c14f2a4 100644 --- a/scripts/node_functions/node_functions.gml +++ b/scripts/node_functions/node_functions.gml @@ -210,7 +210,11 @@ return inp == noone? 0 : inp.getValueRecursive()[0]; } else if(string_lower(strs[0]) == "project") { if(!ds_map_exists(PROJECT_VARIABLES, strs[1])) return 0; - return PROJECT_VARIABLES[? strs[1]](); + + var val = PROJECT_VARIABLES[? strs[1]]; + if(is_callable(val)) + return val(); + return val; } else if(array_length(strs) > 2) { var key = strs[0]; if(!ds_map_exists(PROJECT.nodeNameMap, key)) return 0; diff --git a/scripts/node_gradient_palette/node_gradient_palette.gml b/scripts/node_gradient_palette/node_gradient_palette.gml index af2fe94ab..0161d2c76 100644 --- a/scripts/node_gradient_palette/node_gradient_palette.gml +++ b/scripts/node_gradient_palette/node_gradient_palette.gml @@ -33,14 +33,18 @@ function Node_Gradient_Palette(_x, _y, _group = noone) : Node_Processor(_x, _y, var type = _data[3]; var grad = new gradientObject(); - grad.keys = []; + var len = min(128, array_length(pal)); + grad.keys = array_create(len); - for( var i = 0, n = array_length(pal); i < n; i++ ) { + //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 / array_length(pal); + 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) { case 0 : grad.type = GRADIENT_INTER.smooth; break; case 1 : grad.type = GRADIENT_INTER.hue; break; diff --git a/scripts/node_palette_extract/node_palette_extract.gml b/scripts/node_palette_extract/node_palette_extract.gml index 930937e8c..4af65df5b 100644 --- a/scripts/node_palette_extract/node_palette_extract.gml +++ b/scripts/node_palette_extract/node_palette_extract.gml @@ -300,6 +300,8 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node(_x, _y, _group) con } outputs[| 0].setValue(res); + + triggerRender(); } static onInspector1Update = function() { extractPalettes(); } diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 89448e9c4..b3aa1c1b3 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -100,7 +100,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { ds_list_add(iter, "Groups"); addNodeObject(iter, "Input", s_node_loop_input, "Node_Iterator_Input", [1, Node_Iterator_Input]); addNodeObject(iter, "Output", s_node_loop_output, "Node_Iterator_Output", [1, Node_Iterator_Output]); - + ds_list_add(iter, "Loops"); addNodeObject(iter, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]); addNodeObject(iter, "Loop amount", s_node_iterator_amount, "Node_Iterator_Length", [1, Node_Iterator_Length]); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 6f0bb2abd..95ed160e5 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -1063,6 +1063,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru cache_hit &= (!is_anim && value_from == noone) || cache_value[1] == _time; cache_hit &= cache_value[2] != undefined; cache_hit &= connect_type == JUNCTION_CONNECT.input; + cache_hit &= unit.reference == noone || unit.mode == VALUE_UNIT.constant; if(cache_hit) { global.cache_hit++; @@ -1160,7 +1161,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru //print($"========== EXPRESSION CALLED =========="); //print(debug_get_callstack(8)); - printIf(global.FLAG.expression_debug, "==================== EVAL BEGIN ===================="); + //printIf(global.FLAG.expression_debug, "==================== EVAL BEGIN ===================="); if(global.EVALUATE_HEAD != noone && global.EVALUATE_HEAD == self) { //noti_warning($"Expression evaluation error : recursive call detected."); } else { @@ -1204,7 +1205,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru } static showValue = function() { - var val = getValue(, false,, false); + var val = getValue(, false,, true); if(isArray()) { if(array_length(val) == 0) return 0; var v = val[safe_mod(node.preview_index, array_length(val))]; diff --git a/scripts/panel_data/panel_data.gml b/scripts/panel_data/panel_data.gml index 261b3426e..a6a1c4d38 100644 --- a/scripts/panel_data/panel_data.gml +++ b/scripts/panel_data/panel_data.gml @@ -614,7 +614,6 @@ function Panel(_parent, _x, _y, _w, _h) constructor { function setTab(tabIndex) { if(tabIndex < 0) return; if(tabIndex >= array_length(content)) return; - if(content_index == tabIndex) return; var prec = array_safe_get(content, content_index); if(prec) prec.onFocusEnd(); diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index 1cba9c71a..296444c3f 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -688,6 +688,9 @@ function Panel_Inspector() : PanelContent() constructor { draw_sprite_stretched(THEME.ui_panel_bg, 1, ui(8), top_bar_h - ui(8), w - ui(16), h - top_bar_h); + if(inspecting && !inspecting.active) + inspecting = noone; + if(inspecting) { title = inspecting.display_name == ""? inspecting.name : inspecting.display_name; inspecting.inspectorStep(); diff --git a/scripts/panel_menu/panel_menu.gml b/scripts/panel_menu/panel_menu.gml index 14f1bf5ea..1a408b0f2 100644 --- a/scripts/panel_menu/panel_menu.gml +++ b/scripts/panel_menu/panel_menu.gml @@ -61,6 +61,7 @@ function Panel_Menu() : PanelContent() constructor { gameframe_set_fullscreen(2); },, ["", "Fullscreen"]), menuItem(__txt("Close current file"), function() { PANEL_GRAPH.close(); },, [ "", "Close file" ]), + menuItem(__txt("Close all projects"), function() { for( var i = array_length(PROJECTS) - 1; i >= 0; i-- ) closeProject(PROJECTS[i]); },, [ "", "Close all" ]), menuItem(__txt("Close program"), function() { window_close(); },, [ "", "Close program" ]), ]; diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index ef8efe670..6bde73b9b 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -188,6 +188,10 @@ function Panel_Preview() : PanelContent() constructor { var node = preview_node[i]; if(node == noone) continue; + if(!node.active) { + preview_node[i] = noone; + continue; + } var _prev_val = node.getPreviewValue(); diff --git a/scripts/render_data/render_data.gml b/scripts/render_data/render_data.gml index dfee235c5..259ebdc8e 100644 --- a/scripts/render_data/render_data.gml +++ b/scripts/render_data/render_data.gml @@ -112,7 +112,7 @@ function Render(partial = false, runAction = false) { // render forward while(!RENDER_QUEUE.empty()) { LOG_BLOCK_START(); - LOG_IF(global.FLAG.render, $"➤➤➤➤➤➤ CURRENT RENDER QUEUE {RENDER_QUEUE}"); + LOG_IF(global.FLAG.render, $"➤➤➤➤➤➤ CURRENT RENDER QUEUE {RENDER_QUEUE} [{RENDER_QUEUE.size()}] "); rendering = RENDER_QUEUE.dequeue(); var renderable = rendering.isRenderable(); diff --git a/scripts/save_function/save_function.gml b/scripts/save_function/save_function.gml index ab91d4c31..1565da7a3 100644 --- a/scripts/save_function/save_function.gml +++ b/scripts/save_function/save_function.gml @@ -57,6 +57,8 @@ function SET_PATH(project, path) { } else if(!project.readonly) { ds_list_remove(RECENT_FILES, path); ds_list_insert(RECENT_FILES, 0, path); + while(ds_list_size(RECENT_FILES) > 64) + ds_list_delete(RECENT_FILES, ds_list_size(RECENT_FILES) - 1); RECENT_SAVE(); RECENT_REFRESH(); //project.path = filename_name(path); diff --git a/scripts/shader_functions/shader_functions.gml b/scripts/shader_functions/shader_functions.gml index cf8c54acf..f5980ddc5 100644 --- a/scripts/shader_functions/shader_functions.gml +++ b/scripts/shader_functions/shader_functions.gml @@ -26,7 +26,7 @@ function shader_set_f(uniform, value) { shader_set_f_array(shader, uniform, value); return; } - + if(argument_count > 2) { var array = []; for( var i = 1; i < argument_count; i++ ) @@ -38,13 +38,15 @@ function shader_set_f(uniform, value) { shader_set_uniform_f(shader_get_uniform(shader, uniform), value); } -function shader_set_f_array(shader, uniform, array) { - shader_set_uniform_f_array(shader_get_uniform(shader, uniform), array); +function shader_set_f_array(shader, uniform, array, max_length = 128) { + shader_set_uniform_f_array_safe(shader_get_uniform(shader, uniform), array, max_length); } -function shader_set_uniform_f_array_safe(uniform, array) { +function shader_set_uniform_f_array_safe(uniform, array, max_length = 128) { if(!is_array(array)) return; if(array_length(array) == 0) return; + if(array_length(array) > max_length) + array_resize(array, max_length) shader_set_uniform_f_array(uniform, array); } @@ -81,11 +83,11 @@ function shader_set_color(uniform, col, alpha = 1) { shader_set_f(uniform, colToVec4(col, alpha)); } -function shader_set_palette(pal, pal_uni = "palette", amo_uni = "paletteAmount") { - shader_set_i(amo_uni, array_length(pal)); +function shader_set_palette(pal, pal_uni = "palette", amo_uni = "paletteAmount", max_length = 128) { + shader_set_i(amo_uni, min(max_length, array_length(pal))); var _pal = []; - for( var i = 0, n = array_length(pal); i < n; i++ ) + for( var i = 0, n = min(max_length, array_length(pal)); i < n; i++ ) array_append(_pal, colToVec4(pal[i])); if(array_length(_pal)) diff --git a/scripts/string_cut/string_cut.gml b/scripts/string_cut/string_cut.gml index 7c9cacbee..fb8dbeacb 100644 --- a/scripts/string_cut/string_cut.gml +++ b/scripts/string_cut/string_cut.gml @@ -7,17 +7,13 @@ function string_cut(str, w, tail = "...", scale = 1) { if(string_width(str) <= w) return str; var amo = string_length(str); - for( var i = 1; i <= amo; i++ ) { - var ch = string_char_at(str, 1); - str = string_copy(str, 2, string_length(str) - 1); + + for( var i = 1, n = string_length(str); i <= n; i++ ) { + var ch = string_char_at(str, i); - var _w = string_width(ch) * scale; - ww += _w; - - var _tl = string_width(str) * scale; - - if(ww + tw > w) - return ww + _tl <= w? _str : ss + tail; + if(string_width(ss + ch) + tw > w) + return ss + tail; + ss += ch; } diff --git a/scripts/string_eval/string_eval.gml b/scripts/string_eval/string_eval.gml index 1acfd931f..f4d197c4d 100644 --- a/scripts/string_eval/string_eval.gml +++ b/scripts/string_eval/string_eval.gml @@ -535,7 +535,7 @@ function functionStringClean(fx) { var _ch = ""; var in_str = false; - //print($"===== Function: {fx} ====="); + printIf(global.FLAG.expression_debug, $"===== Evaluating function: {fx} ====="); while(l <= len) { ch = string_char_at(fx, l); diff --git a/scripts/textArea/textArea.gml b/scripts/textArea/textArea.gml index 6ed06f05e..07cd83b4e 100644 --- a/scripts/textArea/textArea.gml +++ b/scripts/textArea/textArea.gml @@ -14,6 +14,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod auto_update = false; _input_text_line = []; + _input_text_line_index = []; _current_text = ""; _input_text = ""; _prev_text = ""; @@ -256,6 +257,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod static cut_line = function() { _input_text_line = []; + _input_text_line_index = []; draw_set_font(font); var _txtLines = string_splice(_input_text, "\n"); @@ -268,6 +270,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod var currL = ""; var cut = true; var len = array_length(words); + var _iIndex = i + 1; for( var j = 0; j < len; j++ ) { var word = words[j]; @@ -279,6 +282,8 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod if(currW + string_width(ch) > line_width) { array_push(_input_text_line, currL); + array_push(_input_text_line_index, _iIndex); _iIndex = ""; + currW = 0; currL = ""; } @@ -291,6 +296,8 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod if(currW + string_width(word) > line_width) { array_push(_input_text_line, currL); + array_push(_input_text_line_index, _iIndex); _iIndex = ""; + currW = 0; currL = ""; } @@ -300,7 +307,10 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod currL += word; } - if(cut) array_push(_input_text_line, currL); + if(cut) { + array_push(_input_text_line, currL); + array_push(_input_text_line_index, _iIndex); _iIndex = ""; + } } } @@ -611,7 +621,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod for( var i = 0; i < line_count; i++ ) { var ly = _y + ui(7) + i * c_h; - draw_text(lx, ly, string(i + 1)); + draw_text(lx, ly, _input_text_line_index[i]); } } diff --git a/shaders/sh_color_picker_hue/sh_color_picker_hue.fsh b/shaders/sh_color_picker_hue/sh_color_picker_hue.fsh index 7347168e6..4510ef26f 100644 --- a/shaders/sh_color_picker_hue/sh_color_picker_hue.fsh +++ b/shaders/sh_color_picker_hue/sh_color_picker_hue.fsh @@ -5,8 +5,10 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; uniform float hue; +#define PALETTE_LIMIT 128 + uniform int usePalette; -uniform vec4 palette[64]; +uniform vec4 palette[PALETTE_LIMIT]; uniform int paletteAmount; vec3 hsv2rgb(vec3 c) { diff --git a/shaders/sh_color_picker_side_hue/sh_color_picker_side_hue.fsh b/shaders/sh_color_picker_side_hue/sh_color_picker_side_hue.fsh index b78d2b6d5..bd6a7b562 100644 --- a/shaders/sh_color_picker_side_hue/sh_color_picker_side_hue.fsh +++ b/shaders/sh_color_picker_side_hue/sh_color_picker_side_hue.fsh @@ -3,11 +3,14 @@ // varying vec2 v_vTexcoord; varying vec4 v_vColour; + +#define PALETTE_LIMIT 128 + uniform float sat; uniform float value; uniform int usePalette; -uniform vec4 palette[64]; +uniform vec4 palette[PALETTE_LIMIT]; uniform int paletteAmount; vec3 hsv2rgb(vec3 c) { diff --git a/shaders/sh_color_picker_side_value/sh_color_picker_side_value.fsh b/shaders/sh_color_picker_side_value/sh_color_picker_side_value.fsh index bd86b854c..3a1c69b03 100644 --- a/shaders/sh_color_picker_side_value/sh_color_picker_side_value.fsh +++ b/shaders/sh_color_picker_side_value/sh_color_picker_side_value.fsh @@ -3,11 +3,14 @@ // varying vec2 v_vTexcoord; varying vec4 v_vColour; + +#define PALETTE_LIMIT 128 + uniform float hue; uniform float sat; uniform int usePalette; -uniform vec4 palette[64]; +uniform vec4 palette[PALETTE_LIMIT]; uniform int paletteAmount; vec3 hsv2rgb(vec3 c) { diff --git a/shaders/sh_color_picker_value/sh_color_picker_value.fsh b/shaders/sh_color_picker_value/sh_color_picker_value.fsh index 6c39032a6..a0d499570 100644 --- a/shaders/sh_color_picker_value/sh_color_picker_value.fsh +++ b/shaders/sh_color_picker_value/sh_color_picker_value.fsh @@ -3,10 +3,13 @@ // varying vec2 v_vTexcoord; varying vec4 v_vColour; + +#define PALETTE_LIMIT 128 + uniform float value; uniform int usePalette; -uniform vec4 palette[64]; +uniform vec4 palette[PALETTE_LIMIT]; uniform int paletteAmount; vec3 hsv2rgb(vec3 c) { diff --git a/shaders/sh_gradient_display/sh_gradient_display.fsh b/shaders/sh_gradient_display/sh_gradient_display.fsh index f21af4ee9..9939dd0e0 100644 --- a/shaders/sh_gradient_display/sh_gradient_display.fsh +++ b/shaders/sh_gradient_display/sh_gradient_display.fsh @@ -67,10 +67,9 @@ vec3 gradientEval(in float prog) { } break; } - if(i >= gradient_keys - 1) { - col = gradient_color[gradient_keys - 1]; - break; - } + + if(i >= gradient_keys - 1) + return gradient_color[gradient_keys - 1].rgb; } return col.rgb; diff --git a/shaders/sh_posterize_palette/sh_posterize_palette.fsh b/shaders/sh_posterize_palette/sh_posterize_palette.fsh index ea4ded843..be76219da 100644 --- a/shaders/sh_posterize_palette/sh_posterize_palette.fsh +++ b/shaders/sh_posterize_palette/sh_posterize_palette.fsh @@ -4,7 +4,9 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; -uniform vec4 palette[64]; +#define PALETTE_LIMIT 128 + +uniform vec4 palette[PALETTE_LIMIT]; uniform int keys; vec3 rgb2xyz( vec3 c ) {