export project as a portable zip file.

This commit is contained in:
Tanasart 2023-09-26 19:35:25 +07:00
parent b681ca3b88
commit e750f30168
60 changed files with 424 additions and 144 deletions

View file

@ -65,6 +65,7 @@
{"name":"physics","order":21,"path":"folders/functions/physics.yy",},
{"name":"project","order":37,"path":"folders/functions/project.yy",},
{"name":"shader","order":16,"path":"folders/functions/shader.yy",},
{"name":"sprite","order":42,"path":"folders/functions/sprite.yy",},
{"name":"string","order":5,"path":"folders/functions/string.yy",},
{"name":"surface","order":9,"path":"folders/functions/surface.yy",},
{"name":"dynamic surface","order":10,"path":"folders/functions/surface/dynamic surface.yy",},
@ -208,7 +209,6 @@
{"name":"biterator","order":2,"path":"folders/VCT/biterator.yy",},
{"name":"widget","order":3,"path":"folders/VCT/widget.yy",},
{"name":"widgets","order":5,"path":"folders/widgets.yy",},
{"name":"sprite","order":42,"path":"folders/functions/sprite.yy",},
],
"ResourceOrderSettings": [
{"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",},
@ -1324,6 +1324,7 @@
{"name":"buttonGradient","order":4,"path":"scripts/buttonGradient/buttonGradient.yy",},
{"name":"sh_draw_downsample","order":2,"path":"shaders/sh_draw_downsample/sh_draw_downsample.yy",},
{"name":"__view_get","order":1,"path":"scripts/__view_get/__view_get.yy",},
{"name":"export_portable","order":3,"path":"scripts/export_portable/export_portable.yy",},
{"name":"s_node_texture_map","order":38,"path":"sprites/s_node_texture_map/s_node_texture_map.yy",},
{"name":"fd_rectangle_create","order":7,"path":"scripts/fd_rectangle_create/fd_rectangle_create.yy",},
{"name":"s_node_level_selector","order":29,"path":"sprites/s_node_level_selector/s_node_level_selector.yy",},
@ -1565,6 +1566,7 @@
{"name":"o_dialog_assetbox","order":3,"path":"objects/o_dialog_assetbox/o_dialog_assetbox.yy",},
{"name":"node_lerp","order":2,"path":"scripts/node_lerp/node_lerp.yy",},
{"name":"s_node_pixel_sort","order":42,"path":"sprites/s_node_pixel_sort/s_node_pixel_sort.yy",},
{"name":"sh_mask_expand","order":55,"path":"shaders/sh_mask_expand/sh_mask_expand.yy",},
{"name":"node_texture_remap","order":2,"path":"scripts/node_texture_remap/node_texture_remap.yy",},
{"name":"sh_fd_visualize_pixel_art_fiery_smoke_glsl","order":14,"path":"shaders/sh_fd_visualize_pixel_art_fiery_smoke_glsl/sh_fd_visualize_pixel_art_fiery_smoke_glsl.yy",},
{"name":"node_ase_layer","order":15,"path":"scripts/node_ase_layer/node_ase_layer.yy",},

View file

@ -88,6 +88,7 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"physics","folderPath":"folders/functions/physics.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"project","folderPath":"folders/functions/project.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"shader","folderPath":"folders/functions/shader.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"sprite","folderPath":"folders/functions/sprite.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"string","folderPath":"folders/functions/string.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"surface","folderPath":"folders/functions/surface.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"dynamic surface","folderPath":"folders/functions/surface/dynamic surface.yy",},
@ -247,7 +248,6 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"biterator","folderPath":"folders/VCT/biterator.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"sprite","folderPath":"folders/functions/sprite.yy",},
],
"IncludedFiles": [
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",},
@ -262,7 +262,6 @@
{"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",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Nodes.zip","CopyToMask":-1,"filePath":"datafiles/data",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"icon.png","CopyToMask":-1,"filePath":"datafiles/data",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"layouts.zip","CopyToMask":-1,"filePath":"datafiles/data",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Horizontal.json","CopyToMask":-1,"filePath":"datafiles/data/layouts",},
@ -286,6 +285,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"UI.json","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"words.json","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"nodes.json","CopyToMask":-1,"filePath":"datafiles/data",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Nodes.zip","CopyToMask":-1,"filePath":"datafiles/data",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"default.zip","CopyToMask":-1,"filePath":"datafiles/data/themes",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"FiraCode-Medium.ttf","CopyToMask":-1,"filePath":"datafiles/data/themes/default/fonts",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"fonts.json","CopyToMask":-1,"filePath":"datafiles/data/themes/default/fonts",},
@ -363,6 +363,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_array_processor.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_center_canvas.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_curve_connection.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_export_package.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_grid_setting.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_grid_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_keyframe_override.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
@ -403,6 +404,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_node_resize.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_node_use_experssion.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_node_use_global.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_noti_icon_console.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_noti_icon_error_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_noti_icon_file_load.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_noti_icon_file_save.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
@ -2021,6 +2023,7 @@
{"id":{"name":"buttonGradient","path":"scripts/buttonGradient/buttonGradient.yy",},},
{"id":{"name":"sh_draw_downsample","path":"shaders/sh_draw_downsample/sh_draw_downsample.yy",},},
{"id":{"name":"__view_get","path":"scripts/__view_get/__view_get.yy",},},
{"id":{"name":"export_portable","path":"scripts/export_portable/export_portable.yy",},},
{"id":{"name":"sh_sample","path":"shaders/sh_sample/sh_sample.yy",},},
{"id":{"name":"s_node_texture_map","path":"sprites/s_node_texture_map/s_node_texture_map.yy",},},
{"id":{"name":"fd_rectangle_create","path":"scripts/fd_rectangle_create/fd_rectangle_create.yy",},},
@ -2302,6 +2305,7 @@
{"id":{"name":"o_dialog_assetbox","path":"objects/o_dialog_assetbox/o_dialog_assetbox.yy",},},
{"id":{"name":"node_lerp","path":"scripts/node_lerp/node_lerp.yy",},},
{"id":{"name":"s_node_pixel_sort","path":"sprites/s_node_pixel_sort/s_node_pixel_sort.yy",},},
{"id":{"name":"sh_mask_expand","path":"shaders/sh_mask_expand/sh_mask_expand.yy",},},
{"id":{"name":"node_texture_remap","path":"scripts/node_texture_remap/node_texture_remap.yy",},},
{"id":{"name":"sh_fd_visualize_pixel_art_fiery_smoke_glsl","path":"shaders/sh_fd_visualize_pixel_art_fiery_smoke_glsl/sh_fd_visualize_pixel_art_fiery_smoke_glsl.yy",},},
{"id":{"name":"node_ase_layer","path":"scripts/node_ase_layer/node_ase_layer.yy",},},

Binary file not shown.

View file

@ -128,7 +128,7 @@ draw_sprite_ext(s_noti_icon_error, 0, 18, 18, 0.5, 0.5, 0, c_white, 1);
if(point_in_rectangle(mouse_mx, mouse_my, bx0, by0, bx0 + bw, by0 + bh)) {
if(mouse_check_button_pressed(mb_left)) {
var path = executable_get_pathname();
execute_shell(path, "--crashed");
shell_execute(path, "--crashed");
}
if(mouse_check_button(mb_left))

View file

@ -46,7 +46,7 @@ if !ready exit;
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, __txtx("color_selector_open_palette", "Open palette folder"), THEME.folder) == 2) {
var _realpath = environment_get_variable("LOCALAPPDATA") + "/Pixels_Composer/Palettes";
var _windir = environment_get_variable("WINDIR") + "/explorer.exe";
execute_shell(_windir, _realpath);
shell_execute(_windir, _realpath);
}
bx -= ui(32);

View file

@ -45,7 +45,7 @@ draw_set_alpha(1);
if(directory_exists(_o)) {
var shell = "/E /I " + _o + " " + _n;
execute_shell("Xcopy", shell);
shell_execute("Xcopy", shell);
}
}
instance_destroy();

View file

@ -91,10 +91,10 @@
environment_set_variable("IMGUI_DIALOG_WIDTH", string(800));
var cmd = ".pxc=\"" + string(program_directory) + "PixelComposer.exe\"";
execute_shell("assoc", cmd);
shell_execute("assoc", cmd);
var cmd = ".pxcc=\"" + string(program_directory) + "PixelComposer.exe\"";
execute_shell("assoc", cmd);
shell_execute("assoc", cmd);
//print($"Setup time: {(current_time - t)/1000}s");
#endregion

View file

@ -11,18 +11,18 @@ enum PARTICLE_BLEND_MODE {
}
function __part(_node) constructor {
seed = irandom(99999);
node = _node;
active = false;
surf = noone;
prevx = 0;
prevy = 0;
x = 0;
y = 0;
seed = irandom(99999);
node = _node;
active = false;
surf = noone;
prevx = 0;
prevy = 0;
x = 0;
y = 0;
speedx = 0;
speedy = 0;
turning = 0;
turnSpd = 0
turnSpd = 0;
accel = 0;
wig = 0;
@ -120,6 +120,7 @@ function __part(_node) constructor {
static kill = function() {
active = false;
node.onPartDestroy(self);
}
@ -169,7 +170,6 @@ function __part(_node) constructor {
}
static draw = function(exact, surf_w, surf_h) {
if(!active) return;
var ss = surf;
if(is_array(surf)) {
var ind = abs(round((life_total - life) * anim_speed));
@ -189,7 +189,9 @@ function __part(_node) constructor {
break;
}
}
if(!is_surface(ss)) return;
var surface = node.surface_cache[? ss];
if(!is_surface(surface)) return;
var lifeRat = 1 - life / life_total;
var scCurve = eval_curve_x(sct, lifeRat);
@ -197,8 +199,8 @@ function __part(_node) constructor {
scy = sc_sy * scCurve;
var _xx, _yy;
var s_w = surface_get_width_safe(ss) * scx;
var s_h = surface_get_height_safe(ss) * scy;
var s_w = surface_get_width_safe(surface) * scx;
var s_h = surface_get_height_safe(surface) * scy;
if(boundary_data == -1) {
var _pp = point_rotate(-s_w / 2, -s_h / 2, 0, 0, rot);
@ -233,7 +235,7 @@ function __part(_node) constructor {
if(blend != c_white) cc = colorMultiply(blend, cc);
alp_draw = alp * eval_curve_x(alp_fade, lifeRat);
draw_surface_ext_safe(ss, _xx, _yy, scx, scy, rot, cc, alp_draw);
draw_surface_ext_safe(surface, _xx, _yy, scx, scy, rot, cc, alp_draw);
}
static getPivot = function() {

View file

@ -162,7 +162,7 @@ function __Node_3D_Repeat(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inputs[| 21].setVisible(_proj);
}
function update(frame = PROJECT.animator.current_frame) {
static update = function(frame = PROJECT.animator.current_frame) {
var _dim = inputs[| 0].getValue();
var _lpos = inputs[| 1].getValue();
var _lrot = inputs[| 2].getValue();

View file

@ -147,19 +147,20 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
parts_runner = 0;
seed = 0;
spawn_index = 0;
spawn_index = 0;
scatter_index = 0;
def_surface = -1;
def_surface = -1;
current_data = [];
current_data = [];
surface_cache = ds_map_create();
for(var i = 0; i < attributes.part_amount; i++)
parts[i] = new __part(self);
static spawn = function(_time = PROJECT.animator.current_frame, _pos = -1) {
static spawn = function(_time = PROJECT.animator.current_frame, _pos = -1) { #region
var _inSurf = current_data[0];
if(_inSurf == 0) {
if(!is_surface(_inSurf)) {
if(!is_surface(def_surface))
return;
_inSurf = def_surface;
@ -309,7 +310,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
parts_runner = safe_mod(parts_runner + 1, attributes.part_amount);
}
}
} #endregion
static onSpawn = function(_time, part) {}
@ -326,6 +327,10 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
render();
seed = inputs[| 32].getValue();
var keys = ds_map_keys_to_array(surface_cache);
for( var i = 0, n = array_length(keys); i < n; i++ )
surface_free_safe(surface_cache[? keys[i]]);
var _loop = inputs[| 21].getValue();
if(!_loop) return;
@ -357,6 +362,17 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
for( var i = 0; i < ds_list_size(inputs); i++ )
current_data[i] = inputs[| i].getValue(_time);
var surfs = current_data[0];
if(!is_array(current_data[0])) surfs = [ surfs ];
if(!array_empty(current_data[0])) {
if(is_array(current_data[0]))
surfs = array_spread(surfs);
for( var i = 0, n = array_length(surfs); i < n; i++ ) {
if(is_surface(surface_cache[? surfs[i]])) continue;
surface_cache[? surfs[i]] = surface_clone(surfs[i]);
}
}
if(_spawn_active) {
switch(_spawn_type) {
case 0 :

View file

@ -30,7 +30,7 @@ function dynaSurf() constructor {
onFree();
}
static clone = function() {}
static clone = function() { return noone; }
static destroy = function() {}
}
@ -60,4 +60,14 @@ function compute_dynaSurf() : dynaSurf() constructor {
drawFn.eval(params);
}
static clone = function() {
var _surf = new compute_dynaSurf();
_surf.drawFn = drawFn;
_surf.widthFn = widthFn;
_surf.heightFn = heightFn;
return _surf;
}
}

View file

@ -34,13 +34,26 @@ function dynaSurf_iso() : dynaSurf() constructor {
var _surf = getSurface(_rot);
draw_surface_part_ext_safe(_surf, _l, _t, _w, _h, _x, _y, _xs, _ys, 0, _col, _alp);
}
static clone = function() {
var _new = new dynaSurf_iso();
_new.surfaces = surface_array_clone(surfaces);
_new.angles = array_clone(angles);
_new.angle_shift = angle_shift;
return _new;
}
static destroy = function() {
surface_array_free(surfaces);
}
}
function dynaSurf_iso_4() : dynaSurf_iso() constructor {
surfaces = array_create(4, noone);
static getSurface = function(_rot) {
_rot += angle;
_rot += angle_shift;
var ind = 0;
if(abs(angle_difference( 0, _rot)) <= 45) ind = 0;
else if(abs(angle_difference( 90, _rot)) <= 45) ind = 1;
@ -52,8 +65,9 @@ function dynaSurf_iso_4() : dynaSurf_iso() constructor {
static clone = function() {
var _new = new dynaSurf_iso_4();
_new.surfaces = surfaces;
_new.angle = angle;
_new.surfaces = surface_array_clone(surfaces);
_new.angles = array_clone(angles);
_new.angle_shift = angle_shift;
return _new;
}
@ -63,7 +77,7 @@ function dynaSurf_iso_8() : dynaSurf_iso() constructor {
surfaces = array_create(8, noone);
static getSurface = function(_rot) {
_rot += angle;
_rot += angle_shift;
var ind = 0;
if(abs(angle_difference( 0, _rot)) <= 22.5) ind = 0;
else if(abs(angle_difference( 45, _rot)) <= 22.5) ind = 1;
@ -79,8 +93,9 @@ function dynaSurf_iso_8() : dynaSurf_iso() constructor {
static clone = function() {
var _new = new dynaSurf_iso_8();
_new.surfaces = surfaces;
_new.angle = angle;
_new.surfaces = surface_array_clone(surfaces);
_new.angles = array_clone(angles);
_new.angle_shift = angle_shift;
return _new;
}

View file

@ -0,0 +1,51 @@
function __pack_file_strip(zip, path) {
var _fname = filename_name(path);
var _nname = "src/" + _fname;
zip_add_file(zip, _nname, path);
return _nname;
}
function exportPortable(project = PROJECT) {
if(DEMO) return false;
var path = get_save_filename("Pixel Composer portable project (.zip)|*.zip", "");
key_release();
if(path == "") return false;
var raw_name = filename_name_only(path);
var raw_path = filename_path(path) + raw_name;
var _proj = save_serialize(project, true);
var zip = zip_create();
for( var i = 0, n = array_length(_proj.nodes); i < n; i++ ) {
var _node = _proj.nodes[i];
for( var j = 0, m = array_length(_node.inputs); j < m; j++ ) {
var _input = _node.inputs[j];
for( var k = 0, o = array_length(_input.raw_value); k < o; k++ ) {
var _val = _input.raw_value[k][1];
if(is_string(_val) && file_exists(_val))
_input.raw_value[k][1] = __pack_file_strip(zip, _val);
else if(is_array(_val)) {
for( var l = 0, p = array_length(_val); l < p; l++ ) {
if(is_string(_val[l]) && file_exists(_val[l]))
_input.raw_value[k][1][l] = __pack_file_strip(zip, _val[l]);
}
}
}
}
}
var pro_path = DIRECTORY + "temp/" + raw_name + ".pxc";
var file = file_text_open_write(pro_path);
file_text_write_string(file, PREF_MAP[? "save_file_minify"]? json_stringify_minify(_proj) : json_stringify(_proj, true));
file_text_close(file);
zip_add_file(zip, raw_name + ".pxc", pro_path);
zip_save(zip, raw_path + ".zip");
log_message("EXPORT", $"Export package to {raw_path}.zip succeed.", THEME.noti_icon_file_save);
}

View file

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

View file

@ -59,7 +59,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
refreshDynamicInput();
}
function step() {
static step = function() {
var _dim = inputs[| 0].getValue();
var _outSurf = outputs[| 0].getValue();
@ -67,7 +67,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
outputs[| 0].setValue(_outSurf);
}
function update(_time = PROJECT.animator.current_frame) {
static update = function(_time = PROJECT.animator.current_frame) {
if(!PROJECT.animator.is_playing) {
recoverCache();
return;
@ -103,6 +103,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
for(var j = 0; j < array_length(parts); j++)
for(var k = 0; k < array_length(parts[j]); k++) {
if(!parts[j][k].active) continue;
parts[j][k].draw(_exact, surf_w, surf_h);
}
}

View file

@ -39,7 +39,7 @@ function Node_Armature_Sample(_x, _y, _group = noone) : Node(_x, _y, _group) con
_b.draw(attributes, false, _x, _y, _s, _mx, _my);
} #endregion
function update() { #region
static update = function() { #region
var _bone = inputs[| 0].getValue();
var _name = inputs[| 1].getValue();
var _prog = inputs[| 2].getValue();

View file

@ -76,7 +76,7 @@ function Node_Armature_Path(_x, _y, _group = noone) : Node(_x, _y, _group) const
return new __vec2( _x, _y );
} #endregion
function update() { #region
static update = function() { #region
var _bone = inputs[| 0].getValue();
if(_bone == noone) return;

View file

@ -11,7 +11,7 @@ function Node_Array_Length(_x, _y, _group = noone) : Node(_x, _y, _group) constr
outputs[| 0] = nodeValue("Size", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0);
function update(frame = PROJECT.animator.current_frame) {
static update = function(frame = PROJECT.animator.current_frame) {
var _arr = inputs[| 0].getValue();
inputs[| 0].type = inputs[| 0].value_from == noone? VALUE_TYPE.any : inputs[| 0].value_from.type;

View file

@ -54,7 +54,7 @@ function Node_Compare(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
return 0;
}
function update(frame = PROJECT.animator.current_frame) {
static update = function(frame = PROJECT.animator.current_frame) {
var mode = inputs[| 0].getValue();
var a = inputs[| 1].getValue();
var b = inputs[| 2].getValue();

View file

@ -273,7 +273,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var shell_cmd = _pathTemp + " -define webp:lossless=true " + _frame;
array_push(frames, _frame);
execute_shell(magick, shell_cmd);
shell_execute(magick, shell_cmd, self);
_path = file_find_next();
}
@ -291,7 +291,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
cmd += "-bgcolor 0,0,0,0 ";
cmd += "-o \"" + target_path + "\"";
execute_shell(webp, cmd);
shell_execute(webp, cmd, self);
var noti = log_message("EXPORT", "Export webp as " + target_path, THEME.noti_icon_tick, COLORS._main_value_positive, false);
noti.path = filename_dir(target_path);
@ -318,14 +318,14 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
shell_cmd += temp_path;
//print($"{gifski} {shell_cmd}");
execute_shell(gifski, shell_cmd);
shell_execute(gifski, shell_cmd, self);
} else {
var shell_cmd = $"-delay {framerate} -alpha set -dispose previous -loop {loop_str}";
if(opti) shell_cmd += $" -fuzz {fuzz * 100}% -layers OptimizeFrame -layers OptimizeTransparency";
shell_cmd += " " + temp_path + " " + target_path;
//print($"{converter} {shell_cmd}");
execute_shell(converter, shell_cmd);
shell_execute(converter, shell_cmd, self);
}
var noti = log_message("EXPORT", "Export gif as " + target_path, THEME.noti_icon_tick, COLORS._main_value_positive, false);
@ -373,8 +373,18 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
res = true;
break;
case "i" :
if(_array) array_push(s, [ "i", string(index) ]);
else s += string(index);
var _txt = "";
var float_str = string_digits(str);
if(float_str != "") {
var float_val = string_digits(float_str);
var str_val = max(float_val - string_length(string(index)), 0);
repeat(str_val)
_txt += "0";
}
_txt += string(index);
if(_array) array_push(s, [ "i", _txt ]);
else s += _txt;
res = true;
break;
case "d" :
@ -418,8 +428,11 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
}
}
if(_array) array_push(s, ["ext", ".png"]);
else s += ".png";
var _e = inputs[| 9].getValue();
var _ext = array_safe_get(inputs[| 9].display_data, _e, ".png");
if(_array) array_push(s, ["ext", _ext]);
else s += _ext;
return s;
}
@ -451,7 +464,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
_pathTemp = "\"" + _pathTemp + "\"";
var shell_cmd = _pathTemp + " -quality " + string(qual) + " " + _pathOut;
execute_shell(magick, shell_cmd);
shell_execute(magick, shell_cmd, self);
break;
case ".webp":
@ -461,7 +474,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
_pathTemp = "\"" + _pathTemp + "\"";
var shell_cmd = _pathTemp + " -quality " + string(qual) + " -define webp:lossless=true " + _pathOut;
execute_shell(magick, shell_cmd);
shell_execute(magick, shell_cmd, self);
break;
}

View file

@ -21,14 +21,22 @@ function Node_Fluid_Add(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) con
inputs[| 5] = nodeValue("Density", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01 ]);
inputs[| 6] = nodeValue("Expand velocity mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0);
inputs[| 7] = nodeValue("Velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 0])
.setDisplay(VALUE_DISPLAY.vector);
input_display_list = [
["Domain", false], 0,
["Fluid", false], 3, 1, 5, 2, 4,
["Domain", false], 0,
["Fluid", false], 3, 1, 5, 2,
["Velocity", false], 7, 4, 6,
];
_prevPos = noone;
outputs[| 0] = nodeValue("Fluid Domain", self, JUNCTION_CONNECT.output, VALUE_TYPE.fdomain, noone);
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
var _mat = inputs[| 1].getValue();
var _pos = inputs[| 2].getValue();
@ -42,9 +50,7 @@ function Node_Fluid_Add(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) con
}
inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
}
_prevPos = noone;
} #endregion
static update = function(frame = PROJECT.animator.current_frame) {
var _dom = inputs[| 0].getValue(frame);
@ -53,6 +59,8 @@ function Node_Fluid_Add(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) con
var _act = inputs[| 3].getValue(frame);
var _inh = inputs[| 4].getValue(frame);
var _den = inputs[| 5].getValue(frame);
var _msk = inputs[| 6].getValue(frame);
var _vel = inputs[| 7].getValue(frame);
if(_dom == noone || !instance_exists(_dom)) return;
outputs[| 0].setValue(_dom);
@ -63,11 +71,38 @@ function Node_Fluid_Add(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) con
var sw = surface_get_width_safe(_mat);
var sh = surface_get_height_safe(_mat);
var dx = _vel[0];
var dy = _vel[1];
if(_prevPos != noone && _inh != 0) {
var dx = _pos[0] - _prevPos[0];
var dy = _pos[1] - _prevPos[1];
dx += (_pos[0] - _prevPos[0]) * _inh;
dy += (_pos[1] - _prevPos[1]) * _inh;
}
if(dx != 0 || dy != 0) {
if(_msk == 0)
fd_rectangle_add_velocity_surface(_dom, _mat, _pos[0] - sw / 2, _pos[1] - sh / 2, 1, 1, dx, dy);
else {
var _vw = sw + max(0, _msk * 2);
var _vh = sh + max(0, _msk * 2);
fd_rectangle_add_velocity_surface(_dom, _mat, _pos[0] - sw / 2, _pos[1] - sh / 2, 1, 1, dx * _inh, dy * _inh);
var _vmask = surface_create(_vw, _vh);
surface_set_shader(_vmask,,, BLEND.over);
draw_surface_safe(_mat, max(0, _msk), max(0, _msk));
surface_reset_shader();
var vel_mask = surface_create(_vw, _vh);
surface_set_shader(vel_mask, sh_mask_expand);
shader_set_f("dimension", _vw, _vh);
shader_set_f("amount", _msk);
draw_surface_safe(_vmask);
surface_reset_shader();
fd_rectangle_add_velocity_surface(_dom, vel_mask, _pos[0] - _vw / 2, _pos[1] - _vh / 2, 1, 1, dx, dy);
surface_free(_vmask);
surface_free(vel_mask);
}
}
fd_rectangle_add_material_surface(_dom, _mat, _pos[0] - sw / 2, _pos[1] - sh / 2, 1, 1, c_white, _den);

View file

@ -25,10 +25,12 @@ function variable_editor(nodeVal) constructor {
vb_range = new vectorBox(2, function(index, val) {
slider_range[index] = val;
refreshInput();
});
tb_step = new textBox(TEXTBOX_INPUT.number, function(val) {
slider_step = val;
refreshInput();
});
sc_type = new scrollBox(val_type_name, function(val) {
@ -81,6 +83,7 @@ function variable_editor(nodeVal) constructor {
value.setValue([0, 0, 0]);
break;
case "Vector4" :
case "Vector2 range" :
case "Padding" :
value.setValue([0, 0, 0, 0]);
break;
@ -124,16 +127,16 @@ function variable_editor(nodeVal) constructor {
case "Rotation" : value.setDisplay(VALUE_DISPLAY.rotation); break;
case "Rotation range" : value.setDisplay(VALUE_DISPLAY.rotation_range); break;
case "Slider" :
value.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]);
value.setDisplay(VALUE_DISPLAY.slider, [slider_range[0], slider_range[1], slider_step]);
break;
case "Slider range" :
value.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, 0.01]);
value.setDisplay(VALUE_DISPLAY.slider_range, [slider_range[0], slider_range[1], slider_step]);
break;
case "Padding" : value.setDisplay(VALUE_DISPLAY.padding); break;
case "Vector2" : value.setDisplay(VALUE_DISPLAY.vector); break;
case "Vector3" : value.setDisplay(VALUE_DISPLAY.vector); break;
case "Vector2" :
case "Vector3" :
case "Vector4" : value.setDisplay(VALUE_DISPLAY.vector); break;
case "Vector range" : value.setDisplay(VALUE_DISPLAY.vector_range); break;
case "Vector range" :
case "Vector2 range" : value.setDisplay(VALUE_DISPLAY.vector_range); break;
case "Area" : value.setDisplay(VALUE_DISPLAY.area); break;
case "Palette" : value.setDisplay(VALUE_DISPLAY.palette); break;

View file

@ -101,7 +101,7 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con
json_save_struct(path, cont);
}
function step() {
static step = function() {
for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
var inp = inputs[| i + 1];
var typ = inp.value_from == noone? VALUE_TYPE.any : inp.value_from.type;

View file

@ -181,7 +181,7 @@ function Node_Logic(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
return val;
}
function update(frame = PROJECT.animator.current_frame) {
static update = function(frame = PROJECT.animator.current_frame) {
var mode = inputs[| 0].getValue();
var a = inputs[| 1].getValue();
var val;

View file

@ -201,7 +201,7 @@ function Node_Math(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
return val;
}
function update(frame = PROJECT.animator.current_frame) {
static update = function(frame = PROJECT.animator.current_frame) {
use_mod = inputs[| 0].getValue();
var a = inputs[| 1].getValue();
var b = inputs[| 2].getValue();

View file

@ -22,7 +22,7 @@ function Node_Mesh_Create_Path(_x, _y, _group = noone) : Node(_x, _y, _group) co
mesh.draw(_x, _y, _s);
}
function update() {
static update = function() {
var _pth = inputs[| 0].getValue();
var _sam = inputs[| 1].getValue();
var _algo = inputs[| 2].getValue();

View file

@ -48,7 +48,7 @@ function Node_Mesh_To_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constr
return new __vec2();
}
function update() {
static update = function() {
var _mesh = inputs[| 0].getValue();
outputs[| 0].setValue(self);
if(_mesh == noone) return;

View file

@ -48,7 +48,7 @@ function Node_Mesh_Transform(_x, _y, _group = noone) : Node(_x, _y, _group) cons
p.y = _pp[1] + _pos[1];
}
function update() {
static update = function() {
var _msh = inputs[| 0].getValue();
var _pos = inputs[| 1].getValue();
var _rot = inputs[| 2].getValue();

View file

@ -36,7 +36,7 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
inputs[| 0].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
}
function step() {
static step = function() {
var int = inputs[| 1].getValueCached();
var disp = inputs[| 2].getValueCached();
@ -227,7 +227,7 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
}
}
function step() {
static step = function() {
var int = inputs[| 2].getValueCached();
var disp = inputs[| 3].getValueCached();
@ -411,7 +411,7 @@ function Node_Vector3(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
outputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
function step() {
static step = function() {
var int = inputs[| 3].getValueCached();
for( var i = 0; i < 3; i++ ) {
inputs[| i].type = int? VALUE_TYPE.integer : VALUE_TYPE.float;
@ -466,7 +466,7 @@ function Node_Vector4(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
outputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
function step() {
static step = function() {
var int = inputs[| 4].getValueCached();
for( var i = 0; i < 4; i++ ) {
inputs[| i].type = int? VALUE_TYPE.integer : VALUE_TYPE.float;

View file

@ -305,7 +305,7 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node(_x, _y, _group) con
static onValueUpdate = function() { extractPalettes(); }
static onValueFromUpdate = function() { extractPalettes(); }
function update() {
static update = function() {
extractPalettes();
}

View file

@ -29,7 +29,7 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
static onInspector2Update = function() { clearCache(); }
static onValueUpdate = function(index = 0) {
static onValueUpdate = function(index = 0) { #region
if(index == input_len + 0) {
var _dim = inputs[| input_len + 0].getValue();
var _outSurf = outputs[| 0].getValue();
@ -40,17 +40,17 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
if(PROJECT.animator.is_playing)
PROJECT.animator.setFrame(-1);
}
} #endregion
static onStep = function() {
static onStep = function() { #region
var _dim = inputs[| input_len + 0].getValue();
var _outSurf = outputs[| 0].getValue();
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
outputs[| 0].setValue(_outSurf);
}
} #endregion
static onUpdate = function() {
static onUpdate = function() { #region
if(ANIMATION_STATIC) {
if(!recoverCache()) {
var _dim = inputs[| input_len + 0].getValue();
@ -67,9 +67,9 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
if(PROJECT.animator.current_frame == 0)
reset();
runVFX(PROJECT.animator.current_frame);
}
} #endregion
function render(_time = PROJECT.animator.current_frame) {
function render(_time = PROJECT.animator.current_frame) { #region
var _dim = inputs[| input_len + 0].getValue(_time);
var _exact = inputs[| input_len + 1].getValue(_time);
var _blend = inputs[| input_len + 2].getValue(_time);
@ -90,8 +90,12 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
var surf_w = surface_get_width_safe(_outSurf);
var surf_h = surface_get_height_safe(_outSurf);
for(var i = 0; i < attributes.part_amount; i++)
//print($"===== Drawing frame {_time} =====");
for(var i = 0; i < attributes.part_amount; i++) {
if(!parts[i].active) continue;
//print($" > Draw part {i} = ({parts[i].x}, {parts[i].y})");
parts[i].draw(_exact, surf_w, surf_h);
}
BLEND_NORMAL;
surface_reset_shader();
@ -100,5 +104,5 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
//print($"Cache frame {PROJECT.animator.current_frame}");
cacheCurrentFrame(_outSurf);
}
}
} #endregion
}

View file

@ -129,7 +129,7 @@ function Node_Path_Blend(_x, _y, _group = noone) : Node(_x, _y, _group) construc
return _p1.lerpTo(_p2, _lerp);
}
function update() {
static update = function() {
outputs[| 0].setValue(self);
}

View file

@ -107,7 +107,7 @@ function Node_Path_Builder(_x, _y, _group = noone) : Node(_x, _y, _group) constr
return boundary;
}
function update() {
static update = function() {
var _lines = inputs[| 0].getValue();
var _conn = inputs[| 1].getValue();

View file

@ -181,7 +181,7 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const
static getBoundary = function() { return boundary; }
function update() { #region
static update = function() { #region
var _len = inputs[| 0].getValue();
var _ang = inputs[| 1].getValue();
var _pos = inputs[| 2].getValue();

View file

@ -70,7 +70,7 @@ function Node_Path_Map_Area(_x, _y, _group = noone) : Node(_x, _y, _group) const
_area[AREA_INDEX.center_y] + _area[AREA_INDEX.half_h] );
}
function update() {
static update = function() {
outputs[| 0].setValue(self);
}

View file

@ -116,7 +116,7 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct
static getBoundary = function() { return boundary; }
function step() {
static step = function() {
var _coor = inputs[| 1].getValue();
var _eqa = inputs[| 2].getValue();
@ -167,7 +167,7 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct
}
}
function updateBoundary() {
static updateBoundary = function() {
boundary = new BoundingBox( 0, 0, 1, 1 );
length = 0;
@ -184,7 +184,7 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct
}
}
function update() {
static update = function() {
updateBoundary();
outputs[| 0].setValue(self);
}

View file

@ -46,7 +46,7 @@ function Node_Path_Reverse(_x, _y, _group = noone) : Node(_x, _y, _group) constr
return getPointRatio(_dist / getLength(), ind);
}
function update() {
static update = function() {
outputs[| 0].setValue(self);
}

View file

@ -64,7 +64,7 @@ function Node_Path_Shift(_x, _y, _group = noone) : Node(_x, _y, _group) construc
return struct_has(_path, "getBoundary")? _path.getBoundary(ind) : new BoundingBox( 0, 0, 1, 1 );
}
function update() {
static update = function() {
outputs[| 0].setValue(self);
}

View file

@ -134,7 +134,7 @@ function Node_Path_Transform(_x, _y, _group = noone) : Node(_x, _y, _group) cons
_b[3] = cy + (_b[3] - cy) * _sca[1];
}
function update() {
static update = function() {
outputs[| 0].setValue(self);
}

View file

@ -57,7 +57,7 @@ function Node_Path_Trim(_x, _y, _group = noone) : Node(_x, _y, _group) construct
return struct_has(_path, "getBoundary")? _path.getBoundary(ind) : new BoundingBox( 0, 0, 1, 1 );
}
function update() {
static update = function() {
outputs[| 0].setValue(self);
}

View file

@ -99,7 +99,7 @@ function Node_Path_Wave(_x, _y, _group = noone) : Node(_x, _y, _group) construct
return struct_has(_path, "getBoundary")? _path.getBoundary(ind) : new BoundingBox( 0, 0, 1, 1 );
}
function update() {
static update = function() {
for( var i = 0, n = ds_list_size(inputs); i < n; i++ )
current_data[i] = inputs[| i].getValue();

View file

@ -76,24 +76,25 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
if(_output.type == VALUE_TYPE.d3object) //passing 3D vertex call
return _out;
if(_output.type == VALUE_TYPE.surface) //free surface if needed
surface_array_free(_out);
if(_output.type == VALUE_TYPE.surface && dimension_index > -1) { //resize surface
var surf = inputs_data[dimension_index];
var _sw = 1, _sh = 1;
if(inputs[| dimension_index].type == VALUE_TYPE.surface) {
if(is_surface(surf)) {
_sw = surface_get_width_safe(surf);
_sh = surface_get_height_safe(surf);
} else
return noone;
} else if(is_array(surf)) {
_sw = array_safe_get(surf, 0, 1);
_sh = array_safe_get(surf, 1, 1);
if(_output.type == VALUE_TYPE.surface) { //resize surface
if(dimension_index == -1)
surface_array_free(_out);
else {
var surf = inputs_data[dimension_index];
var _sw = 1, _sh = 1;
if(inputs[| dimension_index].type == VALUE_TYPE.surface) {
if(is_surface(surf)) {
_sw = surface_get_width_safe(surf);
_sh = surface_get_height_safe(surf);
} else
return noone;
} else if(is_array(surf)) {
_sw = array_safe_get(surf, 0, 1);
_sh = array_safe_get(surf, 1, 1);
}
_out = surface_verify(_out, _sw, _sh, attrDepth());
}
_out = surface_verify(_out, _sw, _sh, attrDepth());
}
current_data = inputs_data;
@ -105,7 +106,6 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
return inputs_data[0]
}
all_inputs = inputs_data;
var data = processData(_out, inputs_data, outIndex, 0); /// Process data
return data;
} #endregion
@ -190,6 +190,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
} #endregion
static processOutput = function() { #region
var val;
for(var i = 0; i < ds_list_size(outputs); i++) {
if(outputs[| i].process_array) {
val = processDataArray(i);

View file

@ -251,7 +251,7 @@ function Node_Repeat(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
surface_reset_target();
}
function update(frame = PROJECT.animator.current_frame) {
static update = function(frame = PROJECT.animator.current_frame) {
var _inSurf = inputs[| 0].getValue();
if(is_array(_inSurf) && array_length(_inSurf) == 0) return;
if(!is_array(_inSurf) && !is_surface(_inSurf)) return;

View file

@ -53,7 +53,7 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons
static getPreviewValues = function() { return refVal.getValue(); }
function update(frame = PROJECT.animator.current_frame) {
static update = function(frame = PROJECT.animator.current_frame) {
var _area = inputs[| 0].getValue();
var _dist = inputs[| 1].getValue();
var _scat = inputs[| 2].getValue();

View file

@ -13,7 +13,7 @@ function Node_String_Join(_x, _y, _group = noone) : Node(_x, _y, _group) constru
outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, "");
function update() {
static update = function() {
var _arr = inputs[| 0].getValue();
var _div = inputs[| 1].getValue();
var str = "";

View file

@ -25,7 +25,7 @@ function Node_String_Trim(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
["Trim", false], 3, 4, 1, 2,
];
function step() {
static step = function() {
var mode = inputs[| 4].getValue();
inputs[| 1].type = mode? VALUE_TYPE.float : VALUE_TYPE.integer;

View file

@ -53,7 +53,7 @@ function Node_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| index + 1].name = inputs[| index].getValue() + " value";
}
function step() {
static step = function() {
for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
var inp = inputs[| i + 1];
var typ = inp.value_from == noone? VALUE_TYPE.any : inp.value_from.type;
@ -61,7 +61,7 @@ function Node_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
}
}
function update() {
static update = function() {
var str = {};
for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {

View file

@ -11,7 +11,7 @@ function Node_Struct_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construc
outputs[| 0] = nodeValue("Struct", self, JUNCTION_CONNECT.output, VALUE_TYPE.struct, {});
function update() {
static update = function() {
var str = inputs[| 0].getValue();
var key = inputs[| 1].getValue();

View file

@ -25,7 +25,7 @@ function Node_Trigger(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| 0].setValue(true);
}
function step() {
static step = function() {
if(doTrigger == 1) {
outputs[| 0].setValue(true);
doTrigger = -1;
@ -35,7 +35,7 @@ function Node_Trigger(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
}
}
function update() {
static update = function() {
var trg = inputs[| 0].getValue();
if(trg) doTrigger = 1;
}

View file

@ -18,7 +18,7 @@ function Node_Trigger_Bool(_x, _y, _group = noone) : Node(_x, _y, _group) constr
doTrigger = 0;
function step() {
static step = function() {
if(doTrigger == 1) {
outputs[| 0].setValue(true);
doTrigger = -1;
@ -28,7 +28,7 @@ function Node_Trigger_Bool(_x, _y, _group = noone) : Node(_x, _y, _group) constr
}
}
function update() {
static update = function() {
var val = inputs[| 0].getValue();
var con = inputs[| 1].getValue();

View file

@ -810,8 +810,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion
case VALUE_DISPLAY.slider_range : #region
editWidget = new sliderRange(display_data[0], display_data[1], display_data[2], function(index, val) {
//var _val = animator.getValue();
//_val[index] = val;
return setValueDirect(val, index);
} );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1);

View file

@ -15,7 +15,7 @@ function Panel_Menu() : PanelContent() constructor {
else
action_buttons = ["exit", "minimize", "maximize", "fullscreen"];
menu_file = [
menu_file_nondemo = [
menuItem(__txt("New"), function() { NEW(); }, THEME.new_file, ["", "New file"]),
menuItem(__txt("Open") + "...", function() { LOAD(); }, THEME.noti_icon_file_load, ["", "Open"]),
menuItem(__txt("Save"), function() { SAVE(); }, THEME.save, ["", "Save"]),
@ -31,7 +31,17 @@ function Panel_Menu() : PanelContent() constructor {
return submenuCall(_dat, arr);
}).setIsShelf(),
menuItem(__txtx("panel_menu_auto_save_folder", "Open autosave folder"), function() { shellOpenExplorer(DIRECTORY + "autosave"); }, THEME.save_auto),
menuItem(__txt("Export"), function(_dat) {
var arr = [
menuItem(__txt("Portable project (.zip)") + "...", function() { exportPortable(); }),
];
return submenuCall(_dat, arr);
}).setIsShelf(),
-1,
];
menu_file = [
menuItem(__txt("Preferences") + "...", function() { dialogCall(o_dialog_preference); }, THEME.gear),
menuItem(__txt("Splash screen"), function() { dialogCall(o_dialog_splash); }),
-1,
@ -68,7 +78,7 @@ function Panel_Menu() : PanelContent() constructor {
menuItem(__txt("Close program"), function() { window_close(); },, [ "", "Close program" ]),
];
if(DEMO) array_delete(menu_file, 1, 5);
if(!DEMO) menu_file = array_append(menu_file_nondemo, menu_file);
menu_help = [
menuItem(__txtx("panel_menu_help_video", "Tutorial videos"), function() {

View file

@ -10,7 +10,7 @@ function NEW() {
PANEL_GRAPH = graph;
}
function save_serialize(project = PROJECT) {
function save_serialize(project = PROJECT, _outMap = false) {
var _map = {};
_map.version = SAVE_VERSION;
@ -50,8 +50,9 @@ function save_serialize(project = PROJECT) {
}
_map.addon = _addon;
var val = PREF_MAP[? "save_file_minify"]? json_stringify_minify(_map) : json_stringify(_map, true);
return val;
if(_outMap) return _map;
return PREF_MAP[? "save_file_minify"]? json_stringify_minify(_map) : json_stringify(_map, true);
}
function SET_PATH(project, path) {

View file

@ -1,5 +1,12 @@
function shellOpenExplorer(path) {
var _windir = environment_get_variable("WINDIR") + "/explorer.exe";
path = string_replace_all(path, "/", "\\");
execute_shell(_windir, path);
shell_execute(_windir, path);
}
function shell_execute(path, command, ref = noone) {
gml_pragma("forceinline");
noti_status($"{path} {command}", THEME.noti_icon_console, false, ref);
execute_shell(path, command);
}

View file

@ -1,7 +1,7 @@
function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widget() constructor {
minn = _min; curr_minn = _min;
maxx = _max; curr_maxx = _max;
step = _step;
stepSize = _step;
onModify = _onModify;
onRelease = _onRelease;
@ -38,7 +38,7 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static draw = function(_x, _y, _w, _h, _data, _m, tb_w = 50, halign = fa_left, valign = fa_top) {
static draw = function(_x, _y, _w, _h, _data, _m, tb_w = 64, halign = fa_left, valign = fa_top) {
x = _x;
y = _y;
w = _w;
@ -89,7 +89,7 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
draw_sprite_stretched_ext(spr, 3, _kx - handle_w / 2, _y, handle_w, _h, COLORS._main_accent, 1);
var val = (_m[0] - _x) / sw * (curr_maxx - curr_minn) + curr_minn;
val = round(val / step) * step;
val = round(val / stepSize) * stepSize;
val = clamp(val, curr_minn, curr_maxx);
if(key_mod_press(CTRL))

View file

@ -1,7 +1,7 @@
function sliderRange(_min, _max, _step, _onModify) : widget() constructor {
minn = _min;
maxx = _max;
step = _step;
stepSize = _step;
spr = THEME.slider;
onModify = _onModify;
@ -70,7 +70,7 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor {
draw_sprite_stretched_ext(spr, 3, _slider_x1 - ui(10), _y, ui(20), _h, COLORS._main_accent, 1);
var val = (_m[0] - _x0) / sw * (maxx - minn) + minn;
val = round(val / step) * step;
val = round(val / stepSize) * stepSize;
val = clamp(val, minn, maxx);
if(key_mod_press(CTRL))
val = round(val);

View file

@ -337,21 +337,23 @@ function surface_copy_from(dst, src, format = noone) {
surface_reset_target();
}
function surface_clone(surface, source = noone, format = noone) {
function surface_clone(surface, destination = noone, format = noone) {
gml_pragma("forceinline");
if(is_struct(surface) && is_instanceof(surface, dynaSurf))
return surface.clone();
if(!is_surface(surface)) return noone;
source = surface_verify(source, surface_get_width_safe(surface), surface_get_height_safe(surface), format == noone? surface_get_format(surface) : format);
destination = surface_verify(destination, surface_get_width_safe(surface), surface_get_height_safe(surface), format == noone? surface_get_format(surface) : format);
surface_set_target(source);
surface_set_target(destination);
DRAW_CLEAR
BLEND_OVERRIDE;
draw_surface_safe(surface, 0, 0);
BLEND_NORMAL
surface_reset_target();
return source;
return destination;
}
//in-place modification

View file

@ -0,0 +1,64 @@
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 dimension;
uniform float amount;
void main() {
vec2 tx = 1. / dimension;
gl_FragColor = texture2D( gm_BaseTexture, v_vTexcoord );
if(amount > 0.) {
if(gl_FragColor.a > 0.) {
gl_FragColor = vec4(1.);
return;
}
for( float i = 0.; i < amount; i++ ) {
vec2 _tx0 = v_vTexcoord + vec2( tx.x, 0. ) * i;
vec2 _tx1 = v_vTexcoord + vec2( -tx.x, 0. ) * i;
vec2 _tx2 = v_vTexcoord + vec2( 0., tx.y ) * i;
vec2 _tx3 = v_vTexcoord + vec2( 0., -tx.y ) * i;
vec4 _sm0 = texture2D( gm_BaseTexture, _tx0 );
if(_sm0.a > 0.) { gl_FragColor = vec4(1.); return; }
vec4 _sm1 = texture2D( gm_BaseTexture, _tx1 );
if(_sm1.a > 0.) { gl_FragColor = vec4(1.); return; }
vec4 _sm2 = texture2D( gm_BaseTexture, _tx2 );
if(_sm2.a > 0.) { gl_FragColor = vec4(1.); return; }
vec4 _sm3 = texture2D( gm_BaseTexture, _tx3 );
if(_sm3.a > 0.) { gl_FragColor = vec4(1.); return; }
}
gl_FragColor = vec4(0.);
} else {
if(gl_FragColor == vec4(0.)) return;
for( float i = 0.; i < abs(amount); i++ ) {
vec2 _tx0 = v_vTexcoord + vec2( tx.x, 0. ) * i;
vec2 _tx1 = v_vTexcoord + vec2( -tx.x, 0. ) * i;
vec2 _tx2 = v_vTexcoord + vec2( 0., tx.y ) * i;
vec2 _tx3 = v_vTexcoord + vec2( 0., -tx.y ) * i;
vec4 _sm0 = texture2D( gm_BaseTexture, _tx0 );
if(_sm0.a == 0.) { gl_FragColor = vec4(0.); return; }
vec4 _sm1 = texture2D( gm_BaseTexture, _tx1 );
if(_sm1.a == 0.) { gl_FragColor = vec4(0.); return; }
vec4 _sm2 = texture2D( gm_BaseTexture, _tx2 );
if(_sm2.a == 0.) { gl_FragColor = vec4(0.); return; }
vec4 _sm3 = texture2D( gm_BaseTexture, _tx3 );
if(_sm3.a == 0.) { gl_FragColor = vec4(0.); return; }
}
gl_FragColor = vec4(1.);
}
}

View file

@ -0,0 +1,19 @@
//
// Simple passthrough vertex shader
//
attribute vec3 in_Position; // (x,y,z)
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
attribute vec4 in_Colour; // (r,g,b,a)
attribute vec2 in_TextureCoord; // (u,v)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main()
{
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord;
}

View file

@ -0,0 +1,10 @@
{
"resourceType": "GMShader",
"resourceVersion": "1.0",
"name": "sh_mask_expand",
"parent": {
"name": "filter",
"path": "folders/shader/filter.yy",
},
"type": 1,
}