1.14pr9.3 update

This commit is contained in:
Tanasart 2023-04-10 20:02:59 +02:00
parent bb6e1311ec
commit 96fb8a513f
27 changed files with 250 additions and 236 deletions

View file

@ -5,4 +5,6 @@
xscale = 1; xscale = 1;
yscale = 1; yscale = 1;
depth = -9999;
#endregion #endregion

View file

@ -0,0 +1,3 @@
/// @description
//if(!is_undefined(phy_active))
// draw_surface_ext_safe(surface, phy_position_x, phy_position_y, xscale, yscale, image_angle);

View file

@ -4,6 +4,7 @@
"name": "oRigidbody", "name": "oRigidbody",
"eventList": [ "eventList": [
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,}, {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,},
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,},
], ],
"managed": true, "managed": true,
"overriddenProperties": [], "overriddenProperties": [],
@ -37,5 +38,5 @@
"path": "sprites/s_fx_pixel/s_fx_pixel.yy", "path": "sprites/s_fx_pixel/s_fx_pixel.yy",
}, },
"spriteMaskId": null, "spriteMaskId": null,
"visible": false, "visible": true,
} }

View file

@ -256,6 +256,5 @@
#region tween #region tween
tweenInit(); tweenInit();
physics_world_update_iterations(300); physics_world_update_iterations(100);
physics_world_update_speed(60);
#endregion #endregion

View file

@ -13,6 +13,8 @@
playback = ANIMATOR_END.loop; playback = ANIMATOR_END.loop;
static setFrame = function(frame) { static setFrame = function(frame) {
//if(frame == 0) resetAnimation();
var _c = current_frame; var _c = current_frame;
frame = clamp(frame, 0, frames_total); frame = clamp(frame, 0, frames_total);
real_frame = frame; real_frame = frame;
@ -33,6 +35,17 @@
} else } else
frame_progress = false; frame_progress = false;
} }
static resetAnimation = function() {
var _key = ds_map_find_first(NODE_MAP);
var amo = ds_map_size(NODE_MAP);
repeat(amo) {
var _node = NODE_MAP[? _key];
_node.resetAnimation();
_key = ds_map_find_next(NODE_MAP, _key);
}
}
} }
#endregion #endregion

View file

@ -10,11 +10,11 @@
directory_create(root); directory_create(root);
var _l = root + "/version"; var _l = root + "/version";
if(file_exists(_l)) { //if(file_exists(_l)) {
var res = json_load_struct(_l); // var res = json_load_struct(_l);
if(!is_struct(res) || !struct_has(res, "version") || res.version < VERSION) // if(!is_struct(res) || !struct_has(res, "version") || res.version != VERSION)
zip_unzip("data/Assets.zip", root); // zip_unzip("data/Assets.zip", root);
} else //} else
zip_unzip("data/Assets.zip", root); zip_unzip("data/Assets.zip", root);
json_save_struct(_l, { version: VERSION }); json_save_struct(_l, { version: VERSION });

View file

@ -9,11 +9,11 @@ function __initCollection() {
directory_create(root); directory_create(root);
var _l = root + "/version"; var _l = root + "/version";
if(file_exists(_l)) { //if(file_exists(_l)) {
var res = json_load_struct(_l); // var res = json_load_struct(_l);
if(!is_struct(res) || !struct_has(res, "version") || res.version < COLLECTION_VERSION) // if(!is_struct(res) || !struct_has(res, "version") || res.version != COLLECTION_VERSION)
zip_unzip("data/Collections.zip", root); // zip_unzip("data/Collections.zip", root);
} else //} else
zip_unzip("data/Collections.zip", root); zip_unzip("data/Collections.zip", root);
json_save_struct(_l, { version: COLLECTION_VERSION }); json_save_struct(_l, { version: COLLECTION_VERSION });

View file

@ -25,8 +25,8 @@ function __log(title, str, fname = "log.txt") {
file_text_close(f); file_text_close(f);
} }
function log_message(title, str, icon = noone, flash = false) { function log_message(title, str, icon = noone, flash = false, write = true) {
__log("[MESSAGE] ", string(title) + ": " + string(str)); if(write) __log("[MESSAGE] ", string(title) + ": " + string(str));
return noti_status(string(title) + ": " + string(str), icon, flash); return noti_status(string(title) + ": " + string(str), icon, flash);
} }

View file

@ -37,7 +37,7 @@
SAVEFILE_VERSION = 1400; SAVEFILE_VERSION = 1400;
COLLECTION_VERSION = 1140.090; COLLECTION_VERSION = 1140.090;
THEME_VERSION = 1140.090; THEME_VERSION = 1140.090;
VERSION_STRING = "1.14.0pr9.2"; VERSION_STRING = "1.14.0pr9.3";
globalvar NODES, NODE_MAP, APPEND_MAP, HOTKEYS, HOTKEY_CONTEXT, NODE_INSTANCES; globalvar NODES, NODE_MAP, APPEND_MAP, HOTKEYS, HOTKEY_CONTEXT, NODE_INSTANCES;

View file

@ -62,6 +62,13 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []); outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, []);
attributes[? "size"] = 1; attributes[? "size"] = 1;
attributes[? "spread_value"] = false;
array_push(attributeEditors, "Node");
array_push(attributeEditors, ["Spread array", "spread_value",
new checkBox(function() {
attributes[? "spread_value"] = !attributes[? "spread_value"];
})]);
static getType = function() { static getType = function() {
var _type = inputs[| 0].getValue(); var _type = inputs[| 0].getValue();
@ -150,11 +157,17 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
var _typ = getType(); var _typ = getType();
outputs[| 0].type = _typ; outputs[| 0].type = _typ;
var res = array_create(ds_list_size(inputs) - input_fix_len - 1); var res = [];
var ind = 0; var ind = 0;
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) { for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
res[ind++] = inputs[| i].getValue(); var val = inputs[| i].getValue();
if(is_array(val) && attributes[? "spread_value"])
array_append(res, val);
else
array_push(res, val);
inputs[| i].type = inputs[| i].value_from? inputs[| i].value_from.type : _typ; inputs[| i].type = inputs[| i].value_from? inputs[| i].value_from.type : _typ;
if(i == input_fix_len && _typ == VALUE_TYPE.any && inputs[| i].value_from) if(i == input_fix_len && _typ == VALUE_TYPE.any && inputs[| i].value_from)

View file

@ -1329,6 +1329,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
static preConnect = function() {} static preConnect = function() {}
static postConnect = function() {} static postConnect = function() {}
static resetAnimation = function() {}
static cleanUp = function() { static cleanUp = function() {
for( var i = 0; i < ds_list_size(inputs); i++ ) for( var i = 0; i < ds_list_size(inputs); i++ )
inputs[| i].cleanUp(); inputs[| i].cleanUp();

View file

@ -132,7 +132,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
execute_shell(webp, cmd); execute_shell(webp, cmd);
var noti = log_message("EXPORT", "Export webp as " + target_path, THEME.noti_icon_tick, COLORS._main_value_positive); 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); noti.path = filename_dir(target_path);
noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer); noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer);
@ -164,7 +164,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
execute_shell(converter, shell_cmd); execute_shell(converter, shell_cmd);
var noti = log_message("EXPORT", "Export gif as " + target_path, THEME.noti_icon_tick, COLORS._main_value_positive); var noti = log_message("EXPORT", "Export gif as " + target_path, THEME.noti_icon_tick, COLORS._main_value_positive, false);
noti.path = filename_dir(target_path); noti.path = filename_dir(target_path);
noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer); noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer);
@ -260,6 +260,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
case ".png": case ".png":
surface_save_safe(_surf, _path); surface_save_safe(_surf, _path);
break; break;
case ".jpg": case ".jpg":
surface_save_safe(_surf, _pathTemp); surface_save_safe(_surf, _pathTemp);
@ -270,6 +271,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
print(shell_cmd) print(shell_cmd)
execute_shell(magick, shell_cmd); execute_shell(magick, shell_cmd);
break; break;
case ".webp": case ".webp":
surface_save_safe(_surf, _pathTemp); surface_save_safe(_surf, _pathTemp);
@ -311,7 +313,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
} }
if(form != NODE_EXPORT_FORMAT.gif) { if(form != NODE_EXPORT_FORMAT.gif) {
var noti = log_message("EXPORT", "Export " + string(array_length(surf)) + " images complete.", THEME.noti_icon_tick, COLORS._main_value_positive); var noti = log_message("EXPORT", "Export " + string(array_length(surf)) + " images complete.", THEME.noti_icon_tick, COLORS._main_value_positive, false);
noti.path = filename_dir(p); noti.path = filename_dir(p);
noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer); noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer);
@ -330,7 +332,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
p = save_surface(surf, p); p = save_surface(surf, p);
if(form != NODE_EXPORT_FORMAT.gif) { if(form != NODE_EXPORT_FORMAT.gif) {
var noti = log_message("EXPORT", "Export image as " + p, THEME.noti_icon_tick, COLORS._main_value_positive); var noti = log_message("EXPORT", "Export image as " + p, THEME.noti_icon_tick, COLORS._main_value_positive, false);
noti.path = filename_dir(p); noti.path = filename_dir(p);
noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer); noti.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer);

View file

@ -75,7 +75,7 @@ function __initNodeData() {
if(file_exists(_l)) { if(file_exists(_l)) {
var res = json_load_struct(_l); var res = json_load_struct(_l);
if(res.version >= VERSION) return; if(res.version == VERSION) return;
} }
json_save_struct(_l, { version: VERSION }); json_save_struct(_l, { version: VERSION });

View file

@ -49,7 +49,7 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons
inputs[| 2] = nodeValue("Stretch frame", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false) inputs[| 2] = nodeValue("Stretch frame", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
.rejectArray(); .rejectArray();
inputs[| 3] = nodeValue("Frame duration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) inputs[| 3] = nodeValue("Frame duration", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.rejectArray(); .rejectArray();
inputs[| 4] = nodeValue("Animation end", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) inputs[| 4] = nodeValue("Animation end", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
@ -174,6 +174,9 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons
break; break;
} }
var _spr = array_safe_get(spr, _frame, noone);
if(_spr == noone) return;
var curr_w = sprite_get_width(spr[_frame]); var curr_w = sprite_get_width(spr[_frame]);
var curr_h = sprite_get_height(spr[_frame]); var curr_h = sprite_get_height(spr[_frame]);
var curr_x = pad[2] + (ww - curr_w) / 2; var curr_x = pad[2] + (ww - curr_w) / 2;

View file

@ -15,11 +15,9 @@ function Node_Rigid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro
_output.inputs[| 0].setFrom(_render.outputs[| 0]); _output.inputs[| 0].setFrom(_render.outputs[| 0]);
} }
//physics_world_update_iterations(30);
//physics_world_update_speed(100)
static reset = function() { static reset = function() {
instance_destroy(oRigidbody); instance_destroy(oRigidbody);
physics_pause_enable(true); physics_pause_enable(true);
var node_list = getNodeList(); var node_list = getNodeList();
@ -28,6 +26,7 @@ function Node_Rigid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro
if(variable_struct_exists(n, "reset")) if(variable_struct_exists(n, "reset"))
n.reset(); n.reset();
} }
physics_pause_enable(false); physics_pause_enable(false);
} }

View file

@ -8,6 +8,7 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
min_h = 96; min_h = 96;
object = []; object = [];
attributes[? "mesh"] = [];
inputs[| 0] = nodeValue("Affect by force", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true) inputs[| 0] = nodeValue("Affect by force", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)
.rejectArray(); .rejectArray();
@ -61,20 +62,12 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
]; ];
static newMesh = function(index) { static newMesh = function(index) {
var mx = "mesh_x" + string(index); var mesh = ds_map_try_get(attributes, "mesh", []);
var my = "mesh_y" + string(index); mesh[index] = [ [ 0, 0],
[32, 0],
attributes[? mx] = ds_list_create(); [32, 32],
attributes[? mx][| 0] = 0; [ 0, 32] ];
attributes[? mx][| 1] = 32; attributes[? "mesh"] = mesh;
attributes[? mx][| 2] = 32;
attributes[? mx][| 3] = 0;
attributes[? my] = ds_list_create();
attributes[? my][| 0] = 0;
attributes[? my][| 1] = 0;
attributes[? my][| 2] = 32;
attributes[? my][| 3] = 32;
} }
newMesh(0); newMesh(0);
@ -97,14 +90,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
var _shp = inputs[| 5].getValue(); var _shp = inputs[| 5].getValue();
var _box = inputs[| 7].getValue(); var _box = inputs[| 7].getValue();
var mshx = "mesh_x" + string(preview_index); var meshes = attributes[? "mesh"];
var mshy = "mesh_y" + string(preview_index); if(preview_index >= array_length(meshes)) return;
if(!ds_map_exists(attributes, mshx))
newMesh(preview_index);
var lx = attributes[? mshx];
var ly = attributes[? mshy];
var len = ds_list_size(lx);
if(previewing == 0) { if(previewing == 0) {
if(_shp == 2) { if(_shp == 2) {
@ -115,11 +102,15 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
draw_set_color(is_convex? COLORS._main_accent : COLORS._main_value_negative); draw_set_color(is_convex? COLORS._main_accent : COLORS._main_value_negative);
for( var i = 0; i < len; i++ ) { for( var j = 0; j < array_length(meshes); j++ ) {
var _px0 = lx[| i]; var _m = meshes[j];
var _py0 = ly[| i]; var _l = array_length(_m);
var _px1 = lx[| safe_mod(i + 1, len)];
var _py1 = ly[| safe_mod(i + 1, len)]; for( var i = 0; i < _l; i++ ) {
var _px0 = _m[i][0];
var _py0 = _m[i][1];
var _px1 = _m[safe_mod(i + 1, _l)][0];
var _py1 = _m[safe_mod(i + 1, _l)][1];
_px0 = (_px0 / tw) * 2 - 1; _px0 = (_px0 / tw) * 2 - 1;
_py0 = (_py0 / th) * 2 - 1; _py0 = (_py0 / th) * 2 - 1;
@ -138,6 +129,7 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
draw_line_width(_dx0, _dy0, _dx1, _dy1, 1); draw_line_width(_dx0, _dy0, _dx1, _dy1, 1);
} }
}
draw_set_color(COLORS._main_accent); draw_set_color(COLORS._main_accent);
var x0 = _box[0] - _box[2]; var x0 = _box[0] - _box[2];
@ -162,14 +154,17 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
var _hover = -1, _side = 0; var _hover = -1, _side = 0;
draw_set_color(is_convex? COLORS._main_accent : COLORS._main_value_negative); draw_set_color(is_convex? COLORS._main_accent : COLORS._main_value_negative);
var mesh = meshes[preview_index];
var len = array_length(mesh);
is_convex = true; is_convex = true;
for( var i = 0; i < len; i++ ) { for( var i = 0; i < len; i++ ) {
var _px0 = lx[| i]; var _px0 = mesh[safe_mod(i + 0, len)][0];
var _py0 = ly[| i]; var _py0 = mesh[safe_mod(i + 0, len)][1];
var _px1 = lx[| safe_mod(i + 1, len)]; var _px1 = mesh[safe_mod(i + 1, len)][0];
var _py1 = ly[| safe_mod(i + 1, len)]; var _py1 = mesh[safe_mod(i + 1, len)][1];
var _px2 = lx[| safe_mod(i + 2, len)]; var _px2 = mesh[safe_mod(i + 2, len)][0];
var _py2 = ly[| safe_mod(i + 2, len)]; var _py2 = mesh[safe_mod(i + 2, len)][1];
var side = cross_product(_px0, _py0, _px1, _py1, _px2, _py2); var side = cross_product(_px0, _py0, _px1, _py1, _px2, _py2);
if(_side != 0 && sign(_side) != sign(side)) if(_side != 0 && sign(_side) != sign(side))
@ -191,8 +186,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
draw_set_text(f_p1, fa_center, fa_bottom); draw_set_text(f_p1, fa_center, fa_bottom);
for( var i = 0; i < len; i++ ) { for( var i = 0; i < len; i++ ) {
var _px = lx[| i]; var _px = mesh[i][0];
var _py = ly[| i]; var _py = mesh[i][1];
var _dx = _x + _px * _s; var _dx = _x + _px * _s;
var _dy = _y + _py * _s; var _dy = _y + _py * _s;
@ -216,8 +211,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
dx = value_snap(dx, _snx); dx = value_snap(dx, _snx);
dy = value_snap(dy, _sny); dy = value_snap(dy, _sny);
lx[| anchor_dragging] = dx; mesh[anchor_dragging][0] = dx;
ly[| anchor_dragging] = dy; mesh[anchor_dragging][1] = dy;
if(mouse_release(mb_left)) if(mouse_release(mb_left))
anchor_dragging = -1; anchor_dragging = -1;
@ -230,15 +225,13 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
if(mouse_click(mb_left, active)) { if(mouse_click(mb_left, active)) {
if(isUsingTool(0)) { if(isUsingTool(0)) {
anchor_dragging = hover; anchor_dragging = hover;
anchor_drag_sx = lx[| hover]; anchor_drag_sx = mesh[hover][0];
anchor_drag_sy = ly[| hover]; anchor_drag_sy = mesh[hover][1];
anchor_drag_mx = _mx; anchor_drag_mx = _mx;
anchor_drag_my = _my; anchor_drag_my = _my;
} else if(isUsingTool(1)) { } else if(isUsingTool(1)) {
if(ds_list_size(lx) > 3) { if(array_length(mesh) > 3)
ds_list_delete(lx, hover); array_delete(mesh, hover, 1);
ds_list_delete(ly, hover);
}
} }
} }
} else { } else {
@ -248,8 +241,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
ds_list_insert(ly, ind, (_my - _y) / _s); ds_list_insert(ly, ind, (_my - _y) / _s);
anchor_dragging = ind; anchor_dragging = ind;
anchor_drag_sx = lx[| ind]; anchor_drag_sx = mesh[ind][0];
anchor_drag_sy = ly[| ind]; anchor_drag_sy = mesh[ind][1];
anchor_drag_mx = _mx; anchor_drag_mx = _mx;
anchor_drag_my = _my; anchor_drag_my = _my;
} }
@ -267,13 +260,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
if(!is_surface(_tex)) return; if(!is_surface(_tex)) return;
var mshx = "mesh_x" + string(index); var meshes = attributes[? "mesh"];
var mshy = "mesh_y" + string(index); var mesh = [];
var lx = attributes[? mshx];
var ly = attributes[? mshy];
ds_list_clear(lx);
ds_list_clear(ly);
var ww = surface_get_width(_tex); var ww = surface_get_width(_tex);
var hh = surface_get_height(_tex); var hh = surface_get_height(_tex);
@ -349,29 +337,26 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
py = cmY + lengthdir_y(dist, dirr); py = cmY + lengthdir_y(dist, dirr);
} }
ds_list_add(lx, px); array_push(mesh, [ px, py ]);
ds_list_add(ly, py);
} }
removeColinear(index); mesh = removeColinear(mesh);
removeConcave(index); mesh = removeConcave(mesh);
var _sm = ds_map_create(); var _sm = ds_map_create();
for( var i = 0; i < ds_list_size(lx); i++ ) for( var i = 0; i < array_length(mesh); i++ )
_sm[? point_direction_positive(cmX, cmY, lx[| i], ly[| i])] = [lx[| i], ly[| i]]; _sm[? point_direction_positive(cmX, cmY, mesh[i][0], mesh[i][1])] = [ mesh[i][0], mesh[i][1] ];
var keys = ds_map_keys_to_array(_sm); var keys = ds_map_keys_to_array(_sm);
mesh = [];
if(array_length(keys)) { if(array_length(keys)) {
array_sort(keys, false); array_sort(keys, false);
ds_list_clear(lx);
ds_list_clear(ly);
for( var i = 0; i < array_length(keys); i++ ) { for( var i = 0; i < array_length(keys); i++ ) {
ds_list_add(lx, _sm[? keys[i]][0]); var k = keys[i];
ds_list_add(ly, _sm[? keys[i]][1]); array_push( mesh, [_sm[? k][0], _sm[? k][1]] );
} }
} }
@ -381,26 +366,23 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
ds_map_destroy(_pm); ds_map_destroy(_pm);
surface_free(temp); surface_free(temp);
buffer_delete(surface_buffer); buffer_delete(surface_buffer);
meshes[index] = mesh;
attributes[? "mesh"] = meshes;
} }
static removeColinear = function(index = 0) { static removeColinear = function(mesh) {
var mshx = "mesh_x" + string(index); var len = array_length(mesh), _side = 0;
var mshy = "mesh_y" + string(index);
var fxList = attributes[? mshx];
var fyList = attributes[? mshy];
var len = ds_list_size(fxList), _side = 0;
var remSt = []; var remSt = [];
var tolerance = 5; var tolerance = 5;
for( var i = 0; i < len; i++ ) { for( var i = 0; i < len; i++ ) {
var _px0 = fxList[| i]; var _px0 = mesh[safe_mod(i + 0, len)][0];
var _py0 = fyList[| i]; var _py0 = mesh[safe_mod(i + 0, len)][1];
var _px1 = fxList[| safe_mod(i + 1, len)]; var _px1 = mesh[safe_mod(i + 1, len)][0];
var _py1 = fyList[| safe_mod(i + 1, len)]; var _py1 = mesh[safe_mod(i + 1, len)][1];
var _px2 = fxList[| safe_mod(i + 2, len)]; var _px2 = mesh[safe_mod(i + 2, len)][0];
var _py2 = fyList[| safe_mod(i + 2, len)]; var _py2 = mesh[safe_mod(i + 2, len)][1];
var dir0 = point_direction(_px0, _py0, _px1, _py1); var dir0 = point_direction(_px0, _py0, _px1, _py1);
var dir1 = point_direction(_px1, _py1, _px2, _py2); var dir1 = point_direction(_px1, _py1, _px2, _py2);
@ -412,27 +394,21 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
array_sort(remSt, false); array_sort(remSt, false);
for( var i = 0; i < array_length(remSt); i++ ) { for( var i = 0; i < array_length(remSt); i++ ) {
var ind = remSt[i]; var ind = remSt[i];
array_delete(mesh, ind, 1);
ds_list_delete(fxList, ind);
ds_list_delete(fyList, ind);
}
} }
static removeConcave = function(index = 0) { return mesh;
var mshx = "mesh_x" + string(index); }
var mshy = "mesh_y" + string(index);
var fxList = attributes[? mshx]; static removeConcave = function(mesh) {
var fyList = attributes[? mshy]; var len = array_length(mesh);
var len = ds_list_size(fxList);
if(len <= 3) return; if(len <= 3) return;
var startIndex = 0; var startIndex = 0;
var maxx = 0; var maxx = 0;
for( var i = 0; i < len; i++ ) { for( var i = 0; i < len; i++ ) {
var _px0 = fxList[| i]; var _px0 = mesh[i][0];
if(_px0 > maxx) { if(_px0 > maxx) {
maxx = _px0; maxx = _px0;
@ -457,12 +433,12 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
printIf(log, "Checking " + string(potentialPoint) + " Against " + string(anchorPoint) + " Test " + string(anchorTest)) printIf(log, "Checking " + string(potentialPoint) + " Against " + string(anchorPoint) + " Test " + string(anchorTest))
if(potentialPoint == startIndex) break; if(potentialPoint == startIndex) break;
var _px0 = fxList[| anchorPoint]; var _px0 = mesh[anchorPoint][0];
var _py0 = fyList[| anchorPoint]; var _py0 = mesh[anchorPoint][1];
var _px1 = fxList[| potentialPoint]; var _px1 = mesh[potentialPoint][0];
var _py1 = fyList[| potentialPoint]; var _py1 = mesh[potentialPoint][1];
var _px2 = fxList[| anchorTest]; var _px2 = mesh[anchorTest][0];
var _py2 = fyList[| anchorTest]; var _py2 = mesh[anchorTest][1];
var side = sign(cross_product(_px0, _py0, _px1, _py1, _px2, _py2)); var side = sign(cross_product(_px0, _py0, _px1, _py1, _px2, _py2));
if(_side == 0 || _side == side) { if(_side == 0 || _side == side) {
@ -485,10 +461,10 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
for( var i = 0; i < array_length(remSt); i++ ) { for( var i = 0; i < array_length(remSt); i++ ) {
var ind = remSt[i]; var ind = remSt[i];
array_delete(mesh, ind, 1);
ds_list_delete(fxList, ind);
ds_list_delete(fyList, ind);
} }
return mesh;
} }
static onValueUpdate = function(index = 0) { static onValueUpdate = function(index = 0) {
@ -545,8 +521,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
if(object == noone) { if(object == noone) {
object = instance_create_depth(ox - _spos[2], oy - _spos[3], 0, oRigidbody); object = instance_create_depth(ox - _spos[2], oy - _spos[3], 0, oRigidbody);
object.image_xscale = _spos[2] / ww * 2; object.xscale = _spos[2] / ww * 2;
object.image_yscale = _spos[3] / hh * 2; object.yscale = _spos[3] / hh * 2;
object.surface = _tex; object.surface = _tex;
} else if(instance_exists(object)) { } else if(instance_exists(object)) {
for( var i = 0; i < array_length(object.fixture); i++ ) for( var i = 0; i < array_length(object.fixture); i++ )
@ -564,23 +540,19 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
physics_fixture_set_circle_shape(fixture, min(_spos[2], _spos[3])); physics_fixture_set_circle_shape(fixture, min(_spos[2], _spos[3]));
fixtureCreate(fixture, object); fixtureCreate(fixture, object);
} else if(_shp == 2) { } else if(_shp == 2) {
var mshx = "mesh_x" + string(index); var mesh = attributes[? "mesh"][index];
var mshy = "mesh_y" + string(index);
var fxList = attributes[? mshx];
var fyList = attributes[? mshy];
var cx = 0, cy = 0; var cx = 0, cy = 0;
var cmx = 0, cmy = 0; var cmx = 0, cmy = 0;
var len = ds_list_size(fxList), _side = 0; var len = array_length(mesh), _side = 0;
is_convex = true; is_convex = true;
for( var i = 0; i < len; i++ ) { for( var i = 0; i < len; i++ ) {
var _px0 = fxList[| i]; var _px0 = mesh[safe_mod(i + 0, len)][0];
var _py0 = fyList[| i]; var _py0 = mesh[safe_mod(i + 0, len)][1];
var _px1 = fxList[| safe_mod(i + 1, len)]; var _px1 = mesh[safe_mod(i + 1, len)][0];
var _py1 = fyList[| safe_mod(i + 1, len)]; var _py1 = mesh[safe_mod(i + 1, len)][1];
var _px2 = fxList[| safe_mod(i + 2, len)]; var _px2 = mesh[safe_mod(i + 2, len)][0];
var _py2 = fyList[| safe_mod(i + 2, len)]; var _py2 = mesh[safe_mod(i + 2, len)][1];
var side = cross_product(_px0, _py0, _px1, _py1, _px2, _py2); var side = cross_product(_px0, _py0, _px1, _py1, _px2, _py2);
if(_side != 0 && sign(_side) != sign(side)) if(_side != 0 && sign(_side) != sign(side))
@ -611,8 +583,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
physics_fixture_set_polygon_shape(fixture); physics_fixture_set_polygon_shape(fixture);
for( var i = 0; i < len; i++ ) { for( var i = 0; i < len; i++ ) {
var _px0 = fxList[| i]; var _px0 = mesh[i][0];
var _py0 = fyList[| i]; var _py0 = mesh[i][1];
_px0 = (_px0 / ww) * 2 - 1; _px0 = (_px0 / ww) * 2 - 1;
_py0 = (_py0 / hh) * 2 - 1; _py0 = (_py0 / hh) * 2 - 1;
@ -620,7 +592,7 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
_px0 = _spos[2] * _px0; _px0 = _spos[2] * _px0;
_py0 = _spos[3] * _py0; _py0 = _spos[3] * _py0;
physics_fixture_add_point(fixture, _px0, _py0); physics_fixture_add_point(fixture, round(_px0), round(_py0));
} }
fixtureCreate(fixture, object); fixtureCreate(fixture, object);
@ -629,10 +601,10 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
var fixture = physics_fixture_create(); var fixture = physics_fixture_create();
physics_fixture_set_polygon_shape(fixture); physics_fixture_set_polygon_shape(fixture);
var _px0 = fxList[| i]; var _px0 = mesh[safe_mod(i + 0, len)][0];
var _py0 = fyList[| i]; var _py0 = mesh[safe_mod(i + 0, len)][1];
var _px1 = fxList[| safe_mod(i + 1, len)]; var _px1 = mesh[safe_mod(i + 1, len)][0];
var _py1 = fyList[| safe_mod(i + 1, len)]; var _py1 = mesh[safe_mod(i + 1, len)][1];
_px0 = (_px0 / ww) * 2 - 1; _px0 = (_px0 / ww) * 2 - 1;
_py0 = (_py0 / hh) * 2 - 1; _py0 = (_py0 / hh) * 2 - 1;
@ -662,14 +634,10 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
} }
static update = function(frame = ANIMATOR.current_frame) { static update = function(frame = ANIMATOR.current_frame) {
if(ANIMATOR.current_frame == 0) {
reset();
return;
}
if(!isAnimated()) return; if(!isAnimated()) return;
for( var i = 0; i < array_length(object); i++ ) //for( var i = 0; i < array_length(object); i++ )
spawn(noone, i, object[i]); // spawn(noone, i, object[i]);
} }
static step = function() { static step = function() {
@ -679,13 +647,12 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
var _tex = inputs[| 6].getValue(); var _tex = inputs[| 6].getValue();
if(is_array(_tex)) { if(is_array(_tex)) {
for( var i = 0; i < array_length(_tex); i++ ) { var meshes = attributes[? "mesh"];
var mshx = "mesh_x" + string(i);
if(!ds_map_exists(attributes, mshx)) for( var i = array_length(meshes); i < array_length(_tex); i++ )
newMesh(i); newMesh(i);
} }
} }
}
static reset = function() { static reset = function() {
var _tex = inputs[| 6].getValue(); var _tex = inputs[| 6].getValue();
@ -716,21 +683,15 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
static attributeSerialize = function() { static attributeSerialize = function() {
var att = ds_map_create(); var att = ds_map_create();
var k = ds_map_find_first(attributes);
repeat(ds_map_size(attributes)) { var mesh = ds_map_try_get(attributes, "mesh", []);
ds_map_add_list(att, k, ds_list_clone(attributes[? k])); att[? "mesh"] = json_stringify(mesh);
k = ds_map_find_next(attributes, k);
}
return att; return att;
} }
static attributeDeserialize = function(attr) { static attributeDeserialize = function(attr) {
var k = ds_map_find_first(attr); if(ds_map_exists(attr, "mesh"))
ds_map_clear(attributes); attributes[? "mesh"] = json_parse(attr[? "mesh"]);
repeat(ds_map_size(attr)) {
ds_map_add_list(attributes, k, ds_list_clone(attr[? k]));
k = ds_map_find_next(attr, k);
}
} }
} }

View file

@ -58,7 +58,7 @@ function Node_Rigid_Override(_x, _y, _group = noone) : Node(_x, _y, _group) cons
} }
if(is_array(_rot) && array_length(_rot) > i) if(is_array(_rot) && array_length(_rot) > i)
obj.phy_rotation = _rot[i]; obj.image_angle = _rot[i];
if(is_array(_col) && array_length(_col) > i) if(is_array(_col) && array_length(_col) > i)
obj.image_blend = _col[i]; obj.image_blend = _col[i];

View file

@ -73,6 +73,11 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr
surface_set_target(_outSurf); surface_set_target(_outSurf);
DRAW_CLEAR DRAW_CLEAR
if(TESTING && keyboard_check(ord("D"))) {
var flag = phy_debug_render_shapes | phy_debug_render_coms;
draw_set_color(c_white);
physics_world_draw_debug(flag);
} else {
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) { for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
var objNode = inputs[| i].getValue(); var objNode = inputs[| i].getValue();
if(!is_array(objNode)) objNode = [ objNode ]; if(!is_array(objNode)) objNode = [ objNode ];
@ -88,24 +93,26 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr
if(_o == noone || !instance_exists(_o)) continue; if(_o == noone || !instance_exists(_o)) continue;
if(is_undefined(_o.phy_active)) continue; if(is_undefined(_o.phy_active)) continue;
var ixs = max(0, _o.image_xscale); var ixs = max(0, _o.xscale);
var iys = max(0, _o.image_yscale); var iys = max(0, _o.yscale);
var xs = max(0, _o.xscale);
var ys = max(0, _o.yscale);
var xx = lerp(_o.phy_com_x, _o.phy_position_x, xs); var xx = _o.phy_position_x;
var yy = lerp(_o.phy_com_y, _o.phy_position_y, ys); var yy = _o.phy_position_y;
draw_surface_ext_safe(_o.surface, xx, yy, ixs * xs, iys * ys, _o.image_angle, _o.image_blend, _o.image_alpha); draw_surface_ext_safe(_o.surface, xx, yy, ixs, iys, _o.image_angle, _o.image_blend, _o.image_alpha);
//draw_set_color(c_red);
//draw_circle(_o.phy_com_x, _o.phy_com_y, 2, false);
//draw_set_color(c_blue);
//draw_circle(_o.phy_position_x, _o.phy_position_y, 2, false);
}
} }
} }
} }
if(TESTING && keyboard_check(ord("D"))) {
var flag = phy_debug_render_shapes | phy_debug_render_coms;
draw_set_color(c_white); draw_set_color(c_white);
physics_world_draw_debug(flag); physics_draw_debug();
}
surface_reset_target(); surface_reset_target();
cacheCurrentFrame(_outSurf); cacheCurrentFrame(_outSurf);

View file

@ -62,7 +62,7 @@ function Node_Rigid_Variable(_x, _y, _group = noone) : Node(_x, _y, _group) cons
if(_get[0]) _val[0][i] = [ obj.x, obj.y ]; if(_get[0]) _val[0][i] = [ obj.x, obj.y ];
if(_get[1]) _val[1][i] = [ obj.xscale, obj.yscale ]; if(_get[1]) _val[1][i] = [ obj.xscale, obj.yscale ];
if(_get[2]) _val[2][i] = [ obj.phy_rotation ]; if(_get[2]) _val[2][i] = [ obj.image_angle ];
if(_get[3]) _val[3][i] = [ obj.image_blend ]; if(_get[3]) _val[3][i] = [ obj.image_blend ];
if(_get[4]) _val[4][i] = [ obj.image_alpha ]; if(_get[4]) _val[4][i] = [ obj.image_alpha ];
if(_get[5]) _val[5][i] = [ obj.phy_linear_velocity_x, obj.phy_linear_velocity_y ]; if(_get[5]) _val[5][i] = [ obj.phy_linear_velocity_x, obj.phy_linear_velocity_y ];

View file

@ -952,9 +952,17 @@ function Panel_Animation() : PanelContent() constructor {
} else } else
draw_sprite_ui_uniform(THEME.arrow, _node.anim_show? 3 : 0, ui(10), _node_y, 1, COLORS._main_icon, 0.75); draw_sprite_ui_uniform(THEME.arrow, _node.anim_show? 3 : 0, ui(10), _node_y, 1, COLORS._main_icon, 0.75);
draw_set_color(node_ordering == _node? COLORS._main_text_accent : COLORS._main_text_sub); var nodeName = "[" + _node.name + "] ";
draw_set_alpha(aa); var tw = string_width(nodeName);
draw_text(ui(20), _node_y - ui(2), _node.name);
draw_set_color(node_ordering == _node? COLORS._main_text_accent : COLORS._main_text);
draw_set_alpha(0.4);
draw_text(ui(20), _node_y - ui(2), nodeName);
draw_set_alpha(0.9);
draw_text(ui(20) + tw, _node_y - ui(2), _node.display_name);
draw_set_alpha(1); draw_set_alpha(1);
if(!_node.anim_show) { if(!_node.anim_show) {

View file

@ -208,7 +208,7 @@ function Panel_Collection() : PanelContent() constructor {
draw_sprite_ui_uniform(THEME.steam_creator, 0, _boxx + grid_size - ui(8), yy + ui(12), 1, COLORS._main_icon_dark, 1); draw_sprite_ui_uniform(THEME.steam_creator, 0, _boxx + grid_size - ui(8), yy + ui(12), 1, COLORS._main_icon_dark, 1);
} }
if(meta.version < SAVEFILE_VERSION) { if(meta.version != SAVEFILE_VERSION) {
draw_set_color(COLORS._main_accent); draw_set_color(COLORS._main_accent);
draw_circle(_boxx + grid_size - ui(8), yy + grid_size - ui(8), 3, false); draw_circle(_boxx + grid_size - ui(8), yy + grid_size - ui(8), 3, false);
} }

View file

@ -123,7 +123,7 @@
globalvar CURRENT_PANEL; globalvar CURRENT_PANEL;
panelObjectInit(); panelObjectInit();
if(!directory_exists(DIRECTORY + "layouts")) //if(!directory_exists(DIRECTORY + "layouts"))
zip_unzip("data/layouts.zip", DIRECTORY); zip_unzip("data/layouts.zip", DIRECTORY);
var file = DIRECTORY + "layouts/" + PREF_MAP[? "panel_layout_file"] + ".json"; var file = DIRECTORY + "layouts/" + PREF_MAP[? "panel_layout_file"] + ".json";

View file

@ -1030,7 +1030,7 @@ function Panel_Graph() : PanelContent() constructor {
if(ds_list_empty(nodes_select_list)) return; if(ds_list_empty(nodes_select_list)) return;
if(ds_list_size(nodes_select_list) != 2) return; if(ds_list_size(nodes_select_list) != 2) return;
var cx = 0; var cx = nodes_select_list[| 0].x;
var cy = 0; var cy = 0;
for(var i = 0; i < ds_list_size(nodes_select_list); i++) { for(var i = 0; i < ds_list_size(nodes_select_list); i++) {
var _node = nodes_select_list[| i]; var _node = nodes_select_list[| i];
@ -1057,7 +1057,7 @@ function Panel_Graph() : PanelContent() constructor {
function doCompose() { function doCompose() {
if(ds_list_empty(nodes_select_list)) return; if(ds_list_empty(nodes_select_list)) return;
var cx = -99999; var cx = nodes_select_list[| 0].x;
var cy = 0; var cy = 0;
for(var i = 0; i < ds_list_size(nodes_select_list); i++) { for(var i = 0; i < ds_list_size(nodes_select_list); i++) {
@ -1084,7 +1084,7 @@ function Panel_Graph() : PanelContent() constructor {
function doArray() { function doArray() {
if(ds_list_empty(nodes_select_list)) return; if(ds_list_empty(nodes_select_list)) return;
var cx = -99999; var cx = nodes_select_list[| 0].x;
var cy = 0; var cy = 0;
for(var i = 0; i < ds_list_size(nodes_select_list); i++) { for(var i = 0; i < ds_list_size(nodes_select_list); i++) {

View file

@ -11,11 +11,11 @@
var _l = root + "/version"; var _l = root + "/version";
var _preset_path = "data/Preset.zip"; var _preset_path = "data/Preset.zip";
if(file_exists(_preset_path)) { if(file_exists(_preset_path)) {
if(file_exists(_l)) { //if(file_exists(_l)) {
var res = json_load_struct(_l); // var res = json_load_struct(_l);
if(!is_struct(res) || !struct_has(res, "version") || res.version < VERSION) // if(!is_struct(res) || !struct_has(res, "version") || res.version != VERSION)
zip_unzip(_preset_path, root); // zip_unzip(_preset_path, root);
} else //} else
zip_unzip(_preset_path, root); zip_unzip(_preset_path, root);
} }
json_save_struct(_l, { version: VERSION }); json_save_struct(_l, { version: VERSION });

View file

@ -6,7 +6,7 @@ function __initTheme() {
var _l = root + "/version"; var _l = root + "/version";
if(file_exists(_l)) { if(file_exists(_l)) {
var res = json_load_struct(_l); var res = json_load_struct(_l);
if(res.version >= THEME_VERSION) return; if(res.version == THEME_VERSION) return;
} }
json_save_struct(_l, { version: THEME_VERSION }); json_save_struct(_l, { version: THEME_VERSION });

View file

@ -45,6 +45,12 @@ function draw_surface_part_ext_safe(surface, _l, _t, _w, _h, _x, _y, _xs = 1, _y
function surface_save_safe(surface, path) { function surface_save_safe(surface, path) {
if(!is_surface(surface)) return; if(!is_surface(surface)) return;
var f = surface_get_format(surface); var f = surface_get_format(surface);
if(f == surface_rgba8unorm) {
surface_save(surface, path);
return;
}
var w = surface_get_width(surface); var w = surface_get_width(surface);
var h = surface_get_height(surface); var h = surface_get_height(surface);
var s = surface_create(w, h, surface_rgba8unorm); var s = surface_create(w, h, surface_rgba8unorm);

View file

@ -6,10 +6,5 @@ varying vec4 v_vColour;
void main() { void main() {
vec4 basecolor = texture2D( gm_BaseTexture, v_vTexcoord ); vec4 basecolor = texture2D( gm_BaseTexture, v_vTexcoord );
vec4 blendcolor = v_vColour; gl_FragColor = basecolor * v_vColour;
basecolor.rgb *= v_vColour.rgb;
basecolor.a = v_vColour.a;
gl_FragColor = basecolor;
} }