Expression bug fixes

This commit is contained in:
Tanasart 2023-08-02 19:11:57 +02:00
parent 1d282222ca
commit 77e7fefff0
44 changed files with 6419 additions and 242 deletions

View file

@ -21,6 +21,7 @@
{"name":"widget","order":9,"path":"folders/dialog/widget.yy",},
{"name":"font","order":7,"path":"folders/font.yy",},
{"name":"functions","order":6,"path":"folders/functions.yy",},
{"name":"action","order":40,"path":"folders/functions/action.yy",},
{"name":"animation","order":19,"path":"folders/functions/animation.yy",},
{"name":"async","order":36,"path":"folders/functions/async.yy",},
{"name":"audio","order":35,"path":"folders/functions/audio.yy",},
@ -829,6 +830,7 @@
{"name":"node_trigger_bool","order":1,"path":"scripts/node_trigger_bool/node_trigger_bool.yy",},
{"name":"s_node_strandSim_gravity","order":4,"path":"sprites/s_node_strandSim_gravity/s_node_strandSim_gravity.yy",},
{"name":"node_VFX_effect_turbulence","order":11,"path":"scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.yy",},
{"name":"action_loader","order":15,"path":"scripts/action_loader/action_loader.yy",},
{"name":"sh_surface_replace_replace","order":1,"path":"shaders/sh_surface_replace_replace/sh_surface_replace_replace.yy",},
{"name":"node_ase_file_read","order":14,"path":"scripts/node_ase_file_read/node_ase_file_read.yy",},
{"name":"s_node_print","order":30,"path":"sprites/s_node_print/s_node_print.yy",},
@ -1316,6 +1318,7 @@
{"name":"s_node_image_animation","order":2,"path":"sprites/s_node_image_animation/s_node_image_animation.yy",},
{"name":"node_string_merge","order":6,"path":"scripts/node_string_merge/node_string_merge.yy",},
{"name":"s_node_palette_replace","order":1,"path":"sprites/s_node_palette_replace/s_node_palette_replace.yy",},
{"name":"node_action_object","order":1,"path":"scripts/node_action_object/node_action_object.yy",},
{"name":"s_node_pb_box_divide","order":24,"path":"sprites/s_node_pb_box_divide/s_node_pb_box_divide.yy",},
{"name":"bin_function","order":11,"path":"scripts/bin_function/bin_function.yy",},
{"name":"s_node_feedback_output","order":9,"path":"sprites/s_node_feedback_output/s_node_feedback_output.yy",},

View file

@ -42,6 +42,7 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"font","folderPath":"folders/font.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"functions","folderPath":"folders/functions.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"3d","folderPath":"folders/functions/3d.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"action","folderPath":"folders/functions/action.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"animation","folderPath":"folders/functions/animation.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"async","folderPath":"folders/functions/async.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"audio","folderPath":"folders/functions/audio.yy",},
@ -220,6 +221,14 @@
],
"IncludedFiles": [
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Actions.zip","CopyToMask":-1,"filePath":"datafiles/data",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"icons.ai","CopyToMask":-1,"filePath":"datafiles/data/Actions",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Armature Build.json","CopyToMask":-1,"filePath":"datafiles/data/Actions/Nodes",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Armature Build.png","CopyToMask":-1,"filePath":"datafiles/data/Actions/Nodes",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Follow Path.json","CopyToMask":-1,"filePath":"datafiles/data/Actions/Nodes",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Follow Path.png","CopyToMask":-1,"filePath":"datafiles/data/Actions/Nodes",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Line from Path.json","CopyToMask":-1,"filePath":"datafiles/data/Actions/Nodes",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Line from Path.png","CopyToMask":-1,"filePath":"datafiles/data/Actions/Nodes",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Addons.zip","CopyToMask":-1,"filePath":"datafiles/data",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Assets.zip","CopyToMask":-1,"filePath":"datafiles/data",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Collections.zip","CopyToMask":-1,"filePath":"datafiles/data",},
@ -320,6 +329,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_output_visibility.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_play_sound.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_preview_export.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_reset_16.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_reset_when_preview_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_revert.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_save_all.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
@ -365,6 +375,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_paste.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_pin.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_pixel_builder.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_play_24.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_play_all.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_preset.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_project.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
@ -1423,6 +1434,7 @@
{"id":{"name":"node_trigger_bool","path":"scripts/node_trigger_bool/node_trigger_bool.yy",},},
{"id":{"name":"s_node_strandSim_gravity","path":"sprites/s_node_strandSim_gravity/s_node_strandSim_gravity.yy",},},
{"id":{"name":"node_VFX_effect_turbulence","path":"scripts/node_VFX_effect_turbulence/node_VFX_effect_turbulence.yy",},},
{"id":{"name":"action_loader","path":"scripts/action_loader/action_loader.yy",},},
{"id":{"name":"sh_surface_replace_replace","path":"shaders/sh_surface_replace_replace/sh_surface_replace_replace.yy",},},
{"id":{"name":"node_ase_file_read","path":"scripts/node_ase_file_read/node_ase_file_read.yy",},},
{"id":{"name":"s_workshop_frame","path":"sprites/s_workshop_frame/s_workshop_frame.yy",},},
@ -1617,6 +1629,7 @@
{"id":{"name":"ase_reader","path":"scripts/ase_reader/ase_reader.yy",},},
{"id":{"name":"fd_rectangle_inherit_velocity","path":"scripts/fd_rectangle_inherit_velocity/fd_rectangle_inherit_velocity.yy",},},
{"id":{"name":"node_path","path":"scripts/node_path/node_path.yy",},},
{"id":{"name":"action_object","path":"scripts/action_object/action_object.yy",},},
{"id":{"name":"node_wrap_area","path":"scripts/node_wrap_area/node_wrap_area.yy",},},
{"id":{"name":"node_attributes","path":"scripts/node_attributes/node_attributes.yy",},},
{"id":{"name":"sh_seperate_shape_sep","path":"shaders/sh_seperate_shape_sep/sh_seperate_shape_sep.yy",},},
@ -1980,6 +1993,7 @@
{"id":{"name":"s_node_image_animation","path":"sprites/s_node_image_animation/s_node_image_animation.yy",},},
{"id":{"name":"node_string_merge","path":"scripts/node_string_merge/node_string_merge.yy",},},
{"id":{"name":"s_node_palette_replace","path":"sprites/s_node_palette_replace/s_node_palette_replace.yy",},},
{"id":{"name":"node_action_object","path":"scripts/node_action_object/node_action_object.yy",},},
{"id":{"name":"s_node_pb_box_divide","path":"sprites/s_node_pb_box_divide/s_node_pb_box_divide.yy",},},
{"id":{"name":"bin_function","path":"scripts/bin_function/bin_function.yy",},},
{"id":{"name":"s_node_feedback_output","path":"sprites/s_node_feedback_output/s_node_feedback_output.yy",},},

BIN
datafiles/data/Actions.zip Normal file

Binary file not shown.

View file

@ -0,0 +1,15 @@
{
"name": "Armature Build",
"tags": ["bone", "rigging"],
"tooltip": "",
"sprPath": "./Armature Build.png",
"nodes": [
{ "node": "Node_Armature" },
{ "node": "Node_Armature_Pose" },
{ "node": "Node_Armature_Bind" }
],
"connections": [
{ "from": 0, "fromIndex": 0, "to": 1, "toIndex": 0 },
{ "from": 1, "fromIndex": 0, "to": 2, "toIndex": 1 }
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,14 @@
{
"name": "Follow Path",
"tags": [],
"tooltip": "",
"sprPath": "./Follow Path.png",
"nodes": [
{ "node": "Node_Path", "y": 64 },
{ "node": "Node_Transform", "setValues": [ { "index": 2, "unit": "constant" } ] }
],
"connections": [
{ "from": 0, "fromIndex": 0, "to": 1, "toIndex": 2 }
],
"inputNode": 1
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,13 @@
{
"name": "Line from Path",
"tags": [],
"tooltip": "",
"sprPath": "./Line from Path.png",
"nodes": [
{ "node": "Node_Path" },
{ "node": "Node_Line" }
],
"connections": [
{ "from": 0, "fromIndex": 1, "to": 1, "toIndex": 7 }
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -142,6 +142,14 @@ event_inherited();
_inputs = _new_node.inputs;
_outputs = _new_node.outputs;
} else if(instanceof(_node) == "NodeAction") {
var res = _node.build(node_target_x, node_target_y,, _param);
if(_node.inputNode != noone)
_inputs = res[_node.inputNode].inputs;
if(_node.outputNode != noone)
_outputs = res[_node.outputNode].outputs;
} else {
var _new_list = APPEND(_node.path);
_inputs = ds_list_create();
@ -381,7 +389,12 @@ event_inherited();
var _boxx = _nx + (grid_width - grid_size) / 2;
BLEND_OVERRIDE;
draw_sprite_stretched(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size);
if(instanceof(_node) == "NodeObject")
draw_sprite_stretched(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size);
else if(instanceof(_node) == "NodeAction")
draw_sprite_stretched_ext(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size, COLORS._main_value_positive, 1);
else
draw_sprite_stretched_ext(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size, COLORS.dialog_add_node_collection, 1);
BLEND_NORMAL;
if(_hover && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_size)) {
@ -396,7 +409,11 @@ event_inherited();
var spr_y = yy + grid_size / 2;
if(variable_struct_exists(_node, "getSpr")) _node.getSpr();
if(sprite_exists(_node.spr)) draw_sprite_ui_uniform(_node.spr, 0, spr_x, spr_y, 0.5);
if(sprite_exists(_node.spr))
draw_sprite_ui_uniform(_node.spr, 0, spr_x, spr_y, 0.5);
if(instanceof(_node) == "NodeAction")
draw_sprite_ui_uniform(THEME.play_action, 0, _boxx + grid_size - 16, yy + grid_size - 16, 1, COLORS._main_value_positive);
if(_node.getTooltip() != "") {
if(point_in_rectangle(_m[0], _m[1], _boxx, yy, _boxx + ui(16), yy + ui(16))) {
@ -515,6 +532,9 @@ event_inherited();
draw_sprite_ext(_node.spr, 0, spr_x, spr_y, ss, ss, 0, c_white, 1);
}
if(instanceof(_node) == "NodeAction")
draw_sprite_ui_uniform(THEME.play_action, 0, spr_x + list_height / 2 - 8, spr_y + list_height / 2 - 8, 0.5, COLORS._main_value_positive);
var tx = list_height + ui(40);
if(_node.new_node) {
@ -688,8 +708,10 @@ event_inherited();
var _boxx = _nx + (grid_width - grid_size) / 2;
BLEND_OVERRIDE;
if(is_array(s_res))
if(instanceof(_node) == "NodeObject")
draw_sprite_stretched(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size);
else if(instanceof(_node) == "NodeAction")
draw_sprite_stretched_ext(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size, COLORS._main_value_positive, 1);
else
draw_sprite_stretched_ext(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size, COLORS.dialog_add_node_collection, 1);
BLEND_NORMAL;
@ -712,6 +734,9 @@ event_inherited();
draw_sprite_ext(_node.spr, _si, _sx, _sy, _ss, _ss, 0, c_white, 1);
}
if(instanceof(_node) == "NodeAction")
draw_sprite_ui_uniform(THEME.play_action, 0, _boxx + grid_size - 16, yy + grid_size - 16, 1, COLORS._main_value_positive);
draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text);
var txt = _node.getName();
name_height = max(name_height, string_height_ext(txt, -1, grid_width) + ui(8));
@ -792,9 +817,11 @@ event_inherited();
_sy += _sh * _ss / 2 - _soy * _ss;
draw_sprite_ext(_node.spr, _si, _sx, _sy, _ss, _ss, 0, c_white, 1);
if(instanceof(_node) == "NodeAction")
draw_sprite_ui_uniform(THEME.play_action, 0, _sx + list_height / 2 - 8, _sy + list_height / 2 - 8, 0.5, COLORS._main_value_positive);
}
var fav = struct_has(_node, "node") && array_exists(global.FAV_NODES, _node.node);
if(fav) draw_sprite_ui_uniform(THEME.star, 0, ui(20), yy + list_height / 2, 0.7, COLORS._main_accent, 1.);

View file

@ -71,7 +71,6 @@
var line = array_safe_get(textbox._input_text_line, textbox.cursor_line, "");
var crop = string_copy(line, 1, textbox.cursor - textbox.char_run);
var slp = string_splice(crop, [" ", "(", ","], true);
print(slp)
slp[array_length(slp) - 1] = rep;
var txt = "";

View file

@ -63,6 +63,7 @@
log_message("SESSION", "Begin");
log_message("DIRECTORY", DIRECTORY);
log_message("SESSION", "> init Action"); __initAction();
log_message("SESSION", "> init SurfaceFormat"); __initSurfaceFormat();
log_message("SESSION", "> init Locale"); __initLocale();
log_message("SESSION", "> init Theme"); __initTheme();

View file

@ -0,0 +1,20 @@
#region action
global.ACTIONS = [];
function __initAction() {
global.ACTIONS = [];
var root = DIRECTORY + "Actions";
if(!directory_exists(root))
directory_create(root);
var _l = root + "/version";
if(file_exists(_l)) {
var res = json_load_struct(_l);
if(!is_struct(res) || !struct_has(res, "version") || res.version != BUILD_NUMBER)
zip_unzip("data/Actions.zip", DIRECTORY);
} else
zip_unzip("data/Actions.zip", DIRECTORY);
json_save_struct(_l, { version: BUILD_NUMBER });
}
#endregion

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "action_loader",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "startup scripts",
"path": "folders/main/startup scripts.yy",
},
}

View file

@ -0,0 +1,75 @@
function actionStep() constructor {
type = "";
data = {};
static trigger = function() {
}
static serialize = function() {
var map = {};
map.type = type;
map.data = data;
return map;
}
static deserialize = function(map) {
type = map.type;
data = map.data;
return self;
}
}
function actionObject() constructor {
name = "";
spr = noone;
isPlaying = false;
playStep = 0;
actions = [];
static step = function() {
actions[playStep].trigger();
playStep++;
if(playStep == array_length(actions)) {
isPlaying = false;
return true;
}
return false;
}
static play = function() {
if(isPlaying) return;
isPlaying = true;
playStep = 0;
}
static serialize = function() {
var map = {};
map.name = name;
map.actions = [];
for( var i = 0, n = array_length(actions); i < n; i++ )
map.actions[i] = actions[i].serialize();
return map;
}
static deserialize = function(map) {
name = map.name;
actions = [];
for( var i = 0, n = array_length(map.actions); i < n; i++ )
actions[i] = new actionStep().deserialize(map.actions[i]);
return self;
}
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "action_object",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "action",
"path": "folders/functions/action.yy",
},
}

View file

@ -22,7 +22,7 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) {
var _v = _map.version;
PROJECT.version = _v;
if(_v != SAVE_VERSION) {
var warn = "File version mismatch : loading file verion " + string(_v) + " to Pixel Composer " + string(SAVE_VERSION);
var warn = "File version mismatch : loading file version " + string(_v) + " to Pixel Composer " + string(SAVE_VERSION);
log_warning("FILE", warn)
}
}

View file

@ -91,7 +91,7 @@
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[? "progress"] = function() { return PROJECT.animator.current_frame / (PROJECT.animator.frames_total - 1); };
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; };

View file

@ -93,7 +93,7 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false
var _v = _load_content.version;
PROJECT.version = _v;
if(_v != SAVE_VERSION) {
var warn = $"File version mismatch : loading file verion {_v} to Pixel Composer {SAVE_VERSION}";
var warn = $"File version mismatch : loading file version {_v} to Pixel Composer {SAVE_VERSION}";
log_warning("LOAD", warn);
}
} else {

View file

@ -0,0 +1,102 @@
#region node action
function NodeAction() constructor {
name = "";
spr = noone;
node = noone;
tags = [];
tooltip = "";
tooltip_spr = noone;
new_node = false;
nodes = [];
connections = [];
inputNode = noone;
outputNode = noone;
static getName = function() { return name; /*__txt_node_name(node, name); */ }
static getTooltip = function() { return tooltip; /*__txt_node_tooltip(node, tooltip); */ }
static build = function(_x, _y, _group = PANEL_GRAPH.getCurrentContext(), _param = "") {
var _n = [];
for( var i = 0, n = array_length(nodes); i < n; i++ ) {
var __n = nodes[i];
var _nx = struct_has(__n, "x")? _x + __n.x : _x + 160 * i;
var _ny = struct_has(__n, "y")? _y + __n.y : _y;
_n[i] = nodeBuild(__n.node, _nx, _ny, _group);
if(struct_has(__n, "setValues")) {
var _setVals = __n.setValues;
for(var j = 0, m = array_length(_setVals); j < m; j++ ) {
var _setVal = _setVals[j];
var _index = _n[i].inputs[| _setVal.index];
if(struct_has(_setVal, "value"))
_index.setValue(_setVal.value);
if(struct_has(_setVal, "unit"))
_index.unit.setMode(_setVal.unit);
}
}
}
for( var i = 0, n = array_length(connections); i < n; i++ ) {
var _c = connections[i];
_n[_c.to].inputs[| _c.toIndex].setFrom(_n[_c.from].outputs[| _c.fromIndex]);
}
return _n;
}
static serialize = function() {
var map = { name, tooltip, nodes, connections, tags };
return map;
}
static deserialize = function(path) {
var map = json_load_struct(path);
name = struct_try_get(map, "name", "");
tags = struct_try_get(map, "tags", []);
tooltip = struct_try_get(map, "tooltip", "");
nodes = struct_try_get(map, "nodes", []);
connections = struct_try_get(map, "connections", []);
inputNode = struct_try_get(map, "inputNode", noone);
outputNode = struct_try_get(map, "outputNode", noone);
if(struct_has(map, "sprPath")) {
var _path = string_replace(map.sprPath, "./", filename_dir(path) + "/");
if(file_exists(_path)) {
spr = sprite_add(_path, 1, false, false, 0, 0);
sprite_set_offset(spr, sprite_get_width(spr) / 2, sprite_get_height(spr) / 2);
}
}
return self;
}
}
function __initNodeActions(list) {
var root = DIRECTORY + "Actions";
if(!directory_exists(root)) directory_create(root);
root += "/Nodes";
if(!directory_exists(root)) directory_create(root);
var f = file_find_first(root + "/*", 0);
while (f != "") {
if(filename_ext(f) == ".json") {
var _c = new NodeAction().deserialize($"{root}/{f}");
ds_list_add(list, _c);
}
f = file_find_next();
}
file_find_close();
}
#endregion

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_action_object",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "action",
"path": "folders/functions/action.yy",
},
}

View file

@ -77,10 +77,25 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
bone.tb_name.draw(__x + 24, ty + 3, ww + 16, _hh - 6, bone.name, _m);
var _x0 = __x + 24 + ww + 32;
draw_sprite_ui(THEME.bone, 3, _x0, ty + 14,,,, COLORS._main_icon, 0.5);
var _y0 = ty + 14;
var cc = bone.apply_scale? COLORS._main_icon : COLORS._main_value_negative;
if(point_in_circle(_m[0], _m[1], _x0, _y0, 16)) {
draw_sprite_ui(THEME.bone, 3, _x0, _y0,,,, cc, 0.75);
if(mouse_press(mb_left, _focus))
bone.apply_scale = !bone.apply_scale;
} else
draw_sprite_ui(THEME.bone, 3, _x0, _y0,,,, cc, 0.5);
_x0 += 20;
draw_sprite_ui(THEME.bone, 4, _x0, ty + 14,,,, COLORS._main_icon, 0.5);
var cc = bone.apply_rotation? COLORS._main_icon : COLORS._main_value_negative;
if(point_in_circle(_m[0], _m[1], _x0, _y0, 16)) {
draw_sprite_ui(THEME.bone, 4, _x0, _y0,,,, cc, 0.75);
if(mouse_press(mb_left, _focus))
bone.apply_rotation = !bone.apply_rotation;
} else
draw_sprite_ui(THEME.bone, 4, _x0, _y0,,,, cc, 0.5);
ty += _hh;

View file

@ -222,9 +222,19 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
layer_remove = index;
} else
draw_sprite_ui_uniform(THEME.icon_delete, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon);
_bx -= 32;
//if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 16)) {
// draw_sprite_ui_uniform(THEME.reset_16, 3, _bx, _cy + lh / 2, 1, COLORS._main_value_negative);
// if(mouse_press(mb_left, _focus))
// resetTransform(i);
//} else
// draw_sprite_ui_uniform(THEME.reset_16, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon);
if(!is_surface(_surf)) continue;
var aa = (index != layer_dragging || layer_dragging == noone)? 1 : 0.5;
var vis = _vis[index];
var sel = _sel[index];
@ -311,8 +321,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
if(layer_dragging != hoverIndex && hoverIndex != noone) {
var index = input_fix_len + layer_dragging * data_length;
var targt = input_fix_len + hoverIndex * data_length;
var _vis = attributes.layer_visible;
var _sel = attributes.layer_selectable;
var _vis = attributes.layer_visible;
var _sel = attributes.layer_selectable;
var ext = [];
var vis = _vis[layer_dragging];
@ -382,6 +392,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
inputs[| index + 2] = nodeValue("Inherit Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true );
inputs[| index + 3] = nodeValue("Inherit Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
for( var i = 0; i < data_length; i++ )
array_push(input_display_list, index + i);
@ -393,7 +405,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
}
input_fix_len = ds_list_size(inputs);
data_length = 3;
data_length = 4;
if(!LOADING && !APPENDING) createNewSurface();
@ -507,7 +519,9 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
if(surf_dragging > -1) {
var input_dragging = surf_dragging + 1;
var _surf = current_data[surf_dragging];
var _tran = current_data[input_dragging];
var _tran = current_data[input_dragging + 0];
var _aang = current_data[input_dragging + 1];
var _asca = current_data[input_dragging + 2];
var _bone = inputs[| surf_dragging].extra_data.bone_id;
_bone = boneMap[? _bone];
@ -535,7 +549,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
_tran[TRANSFORM.rot] = sa;
} else if(drag_type == NODE_COMPOSE_DRAG.scale) {
var _rot = _ang * _bone.angle + _tran[TRANSFORM.rot];
var _rot = _aang * _bone.angle + _tran[TRANSFORM.rot];
var _sw = surface_get_width(_surf);
var _sh = surface_get_height(_surf);
@ -548,6 +562,11 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
sca_y = sca_x;
}
if(_asca) {
sca_x /= _bone.pose_scale;
sca_y /= _bone.pose_scale;
}
_tran[TRANSFORM.sca_x] = sca_x;
_tran[TRANSFORM.sca_y] = sca_y;
}
@ -589,6 +608,10 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var _anc = _bone.getPoint(0.5);
var _mov = point_rotate(_tran[TRANSFORM.pos_x], _tran[TRANSFORM.pos_y], 0, 0, _bone.angle);
var _sca = [ _tran[TRANSFORM.sca_x], _tran[TRANSFORM.sca_y] ];
if(_asca) {
_sca[0] *= _bone.pose_scale;
_sca[1] *= _bone.pose_scale;
}
var _ww = surface_get_width(_surf);
var _hh = surface_get_height(_surf);
@ -658,7 +681,9 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
draw_sprite_colored(THEME.anchor_rotate, _ri, a.rr[0], a.rr[1],, a.rot);
draw_sprite_colored(THEME.anchor_scale, _si, a.d3[0], a.d3[1],, a.rot);
} else if(point_in_rectangle_points(_mx, _my, a.d0[0], a.d0[1], a.d1[0], a.d1[1], a.d2[0], a.d2[1], a.d3[0], a.d3[1])) {
} else if(point_in_rectangle_points(_mx, _my, a.d0[0], a.d0[1], a.d1[0], a.d1[1], a.d2[0], a.d2[1], a.d3[0], a.d3[1]) &&
(surface_selecting != hovering || surface_selecting == noone)) {
hovering = index;
hovering_type = NODE_COMPOSE_DRAG.move;
}
@ -688,6 +713,10 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
}
if(hovering != noone && hovering_type != noone && mouse_press(mb_left, active)) {
var _tran = current_data[hovering + 1];
var _aang = current_data[hovering + 2];
var _asca = current_data[hovering + 3];
var a = anchors[hovering];
if(hovering_type == NODE_COMPOSE_DRAG.move) { //move
@ -783,10 +812,16 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var _tran = use_data? _bind[i].transform : _data[datInd + 1];
var _aang = _data[datInd + 2];
var _asca = _data[datInd + 3];
var _rot = _aang * _b.angle + _tran[TRANSFORM.rot];
var _anc = _b.getPoint(0.5);
var _mov = point_rotate(_tran[TRANSFORM.pos_x], _tran[TRANSFORM.pos_y], 0, 0, _b.angle);
var _sca = [ _tran[TRANSFORM.sca_x], _tran[TRANSFORM.sca_y] ];
if(_asca) {
_sca[0] *= _b.pose_scale;
_sca[1] *= _b.pose_scale;
}
var _ww = surface_get_width(_s);
var _hh = surface_get_height(_s);
@ -815,6 +850,29 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
return _outSurf;
}
static resetTransform = function(surfIndex) {
var _bind = inputs[| 2].getValue();
var use_data = _bind != noone;
var _surf = inputs[| surfIndex + 0].getValue();
var _tran = inputs[| surfIndex + 1].getValue();
var _arot = inputs[| surfIndex + 2].getValue();
var _b = use_data? _bind[i].bone : inputs[| surfIndex].extra_data.bone_id;
if(!ds_map_exists(boneMap, _b)) return;
_b = boneMap[? _b];
var _cx = surface_get_width(_surf) / 2;
var _cy = surface_get_height(_surf) / 2;
var _anc = _b.getPoint(0.5);
var _rot = _arot? -_b.angle : 0;
var _tr = [ _cx - _anc.x, _cy - _anc.y, _rot, 1, 1 ];
inputs[| surfIndex + 1].setValue(_tr);
}
static postDeserialize = function() {
var _inputs = load_map.inputs;
@ -823,8 +881,10 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
if(PROJECT.version < 11481) {
var _idx = [];
for( var i = load_fix_len, n = array_length(_inputs); i < n; i += 2 )
for( var i = load_fix_len, n = array_length(_inputs); i < n; i += 2 ) {
array_append(_idx, i + 3);
array_append(_idx, i + 4);
}
for( var i = array_length(_idx) - 1; i >= 0; i++ )
array_insert(load_map.inputs, _idx[i], noone);

View file

@ -353,7 +353,6 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
_pathTemp = "\"" + _pathTemp + "\"";
var shell_cmd = _pathTemp + " -quality " + string(qual) + " " + _pathOut;
print(shell_cmd)
execute_shell(magick, shell_cmd);
break;

View file

@ -191,7 +191,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
var _segLength = struct_has(_pat, "getAccuLength")? _pat.getAccuLength(i) : [];
var _segIndex = 0;
var _pathStr = _rtStr;
var _pathEnd = _rtMax;

View file

@ -56,6 +56,18 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
return l;
}
static getSegmentCount = function(ind = 0) {
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
var _path = inputs[| i].getValue();
var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
if(ind < lc) return _path.getSegmentCount(ind);
ind -= lc;
}
return 0;
}
static getLength = function(ind = 0) {
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
var _path = inputs[| i].getValue();
@ -68,18 +80,6 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
return 0;
}
static getBoundary = function(ind = 0) {
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
var _path = inputs[| i].getValue();
var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
if(ind < lc) return _path.getBoundary(ind);
ind -= lc;
}
return 0;
}
static getAccuLength = function(ind = 0) {
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
var _path = inputs[| i].getValue();
@ -92,18 +92,6 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
return 0;
}
static getSegmentCount = function(ind = 0) {
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
var _path = inputs[| i].getValue();
var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
if(ind < lc) return _path.getSegmentCount(ind);
ind -= lc;
}
return 0;
}
static getPointRatio = function(_rat, ind = 0) {
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
var _path = inputs[| i].getValue();
@ -128,6 +116,18 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
return new Point();
}
static getBoundary = function(ind = 0) {
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
var _path = inputs[| i].getValue();
var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
if(ind < lc) return _path.getBoundary(ind);
ind -= lc;
}
return 0;
}
static update = function(frame = PROJECT.animator.current_frame) {
outputs[| 0].setValue(self);
}

View file

@ -3,6 +3,7 @@ function Node_Path_Blend(_x, _y, _group = noone) : Node(_x, _y, _group) construc
previewable = false;
w = 96;
length = 0;
inputs[| 0] = nodeValue("Path 1", self, JUNCTION_CONNECT.input, VALUE_TYPE.pathnode, noone)
.setVisible(true, true)
@ -18,7 +19,12 @@ function Node_Path_Blend(_x, _y, _group = noone) : Node(_x, _y, _group) construc
outputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self);
static getSegmentCount = function() {
static getLineCount = function() {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
}
static getSegmentCount = function(ind = 0) {
var _path1 = inputs[| 0].getValue();
var _path2 = inputs[| 1].getValue();
var _lerp = inputs[| 2].getValue();
@ -27,32 +33,10 @@ function Node_Path_Blend(_x, _y, _group = noone) : Node(_x, _y, _group) construc
var p2 = _path2 != noone && struct_has(_path2, "getSegmentCount");
if(!p1 && !p2) return 0;
if( p1 && !p2) return _path1.getSegmentCount();
if(!p1 && p2) return _path2.getSegmentCount();
if( p1 && !p2) return _path1.getSegmentCount(ind);
if(!p1 && p2) return _path2.getSegmentCount(ind);
return max(_path1.getSegmentCount(), _path2.getSegmentCount());
}
static getPointRatio = function(_rat) {
var _path1 = inputs[| 0].getValue();
var _path2 = inputs[| 1].getValue();
var _lerp = inputs[| 2].getValue();
var p1 = _path1 != noone && struct_has(_path1, "getPointRatio");
var p2 = _path2 != noone && struct_has(_path2, "getPointRatio");
if(!p1 && !p2) return new Point();
if( p1 && !p2) return _path1.getPointRatio(_rat);
if(!p1 && p2) return _path2.getPointRatio(_rat);
var _p1 = _path1.getPointRatio(_rat);
var _p2 = _path2.getPointRatio(_rat);
var _r = new Point();
_r.x = lerp(_p1.x, _p2.x, _lerp);
_r.y = lerp(_p1.y, _p2.y, _lerp);
return _r;
return max(_path1.getSegmentCount(ind), _path2.getSegmentCount(ind));
}
static getLength = function(ind = 0) {
@ -73,7 +57,61 @@ function Node_Path_Blend(_x, _y, _group = noone) : Node(_x, _y, _group) construc
return lerp(_p1, _p2, _lerp);
}
static getBoundary = function() {
static getAccuLength = function(ind = 0) {
var _path1 = inputs[| 0].getValue();
var _path2 = inputs[| 1].getValue();
var _lerp = inputs[| 2].getValue();
var p1 = _path1 != noone && struct_has(_path1, "getAccuLength");
var p2 = _path2 != noone && struct_has(_path2, "getAccuLength");
if(!p1 && !p2) return 0;
if( p1 && !p2) return _path1.getAccuLength(ind);
if(!p1 && p2) return _path2.getAccuLength(ind);
var _p1 = _path1.getAccuLength(ind);
var _p2 = _path2.getAccuLength(ind);
var len = max(array_length(_p1), array_length(_p2));
var res = [];
for( var i = 0; i < len; i++ ) {
var _l1 = array_get_decimal(_p1, i);
var _l2 = array_get_decimal(_p2, i);
res[i] = lerp(_l1, _l2, _lerp);
}
return res;
}
static getPointRatio = function(_rat, ind = 0) {
var _path1 = inputs[| 0].getValue();
var _path2 = inputs[| 1].getValue();
var _lerp = inputs[| 2].getValue();
var p1 = _path1 != noone && struct_has(_path1, "getPointRatio");
var p2 = _path2 != noone && struct_has(_path2, "getPointRatio");
if(!p1 && !p2) return new Point();
if( p1 && !p2) return _path1.getPointRatio(_rat, ind);
if(!p1 && p2) return _path2.getPointRatio(_rat, ind);
var _p1 = _path1.getPointRatio(_rat, ind);
var _p2 = _path2.getPointRatio(_rat, ind);
var _r = new Point();
_r.x = lerp(_p1.x, _p2.x, _lerp);
_r.y = lerp(_p1.y, _p2.y, _lerp);
return _r;
}
static getPointDistance = function(_dist, ind = 0) {
return getPointRatio(_dist / getLength(ind), ind);
}
static getBoundary = function(ind = 0) {
var _path1 = inputs[| 0].getValue();
var _path2 = inputs[| 1].getValue();
var _lerp = inputs[| 2].getValue();
@ -82,11 +120,11 @@ function Node_Path_Blend(_x, _y, _group = noone) : Node(_x, _y, _group) construc
var p2 = _path2 != noone && struct_has(_path2, "getPointRatio");
if(!p1 && !p2) return new BoundingBox();
if( p1 && !p2) return _path1.getBoundary();
if(!p1 && p2) return _path2.getBoundary();
if( p1 && !p2) return _path1.getBoundary(ind);
if(!p1 && p2) return _path2.getBoundary(ind);
var _p1 = _path1.getBoundary();
var _p2 = _path2.getBoundary();
var _p1 = _path1.getBoundary(ind);
var _p2 = _path2.getBoundary(ind);
return _p1.lerpTo(_p2, _lerp);
}

View file

@ -59,15 +59,6 @@ function Node_Path_Builder(_x, _y, _group = noone) : Node(_x, _y, _group) constr
static getAccuLength = function(index) { return array_safe_get(lengthAcc, index, []); }
static getBoundary = function() {
var boundary = new BoundingBox();
var _lines = inputs[| 0].getValue();
for( var i = 0, n = array_length(_lines); i < n; i++ )
boundary.addPoint(_lines[i][0], _lines[i][1]);
return boundary;
}
static getPointRatio = function(_rat, _ind = 0) {
var _lines = inputs[| 0].getValue();
var _conn = inputs[| 1].getValue();
@ -107,6 +98,15 @@ function Node_Path_Builder(_x, _y, _group = noone) : Node(_x, _y, _group) constr
else return getPointRatio(_dist / length[ind], ind);
}
static getBoundary = function() {
var boundary = new BoundingBox();
var _lines = inputs[| 0].getValue();
for( var i = 0, n = array_length(_lines); i < n; i++ )
boundary.addPoint(_lines[i][0], _lines[i][1]);
return boundary;
}
function update() {
var _lines = inputs[| 0].getValue();
var _conn = inputs[| 1].getValue();

View file

@ -141,10 +141,9 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const
}
}
static getBoundary = function() { return boundary; }
static getLineCount = function() { return array_length(lines); }
static getSegmentCount = function() { return 1; }
static getLength = function() { return current_length; }
static getAccuLength = function() { return [ 0, current_length ]; }
@ -162,10 +161,6 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const
return lerp(_p0[2], _p1[2], _rat);
}
static getPointDistance = function(_dist, _ind = 0) {
return getPointRatio(_dist / current_length, _ind);
}
static getPointRatio = function(_rat, _ind = 0) {
var _p0 = lines[_ind][0];
var _p1 = lines[_ind][1];
@ -179,6 +174,12 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const
return new Point( _x, _y );
}
static getPointDistance = function(_dist, _ind = 0) {
return getPointRatio(_dist / current_length, _ind);
}
static getBoundary = function() { return boundary; }
function update() {
var _len = inputs[| 0].getValue();
var _ang = inputs[| 1].getValue();

View file

@ -22,19 +22,19 @@ function Node_Path_Map_Area(_x, _y, _group = noone) : Node(_x, _y, _group) const
return struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
}
static getSegmentCount = function() {
static getSegmentCount = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getSegmentCount")? _path.getSegmentCount() : 0;
return struct_has(_path, "getSegmentCount")? _path.getSegmentCount(ind) : 0;
}
static getLength = function() {
static getLength = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getLength")? _path.getLength() : 0;
return struct_has(_path, "getLength")? _path.getLength(ind) : 0;
}
static getAccuLength = function() {
static getAccuLength = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getAccuLength")? _path.getAccuLength() : [];
return struct_has(_path, "getAccuLength")? _path.getAccuLength(ind) : [];
}
static getPointRatio = function(_rat, ind = 0) {

View file

@ -2,6 +2,7 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct
name = "Plot Path";
previewable = false;
length = 0;
w = 96;
inputs[| 0] = nodeValue("Output scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 8, 8 ])
@ -39,14 +40,16 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct
boundary = new BoundingBox( 0, 0, 1, 1 );
static getLineCount = function() { return 1; }
static getSegmentCount = function() { return 0; }
static getBoundary = function() { return boundary; }
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
inputs[| 5].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
}
static getLineCount = function() { return 1; }
static getSegmentCount = function() { return 1; }
static getLength = function(ind = 0) { return length; }
static getAccuLength = function(ind = 0) { return [ length ]; }
static getPointRatio = function(_rat, ind = 0) {
var _sca = inputs[| 0].getValue();
var _coor = inputs[| 1].getValue();
@ -107,6 +110,12 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct
return _p;
}
static getPointDistance = function(_dist, ind = 0) {
return getPointRatio(_dist / getLength(ind), ind);
}
static getBoundary = function() { return boundary; }
function step() {
var _coor = inputs[| 1].getValue();
var _eqa = inputs[| 2].getValue();
@ -160,11 +169,18 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct
function updateBoundary() {
boundary = new BoundingBox( 0, 0, 1, 1 );
length = 0;
var sample = 64;
var op, np;
for( var i = 0; i <= sample; i++ ) {
var p = getPointRatio(i / sample);
boundary.addPoint(p.x, p.y);
np = getPointRatio(i / sample);
boundary.addPoint(np.x, np.y);
if(i) length += point_distance(op.x, op.y, np.x, np.y);
op = np;
}
}

View file

@ -14,24 +14,24 @@ function Node_Path_Reverse(_x, _y, _group = noone) : Node(_x, _y, _group) constr
return struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
}
static getSegmentCount = function() {
static getSegmentCount = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getSegmentCount")? _path.getSegmentCount() : 0;
return struct_has(_path, "getSegmentCount")? _path.getSegmentCount(ind) : 0;
}
static getLength = function() {
static getLength = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getLength")? _path.getLength() : 0;
return struct_has(_path, "getLength")? _path.getLength(ind) : 0;
}
static getAccuLength = function() {
static getAccuLength = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getAccuLength")? _path.getAccuLength() : [];
return struct_has(_path, "getAccuLength")? array_reverse(_path.getAccuLength(ind)) : [];
}
static getBoundary = function() {
static getBoundary = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getBoundary")? _path.getBoundary() : new BoundingBox(0, 0, 1, 1);
return struct_has(_path, "getBoundary")? _path.getBoundary(ind) : new BoundingBox(0, 0, 1, 1);
}
static getPointRatio = function(_rat, ind = 0) {

View file

@ -16,24 +16,19 @@ function Node_Path_Shift(_x, _y, _group = noone) : Node(_x, _y, _group) construc
return struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
}
static getSegmentCount = function() {
static getSegmentCount = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getSegmentCount")? _path.getSegmentCount() : 0;
return struct_has(_path, "getSegmentCount")? _path.getSegmentCount(ind) : 0;
}
static getLength = function() {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getLength")? _path.getLength() : 0;
static getLength = function(ind = 0) {
var _path = inputs[| 0].getValue(ind = 0);
return struct_has(_path, "getLength")? _path.getLength(ind) : 0;
}
static getAccuLength = function() {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getAccuLength")? _path.getAccuLength() : [];
}
static getBoundary = function() {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getBoundary")? _path.getBoundary() : new BoundingBox( 0, 0, 1, 1 );
static getAccuLength = function(ind = 0) {
var _path = inputs[| 0].getValue(ind = 0);
return struct_has(_path, "getAccuLength")? _path.getAccuLength(ind) : [];
}
static getPointRatio = function(_rat, ind = 0) {
@ -64,6 +59,11 @@ function Node_Path_Shift(_x, _y, _group = noone) : Node(_x, _y, _group) construc
return getPointRatio(_dist / getLength(), ind);
}
static getBoundary = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getBoundary")? _path.getBoundary(ind) : new BoundingBox( 0, 0, 1, 1 );
}
function update() {
outputs[| 0].setValue(self);
}

View file

@ -36,27 +36,27 @@ function Node_Path_Transform(_x, _y, _group = noone) : Node(_x, _y, _group) cons
return struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
}
static getSegmentCount = function() {
static getSegmentCount = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getSegmentCount")? _path.getSegmentCount() : 0;
return struct_has(_path, "getSegmentCount")? _path.getSegmentCount(ind) : 0;
}
static getLength = function() {
static getLength = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getLength")? _path.getLength() : 0;
return struct_has(_path, "getLength")? _path.getLength(ind) : 0;
}
static getAccuLength = function() {
static getAccuLength = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getAccuLength")? _path.getAccuLength() : [];
return struct_has(_path, "getAccuLength")? _path.getAccuLength(ind) : [];
}
static getBoundary = function() {
static getBoundary = function(ind = 0) {
var _path = inputs[| 0].getValue();
if(!struct_has(_path, "getBoundary"))
return new BoundingBox( 0, 0, 1, 1 );
var b = _path.getBoundary().clone();
var b = _path.getBoundary(ind).clone();
var _pos = inputs[| 1].getValue();
var _rot = inputs[| 2].getValue();
@ -115,7 +115,7 @@ function Node_Path_Transform(_x, _y, _group = noone) : Node(_x, _y, _group) cons
return getPointRatio(_dist / getLength(), ind);
}
static getBoundary = function() {
static getBoundary = function(ind = 0) {
var _path = inputs[| 0].getValue();
var _pos = inputs[| 1].getValue();
var _rot = inputs[| 2].getValue();
@ -123,7 +123,7 @@ function Node_Path_Transform(_x, _y, _group = noone) : Node(_x, _y, _group) cons
if(_path == noone) return [ 0, 0, 1, 1 ];
var _b = _path.getBoundary();
var _b = _path.getBoundary(ind);
var cx = (_b[0] + _b[2]) / 2;
var cy = (_b[1] + _b[1]) / 2;

View file

@ -17,26 +17,21 @@ function Node_Path_Trim(_x, _y, _group = noone) : Node(_x, _y, _group) construct
return struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
}
static getSegmentCount = function() {
static getSegmentCount = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getSegmentCount")? _path.getSegmentCount() : 0;
return struct_has(_path, "getSegmentCount")? _path.getSegmentCount(ind) : 0;
}
static getLength = function() {
static getLength = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getLength")? _path.getLength() : 0;
return struct_has(_path, "getLength")? _path.getLength(ind) : 0;
}
static getAccuLength = function() {
static getAccuLength = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getAccuLength")? _path.getAccuLength() : [];
return struct_has(_path, "getAccuLength")? _path.getAccuLength(ind) : [];
}
static getBoundary = function() {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getBoundary")? _path.getBoundary() : new BoundingBox( 0, 0, 1, 1 );
}
static getPointRatio = function(_rat, ind = 0) {
var _path = inputs[| 0].getValue();
var _rng = inputs[| 1].getValue();
@ -57,6 +52,11 @@ function Node_Path_Trim(_x, _y, _group = noone) : Node(_x, _y, _group) construct
return getPointRatio(_dist / getLength(), ind);
}
static getBoundary = function(ind = 0) {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getBoundary")? _path.getBoundary(ind) : new BoundingBox( 0, 0, 1, 1 );
}
function update() {
outputs[| 0].setValue(self);
}

View file

@ -22,37 +22,49 @@ function Node_Path_Wave(_x, _y, _group = noone) : Node(_x, _y, _group) construct
["Wave", false], 1, 2, 3, 4,
]
current_data = [];
static getLineCount = function() {
var _path = inputs[| 0].getValue();
var _path = current_data[0];
return struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
}
static getSegmentCount = function() {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getSegmentCount")? _path.getSegmentCount() : 0;
static getSegmentCount = function(ind = 0) {
var _path = current_data[0];
return struct_has(_path, "getSegmentCount")? _path.getSegmentCount(ind) : 0;
}
static getLength = function() {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getLength")? _path.getLength() : 0;
static getLength = function(ind = 0) {
var _path = current_data[0];
var _fre = current_data[1];
var _amo = current_data[2];
var _len = struct_has(_path, "getLength")? _path.getLength(ind) : 0;
_len *= _fre * sqrt(_amo + 1 / _fre);
return _len;
}
static getAccuLength = function() {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getAccuLength")? _path.getAccuLength() : [];
static getAccuLength = function(ind = 0) {
var _path = current_data[0];
var _fre = current_data[1];
var _amo = current_data[2];
var _len = struct_has(_path, "getAccuLength")? _path.getAccuLength(ind) : [];
var _mul = _fre * sqrt(_amo + 1 / _fre);
for( var i = 0, n = array_length(_len); i < n; i++ )
_len[i] *= _mul;
return _len;
}
static getBoundary = function() {
var _path = inputs[| 0].getValue();
return struct_has(_path, "getBoundary")? _path.getBoundary() : new BoundingBox( 0, 0, 1, 1 );
}
static getPointRatio = function(_rat, ind = 0) {
var _path = inputs[| 0].getValue();
var _fre = inputs[| 1].getValue();
var _amo = inputs[| 2].getValue();
var _shf = inputs[| 3].getValue();
var _smt = inputs[| 4].getValue();
var _path = current_data[0];
var _fre = current_data[1];
var _amo = current_data[2];
var _shf = current_data[3];
var _smt = current_data[4];
if(is_array(_path)) {
_path = array_safe_get(_path, ind);
@ -82,7 +94,15 @@ function Node_Path_Wave(_x, _y, _group = noone) : Node(_x, _y, _group) construct
return getPointRatio(_dist / getLength(), ind);
}
static getBoundary = function(ind = 0) {
var _path = current_data[0];
return struct_has(_path, "getBoundary")? _path.getBoundary(ind) : new BoundingBox( 0, 0, 1, 1 );
}
function update() {
for( var i = 0, n = ds_list_size(inputs); i < n; i++ )
current_data[i] = inputs[| i].getValue();
outputs[| 0].setValue(self);
}

View file

@ -68,8 +68,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
ALL_NODES[? _node] = _n;
}
if(tooltip != "")
_n.tooltip = tooltip;
if(tooltip != "") _n.tooltip = tooltip;
ds_list_add(_list, _n);
return _n;
}
@ -381,14 +380,14 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
addNodeObject(generator, "Shape", s_node_shape, "Node_Shape", [1, Node_Shape],, "Draw simple shapes using signed distance field.");
addNodeObject(generator, "Polygon Shape", s_node_shape_polygon, "Node_Shape_Polygon", [1, Node_Shape_Polygon],, "Draw simple shapes using triangles.").setVersion(1130);
addNodeObject(generator, "Random Shape", s_node_random_shape, "Node_Random_Shape", [1, Node_Random_Shape]).setVersion(1147);
ds_list_add(generator, "Noises");
addNodeObject(generator, "Noise", s_node_noise, "Node_Noise", [1, Node_Noise],, "Generate white noise.");
addNodeObject(generator, "Perlin Noise", s_node_noise_perlin, "Node_Perlin", [1, Node_Perlin],, "Generate perlin noise.");
addNodeObject(generator, "Simplex Noise", s_node_noise_simplex, "Node_Noise_Simplex", [1, Node_Noise_Simplex], ["perlin"], "Generate simplex noise, similiar to perlin noise with better fidelity but non-tilable.").setVersion(1080);
addNodeObject(generator, "Cellular Noise", s_node_noise_cell, "Node_Cellular", [1, Node_Cellular], ["voronoi", "worley"], "Generate voronoi pattern.");
addNodeObject(generator, "Anisotropic Noise", s_node_noise_aniso, "Node_Noise_Aniso", [1, Node_Noise_Aniso],, "Generate anisotropic noise.");
ds_list_add(generator, "Patterns");
addNodeObject(generator, "Stripe", s_node_stripe, "Node_Stripe", [1, Node_Stripe],, "Generate stripe pattern.");
addNodeObject(generator, "Zigzag", s_node_zigzag, "Node_Zigzag", [1, Node_Zigzag],, "Generate zigzag pattern.");
@ -396,11 +395,11 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
addNodeObject(generator, "Grid", s_node_grid, "Node_Grid", [1, Node_Grid], ["tile"], "Generate grid pattern.");
addNodeObject(generator, "Triangular Grid", s_node_grid_tri, "Node_Grid_Tri", [1, Node_Grid_Tri],, "Generate triangular grid pattern.");
addNodeObject(generator, "Hexagonal Grid", s_node_grid_hex, "Node_Grid_Hex", [1, Node_Grid_Hex],, "Generate hexagonal grid pattern.");
ds_list_add(generator, "Populate");
addNodeObject(generator, "Repeat", s_node_repeat, "Node_Repeat", [1, Node_Repeat],, "Repeat image multiple times linearly, or in grid pattern.").setVersion(1100);
addNodeObject(generator, "Scatter", s_node_scatter, "Node_Scatter", [1, Node_Scatter],, "Scatter image randomly multiple times.");
ds_list_add(generator, "Simulation");
//addNodeObject(generator, "Dust", s_node_particle, "Node_Dust", [1, Node_Dust]).setVersion(1147);
addNodeObject(generator, "Particle", s_node_particle, "Node_Particle", [1, Node_Particle],, "Generate particle effect.");
@ -623,6 +622,10 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
ds_list_add(node, "Debug");
addNodeObject(node, "Print", s_node_print, "Node_Print", [1, Node_Print], ["debug log"], "Display text to notification.").setVersion(1145);
var actions = ds_list_create();
addNodeCatagory("Actions", actions);
__initNodeActions(actions);
//////////////////////////////////////////////////////////////// PIXEL BUILDER ////////////////////////////////////////////////////////////////
var pb_draw = ds_list_create();
@ -708,7 +711,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
global.VALUE_SUGGESTION[? VALUE_TYPE.color] = [ "Node_Solid", "Node_Color_Data", "Node_Color_Mix" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.surface] = [ "Node_Transform", "Node_Blend", "Node_Composite", "Node_Export" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.path] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.path] = [ "Node_Line" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.curve] = [ ];
global.VALUE_SUGGESTION[? VALUE_TYPE.text] = [ "Node_Text", "Node_To_Number" ];
global.VALUE_SUGGESTION[? VALUE_TYPE.object] = [ ];

View file

@ -289,6 +289,16 @@ function nodeValueUnit(value) constructor {
triggerButton.icon_blend = COLORS._main_icon_light;
triggerButton.icon = THEME.unit_ref;
static setMode = function(type) {
if(type == "constant" && mode == VALUE_UNIT.constant) return;
if(type == "relative" && mode == VALUE_UNIT.reference) return;
mode = type == "constant"? VALUE_UNIT.constant : VALUE_UNIT.reference;
value.cache_value[0] = false;
value.unitConvert(mode);
value.node.doUpdate();
}
static draw = function(_x, _y, _w, _h, _m) {
triggerButton.icon_index = mode;
triggerButton.tooltip = (mode? "Fraction" : "Pixel") + " unit";
@ -1167,7 +1177,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(global.EVALUATE_HEAD != noone && global.EVALUATE_HEAD == self) {
//noti_warning($"Expression evaluation error : recursive call detected.");
} else {
printIf(global.LOG_EXPRESSION, "==================== EVAL BEGIN {expTree} ====================");
printIf(global.LOG_EXPRESSION, $"==================== EVAL BEGIN {expTree} ====================");
//print(json_beautify(json_stringify(expTree)));
//printCallStack();
global.EVALUATE_HEAD = self;
var params = {
@ -1175,7 +1187,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
node_name: node.display_name,
value: val[0]
};
val[0] = expTree.eval(variable_clone(params));
var _exp_res = expTree.eval(variable_clone(params));
if(is_undefined(_exp_res)) {
val[0] = 0;
noti_warning("Expression not returning any values.");
} else
val[0] = _exp_res;
global.EVALUATE_HEAD = noone;
}
}
@ -1209,7 +1227,11 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
static showValue = function() {
var val = _getValue(, false);
var useCache = true;
if(display_type == VALUE_DISPLAY.area)
useCache = false;
var val = getValue(, false, 0, useCache);
if(isArray()) {
if(array_length(val) == 0) return 0;
@ -1506,6 +1528,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
drag_sy = 0;
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
if(type != VALUE_TYPE.integer && type != VALUE_TYPE.float) return -1;
if(value_from != noone) return -1;
if(expUse) return -1;
switch(display_type) {
case VALUE_DISPLAY._default :

View file

@ -84,7 +84,7 @@
ds_list_add(STATUSES, noti);
ds_list_add(WARNING, noti);
if(!instance_exists(o_dialog_warning) && !TESTING)
if(!instance_exists(o_dialog_warning))
dialogCall(o_dialog_warning, mouse_mx + ui(16), mouse_my + ui(16)).warning_text = str;
if(ref) {

View file

@ -94,13 +94,13 @@ function readObj(path, flipUV = false) {
}
file_text_close(file);
var txt = "OBJ summary";
txt += "\n\tVerticies : " + string(array_length(v));
txt += "\n\tTexture Verticies : " + string(array_length(vt));
txt += "\n\tNormal Verticies : " + string(array_length(vn));
txt += "\n\tFaces : " + string(face);
txt += "\n\tVertex groups : " + string(array_length(_VB));
print(txt);
//var txt = "OBJ summary";
//txt += "\n\tVerticies : " + string(array_length(v));
//txt += "\n\tTexture Verticies : " + string(array_length(vt));
//txt += "\n\tNormal Verticies : " + string(array_length(vn));
//txt += "\n\tFaces : " + string(face);
//txt += "\n\tVertex groups : " + string(array_length(_VB));
//print(txt);
#region centralize vertex
var cv = [0, 0, 0];

View file

@ -14,7 +14,7 @@ function pxl_document_parser(prompt) {
if(array_length(eq) > 1) {
for( var j = 0; j < array_length(eq) - 1; j++ )
array_push(params, string_trim(eq[j]));
array_push_unique(params, string_trim(eq[j]));
}
}

View file

@ -21,6 +21,11 @@
global.EQUATION_PRES[? "~"] = 9;
global.EQUATION_PRES[? "="] = -99;
global.EQUATION_PRES[? "⊕"] = -99; //+=
global.EQUATION_PRES[? "⊖"] = -99; //-=
global.EQUATION_PRES[? "⊗"] = -99; //*=
global.EQUATION_PRES[? "⊘"] = -99; ///=
global.EQUATION_PRES[? "⩵"] = -1; //==
global.EQUATION_PRES[? "≠"] = -1; //!=
global.EQUATION_PRES[? "<"] = 0;
@ -95,6 +100,14 @@ function functionStringClean(fx) {
fx = string_replace_all(fx, ">=", "≥");
fx = string_replace_all(fx, "<=", "≤");
fx = string_replace_all(fx, "++", "⊕1");
fx = string_replace_all(fx, "--", "⊖1");
fx = string_replace_all(fx, "+=", "⊕");
fx = string_replace_all(fx, "-=", "⊖");
fx = string_replace_all(fx, "*=", "⊗");
fx = string_replace_all(fx, "/=", "⊘");
fx = string_trim(fx);
return fx;
@ -175,6 +188,7 @@ function functionStringClean(fx) {
itr_array = false;
cond_init = noone;
cond_indx = noone;
cond_iter = noone;
cond_term = noone;
@ -215,6 +229,8 @@ function functionStringClean(fx) {
printIf(global.LOG_EXPRESSION, $"<<<<<< FOR EACH {_arr} >>>>>>");
for( var i = 0, n = array_length(_arr); i < n; i++ ) {
var val = _arr[i];
if(cond_indx != noone)
params[$ cond_indx] = i;
params[$ cond_iter] = val;
printIf(global.LOG_EXPRESSION, $"<< ITER {i}: {cond_iter} = {val} >>");
@ -345,7 +361,14 @@ function functionStringClean(fx) {
return res;
}
var v1 = getVal(l, params, symbol == "=" || symbol == "【" || isLeft);
var getRaw = false;
switch(symbol) {
case "=":
case "【":
getRaw = true;
}
var v1 = getVal(l, params, getRaw || isLeft);
var v2 = getVal(r, params);
var res = 0;
@ -362,7 +385,7 @@ function functionStringClean(fx) {
} else if(symbol == "=") {
if(is_array(v1)) {
var val = params[$ v1[0]];
array_safe_set(val, v1[1], v2);
val = array_safe_set(val, v1[1], v2);
params[$ v1[0]] = val;
res = val;
} else {
@ -384,28 +407,54 @@ function functionStringClean(fx) {
} else
res = eval_real(v1, v2);
printIf(global.LOG_EXPRESSION, $"|{v1}|{symbol}|{v2}| = {res}");
printIf(global.LOG_EXPRESSION, $"symbol : {symbol}");
printIf(global.LOG_EXPRESSION, $"l : | {typeof(l)} |{l}|");
printIf(global.LOG_EXPRESSION, $"r : | {typeof(r)} |{r}|");
printIf(global.LOG_EXPRESSION, "====================");
var _v1_var = getVal(l, params, true);
switch(symbol) {
case "⊕":
case "⊖":
case "⊗":
case "⊘":
if(is_array(_v1_var)) {
var val = params[$ _v1_var[0]];
val = array_safe_set(val, _v1_var[1], res);
params[$ _v1_var[0]] = val;
} else
params[$ _v1_var] = res;
printIf(global.LOG_EXPRESSION, $"|{_v1_var}| = {v1}|{symbol}|{v2}| = {res}");
printIf(global.LOG_EXPRESSION, $"symbol : {symbol}");
printIf(global.LOG_EXPRESSION, $"l : | {typeof(l)} |{l}|");
printIf(global.LOG_EXPRESSION, $"r : | {typeof(r)} |{r}|");
printIf(global.LOG_EXPRESSION, "====================");
break;
default:
printIf(global.LOG_EXPRESSION, $"|{v1}|{symbol}|{v2}| = {res}");
printIf(global.LOG_EXPRESSION, $"symbol : {symbol}");
printIf(global.LOG_EXPRESSION, $"l : | {typeof(l)} |{l}|");
printIf(global.LOG_EXPRESSION, $"r : | {typeof(r)} |{r}|");
printIf(global.LOG_EXPRESSION, "====================");
break;
}
return res;
}
static eval_real = function(v1, v2) {
switch(symbol) {
static eval_real = function(v1, v2, _symbol = symbol) {
switch(_symbol) {
case "+":
case "⊕":
if(_string(v1) || _string(v2))
return _string_trim(v1) + _string_trim(v2);
if(is_real(v1) && is_real(v2))
return v1 + v2;
return 0;
case "-": return (is_real(v1) && is_real(v2))? v1 - v2 : 0;
case "-":
case "⊖": return (is_real(v1) && is_real(v2))? v1 - v2 : 0;
case "∸": return is_real(v1)? -v1 : 0;
case "*": return (is_real(v1) && is_real(v2))? v1 * v2 : 0;
case "*":
case "⊗": return (is_real(v1) && is_real(v2))? v1 * v2 : 0;
case "$": return (is_real(v1) && is_real(v2))? power(v1, v2) : 0;
case "/": return (is_real(v1) && is_real(v2) && v2 != 0)? v1 / v2 : 0;
case "/":
case "⊘": return (is_real(v1) && is_real(v2) && v2 != 0)? v1 / v2 : 0;
case "%": return (is_real(v1) && is_real(v2) && v2 != 0)? v1 % v2 : 0;
case "&": return (is_real(v1) && is_real(v2))? v1 & v2 : 0;
@ -459,67 +508,91 @@ function functionStringClean(fx) {
}
function evaluateFunctionList(fx) {
var fxs = string_split(fx, "\n");
fx = string_replace_all(fx, "{", "\n{\n");
fx = string_replace_all(fx, "}", "\n}\n");
var fxs = string_split(fx, "\n", true);
var flist = new __funcList();
var call_st = ds_stack_create();
var blok_st = ds_stack_create();
ds_stack_push(call_st, flist);
for( var i = 0, n = array_length(fxs); i < n; i++ ) {
var _fx = functionStringClean(fxs[i]);
if(_fx == "") continue;
//print($"Eval line {i}: {_fx} [stack size = {ds_stack_size(call_st)}]");
var _fx_sp = string_split(_fx, "(");
if(string_char_at(_fx, 1) == "}") {
if(_fx == "" || _fx == "{") continue;
if(_fx == "}") {
ds_stack_pop(call_st);
_fx = string_replace(_fx, "}", "");
continue;
}
if(array_length(_fx_sp) > 1) {
var _cond = functionStrip(_fx);
switch(_fx_sp[0]) {
case "if":
var con_if = new __funcIf();
con_if.condition = evaluateFunctionTree(_cond);
ds_stack_top(call_st).addFunction(con_if);
ds_stack_push(call_st, con_if.if_true);
continue;
case "else if":
var con_if = new __funcIf();
con_if.condition = evaluateFunctionTree(_cond);
ds_stack_top(call_st).addFunction(con_if);
ds_stack_push(call_st, con_if.if_true);
continue;
case "else":
ds_stack_push(call_st, con_if.if_false);
continue;
case "for":
var con_for = new __funcFor();
var cond = string_splice(_cond, ":");
if(array_length(cond) == 2) {
con_for.itr_array = true;
con_for.cond_iter = cond[0];
con_for.cond_arr = evaluateFunctionTree(cond[1]);
} else if(array_length(cond) == 3) {
con_for.itr_array = false;
con_for.cond_init = evaluateFunctionTree(cond[0]);
con_for.cond_iter = evaluateFunctionTree(cond[1]);
con_for.cond_term = evaluateFunctionTree(cond[2]);
}
ds_stack_top(call_st).addFunction(con_for);
ds_stack_push(call_st, con_for.action);
continue;
}
}
var _fx_sp = string_split(_fx, "(");
var _cmd = string_trim(_fx_sp[0]);
var _cond = functionStrip(_fx);
ds_stack_top(call_st).addFunction(evaluateFunctionTree(_fx));
switch(_cmd) {
case "if":
var con_if = new __funcIf();
con_if.condition = evaluateFunctionTree(_cond);
ds_stack_top(call_st).addFunction(con_if);
ds_stack_push(call_st, con_if.if_true);
ds_stack_push(blok_st, con_if);
continue;
case "elseif":
var con_if = ds_stack_pop(blok_st);
var con_elif = new __funcIf();
con_elif.condition = evaluateFunctionTree(_cond);
con_if.if_false.addFunction(con_elif);
ds_stack_push(call_st, con_elif.if_true);
ds_stack_push(blok_st, con_elif);
continue;
case "else":
var con_if = ds_stack_pop(blok_st);
ds_stack_push(call_st, con_if.if_false);
continue;
case "for":
var con_for = new __funcFor();
var cond = string_splice(_cond, ":");
if(array_length(cond) == 2) {
con_for.itr_array = true;
con_for.cond_arr = evaluateFunctionTree(cond[1]);
cond[0] = string_trim(cond[0]);
var _itr = string_split(cond[0], ",");
if(array_length(_itr) == 1)
con_for.cond_iter = cond[0];
else if(array_length(_itr) == 2) {
con_for.cond_indx = string_trim(_itr[0]);
con_for.cond_iter = string_trim(_itr[1]);
}
} else if(array_length(cond) == 3) {
con_for.itr_array = false;
con_for.cond_init = evaluateFunctionTree(cond[0]);
con_for.cond_iter = evaluateFunctionTree(cond[1]);
con_for.cond_term = evaluateFunctionTree(cond[2]);
}
ds_stack_top(call_st).addFunction(con_for);
ds_stack_push(call_st, con_for.action);
continue;
}
if(ds_stack_empty(call_st)) {
print("Block stack empty, how?");
} else {
var _top = ds_stack_top(call_st);
_top.addFunction(evaluateFunctionTree(_fx));
}
}
var val = ds_stack_pop(call_st);
ds_stack_destroy(call_st);
ds_stack_destroy(blok_st);
return val;
return flist;
}
function evaluateFunctionTree(fx) {
@ -721,6 +794,11 @@ function functionStringClean(fx) {
case "<":
case ">":
case "⊕":
case "⊖":
case "⊗":
case "⊘":
if(ds_stack_size(vl) >= 2) {
var _v1 = ds_stack_pop(vl);
var _v2 = ds_stack_pop(vl);