mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-11 23:06:51 +01:00
New log system, fix array loop/filter, image replace, ase tags.
This commit is contained in:
parent
3fe4f266bf
commit
99e04c525a
27 changed files with 320 additions and 163 deletions
|
@ -836,6 +836,7 @@
|
||||||
{"name":"render_data","order":3,"path":"scripts/render_data/render_data.yy",},
|
{"name":"render_data","order":3,"path":"scripts/render_data/render_data.yy",},
|
||||||
{"name":"o_dialog_graph_view","order":4,"path":"objects/o_dialog_graph_view/o_dialog_graph_view.yy",},
|
{"name":"o_dialog_graph_view","order":4,"path":"objects/o_dialog_graph_view/o_dialog_graph_view.yy",},
|
||||||
{"name":"fd_rectangle_get_velocity_height","order":22,"path":"scripts/fd_rectangle_get_velocity_height/fd_rectangle_get_velocity_height.yy",},
|
{"name":"fd_rectangle_get_velocity_height","order":22,"path":"scripts/fd_rectangle_get_velocity_height/fd_rectangle_get_velocity_height.yy",},
|
||||||
|
{"name":"logger","order":1,"path":"scripts/logger/logger.yy",},
|
||||||
{"name":"s_node_blur_directional","order":11,"path":"sprites/s_node_blur_directional/s_node_blur_directional.yy",},
|
{"name":"s_node_blur_directional","order":11,"path":"sprites/s_node_blur_directional/s_node_blur_directional.yy",},
|
||||||
{"name":"s_node_average","order":50,"path":"sprites/s_node_average/s_node_average.yy",},
|
{"name":"s_node_average","order":50,"path":"sprites/s_node_average/s_node_average.yy",},
|
||||||
{"name":"s_node_sprite_sheet","order":1,"path":"sprites/s_node_sprite_sheet/s_node_sprite_sheet.yy",},
|
{"name":"s_node_sprite_sheet","order":1,"path":"sprites/s_node_sprite_sheet/s_node_sprite_sheet.yy",},
|
||||||
|
|
|
@ -1326,6 +1326,7 @@
|
||||||
{"id":{"name":"render_data","path":"scripts/render_data/render_data.yy",},},
|
{"id":{"name":"render_data","path":"scripts/render_data/render_data.yy",},},
|
||||||
{"id":{"name":"o_dialog_graph_view","path":"objects/o_dialog_graph_view/o_dialog_graph_view.yy",},},
|
{"id":{"name":"o_dialog_graph_view","path":"objects/o_dialog_graph_view/o_dialog_graph_view.yy",},},
|
||||||
{"id":{"name":"fd_rectangle_get_velocity_height","path":"scripts/fd_rectangle_get_velocity_height/fd_rectangle_get_velocity_height.yy",},},
|
{"id":{"name":"fd_rectangle_get_velocity_height","path":"scripts/fd_rectangle_get_velocity_height/fd_rectangle_get_velocity_height.yy",},},
|
||||||
|
{"id":{"name":"logger","path":"scripts/logger/logger.yy",},},
|
||||||
{"id":{"name":"addon_key_displayer","path":"objects/addon_key_displayer/addon_key_displayer.yy",},},
|
{"id":{"name":"addon_key_displayer","path":"objects/addon_key_displayer/addon_key_displayer.yy",},},
|
||||||
{"id":{"name":"s_node_blur_directional","path":"sprites/s_node_blur_directional/s_node_blur_directional.yy",},},
|
{"id":{"name":"s_node_blur_directional","path":"sprites/s_node_blur_directional/s_node_blur_directional.yy",},},
|
||||||
{"id":{"name":"distance_to_line","path":"scripts/distance_to_line/distance_to_line.yy",},},
|
{"id":{"name":"distance_to_line","path":"scripts/distance_to_line/distance_to_line.yy",},},
|
||||||
|
|
|
@ -120,9 +120,12 @@
|
||||||
if(array_length(path) == 0) return;
|
if(array_length(path) == 0) return;
|
||||||
|
|
||||||
var type = "others";
|
var type = "others";
|
||||||
|
|
||||||
|
if(array_length(path) == 1 && directory_exists(path[0]))
|
||||||
|
type = "image";
|
||||||
|
|
||||||
for( var i = 0; i < array_length(path); i++ ) {
|
for( var i = 0; i < array_length(path); i++ ) {
|
||||||
var p = path[i];
|
var p = path[i];
|
||||||
if(directory_exists(p)) continue;
|
|
||||||
var ext = string_lower(filename_ext(p));
|
var ext = string_lower(filename_ext(p));
|
||||||
|
|
||||||
switch(ext) {
|
switch(ext) {
|
||||||
|
|
|
@ -218,6 +218,8 @@ function __part(_node) constructor {
|
||||||
var cc = (col == -1)? c_white : col.eval(lifeRat);
|
var cc = (col == -1)? c_white : col.eval(lifeRat);
|
||||||
if(blend != c_white) cc = colorMultiply(blend, cc);
|
if(blend != c_white) cc = colorMultiply(blend, cc);
|
||||||
alp_draw = alp * eval_curve_x(alp_fade, lifeRat);
|
alp_draw = alp * eval_curve_x(alp_fade, lifeRat);
|
||||||
|
|
||||||
|
shader_set_f("sampleDimension", surface_get_width(ss), surface_get_height(ss));
|
||||||
draw_surface_ext_safe(ss, _xx, _yy, scx, scy, rot, cc, alp_draw);
|
draw_surface_ext_safe(ss, _xx, _yy, scx, scy, rot, cc, alp_draw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,10 @@ function area_get_random_point(area, distrib = AREA_DISTRIBUTION.area, scatter =
|
||||||
case AREA_DISTRIBUTION.area :
|
case AREA_DISTRIBUTION.area :
|
||||||
if(scatter == AREA_SCATTER.uniform) {
|
if(scatter == AREA_SCATTER.uniform) {
|
||||||
var _col = ceil(sqrt(total));
|
var _col = ceil(sqrt(total));
|
||||||
|
var _row = ceil(total / _col);
|
||||||
|
|
||||||
var _iwid = _area_w * 2 / _col;
|
var _iwid = _area_w * 2 / _col;
|
||||||
var _ihig = _area_h * 2 / _col;
|
var _ihig = _area_h * 2 / _row;
|
||||||
|
|
||||||
var _irow = floor(index / _col);
|
var _irow = floor(index / _col);
|
||||||
var _icol = safe_mod(index, _col);
|
var _icol = safe_mod(index, _col);
|
||||||
|
|
40
scripts/logger/logger.gml
Normal file
40
scripts/logger/logger.gml
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#region globals
|
||||||
|
global.LOG_LEVEL = 0;
|
||||||
|
|
||||||
|
function LOG_BLOCK_START() {
|
||||||
|
global.LOG_LEVEL++;
|
||||||
|
}
|
||||||
|
|
||||||
|
function LOG(text) {
|
||||||
|
var s = "";
|
||||||
|
repeat(global.LOG_LEVEL - 1)
|
||||||
|
s += " ";
|
||||||
|
s += "|- ";
|
||||||
|
|
||||||
|
print(s + string(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
function LOG_LINE(text) {
|
||||||
|
LOG_BLOCK_START();
|
||||||
|
LOG(text);
|
||||||
|
LOG_BLOCK_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
function LOG_IF(cond, text) {
|
||||||
|
if(!cond) return;
|
||||||
|
LOG(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
function LOG_LINE_IF(cond, text) {
|
||||||
|
if(!cond) return;
|
||||||
|
LOG_LINE(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
function LOG_BLOCK_END() {
|
||||||
|
global.LOG_LEVEL--;
|
||||||
|
}
|
||||||
|
|
||||||
|
function LOG_END() {
|
||||||
|
global.LOG_LEVEL = 0;
|
||||||
|
}
|
||||||
|
#endregion
|
11
scripts/logger/logger.yy
Normal file
11
scripts/logger/logger.yy
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"resourceType": "GMScript",
|
||||||
|
"resourceVersion": "1.0",
|
||||||
|
"name": "logger",
|
||||||
|
"isCompatibility": false,
|
||||||
|
"isDnD": false,
|
||||||
|
"parent": {
|
||||||
|
"name": "debug",
|
||||||
|
"path": "folders/functions/debug.yy",
|
||||||
|
},
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||||
input_fix_len = ds_list_size(inputs);
|
input_fix_len = ds_list_size(inputs);
|
||||||
|
|
||||||
attribute_surface_depth();
|
attribute_surface_depth();
|
||||||
|
attribute_interpolation();
|
||||||
|
|
||||||
static createNewInput = function() {
|
static createNewInput = function() {
|
||||||
var index = ds_list_size(inputs);
|
var index = ds_list_size(inputs);
|
||||||
|
@ -82,8 +83,8 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
||||||
outputs[| 0].setValue(_outSurf);
|
outputs[| 0].setValue(_outSurf);
|
||||||
|
|
||||||
surface_set_target(_outSurf);
|
surface_set_shader(_outSurf);
|
||||||
DRAW_CLEAR
|
shader_set_interpolation(_outSurf);
|
||||||
|
|
||||||
if(_blend == PARTICLE_BLEND_MODE.normal)
|
if(_blend == PARTICLE_BLEND_MODE.normal)
|
||||||
BLEND_NORMAL;
|
BLEND_NORMAL;
|
||||||
|
@ -108,7 +109,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||||
}
|
}
|
||||||
|
|
||||||
BLEND_NORMAL;
|
BLEND_NORMAL;
|
||||||
surface_reset_target();
|
surface_reset_shader();
|
||||||
|
|
||||||
cacheCurrentFrame(_outSurf);
|
cacheCurrentFrame(_outSurf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,9 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
||||||
if(_hover && point_in_rectangle(_m[0], _m[1], _x + 8, _yy, _x + _w - 8, _yy + hh)) {
|
if(_hover && point_in_rectangle(_m[0], _m[1], _x + 8, _yy, _x + _w - 8, _yy + hh)) {
|
||||||
draw_sprite_stretched_ext(THEME.node_bg_name, 1, _x + 8, _yy, _w - 16, hh, c_white, 0.1);
|
draw_sprite_stretched_ext(THEME.node_bg_name, 1, _x + 8, _yy, _w - 16, hh, c_white, 0.1);
|
||||||
if(mouse_click(mb_left, _focus)) {
|
if(mouse_click(mb_left, _focus)) {
|
||||||
inputs[| 2].setValue(tag[? "Name"]);
|
var _currTag = inputs[| 2].getValue();
|
||||||
|
var _tagName = tag[? "Name"];
|
||||||
|
inputs[| 2].setValue(_currTag == _tagName? "" : _tagName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,11 +152,11 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
||||||
tag_renderer.h = _h;
|
tag_renderer.h = _h;
|
||||||
return _h;
|
return _h;
|
||||||
});
|
});
|
||||||
|
|
||||||
input_display_list = [
|
input_display_list = [
|
||||||
["File", true], 0,
|
["File", true], 0,
|
||||||
["Layers", false], 1, layer_renderer,
|
["Layers", false], 1, layer_renderer,
|
||||||
["Tags", false], tag_renderer,
|
["Tags", false], 2, tag_renderer,
|
||||||
];
|
];
|
||||||
|
|
||||||
attributes[? "layer_visible"] = ds_list_create();
|
attributes[? "layer_visible"] = ds_list_create();
|
||||||
|
|
|
@ -136,20 +136,24 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
||||||
}
|
}
|
||||||
|
|
||||||
static getNextNodes = function() {
|
static getNextNodes = function() {
|
||||||
|
LOG_BLOCK_START();
|
||||||
var nodes = [];
|
var nodes = [];
|
||||||
for(var i = custom_input_index; i < ds_list_size(inputs); i++) {
|
for(var i = custom_input_index; i < ds_list_size(inputs); i++) {
|
||||||
var _in = inputs[| i].from;
|
var _in = inputs[| i].from;
|
||||||
if(!_in.renderActive) continue;
|
if(!_in.renderActive) continue;
|
||||||
|
|
||||||
array_push(nodes, _in);
|
array_push(nodes, _in);
|
||||||
printIf(global.RENDER_LOG, " >> Check complete, push " + _in.name + " to stack.");
|
LOG_IF(global.RENDER_LOG, "Check complete, push " + _in.name + " to stack.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_BLOCK_END();
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static setRenderStatus = function(result) {
|
static setRenderStatus = function(result) {
|
||||||
printIf(global.RENDER_LOG, " >> Set render status for " + name + " : " + string(result));
|
LOG_BLOCK_START();
|
||||||
|
LOG_IF(global.RENDER_LOG, "Set render status for " + name + " : " + string(result));
|
||||||
|
LOG_BLOCK_END();
|
||||||
rendered = result;
|
rendered = result;
|
||||||
|
|
||||||
if(result) {
|
if(result) {
|
||||||
|
@ -365,13 +369,18 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
||||||
node_list[| i].disable();
|
node_list[| i].disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
static resetAllRenderStatus = function() {
|
static resetRender = function() {
|
||||||
var node_list = getNodeList();
|
LOG_BLOCK_START();
|
||||||
for( var i = 0; i < ds_list_size(node_list); i++ ) {
|
LOG_IF(global.RENDER_LOG, "Reset Render for collection " + name);
|
||||||
node_list[| i].setRenderStatus(false);
|
|
||||||
if(variable_struct_exists(node_list[| i], "nodes"))
|
for( var i = 0; i < ds_list_size(nodes); i++ ) {
|
||||||
node_list[| i].resetAllRenderStatus();
|
LOG_IF(global.RENDER_LOG, "Reset Render for " + nodes[| i].name);
|
||||||
|
nodes[| i].rendered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rendered = false;
|
||||||
|
|
||||||
|
LOG_BLOCK_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
static setInstance = function(node) {
|
static setInstance = function(node) {
|
||||||
|
|
|
@ -276,6 +276,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
||||||
static doUpdate = function() {
|
static doUpdate = function() {
|
||||||
if(SAFE_MODE) return;
|
if(SAFE_MODE) return;
|
||||||
var sBase = surface_get_target();
|
var sBase = surface_get_target();
|
||||||
|
LOG_BLOCK_START();
|
||||||
|
LOG_IF(global.RENDER_LOG, "DoUpdate called from " + name);
|
||||||
|
|
||||||
for( var i = 0; i < ds_list_size(inputs); i++ ) {
|
for( var i = 0; i < ds_list_size(inputs); i++ ) {
|
||||||
if(inputs[| i].type != VALUE_TYPE.trigger) continue;
|
if(inputs[| i].type != VALUE_TYPE.trigger) continue;
|
||||||
|
@ -287,9 +289,12 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var t = get_timer();
|
var t = get_timer();
|
||||||
|
if(!is_instanceof(self, Node_Collection))
|
||||||
|
setRenderStatus(true);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
setRenderStatus(true);
|
|
||||||
if(auto_render_time)
|
if(!is_instanceof(self, Node_Collection))
|
||||||
render_time = get_timer() - t;
|
render_time = get_timer() - t;
|
||||||
} catch(exception) {
|
} catch(exception) {
|
||||||
var sCurr = surface_get_target();
|
var sCurr = surface_get_target();
|
||||||
|
@ -308,6 +313,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
||||||
var trigger = inspectInput2.getValue();
|
var trigger = inspectInput2.getValue();
|
||||||
if(trigger) onInspector2Update();
|
if(trigger) onInspector2Update();
|
||||||
}
|
}
|
||||||
|
LOG_BLOCK_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
static valueUpdate = function(index) {
|
static valueUpdate = function(index) {
|
||||||
|
@ -321,16 +327,18 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
||||||
static onValueFromUpdate = function(index) {}
|
static onValueFromUpdate = function(index) {}
|
||||||
|
|
||||||
static triggerRender = function() {
|
static triggerRender = function() {
|
||||||
printIf(global.RENDER_LOG, " -> Trigger render for " + name + " (" + display_name + ")");
|
LOG_BLOCK_START();
|
||||||
|
LOG_IF(global.RENDER_LOG, "Trigger render for " + name + " (" + display_name + ")");
|
||||||
|
|
||||||
setRenderStatus(false);
|
setRenderStatus(false);
|
||||||
UPDATE |= RENDER_TYPE.partial;
|
UPDATE |= RENDER_TYPE.partial;
|
||||||
|
|
||||||
var nodes = getNextNodes();
|
var nodes = getNextNodesRaw();
|
||||||
for(var i = 0; i < array_length(nodes); i++)
|
for(var i = 0; i < array_length(nodes); i++)
|
||||||
nodes[i].triggerRender();
|
nodes[i].triggerRender();
|
||||||
|
LOG_BLOCK_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
static isRenderable = function(log = false) { //Check if every input is ready (updated)
|
static isRenderable = function(log = false) { //Check if every input is ready (updated)
|
||||||
if(!active) return false;
|
if(!active) return false;
|
||||||
if(!renderActive) return false;
|
if(!renderActive) return false;
|
||||||
|
@ -351,9 +359,15 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getNextNodesRaw = function() { return getNextNodes(); }
|
||||||
|
|
||||||
static getNextNodes = function() {
|
static getNextNodes = function() {
|
||||||
var nodes = [];
|
var nodes = [];
|
||||||
|
|
||||||
|
LOG_BLOCK_START();
|
||||||
|
LOG_IF(global.RENDER_LOG, "Call get next node from: " + name);
|
||||||
|
LOG_BLOCK_START();
|
||||||
|
|
||||||
for(var i = 0; i < ds_list_size(outputs); i++) {
|
for(var i = 0; i < ds_list_size(outputs); i++) {
|
||||||
var _ot = outputs[| i];
|
var _ot = outputs[| i];
|
||||||
|
|
||||||
|
@ -361,25 +375,25 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
||||||
var _to = _ot.value_to[| j];
|
var _to = _ot.value_to[| j];
|
||||||
if(!_to.node.active || _to.value_from == noone) continue;
|
if(!_to.node.active || _to.value_from == noone) continue;
|
||||||
|
|
||||||
printIf(global.RENDER_LOG, " |--> Check render " + _to.node.name + " from " + _to.value_from.node.name);
|
LOG_IF(global.RENDER_LOG, "Check render " + _to.node.name + " from " + _to.value_from.node.name);
|
||||||
if(_to.value_from.node != self) continue;
|
if(_to.value_from.node != self) continue;
|
||||||
|
|
||||||
printIf(global.RENDER_LOG, " >> Check complete, push " + _to.node.name + " to stack.");
|
LOG_IF(global.RENDER_LOG, "Check complete, push " + _to.node.name + " to stack.");
|
||||||
array_push(nodes, _to.node);
|
array_push(nodes, _to.node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_BLOCK_END();
|
||||||
|
LOG_BLOCK_END();
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static onInspect = function() {}
|
static onInspect = function() {}
|
||||||
|
|
||||||
static setRenderStatus = function(result) {
|
static setRenderStatus = function(result) {
|
||||||
printIf(global.RENDER_LOG, " >> Set render status for " + name + " : " + string(result));
|
LOG_LINE_IF(global.RENDER_LOG, "Set render status for " + name + " : " + string(result));
|
||||||
rendered = result;
|
|
||||||
|
|
||||||
if(!result && group != noone)
|
rendered = result;
|
||||||
group.setRenderStatus(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static pointIn = function(_x, _y, _mx, _my, _s) {
|
static pointIn = function(_x, _y, _mx, _my, _s) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||||
//group.setRenderStatus(true);
|
//group.setRenderStatus(true);
|
||||||
//printIf(global.RENDER_LOG, "Value to amount " + string(ds_list_size(outParent.value_to)));
|
//printIf(global.RENDER_LOG, "Value to amount " + string(ds_list_size(outParent.value_to)));
|
||||||
|
|
||||||
|
LOG_BLOCK_START();
|
||||||
var nodes = [];
|
var nodes = [];
|
||||||
for(var j = 0; j < ds_list_size(outParent.value_to); j++) {
|
for(var j = 0; j < ds_list_size(outParent.value_to); j++) {
|
||||||
var _to = outParent.value_to[| j];
|
var _to = outParent.value_to[| j];
|
||||||
|
@ -48,8 +49,9 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||||
//printIf(global.RENDER_LOG, "Group output ready " + string(_to.node.isRenderable()));
|
//printIf(global.RENDER_LOG, "Group output ready " + string(_to.node.isRenderable()));
|
||||||
|
|
||||||
array_push(nodes, _to.node);
|
array_push(nodes, _to.node);
|
||||||
printIf(global.RENDER_LOG, " >> Check complete, push " + _to.node.name + " to stack.");
|
LOG_IF(global.RENDER_LOG, "Check complete, push " + _to.node.name + " to stack.");
|
||||||
}
|
}
|
||||||
|
LOG_BLOCK_END();
|
||||||
|
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@ function Node_Iterate(_x, _y, _group = noone) : Node_Collection(_x, _y, _group)
|
||||||
}
|
}
|
||||||
|
|
||||||
static initLoop = function() {
|
static initLoop = function() {
|
||||||
|
resetRender();
|
||||||
|
|
||||||
iterated = 0;
|
iterated = 0;
|
||||||
loop_start_time = get_timer();
|
loop_start_time = get_timer();
|
||||||
var node_list = getNodeList();
|
var node_list = getNodeList();
|
||||||
|
@ -37,7 +39,7 @@ function Node_Iterate(_x, _y, _group = noone) : Node_Collection(_x, _y, _group)
|
||||||
n.initLoop();
|
n.initLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
printIf(global.RENDER_LOG, " > Loop begin");
|
LOG_LINE_IF(global.RENDER_LOG, "Loop begin");
|
||||||
}
|
}
|
||||||
|
|
||||||
static getNextNodes = function() {
|
static getNextNodes = function() {
|
||||||
|
@ -73,7 +75,7 @@ function Node_Iterate(_x, _y, _group = noone) : Node_Collection(_x, _y, _group)
|
||||||
return ITERATION_STATUS.complete;
|
return ITERATION_STATUS.complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
resetAllRenderStatus();
|
resetRender();
|
||||||
return ITERATION_STATUS.loop;
|
return ITERATION_STATUS.loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,10 @@ function Node_Iterate_Each(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr
|
||||||
output.inputs[| 0].setFrom(input.outputs[| 0]);
|
output.inputs[| 0].setFrom(input.outputs[| 0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getNextNodesRaw = function() {
|
||||||
|
return __nodeLeafList(getNodeList());
|
||||||
|
}
|
||||||
|
|
||||||
static getNextNodes = function() {
|
static getNextNodes = function() {
|
||||||
initLoop();
|
initLoop();
|
||||||
return __nodeLeafList(getNodeList());
|
return __nodeLeafList(getNodeList());
|
||||||
|
@ -34,6 +38,7 @@ function Node_Iterate_Each(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr
|
||||||
}
|
}
|
||||||
|
|
||||||
static initLoop = function() {
|
static initLoop = function() {
|
||||||
|
resetRender();
|
||||||
iterated = 0;
|
iterated = 0;
|
||||||
loop_start_time = get_timer();
|
loop_start_time = get_timer();
|
||||||
|
|
||||||
|
@ -45,25 +50,44 @@ function Node_Iterate_Each(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr
|
||||||
outputs[| 0].setValue([])
|
outputs[| 0].setValue([])
|
||||||
}
|
}
|
||||||
|
|
||||||
printIf(global.RENDER_LOG, " > Loop begin");
|
LOG_LINE_IF(global.RENDER_LOG, "Loop begin");
|
||||||
}
|
}
|
||||||
|
|
||||||
static iterationStatus = function() {
|
static getIterationCount = function() {
|
||||||
var iter = true;
|
|
||||||
var arrIn = inputs[| 0].getValue();
|
var arrIn = inputs[| 0].getValue();
|
||||||
var maxIter = is_array(arrIn)? array_length(arrIn) : 0;
|
var maxIter = is_array(arrIn)? array_length(arrIn) : 0;
|
||||||
if(!is_real(maxIter)) maxIter = 1;
|
if(!is_real(maxIter)) maxIter = 1;
|
||||||
|
|
||||||
iterated++;
|
return maxIter;
|
||||||
//print("Iterating " + string(iterated) + "/" + string(maxIter))
|
}
|
||||||
|
|
||||||
if(iterated >= maxIter) {
|
static iterationUpdate = function() {
|
||||||
render_time = get_timer() - loop_start_time;
|
var siz = ds_list_size(outputs); // check if every output is updated
|
||||||
iterated = 0;
|
for( var i = custom_output_index; i < siz; i++ ) {
|
||||||
return ITERATION_STATUS.complete;
|
var _o = outputs[| i];
|
||||||
|
if(_o.node.rendered) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
resetAllRenderStatus();
|
var maxIter = getIterationCount();
|
||||||
|
iterated++;
|
||||||
|
|
||||||
|
LOG_BLOCK_START();
|
||||||
|
LOG_IF(global.RENDER_LOG, "Iteration update: " + string(iterated) + "/" + string(maxIter));
|
||||||
|
|
||||||
|
if(iterated >= maxIter) {
|
||||||
|
LOG_IF(global.RENDER_LOG, "Iteration complete");
|
||||||
|
render_time = get_timer() - loop_start_time;
|
||||||
|
} else {
|
||||||
|
LOG_IF(global.RENDER_LOG, "Iteration not completed, reset render status.");
|
||||||
|
resetRender();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_BLOCK_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
static iterationStatus = function() {
|
||||||
|
if(iterated >= getIterationCount())
|
||||||
|
return ITERATION_STATUS.complete;
|
||||||
return ITERATION_STATUS.loop;
|
return ITERATION_STATUS.loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Collection(_x, _y, _
|
||||||
inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, [] )
|
inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, [] )
|
||||||
.setVisible(true, true);
|
.setVisible(true, true);
|
||||||
|
|
||||||
outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, [] );
|
outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, noone );
|
||||||
|
|
||||||
custom_input_index = ds_list_size(inputs);
|
custom_input_index = ds_list_size(inputs);
|
||||||
custom_output_index = ds_list_size(inputs);
|
custom_output_index = ds_list_size(inputs);
|
||||||
|
@ -36,6 +36,7 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Collection(_x, _y, _
|
||||||
}
|
}
|
||||||
|
|
||||||
static initLoop = function() {
|
static initLoop = function() {
|
||||||
|
resetRender();
|
||||||
iterated = 0;
|
iterated = 0;
|
||||||
loop_start_time = get_timer();
|
loop_start_time = get_timer();
|
||||||
|
|
||||||
|
@ -45,24 +46,38 @@ function Node_Iterate_Filter(_x, _y, _group = noone) : Node_Collection(_x, _y, _
|
||||||
surface_array_free(arrOut);
|
surface_array_free(arrOut);
|
||||||
outputs[| 0].setValue([])
|
outputs[| 0].setValue([])
|
||||||
|
|
||||||
printIf(global.RENDER_LOG, " > Loop begin");
|
LOG("Loop begin");
|
||||||
|
var _val = outputs[| 0].getValue();
|
||||||
|
LOG("Output original value " + string(_val));
|
||||||
}
|
}
|
||||||
|
|
||||||
static iterationStatus = function() {
|
static getIterationCount = function() {
|
||||||
var iter = true;
|
|
||||||
var arrIn = inputs[| 0].getValue();
|
var arrIn = inputs[| 0].getValue();
|
||||||
var maxIter = is_array(arrIn)? array_length(arrIn) : 0;
|
var maxIter = is_array(arrIn)? array_length(arrIn) : 0;
|
||||||
if(!is_real(maxIter)) maxIter = 1;
|
if(!is_real(maxIter)) maxIter = 1;
|
||||||
|
|
||||||
iterated++;
|
return maxIter;
|
||||||
|
}
|
||||||
if(iterated >= maxIter) {
|
|
||||||
render_time = get_timer() - loop_start_time;
|
static iterationUpdate = function() {
|
||||||
iterated = 0;
|
var siz = ds_list_size(outputs); // check if every output is updated
|
||||||
return ITERATION_STATUS.complete;
|
for( var i = custom_output_index; i < siz; i++ ) {
|
||||||
|
var _o = outputs[| i];
|
||||||
|
if(_o.node.rendered) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
resetAllRenderStatus();
|
var maxIter = getIterationCount();
|
||||||
|
iterated++;
|
||||||
|
|
||||||
|
if(iterated >= maxIter)
|
||||||
|
render_time = get_timer() - loop_start_time;
|
||||||
|
else
|
||||||
|
resetRender();
|
||||||
|
}
|
||||||
|
|
||||||
|
static iterationStatus = function() {
|
||||||
|
if(iterated >= getIterationCount())
|
||||||
|
return ITERATION_STATUS.complete;
|
||||||
return ITERATION_STATUS.loop;
|
return ITERATION_STATUS.loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,31 +10,42 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group
|
||||||
outputs[| 0] = nodeValue("Preview", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0 )
|
outputs[| 0] = nodeValue("Preview", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0 )
|
||||||
.setVisible(false);
|
.setVisible(false);
|
||||||
|
|
||||||
|
static getNextNodesRaw = function() {
|
||||||
|
var nodes = [];
|
||||||
|
|
||||||
|
var _ot = group.outputs[| 0];
|
||||||
|
for(var j = 0; j < ds_list_size(_ot.value_to); j++) {
|
||||||
|
var _to = _ot.value_to[| j];
|
||||||
|
if(!_to.node.renderActive) continue;
|
||||||
|
|
||||||
|
if(_to.node.active && _to.value_from != noone && _to.value_from.node == group) {
|
||||||
|
if(_to.node.isRenderable())
|
||||||
|
array_push(nodes, _to.node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nodes;
|
||||||
|
}
|
||||||
|
|
||||||
static getNextNodes = function() {
|
static getNextNodes = function() {
|
||||||
if(!struct_has(group, "iterationStatus")) return [];
|
if(!struct_has(group, "iterationStatus")) return [];
|
||||||
var _ren = group.iterationStatus();
|
var _ren = group.iterationStatus();
|
||||||
var nodes = [];
|
var nodes = [];
|
||||||
|
|
||||||
|
LOG_BLOCK_START();
|
||||||
|
LOG_IF(global.RENDER_LOG, "Call get next node from loop output.");
|
||||||
|
|
||||||
if(_ren == ITERATION_STATUS.loop) { //Go back to the beginning of the loop, reset render status for leaf node inside?
|
if(_ren == ITERATION_STATUS.loop) { //Go back to the beginning of the loop, reset render status for leaf node inside?
|
||||||
printIf(global.RENDER_LOG, " > Loop restart: iteration " + string(group.iterated));
|
LOG_IF(global.RENDER_LOG, "Loop restart: iteration " + string(group.iterated));
|
||||||
nodes = array_append(nodes, __nodeLeafList(group.getNodeList()));
|
nodes = array_append(nodes, __nodeLeafList(group.getNodeList()));
|
||||||
} else if(_ren == ITERATION_STATUS.complete) { //Go out of loop
|
} else if(_ren == ITERATION_STATUS.complete) { //Go out of loop
|
||||||
printIf(global.RENDER_LOG, " > Loop completed");
|
LOG_IF(global.RENDER_LOG, "Loop completed");
|
||||||
group.setRenderStatus(true);
|
group.setRenderStatus(true);
|
||||||
|
nodes = getNextNodesRaw();
|
||||||
var _ot = group.outputs[| 0];
|
|
||||||
for(var j = 0; j < ds_list_size(_ot.value_to); j++) {
|
|
||||||
var _to = _ot.value_to[| j];
|
|
||||||
if(!_to.node.renderActive) continue;
|
|
||||||
|
|
||||||
if(_to.node.active && _to.value_from != noone && _to.value_from.node == group) {
|
|
||||||
_to.node.triggerRender();
|
|
||||||
if(_to.node.isRenderable())
|
|
||||||
array_push(nodes, _to.node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
printIf(global.RENDER_LOG, " > Loop not ready");
|
LOG_IF(global.RENDER_LOG, "Loop not ready");
|
||||||
|
|
||||||
|
LOG_BLOCK_END();
|
||||||
|
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +85,8 @@ function Node_Iterator_Each_Output(_x, _y, _group = noone) : Node(_x, _y, _group
|
||||||
|
|
||||||
_val[@ ind] = cloneValue(array_safe_get(_val, ind), inputs[| 0].getValue());
|
_val[@ ind] = cloneValue(array_safe_get(_val, ind), inputs[| 0].getValue());
|
||||||
|
|
||||||
group.outputs[| 0].setValue(_val);
|
|
||||||
outputs[| 0].setValue(_val);
|
outputs[| 0].setValue(_val);
|
||||||
|
group.outputs[| 0].setValue(_val);
|
||||||
|
group.iterationUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,31 +10,42 @@ function Node_Iterator_Filter_Output(_x, _y, _group = noone) : Node(_x, _y, _gro
|
||||||
inputs[| 1] = nodeValue("Result", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false )
|
inputs[| 1] = nodeValue("Result", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false )
|
||||||
.setVisible(true, true);
|
.setVisible(true, true);
|
||||||
|
|
||||||
|
static getNextNodesRaw = function() {
|
||||||
|
var nodes = [];
|
||||||
|
|
||||||
|
var _ot = group.outputs[| 0];
|
||||||
|
for(var j = 0; j < ds_list_size(_ot.value_to); j++) {
|
||||||
|
var _to = _ot.value_to[| j];
|
||||||
|
if(!_to.node.renderActive) continue;
|
||||||
|
|
||||||
|
if(_to.node.active && _to.value_from != noone && _to.value_from.node == group) {
|
||||||
|
if(_to.node.isRenderable())
|
||||||
|
array_push(nodes, _to.node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nodes;
|
||||||
|
}
|
||||||
|
|
||||||
static getNextNodes = function() {
|
static getNextNodes = function() {
|
||||||
if(!struct_has(group, "iterationStatus")) return [];
|
if(!struct_has(group, "iterationStatus")) return [];
|
||||||
var _ren = group.iterationStatus();
|
var _ren = group.iterationStatus();
|
||||||
var nodes = [];
|
var nodes = [];
|
||||||
|
|
||||||
|
LOG_BLOCK_START();
|
||||||
|
LOG_IF(global.RENDER_LOG, "Call get next node from loop output.");
|
||||||
|
|
||||||
if(_ren == ITERATION_STATUS.loop) { //Go back to the beginning of the loop, reset render status for leaf node inside?
|
if(_ren == ITERATION_STATUS.loop) { //Go back to the beginning of the loop, reset render status for leaf node inside?
|
||||||
printIf(global.RENDER_LOG, " > Loop restart: iteration " + string(group.iterated));
|
LOG_IF(global.RENDER_LOG, "Loop restart: iteration " + string(group.iterated));
|
||||||
nodes = array_append(nodes, __nodeLeafList(group.getNodeList()));
|
nodes = array_append(nodes, __nodeLeafList(group.getNodeList()));
|
||||||
} else if(_ren == ITERATION_STATUS.complete) { //Go out of loop
|
} else if(_ren == ITERATION_STATUS.complete) { //Go out of loop
|
||||||
printIf(global.RENDER_LOG, " > Loop completed");
|
LOG_IF(global.RENDER_LOG, "Loop completed");
|
||||||
group.setRenderStatus(true);
|
group.setRenderStatus(true);
|
||||||
|
nodes = getNextNodesRaw();
|
||||||
var _ot = group.outputs[| 0];
|
|
||||||
for(var j = 0; j < ds_list_size(_ot.value_to); j++) {
|
|
||||||
var _to = _ot.value_to[| j];
|
|
||||||
if(!_to.node.renderActive) continue;
|
|
||||||
|
|
||||||
if(_to.node.active && _to.value_from != noone && _to.value_from.node == group) {
|
|
||||||
_to.node.triggerRender();
|
|
||||||
if(_to.node.isRenderable())
|
|
||||||
array_push(nodes, _to.node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
printIf(global.RENDER_LOG, " > Loop not ready");
|
LOG_IF(global.RENDER_LOG, "Loop not ready");
|
||||||
|
|
||||||
|
LOG_BLOCK_END();
|
||||||
|
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +78,9 @@ function Node_Iterator_Filter_Output(_x, _y, _group = noone) : Node(_x, _y, _gro
|
||||||
array_push(_val, _new_val);
|
array_push(_val, _new_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG("Value " + string(val) + " filter result " + string(res) + " to array " + string(_val));
|
||||||
|
|
||||||
group.outputs[| 0].setValue(_val);
|
group.outputs[| 0].setValue(_val);
|
||||||
|
group.iterationUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -37,11 +37,15 @@ function Node_Iterator_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y
|
||||||
if(!struct_has(_node_it, "iterationStatus")) return nodes;
|
if(!struct_has(_node_it, "iterationStatus")) return nodes;
|
||||||
var _ren = _node_it.iterationStatus();
|
var _ren = _node_it.iterationStatus();
|
||||||
|
|
||||||
|
LOG_BLOCK_START();
|
||||||
|
|
||||||
if(_ren == ITERATION_STATUS.loop) { //Go back to the beginning of the loop, reset render status for leaf node inside?
|
if(_ren == ITERATION_STATUS.loop) { //Go back to the beginning of the loop, reset render status for leaf node inside?
|
||||||
printIf(global.RENDER_LOG, " > Loop restart: iteration " + string(group.iterated));
|
LOG_IF(global.RENDER_LOG, "Loop restart: iteration " + string(group.iterated));
|
||||||
|
|
||||||
|
group.resetRender();
|
||||||
nodes = array_append(nodes, __nodeLeafList(group.getNodeList()));
|
nodes = array_append(nodes, __nodeLeafList(group.getNodeList()));
|
||||||
} else if(_ren == ITERATION_STATUS.complete) { //Go out of loop
|
} else if(_ren == ITERATION_STATUS.complete) { //Go out of loop
|
||||||
printIf(global.RENDER_LOG, " > Loop completed");
|
LOG_IF(global.RENDER_LOG, "Loop completed");
|
||||||
group.setRenderStatus(true);
|
group.setRenderStatus(true);
|
||||||
var _ot = outParent;
|
var _ot = outParent;
|
||||||
for(var j = 0; j < ds_list_size(_ot.value_to); j++) {
|
for(var j = 0; j < ds_list_size(_ot.value_to); j++) {
|
||||||
|
@ -54,8 +58,10 @@ function Node_Iterator_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
printIf(global.RENDER_LOG, " > Loop not ready");
|
LOG_IF(global.RENDER_LOG, "Loop not ready");
|
||||||
|
|
||||||
|
LOG_BLOCK_END();
|
||||||
|
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,15 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
||||||
if(inputs[| i + 2].editWidget != noone)
|
if(inputs[| i + 2].editWidget != noone)
|
||||||
inputs[| i + 2].editWidget.interactable = true;
|
inputs[| i + 2].editWidget.interactable = true;
|
||||||
|
|
||||||
|
var type = inputs[| i + 1].getValue();
|
||||||
|
switch(type) {
|
||||||
|
case 0 : inputs[| i + 2].type = VALUE_TYPE.float; break;
|
||||||
|
case 1 : inputs[| i + 2].type = VALUE_TYPE.text; break;
|
||||||
|
case 2 : inputs[| i + 2].type = VALUE_TYPE.surface; break;
|
||||||
|
case 3 : inputs[| i + 2].type = VALUE_TYPE.struct; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
inputs[| i + 2].setDisplay(VALUE_DISPLAY._default);
|
||||||
array_push(input_display_list, i + 2);
|
array_push(input_display_list, i + 2);
|
||||||
} else {
|
} else {
|
||||||
delete inputs[| i + 0];
|
delete inputs[| i + 0];
|
||||||
|
@ -139,24 +148,9 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
||||||
compiled = false;
|
compiled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(index < input_fix_len) return;
|
|
||||||
if(LOADING || APPENDING) return;
|
if(LOADING || APPENDING) return;
|
||||||
|
|
||||||
compiled = false;
|
compiled = false;
|
||||||
|
|
||||||
if(safe_mod(index - input_fix_len, data_length) == 1) { //Variable type
|
|
||||||
var type = inputs[| index].getValue();
|
|
||||||
|
|
||||||
switch(type) {
|
|
||||||
case 0 : inputs[| index + 1].type = VALUE_TYPE.float; break;
|
|
||||||
case 1 : inputs[| index + 1].type = VALUE_TYPE.text; break;
|
|
||||||
case 2 : inputs[| index + 1].type = VALUE_TYPE.surface; break;
|
|
||||||
case 3 : inputs[| index + 1].type = VALUE_TYPE.struct; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
inputs[| index + 1].setDisplay(VALUE_DISPLAY._default);
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshDynamicInput();
|
refreshDynamicInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,18 +100,15 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
||||||
if(inputs[| i + 2].editWidget != noone)
|
if(inputs[| i + 2].editWidget != noone)
|
||||||
inputs[| i + 2].editWidget.interactable = true;
|
inputs[| i + 2].editWidget.interactable = true;
|
||||||
|
|
||||||
if(LOADING || APPENDING) {
|
var type = inputs[| i + 1].getValue();
|
||||||
var type = inputs[| i + 1].getValue();
|
switch(type) {
|
||||||
switch(type) {
|
case 0 : inputs[| i + 2].type = VALUE_TYPE.float; break;
|
||||||
case 0 : inputs[| i + 2].type = VALUE_TYPE.float; break;
|
case 1 : inputs[| i + 2].type = VALUE_TYPE.text; break;
|
||||||
case 1 : inputs[| i + 2].type = VALUE_TYPE.text; break;
|
case 2 : inputs[| i + 2].type = VALUE_TYPE.surface; break;
|
||||||
case 2 : inputs[| i + 2].type = VALUE_TYPE.surface; break;
|
case 3 : inputs[| i + 2].type = VALUE_TYPE.struct; break;
|
||||||
case 3 : inputs[| i + 2].type = VALUE_TYPE.struct; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
inputs[| i + 2].setDisplay(VALUE_DISPLAY._default);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inputs[| i + 2].setDisplay(VALUE_DISPLAY._default);
|
||||||
array_push(input_display_list, i + 2);
|
array_push(input_display_list, i + 2);
|
||||||
} else {
|
} else {
|
||||||
delete inputs[| i + 0];
|
delete inputs[| i + 0];
|
||||||
|
@ -145,24 +142,9 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
||||||
compiled = false;
|
compiled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(index < input_fix_len) return;
|
|
||||||
if(LOADING || APPENDING) return;
|
if(LOADING || APPENDING) return;
|
||||||
|
|
||||||
compiled = false;
|
compiled = false;
|
||||||
|
|
||||||
if(safe_mod(index - input_fix_len, data_length) == 1) { //Variable type
|
|
||||||
var type = inputs[| index].getValue();
|
|
||||||
|
|
||||||
switch(type) {
|
|
||||||
case 0 : inputs[| index + 1].type = VALUE_TYPE.float; break;
|
|
||||||
case 1 : inputs[| index + 1].type = VALUE_TYPE.text; break;
|
|
||||||
case 2 : inputs[| index + 1].type = VALUE_TYPE.surface; break;
|
|
||||||
case 3 : inputs[| index + 1].type = VALUE_TYPE.struct; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
inputs[| index + 1].setDisplay(VALUE_DISPLAY._default);
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshDynamicInput();
|
refreshDynamicInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
|
||||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||||
|
|
||||||
attribute_surface_depth();
|
attribute_surface_depth();
|
||||||
|
attribute_interpolation();
|
||||||
|
|
||||||
array_insert(input_display_list, 0, ["Output", true], input_len + 0);
|
array_insert(input_display_list, 0, ["Output", true], input_len + 0);
|
||||||
array_push(input_display_list, input_len + 1, input_len + 2);
|
array_push(input_display_list, input_len + 1, input_len + 2);
|
||||||
|
@ -74,9 +75,8 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
|
||||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
||||||
outputs[| 0].setValue(_outSurf);
|
outputs[| 0].setValue(_outSurf);
|
||||||
|
|
||||||
surface_set_target(_outSurf);
|
surface_set_shader(_outSurf);
|
||||||
DRAW_CLEAR
|
shader_set_interpolation(_outSurf);
|
||||||
|
|
||||||
if(_blend == PARTICLE_BLEND_MODE.normal)
|
if(_blend == PARTICLE_BLEND_MODE.normal)
|
||||||
BLEND_NORMAL;
|
BLEND_NORMAL;
|
||||||
else if(_blend == PARTICLE_BLEND_MODE.alpha)
|
else if(_blend == PARTICLE_BLEND_MODE.alpha)
|
||||||
|
@ -91,7 +91,7 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
|
||||||
parts[i].draw(_exact, surf_w, surf_h);
|
parts[i].draw(_exact, surf_w, surf_h);
|
||||||
|
|
||||||
BLEND_NORMAL;
|
BLEND_NORMAL;
|
||||||
surface_reset_target();
|
surface_reset_shader();
|
||||||
|
|
||||||
if(ANIMATOR.is_playing)
|
if(ANIMATOR.is_playing)
|
||||||
cacheCurrentFrame(_outSurf);
|
cacheCurrentFrame(_outSurf);
|
||||||
|
|
|
@ -10,29 +10,33 @@ function Node_Surface_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _
|
||||||
inputs[| 2] = nodeValue("Replacement Image", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone )
|
inputs[| 2] = nodeValue("Replacement Image", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone )
|
||||||
.setArrayDepth(1);
|
.setArrayDepth(1);
|
||||||
|
|
||||||
inputs[| 3] = nodeValue("Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1 )
|
inputs[| 3] = nodeValue("Color Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1, "How similiar the color need to be in order to be count as matched." )
|
||||||
.setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01 ]);
|
.setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01 ]);
|
||||||
|
|
||||||
inputs[| 4] = nodeValue("Draw Base Image", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true )
|
inputs[| 4] = nodeValue("Draw Base Image", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true )
|
||||||
|
|
||||||
inputs[| 5] = nodeValue("Fast Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true )
|
inputs[| 5] = nodeValue("Fast Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true )
|
||||||
|
|
||||||
|
inputs[| 6] = nodeValue("Pixel Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1, "How many pixel need to me matched to replace with replacement image." )
|
||||||
|
.setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01 ]);
|
||||||
|
|
||||||
outputs[| 0] = nodeValue("Surface Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
outputs[| 0] = nodeValue("Surface Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||||
|
|
||||||
input_display_list = [
|
input_display_list = [
|
||||||
["Surface", true], 0, 1, 2,
|
["Surface", true], 0, 1, 2,
|
||||||
["Searching", false], 5, 3,
|
["Searching", false], 5, 3, 6,
|
||||||
["Render", false], 4,
|
["Render", false], 4,
|
||||||
];
|
];
|
||||||
|
|
||||||
temp_surface = [ surface_create(1, 1) ];
|
temp_surface = [ surface_create(1, 1) ];
|
||||||
|
|
||||||
static matchTemplate = function(_index, _surf, _base, _target, _thr, _fst) {
|
static matchTemplate = function(_index, _surf, _base, _target, _cthr, _pthr, _fst) {
|
||||||
surface_set_shader(_surf, _fst? sh_surface_replace_fast_find : sh_surface_replace_find, false);
|
surface_set_shader(_surf, _fst? sh_surface_replace_fast_find : sh_surface_replace_find, false);
|
||||||
shader_set_f("dimension", surface_get_width(_base), surface_get_height(_base));
|
shader_set_f("dimension", surface_get_width(_base), surface_get_height(_base));
|
||||||
shader_set_surface("target", _target);
|
shader_set_surface("target", _target);
|
||||||
shader_set_f("target_dim", surface_get_width(_target), surface_get_height(_target));
|
shader_set_f("target_dim", surface_get_width(_target), surface_get_height(_target));
|
||||||
shader_set_f("threshold", _thr);
|
shader_set_f("colorThreshold", _cthr);
|
||||||
|
shader_set_f("pixelThreshold", _pthr);
|
||||||
shader_set_f("index", _index);
|
shader_set_f("index", _index);
|
||||||
|
|
||||||
BLEND_ADD
|
BLEND_ADD
|
||||||
|
@ -41,7 +45,7 @@ function Node_Surface_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _
|
||||||
surface_reset_shader();
|
surface_reset_shader();
|
||||||
}
|
}
|
||||||
|
|
||||||
static replaceTemplate = function(_index, _surf, _base, _res, _replace, _thr, _fst) {
|
static replaceTemplate = function(_index, _surf, _base, _res, _replace, _fst) {
|
||||||
surface_set_shader(_surf, _fst? sh_surface_replace_fast_replace : sh_surface_replace_replace, false, BLEND.normal);
|
surface_set_shader(_surf, _fst? sh_surface_replace_fast_replace : sh_surface_replace_replace, false, BLEND.normal);
|
||||||
shader_set_f("dimension", surface_get_width(_base), surface_get_height(_base));
|
shader_set_f("dimension", surface_get_width(_base), surface_get_height(_base));
|
||||||
shader_set_surface("replace", _replace);
|
shader_set_surface("replace", _replace);
|
||||||
|
@ -57,10 +61,12 @@ function Node_Surface_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _
|
||||||
var _bas = _data[0];
|
var _bas = _data[0];
|
||||||
var _tar = _data[1];
|
var _tar = _data[1];
|
||||||
var _rep = _data[2];
|
var _rep = _data[2];
|
||||||
var _thr = _data[3];
|
|
||||||
var _drw = _data[4];
|
var _drw = _data[4];
|
||||||
var _fst = _data[5];
|
var _fst = _data[5];
|
||||||
|
|
||||||
|
var _cthr = _data[3];
|
||||||
|
var _pthr = _data[6];
|
||||||
|
|
||||||
if(!is_array(_tar)) _tar = [ _tar ];
|
if(!is_array(_tar)) _tar = [ _tar ];
|
||||||
if(!is_array(_rep)) _rep = [ _rep ];
|
if(!is_array(_rep)) _rep = [ _rep ];
|
||||||
|
|
||||||
|
@ -71,7 +77,7 @@ function Node_Surface_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _
|
||||||
|
|
||||||
var amo = array_length(_tar);
|
var amo = array_length(_tar);
|
||||||
for( var i = 0; i < amo; i++ )
|
for( var i = 0; i < amo; i++ )
|
||||||
matchTemplate(i / amo, temp_surface[0], _bas, _tar[i], _thr, _fst);
|
matchTemplate(i / amo, temp_surface[0], _bas, _tar[i], _cthr, _pthr, _fst);
|
||||||
|
|
||||||
_outSurf = surface_verify(_outSurf, surface_get_width(_bas), surface_get_height(_bas));
|
_outSurf = surface_verify(_outSurf, surface_get_width(_bas), surface_get_height(_bas));
|
||||||
surface_set_target(_outSurf);
|
surface_set_target(_outSurf);
|
||||||
|
@ -81,7 +87,7 @@ function Node_Surface_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _
|
||||||
|
|
||||||
var amo = array_length(_rep);
|
var amo = array_length(_rep);
|
||||||
for( var i = 0; i < amo; i++ )
|
for( var i = 0; i < amo; i++ )
|
||||||
replaceTemplate(i / amo, _outSurf, _bas, temp_surface[0], _rep[i], _thr, _fst, _drw);
|
replaceTemplate(i / amo, _outSurf, _bas, temp_surface[0], _rep[i], _fst, _drw);
|
||||||
return _outSurf;
|
return _outSurf;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -127,7 +127,6 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
|
|
||||||
repeat(amo) {
|
repeat(amo) {
|
||||||
if(TUNNELS_OUT[? k] == _key) {
|
if(TUNNELS_OUT[? k] == _key) {
|
||||||
NODE_MAP[? k].triggerRender();
|
|
||||||
array_push(nodes, NODE_MAP[? k]);
|
array_push(nodes, NODE_MAP[? k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,20 +13,21 @@ enum RENDER_TYPE {
|
||||||
|
|
||||||
function __nodeLeafList(_list) {
|
function __nodeLeafList(_list) {
|
||||||
var nodes = [];
|
var nodes = [];
|
||||||
|
LOG_BLOCK_START();
|
||||||
|
|
||||||
for( var i = 0; i < ds_list_size(_list); i++ ) {
|
for( var i = 0; i < ds_list_size(_list); i++ ) {
|
||||||
var _node = _list[| i];
|
var _node = _list[| i];
|
||||||
if(!_node.active) continue;
|
if(!_node.active) continue;
|
||||||
if(!_node.renderActive) continue;
|
if(!_node.renderActive) continue;
|
||||||
|
|
||||||
_node.triggerRender();
|
|
||||||
var _startNode = _node.isRenderable();
|
var _startNode = _node.isRenderable();
|
||||||
if(_startNode) {
|
if(_startNode) {
|
||||||
array_push(nodes, _node);
|
array_push(nodes, _node);
|
||||||
printIf(global.RENDER_LOG, " > Push node " + _node.name + " to stack");
|
LOG_IF(global.RENDER_LOG, "Push node " + _node.name + " to stack");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_BLOCK_END();
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +53,8 @@ function __nodeInLoop(_node) {
|
||||||
|
|
||||||
function Render(partial = false, runAction = false) {
|
function Render(partial = false, runAction = false) {
|
||||||
var t = current_time;
|
var t = current_time;
|
||||||
printIf(global.RENDER_LOG, "=== RENDER START [frame " + string(ANIMATOR.current_frame) + "] ===");
|
LOG_BLOCK_START();
|
||||||
|
LOG_IF(global.RENDER_LOG, "=== RENDER START [frame " + string(ANIMATOR.current_frame) + "] ===");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var rendering = noone;
|
var rendering = noone;
|
||||||
|
@ -80,33 +82,43 @@ function Render(partial = false, runAction = false) {
|
||||||
if(is_undefined(_node)) continue;
|
if(is_undefined(_node)) continue;
|
||||||
if(!is_struct(_node)) continue;
|
if(!is_struct(_node)) continue;
|
||||||
if(array_exists(global.group_inputs, instanceof(_node))) continue;
|
if(array_exists(global.group_inputs, instanceof(_node))) continue;
|
||||||
|
|
||||||
if(!_node.active) continue;
|
if(!_node.active) continue;
|
||||||
if(!_node.renderActive) continue;
|
if(!_node.renderActive) continue;
|
||||||
if(_node.rendered) {
|
if(_node.rendered) {
|
||||||
printIf(global.RENDER_LOG, " > Skip rendered " + _node.name + " (" + _node.display_name + ")");
|
LOG_IF(global.RENDER_LOG, "Skip rendered " + _node.name + " (" + _node.display_name + ")");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(__nodeInLoop(_node)) continue;
|
if(__nodeInLoop(_node)) continue;
|
||||||
|
|
||||||
|
LOG_BLOCK_START();
|
||||||
|
|
||||||
var _startNode = _node.isRenderable(global.RENDER_LOG);
|
var _startNode = _node.isRenderable(global.RENDER_LOG);
|
||||||
if(_startNode) {
|
if(_startNode) {
|
||||||
printIf(global.RENDER_LOG, " > Found leaf " + _node.name + " (" + _node.display_name + ")");
|
LOG_IF(global.RENDER_LOG, "Found leaf " + _node.name + " (" + _node.display_name + ")");
|
||||||
|
|
||||||
_node.triggerRender();
|
_node.triggerRender();
|
||||||
ds_queue_enqueue(RENDER_QUEUE, _node);
|
ds_queue_enqueue(RENDER_QUEUE, _node);
|
||||||
} else
|
} else
|
||||||
printIf(global.RENDER_LOG, " > Skip leaf " + _node.name + " (" + _node.display_name + ")");
|
LOG_IF(global.RENDER_LOG, "Skip non-leaf " + _node.name + " (" + _node.display_name + ")");
|
||||||
|
|
||||||
|
LOG_BLOCK_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_IF(global.RENDER_LOG, "Get leaf complete: found " + string(ds_queue_size(RENDER_QUEUE)) + " leaves.");
|
||||||
|
LOG_IF(global.RENDER_LOG, "Start rendering...");
|
||||||
|
|
||||||
// render forward
|
// render forward
|
||||||
while(!ds_queue_empty(RENDER_QUEUE)) {
|
while(!ds_queue_empty(RENDER_QUEUE)) {
|
||||||
rendering = ds_queue_dequeue(RENDER_QUEUE);
|
rendering = ds_queue_dequeue(RENDER_QUEUE);
|
||||||
|
|
||||||
var txt = rendering.rendered? " [Skip]" : " [Update]";
|
|
||||||
|
|
||||||
if(!rendering.rendered) {
|
LOG_BLOCK_START();
|
||||||
|
LOG_IF(global.RENDER_LOG, "Rendering " + rendering.name + " (" + rendering.display_name + ")");
|
||||||
|
|
||||||
|
var txt = rendering.isRenderable()? " [Update]" : " [Skip]";
|
||||||
|
|
||||||
|
if(rendering.isRenderable()) {
|
||||||
rendering.doUpdate();
|
rendering.doUpdate();
|
||||||
|
|
||||||
var nextNodes = rendering.getNextNodes();
|
var nextNodes = rendering.getNextNodes();
|
||||||
|
@ -117,12 +129,14 @@ function Render(partial = false, runAction = false) {
|
||||||
rendering.inspector1Update();
|
rendering.inspector1Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
printIf(global.RENDER_LOG, "Rendered " + rendering.name + " (" + rendering.display_name + ") [" + string(instanceof(rendering)) + "]" + txt);
|
LOG_IF(global.RENDER_LOG, "Rendered " + rendering.name + " (" + rendering.display_name + ") [" + string(instanceof(rendering)) + "]" + txt);
|
||||||
|
LOG_BLOCK_END();
|
||||||
}
|
}
|
||||||
} catch(e)
|
} catch(e)
|
||||||
noti_warning(exception_print(e));
|
noti_warning(exception_print(e));
|
||||||
|
|
||||||
printIf(global.RENDER_LOG, "=== RENDER COMPLETE IN {" + string(current_time - t) + "ms} ===\n");
|
LOG_IF(global.RENDER_LOG, "=== RENDER COMPLETE IN {" + string(current_time - t) + "ms} ===\n");
|
||||||
|
LOG_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
function __renderListReset(list) {
|
function __renderListReset(list) {
|
||||||
|
|
|
@ -67,7 +67,6 @@ function shader_set_surface(sampler, surface) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function shader_set_interpolation(surface) {
|
function shader_set_interpolation(surface) {
|
||||||
var shader = shader_current();
|
|
||||||
var intp = ds_map_try_get(attributes, "interpolation", 0);
|
var intp = ds_map_try_get(attributes, "interpolation", 0);
|
||||||
|
|
||||||
gpu_set_tex_filter(intp);
|
gpu_set_tex_filter(intp);
|
||||||
|
|
|
@ -7,7 +7,8 @@ varying vec4 v_vColour;
|
||||||
uniform vec2 dimension;
|
uniform vec2 dimension;
|
||||||
uniform sampler2D target;
|
uniform sampler2D target;
|
||||||
uniform vec2 target_dim;
|
uniform vec2 target_dim;
|
||||||
uniform float threshold;
|
uniform float colorThreshold;
|
||||||
|
uniform float pixelThreshold;
|
||||||
uniform float index;
|
uniform float index;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -19,7 +20,7 @@ void main() {
|
||||||
|
|
||||||
vec2 px = v_vTexcoord * dimension;
|
vec2 px = v_vTexcoord * dimension;
|
||||||
float pixels_count = target_dim.x * target_dim.y;
|
float pixels_count = target_dim.x * target_dim.y;
|
||||||
float target_pixels = pixels_count * (1. - threshold);
|
float target_pixels = pixels_count * (1. - pixelThreshold);
|
||||||
float content_px = 0.;
|
float content_px = 0.;
|
||||||
float match = 0.;
|
float match = 0.;
|
||||||
vec2 baseTx = 1. / dimension;
|
vec2 baseTx = 1. / dimension;
|
||||||
|
@ -36,7 +37,7 @@ void main() {
|
||||||
vec4 base = texture2D( gm_BaseTexture, bpx * baseTx );
|
vec4 base = texture2D( gm_BaseTexture, bpx * baseTx );
|
||||||
|
|
||||||
content_px++;
|
content_px++;
|
||||||
if(distance(base, targ) <= 2. * threshold) {
|
if(distance(base, targ) <= 2. * colorThreshold) {
|
||||||
match++;
|
match++;
|
||||||
if(match >= target_pixels) {
|
if(match >= target_pixels) {
|
||||||
gl_FragColor = vec4(1., index, 0., 1.);
|
gl_FragColor = vec4(1., index, 0., 1.);
|
||||||
|
@ -45,7 +46,7 @@ void main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(match / content_px >= (1. - threshold)) {
|
if(match / content_px >= (1. - pixelThreshold)) {
|
||||||
gl_FragColor = vec4(1., index, 0., 1.);
|
gl_FragColor = vec4(1., index, 0., 1.);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ varying vec4 v_vColour;
|
||||||
uniform vec2 dimension;
|
uniform vec2 dimension;
|
||||||
uniform sampler2D target;
|
uniform sampler2D target;
|
||||||
uniform vec2 target_dim;
|
uniform vec2 target_dim;
|
||||||
uniform float threshold;
|
uniform float colorThreshold;
|
||||||
|
uniform float pixelThreshold;
|
||||||
uniform float index;
|
uniform float index;
|
||||||
|
|
||||||
float random (in vec2 st) {
|
float random (in vec2 st) {
|
||||||
|
@ -29,7 +30,7 @@ float matchTemplate(vec2 pos) {
|
||||||
vec4 base = texture2D( gm_BaseTexture, bpx * baseTx );
|
vec4 base = texture2D( gm_BaseTexture, bpx * baseTx );
|
||||||
|
|
||||||
content_px++;
|
content_px++;
|
||||||
if(distance(base, targ) <= 2. * threshold)
|
if(distance(base, targ) <= 2. * colorThreshold)
|
||||||
match++;
|
match++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,5 +64,5 @@ void main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_FragColor = match >= (1. - threshold)? vec4(matchPos, index, 1.) : vec4(vec3(0.), 0.);
|
gl_FragColor = match >= (1. - pixelThreshold)? vec4(matchPos, index, 1.) : vec4(vec3(0.), 0.);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue