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;
yscale = 1;
depth = -9999;
#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",
"eventList": [
{"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,
"overriddenProperties": [],
@ -37,5 +38,5 @@
"path": "sprites/s_fx_pixel/s_fx_pixel.yy",
},
"spriteMaskId": null,
"visible": false,
"visible": true,
}

View file

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

View file

@ -13,6 +13,8 @@
playback = ANIMATOR_END.loop;
static setFrame = function(frame) {
//if(frame == 0) resetAnimation();
var _c = current_frame;
frame = clamp(frame, 0, frames_total);
real_frame = frame;
@ -33,6 +35,17 @@
} else
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

View file

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

View file

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

View file

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

View file

@ -37,7 +37,7 @@
SAVEFILE_VERSION = 1400;
COLLECTION_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;

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, []);
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() {
var _type = inputs[| 0].getValue();
@ -150,11 +157,17 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
var _typ = getType();
outputs[| 0].type = _typ;
var res = array_create(ds_list_size(inputs) - input_fix_len - 1);
var res = [];
var ind = 0;
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;
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 postConnect = function() {}
static resetAnimation = function() {}
static cleanUp = function() {
for( var i = 0; i < ds_list_size(inputs); i++ )
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);
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.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);
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.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":
surface_save_safe(_surf, _path);
break;
case ".jpg":
surface_save_safe(_surf, _pathTemp);
@ -270,6 +271,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
print(shell_cmd)
execute_shell(magick, shell_cmd);
break;
case ".webp":
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) {
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.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);
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.setOnClick(function() { shellOpenExplorer(self.path); }, "Open in explorer", THEME.explorer);

View file

@ -75,7 +75,7 @@ function __initNodeData() {
if(file_exists(_l)) {
var res = json_load_struct(_l);
if(res.version >= VERSION) return;
if(res.version == VERSION) return;
}
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)
.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();
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;
}
var _spr = array_safe_get(spr, _frame, noone);
if(_spr == noone) return;
var curr_w = sprite_get_width(spr[_frame]);
var curr_h = sprite_get_height(spr[_frame]);
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]);
}
//physics_world_update_iterations(30);
//physics_world_update_speed(100)
static reset = function() {
instance_destroy(oRigidbody);
physics_pause_enable(true);
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"))
n.reset();
}
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;
object = [];
attributes[? "mesh"] = [];
inputs[| 0] = nodeValue("Affect by force", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)
.rejectArray();
@ -61,20 +62,12 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
];
static newMesh = function(index) {
var mx = "mesh_x" + string(index);
var my = "mesh_y" + string(index);
attributes[? mx] = ds_list_create();
attributes[? mx][| 0] = 0;
attributes[? mx][| 1] = 32;
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;
var mesh = ds_map_try_get(attributes, "mesh", []);
mesh[index] = [ [ 0, 0],
[32, 0],
[32, 32],
[ 0, 32] ];
attributes[? "mesh"] = mesh;
}
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 _box = inputs[| 7].getValue();
var mshx = "mesh_x" + string(preview_index);
var mshy = "mesh_y" + string(preview_index);
if(!ds_map_exists(attributes, mshx))
newMesh(preview_index);
var lx = attributes[? mshx];
var ly = attributes[? mshy];
var len = ds_list_size(lx);
var meshes = attributes[? "mesh"];
if(preview_index >= array_length(meshes)) return;
if(previewing == 0) {
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);
for( var i = 0; i < len; i++ ) {
var _px0 = lx[| i];
var _py0 = ly[| i];
var _px1 = lx[| safe_mod(i + 1, len)];
var _py1 = ly[| safe_mod(i + 1, len)];
for( var j = 0; j < array_length(meshes); j++ ) {
var _m = meshes[j];
var _l = array_length(_m);
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;
_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_set_color(COLORS._main_accent);
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;
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;
for( var i = 0; i < len; i++ ) {
var _px0 = lx[| i];
var _py0 = ly[| i];
var _px1 = lx[| safe_mod(i + 1, len)];
var _py1 = ly[| safe_mod(i + 1, len)];
var _px2 = lx[| safe_mod(i + 2, len)];
var _py2 = ly[| safe_mod(i + 2, len)];
var _px0 = mesh[safe_mod(i + 0, len)][0];
var _py0 = mesh[safe_mod(i + 0, len)][1];
var _px1 = mesh[safe_mod(i + 1, len)][0];
var _py1 = mesh[safe_mod(i + 1, len)][1];
var _px2 = mesh[safe_mod(i + 2, len)][0];
var _py2 = mesh[safe_mod(i + 2, len)][1];
var side = cross_product(_px0, _py0, _px1, _py1, _px2, _py2);
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);
for( var i = 0; i < len; i++ ) {
var _px = lx[| i];
var _py = ly[| i];
var _px = mesh[i][0];
var _py = mesh[i][1];
var _dx = _x + _px * _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);
dy = value_snap(dy, _sny);
lx[| anchor_dragging] = dx;
ly[| anchor_dragging] = dy;
mesh[anchor_dragging][0] = dx;
mesh[anchor_dragging][1] = dy;
if(mouse_release(mb_left))
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(isUsingTool(0)) {
anchor_dragging = hover;
anchor_drag_sx = lx[| hover];
anchor_drag_sy = ly[| hover];
anchor_drag_sx = mesh[hover][0];
anchor_drag_sy = mesh[hover][1];
anchor_drag_mx = _mx;
anchor_drag_my = _my;
} else if(isUsingTool(1)) {
if(ds_list_size(lx) > 3) {
ds_list_delete(lx, hover);
ds_list_delete(ly, hover);
}
if(array_length(mesh) > 3)
array_delete(mesh, hover, 1);
}
}
} 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);
anchor_dragging = ind;
anchor_drag_sx = lx[| ind];
anchor_drag_sy = ly[| ind];
anchor_drag_sx = mesh[ind][0];
anchor_drag_sy = mesh[ind][1];
anchor_drag_mx = _mx;
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;
var mshx = "mesh_x" + string(index);
var mshy = "mesh_y" + string(index);
var lx = attributes[? mshx];
var ly = attributes[? mshy];
ds_list_clear(lx);
ds_list_clear(ly);
var meshes = attributes[? "mesh"];
var mesh = [];
var ww = surface_get_width(_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);
}
ds_list_add(lx, px);
ds_list_add(ly, py);
array_push(mesh, [ px, py ]);
}
removeColinear(index);
removeConcave(index);
mesh = removeColinear(mesh);
mesh = removeConcave(mesh);
var _sm = ds_map_create();
for( var i = 0; i < ds_list_size(lx); i++ )
_sm[? point_direction_positive(cmX, cmY, lx[| i], ly[| i])] = [lx[| i], ly[| i]];
for( var i = 0; i < array_length(mesh); 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);
mesh = [];
if(array_length(keys)) {
array_sort(keys, false);
ds_list_clear(lx);
ds_list_clear(ly);
for( var i = 0; i < array_length(keys); i++ ) {
ds_list_add(lx, _sm[? keys[i]][0]);
ds_list_add(ly, _sm[? keys[i]][1]);
var k = keys[i];
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);
surface_free(temp);
buffer_delete(surface_buffer);
meshes[index] = mesh;
attributes[? "mesh"] = meshes;
}
static removeColinear = function(index = 0) {
var mshx = "mesh_x" + string(index);
var mshy = "mesh_y" + string(index);
var fxList = attributes[? mshx];
var fyList = attributes[? mshy];
var len = ds_list_size(fxList), _side = 0;
static removeColinear = function(mesh) {
var len = array_length(mesh), _side = 0;
var remSt = [];
var tolerance = 5;
for( var i = 0; i < len; i++ ) {
var _px0 = fxList[| i];
var _py0 = fyList[| i];
var _px1 = fxList[| safe_mod(i + 1, len)];
var _py1 = fyList[| safe_mod(i + 1, len)];
var _px2 = fxList[| safe_mod(i + 2, len)];
var _py2 = fyList[| safe_mod(i + 2, len)];
var _px0 = mesh[safe_mod(i + 0, len)][0];
var _py0 = mesh[safe_mod(i + 0, len)][1];
var _px1 = mesh[safe_mod(i + 1, len)][0];
var _py1 = mesh[safe_mod(i + 1, len)][1];
var _px2 = mesh[safe_mod(i + 2, len)][0];
var _py2 = mesh[safe_mod(i + 2, len)][1];
var dir0 = point_direction(_px0, _py0, _px1, _py1);
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);
for( var i = 0; i < array_length(remSt); i++ ) {
var ind = remSt[i];
ds_list_delete(fxList, ind);
ds_list_delete(fyList, ind);
}
array_delete(mesh, ind, 1);
}
static removeConcave = function(index = 0) {
var mshx = "mesh_x" + string(index);
var mshy = "mesh_y" + string(index);
return mesh;
}
var fxList = attributes[? mshx];
var fyList = attributes[? mshy];
var len = ds_list_size(fxList);
static removeConcave = function(mesh) {
var len = array_length(mesh);
if(len <= 3) return;
var startIndex = 0;
var maxx = 0;
for( var i = 0; i < len; i++ ) {
var _px0 = fxList[| i];
var _px0 = mesh[i][0];
if(_px0 > maxx) {
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))
if(potentialPoint == startIndex) break;
var _px0 = fxList[| anchorPoint];
var _py0 = fyList[| anchorPoint];
var _px1 = fxList[| potentialPoint];
var _py1 = fyList[| potentialPoint];
var _px2 = fxList[| anchorTest];
var _py2 = fyList[| anchorTest];
var _px0 = mesh[anchorPoint][0];
var _py0 = mesh[anchorPoint][1];
var _px1 = mesh[potentialPoint][0];
var _py1 = mesh[potentialPoint][1];
var _px2 = mesh[anchorTest][0];
var _py2 = mesh[anchorTest][1];
var side = sign(cross_product(_px0, _py0, _px1, _py1, _px2, _py2));
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++ ) {
var ind = remSt[i];
ds_list_delete(fxList, ind);
ds_list_delete(fyList, ind);
array_delete(mesh, ind, 1);
}
return mesh;
}
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) {
object = instance_create_depth(ox - _spos[2], oy - _spos[3], 0, oRigidbody);
object.image_xscale = _spos[2] / ww * 2;
object.image_yscale = _spos[3] / hh * 2;
object.xscale = _spos[2] / ww * 2;
object.yscale = _spos[3] / hh * 2;
object.surface = _tex;
} else if(instance_exists(object)) {
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]));
fixtureCreate(fixture, object);
} else if(_shp == 2) {
var mshx = "mesh_x" + string(index);
var mshy = "mesh_y" + string(index);
var fxList = attributes[? mshx];
var fyList = attributes[? mshy];
var mesh = attributes[? "mesh"][index];
var cx = 0, cy = 0;
var cmx = 0, cmy = 0;
var len = ds_list_size(fxList), _side = 0;
var len = array_length(mesh), _side = 0;
is_convex = true;
for( var i = 0; i < len; i++ ) {
var _px0 = fxList[| i];
var _py0 = fyList[| i];
var _px1 = fxList[| safe_mod(i + 1, len)];
var _py1 = fyList[| safe_mod(i + 1, len)];
var _px2 = fxList[| safe_mod(i + 2, len)];
var _py2 = fyList[| safe_mod(i + 2, len)];
var _px0 = mesh[safe_mod(i + 0, len)][0];
var _py0 = mesh[safe_mod(i + 0, len)][1];
var _px1 = mesh[safe_mod(i + 1, len)][0];
var _py1 = mesh[safe_mod(i + 1, len)][1];
var _px2 = mesh[safe_mod(i + 2, len)][0];
var _py2 = mesh[safe_mod(i + 2, len)][1];
var side = cross_product(_px0, _py0, _px1, _py1, _px2, _py2);
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);
for( var i = 0; i < len; i++ ) {
var _px0 = fxList[| i];
var _py0 = fyList[| i];
var _px0 = mesh[i][0];
var _py0 = mesh[i][1];
_px0 = (_px0 / ww) * 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;
_py0 = _spos[3] * _py0;
physics_fixture_add_point(fixture, _px0, _py0);
physics_fixture_add_point(fixture, round(_px0), round(_py0));
}
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();
physics_fixture_set_polygon_shape(fixture);
var _px0 = fxList[| i];
var _py0 = fyList[| i];
var _px1 = fxList[| safe_mod(i + 1, len)];
var _py1 = fyList[| safe_mod(i + 1, len)];
var _px0 = mesh[safe_mod(i + 0, len)][0];
var _py0 = mesh[safe_mod(i + 0, len)][1];
var _px1 = mesh[safe_mod(i + 1, len)][0];
var _py1 = mesh[safe_mod(i + 1, len)][1];
_px0 = (_px0 / ww) * 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) {
if(ANIMATOR.current_frame == 0) {
reset();
return;
}
if(!isAnimated()) return;
for( var i = 0; i < array_length(object); i++ )
spawn(noone, i, object[i]);
//for( var i = 0; i < array_length(object); i++ )
// spawn(noone, i, object[i]);
}
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();
if(is_array(_tex)) {
for( var i = 0; i < array_length(_tex); i++ ) {
var mshx = "mesh_x" + string(i);
if(!ds_map_exists(attributes, mshx))
var meshes = attributes[? "mesh"];
for( var i = array_length(meshes); i < array_length(_tex); i++ )
newMesh(i);
}
}
}
static reset = function() {
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() {
var att = ds_map_create();
var k = ds_map_find_first(attributes);
repeat(ds_map_size(attributes)) {
ds_map_add_list(att, k, ds_list_clone(attributes[? k]));
k = ds_map_find_next(attributes, k);
}
var mesh = ds_map_try_get(attributes, "mesh", []);
att[? "mesh"] = json_stringify(mesh);
return att;
}
static attributeDeserialize = function(attr) {
var k = ds_map_find_first(attr);
ds_map_clear(attributes);
repeat(ds_map_size(attr)) {
ds_map_add_list(attributes, k, ds_list_clone(attr[? k]));
k = ds_map_find_next(attr, k);
}
if(ds_map_exists(attr, "mesh"))
attributes[? "mesh"] = json_parse(attr[? "mesh"]);
}
}

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)
obj.phy_rotation = _rot[i];
obj.image_angle = _rot[i];
if(is_array(_col) && array_length(_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);
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++ ) {
var objNode = inputs[| i].getValue();
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(is_undefined(_o.phy_active)) continue;
var ixs = max(0, _o.image_xscale);
var iys = max(0, _o.image_yscale);
var xs = max(0, _o.xscale);
var ys = max(0, _o.yscale);
var ixs = max(0, _o.xscale);
var iys = max(0, _o.yscale);
var xx = lerp(_o.phy_com_x, _o.phy_position_x, xs);
var yy = lerp(_o.phy_com_y, _o.phy_position_y, ys);
var xx = _o.phy_position_x;
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);
physics_world_draw_debug(flag);
}
physics_draw_debug();
surface_reset_target();
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[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[4]) _val[4][i] = [ obj.image_alpha ];
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
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);
draw_set_alpha(aa);
draw_text(ui(20), _node_y - ui(2), _node.name);
var nodeName = "[" + _node.name + "] ";
var tw = string_width(nodeName);
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);
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);
}
if(meta.version < SAVEFILE_VERSION) {
if(meta.version != SAVEFILE_VERSION) {
draw_set_color(COLORS._main_accent);
draw_circle(_boxx + grid_size - ui(8), yy + grid_size - ui(8), 3, false);
}

View file

@ -123,7 +123,7 @@
globalvar CURRENT_PANEL;
panelObjectInit();
if(!directory_exists(DIRECTORY + "layouts"))
//if(!directory_exists(DIRECTORY + "layouts"))
zip_unzip("data/layouts.zip", DIRECTORY);
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_size(nodes_select_list) != 2) return;
var cx = 0;
var cx = nodes_select_list[| 0].x;
var cy = 0;
for(var i = 0; i < ds_list_size(nodes_select_list); i++) {
var _node = nodes_select_list[| i];
@ -1057,7 +1057,7 @@ function Panel_Graph() : PanelContent() constructor {
function doCompose() {
if(ds_list_empty(nodes_select_list)) return;
var cx = -99999;
var cx = nodes_select_list[| 0].x;
var cy = 0;
for(var i = 0; i < ds_list_size(nodes_select_list); i++) {
@ -1084,7 +1084,7 @@ function Panel_Graph() : PanelContent() constructor {
function doArray() {
if(ds_list_empty(nodes_select_list)) return;
var cx = -99999;
var cx = nodes_select_list[| 0].x;
var cy = 0;
for(var i = 0; i < ds_list_size(nodes_select_list); i++) {

View file

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

View file

@ -6,7 +6,7 @@ function __initTheme() {
var _l = root + "/version";
if(file_exists(_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 });

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) {
if(!is_surface(surface)) return;
var f = surface_get_format(surface);
if(f == surface_rgba8unorm) {
surface_save(surface, path);
return;
}
var w = surface_get_width(surface);
var h = surface_get_height(surface);
var s = surface_create(w, h, surface_rgba8unorm);

View file

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