From 8a811a84a5cb968de7ed69ce66df0e62c6da8277 Mon Sep 17 00:00:00 2001 From: Tanasart <22589759+Ttanasart-pt@users.noreply.github.com> Date: Thu, 21 Sep 2023 12:05:06 +0200 Subject: [PATCH] - [Transform] Fix position value blow up when animating. --- objects/o_crash_handler/Create_0.gml | 5 +++-- objects/o_crash_handler/Draw_64.gml | 10 +++++----- objects/o_process_handler/Create_0.gml | 6 +++--- rooms/rm_main/rm_main.yy | 2 -- scripts/globals/globals.gml | 6 +++--- scripts/node_keyframe/node_keyframe.gml | 8 ++------ scripts/node_transform/node_transform.gml | 6 ++++-- scripts/node_value/node_value.gml | 4 ++-- 8 files changed, 22 insertions(+), 25 deletions(-) diff --git a/objects/o_crash_handler/Create_0.gml b/objects/o_crash_handler/Create_0.gml index 7847a68fd..42d493cf8 100644 --- a/objects/o_crash_handler/Create_0.gml +++ b/objects/o_crash_handler/Create_0.gml @@ -1,6 +1,7 @@ /// @description gameframe_init(); gameframe_button_array = []; + #region setup window_set_size(640, 480); display_set_gui_size(640, 480); @@ -8,7 +9,7 @@ gameframe_button_array = []; window_set_caption("Pixel Composer crashed") window_set_position( (display_get_width() - 640) / 2, - (display_get_height() - 320) / 2); // center window + (display_get_height() - 480) / 2); // center window #endregion #region directory @@ -51,5 +52,5 @@ gameframe_button_array = []; } win_w = 640; - win_h = 320; + win_h = 480; #endregion \ No newline at end of file diff --git a/objects/o_crash_handler/Draw_64.gml b/objects/o_crash_handler/Draw_64.gml index 1f3b29186..8e1d71bf1 100644 --- a/objects/o_crash_handler/Draw_64.gml +++ b/objects/o_crash_handler/Draw_64.gml @@ -2,8 +2,8 @@ gameframe_update(); draw_clear(#1c1c23); -var w = window_get_width(); -var h = window_get_height(); +var w = 640; +var h = 480; if(win_w != w || win_h != h) { display_set_gui_size(w, h); @@ -31,9 +31,9 @@ draw_sprite_ext(s_noti_icon_error, 0, 18, 18, 0.5, 0.5, 0, c_white, 1); var y0 = 32; var x1 = w - 8; var y1 = h - 8 - 32 - 8; - var tw = x1 - x0; - var th = y1 - y0; - + var tw = max(1, x1 - x0); + var th = max(1, y1 - y0); + draw_sprite_stretched(s_textbox, 3, x0, y0, tw, th); draw_sprite_stretched(s_textbox, 0, x0, y0, tw, th); diff --git a/objects/o_process_handler/Create_0.gml b/objects/o_process_handler/Create_0.gml index 750566f2e..7f4adf726 100644 --- a/objects/o_process_handler/Create_0.gml +++ b/objects/o_process_handler/Create_0.gml @@ -3,8 +3,8 @@ global.PROC_ID = bool(EnvironmentGetVariableExists("process_id"))? int64(EnvironmentGetVariable("process_id")) : 0; EnvironmentSetVariable("process_id", string(global.PROC_ID + 1)); - if (global.PROC_ID == 1) { // if spawn after the main windows - instance_destroy(o_main, false); + if (global.PROC_ID == 0) + instance_create(0, 0, o_main); + else if (global.PROC_ID == 1) instance_create(0, 0, o_crash_handler); - } #endregion \ No newline at end of file diff --git a/rooms/rm_main/rm_main.yy b/rooms/rm_main/rm_main.yy index 2d9800129..81c1f4a8d 100644 --- a/rooms/rm_main/rm_main.yy +++ b/rooms/rm_main/rm_main.yy @@ -8,12 +8,10 @@ "inheritLayers": false, "instanceCreationOrder": [ {"name":"inst_5CA22FC1","path":"rooms/rm_main/rm_main.yy",}, - {"name":"inst_78CD7A2C","path":"rooms/rm_main/rm_main.yy",}, ], "isDnd": false, "layers": [ {"resourceType":"GMRInstanceLayer","resourceVersion":"1.0","name":"Instances","depth":0,"effectEnabled":true,"effectType":null,"gridX":16,"gridY":16,"hierarchyFrozen":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"inheritSubLayers":true,"inheritVisibility":true,"instances":[ - {"resourceType":"GMRInstance","resourceVersion":"1.0","name":"inst_78CD7A2C","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"objectId":{"name":"o_main","path":"objects/o_main/o_main.yy",},"properties":[],"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":160.0,"y":160.0,}, {"resourceType":"GMRInstance","resourceVersion":"1.0","name":"inst_5CA22FC1","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"objectId":{"name":"o_process_handler","path":"objects/o_process_handler/o_process_handler.yy",},"properties":[],"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":160.0,"y":96.0,}, ],"layers":[],"properties":[],"userdefinedDepth":false,"visible":true,}, {"resourceType":"GMRBackgroundLayer","resourceVersion":"1.0","name":"Background","animationFPS":15.0,"animationSpeedType":0,"colour":4280491036,"depth":100,"effectEnabled":true,"effectType":null,"gridX":16,"gridY":16,"hierarchyFrozen":false,"hspeed":0.0,"htiled":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"inheritSubLayers":true,"inheritVisibility":true,"layers":[],"properties":[],"spriteId":null,"stretch":false,"userdefinedAnimFPS":false,"userdefinedDepth":false,"visible":true,"vspeed":0.0,"vtiled":false,"x":0,"y":0,}, diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 927740234..885d1445d 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -107,10 +107,10 @@ globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER; - VERSION = 11521; + VERSION = 11522; SAVE_VERSION = 11500; - VERSION_STRING = "1.15.2.1"; - BUILD_NUMBER = 11521; + VERSION_STRING = "1.15.2.2"; + BUILD_NUMBER = 11522; globalvar APPEND_MAP; APPEND_MAP = ds_map_create(); diff --git a/scripts/node_keyframe/node_keyframe.gml b/scripts/node_keyframe/node_keyframe.gml index 1188131ba..70767a3fc 100644 --- a/scripts/node_keyframe/node_keyframe.gml +++ b/scripts/node_keyframe/node_keyframe.gml @@ -171,15 +171,11 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor { return false; } - if(ds_list_size(values) == 0) - return processTypeDefault(); - - if(ds_list_size(values) == 1) - return processType(values[| 0].value); + if(ds_list_size(values) == 0) return processTypeDefault(); + if(ds_list_size(values) == 1) return processType(values[| 0].value); if(prop.type == VALUE_TYPE.path) return processType(values[| 0].value); - if(!prop.is_anim) return processType(values[| 0].value); diff --git a/scripts/node_transform/node_transform.gml b/scripts/node_transform/node_transform.gml index 3a0ed277b..a87d2caf3 100644 --- a/scripts/node_transform/node_transform.gml +++ b/scripts/node_transform/node_transform.gml @@ -58,7 +58,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) attribute_interpolation(); vel = 0; - prev_pos = [0, 0]; + prev_pos = [ 0, 0 ]; static getDimension = function(arr) { #region var _surf = getSingleValue(0, arr); @@ -474,7 +474,9 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) draw_set_color(COLORS._main_accent); for( var i = 0; i < ds_list_size(allPos); i++ ) { - var _pos = allPos[| i].value; + var pos = allPos[| i].value; + var _pos = [ pos[0], pos[1] ]; + if(posInp.unit.mode == VALUE_UNIT.reference) { _pos[0] *= ow; _pos[1] *= oh; diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 9dd799cbe..385a2eb4f 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -1220,7 +1220,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(cache_hit) { global.cache_hit++; - return cache_value[2]; + return array_clone(cache_value[2]); } } @@ -1232,7 +1232,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru cache_value[1] = _time; } - cache_value[2] = val; + cache_value[2] = array_clone(val); cache_value[3] = applyUnit; return val;