From 83f61c732acf28535a361f39ba836142efbd4c5e Mon Sep 17 00:00:00 2001 From: Tanasart Date: Fri, 20 Dec 2024 08:25:37 +0700 Subject: [PATCH] [Path Extrude] Add profile angle property. --- scripts/d3d_path_extrude/d3d_path_extrude.gml | 15 +- scripts/globals/globals.gml | 2 +- .../node_3d_mesh_path_extrude.gml | 6 +- scripts/node_path_3d/node_path_3d.gml | 2 +- .../panel_notification/panel_notification.gml | 14 +- scripts/pathAnchorBox/pathAnchorBox.gml | 136 ++++++++++++------ 6 files changed, 113 insertions(+), 62 deletions(-) diff --git a/scripts/d3d_path_extrude/d3d_path_extrude.gml b/scripts/d3d_path_extrude/d3d_path_extrude.gml index 9797b32dd..8e9e0a5ac 100644 --- a/scripts/d3d_path_extrude/d3d_path_extrude.gml +++ b/scripts/d3d_path_extrude/d3d_path_extrude.gml @@ -15,6 +15,8 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject() radiusOverPath = []; uvScale = [ 1, 1 ]; + yaw = 0; + static initModel = function() { var vs = []; var v0 = []; @@ -47,6 +49,7 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject() var _vs = uvScale[1]; var firstLoop = array_create(sides * 3); + var _iside = 360 / sides; for(var i = 1; i < _subd; i++) { n.x = points[i * 3 + 0]; @@ -76,7 +79,7 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject() var _rr = radius * radiusOverPath[0]; for(var j = 0; j <= sides; j++) { - var a0 = j / sides * 360; + var a0 = yaw + j * _iside; var _u = u.multiply(dcos(a0)); var _w = w.multiply(dsin(a0)); @@ -96,8 +99,8 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject() var cy1 = prevp[j * 3 + 1 + 3]; var cz1 = prevp[j * 3 + 2 + 3]; - var a0 = (j + 0) / sides * 360; - var a1 = (j + 1) / sides * 360; + var a0 = yaw + (j + 0) * _iside; + var a1 = yaw + (j + 1) * _iside; var __u0 = 0.5 + lengthdir_x(0.5, a0); var __v0 = 0.5 + lengthdir_y(0.5, a0); @@ -137,7 +140,7 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject() var __v1 = 1. - uvProg[i ]; for(var j = 0; j <= sides; j++) { - var a0 = j / sides * 360; + var a0 = yaw + j * _iside; var _u = u.multiply(dcos(a0)); var _w = w.multiply(dsin(a0)); @@ -218,8 +221,8 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject() var cy1 = prevp[j * 3 + 1 + 3]; var cz1 = prevp[j * 3 + 2 + 3]; - var a0 = (j + 0) / sides * 360; - var a1 = (j + 1) / sides * 360; + var a0 = yaw + (j + 0) * _iside; + var a1 = yaw + (j + 1) * _iside; var __u0 = 0.5 + lengthdir_x(0.5, a0); var __v0 = 0.5 + lengthdir_y(0.5, a0); diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 52a87fbd7..612563933 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -44,7 +44,7 @@ LATEST_VERSION = 1_18_00_0; VERSION = 1_18_05_1; SAVE_VERSION = 1_18_05_0; - VERSION_STRING = MAC? "1.18.003m" : "1.18.6.007"; + VERSION_STRING = MAC? "1.18.003m" : "1.18.6.008"; BUILD_NUMBER = 1_18_05_6; var _vsp = string_split(VERSION_STRING, "."); diff --git a/scripts/node_3d_mesh_path_extrude/node_3d_mesh_path_extrude.gml b/scripts/node_3d_mesh_path_extrude/node_3d_mesh_path_extrude.gml index 733457190..00fa8a015 100644 --- a/scripts/node_3d_mesh_path_extrude/node_3d_mesh_path_extrude.gml +++ b/scripts/node_3d_mesh_path_extrude/node_3d_mesh_path_extrude.gml @@ -33,9 +33,11 @@ function Node_3D_Mesh_Path_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y newInput(in_mesh + 11, nodeValue_Bool("Inverted", self, false )); + newInput(in_mesh + 12, nodeValue_Rotation("Profile Angle", self, 0 )); + input_display_list = [ ["Path", false], in_mesh + 0, in_mesh + 10, - __d3d_input_list_mesh, in_mesh + 6, in_mesh + 1, in_mesh + 7, in_mesh + 8, in_mesh + 5, in_mesh + 11, + __d3d_input_list_mesh, in_mesh + 6, in_mesh + 1, in_mesh + 12, in_mesh + 7, in_mesh + 8, in_mesh + 5, in_mesh + 11, __d3d_input_list_transform, ["Material", false], in_mesh + 4, in_mesh + 2, in_mesh + 3, in_mesh + 9, ] @@ -59,6 +61,7 @@ function Node_3D_Mesh_Path_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y var _uvScale = _data[in_mesh + 9]; var _loop = _data[in_mesh + 10]; var _invert = _data[in_mesh + 11]; + var _pfrot = _data[in_mesh + 12]; if(_path == noone) return noone; @@ -102,6 +105,7 @@ function Node_3D_Mesh_Path_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y radiusOverPath: _radPath, loop : _loop, invert : _invert, + yaw : _pfrot, uvProg : _uvProg, uvScale : _uvScale, diff --git a/scripts/node_path_3d/node_path_3d.gml b/scripts/node_path_3d/node_path_3d.gml index 99eef82bf..31cf1411d 100644 --- a/scripts/node_path_3d/node_path_3d.gml +++ b/scripts/node_path_3d/node_path_3d.gml @@ -276,7 +276,7 @@ function Node_Path_3D(_x, _y, _group = noone) : Node(_x, _y, _group) constructor _oy = _ny; } } - + if(!isUsingTool(0)) for(var i = 0; i < ansize; i++) { var _a = anchors[i]; diff --git a/scripts/panel_notification/panel_notification.gml b/scripts/panel_notification/panel_notification.gml index af53ef644..d50690e30 100644 --- a/scripts/panel_notification/panel_notification.gml +++ b/scripts/panel_notification/panel_notification.gml @@ -29,6 +29,8 @@ function Panel_Notification() : PanelContent() constructor { show_time = false; rightClickMenu = [ + menuItem(__txtx("noti_copy_message", "Copy notification message"), function() /*=>*/ { if(noti_selecting == noone) return; clipboard_set_text(noti_selecting.txt); }, THEME.copy), + -1, MENU_ITEMS.noti_clear_all, MENU_ITEMS.noti_clear_log, MENU_ITEMS.noti_clear_warning, @@ -87,15 +89,8 @@ function Panel_Notification() : PanelContent() constructor { if(noti.onClick != noone && mouse_press(mb_left, pFOCUS)) noti.onClick(); - if(mouse_press(mb_right, pFOCUS)) { + if(mouse_press(mb_right, pFOCUS)) noti_selecting = noti; - - var dia = menuCall("notification_menu", [ - menuItem(__txtx("noti_copy_message", "Copy notification message"), function() { clipboard_set_text(noti_selecting.txt); }), - menuItem(__txtx("noti_delete_message", "Delete notification"), function() { ds_list_remove(STATUSES, noti_selecting); }), - ]); - - } } if(noti.life_max > 0) { @@ -163,8 +158,7 @@ function Panel_Notification() : PanelContent() constructor { sp_noti.setFocusHover(pFOCUS, pHOVER); sp_noti.draw(px, py, mx - px, my - py); - if(mouse_press(mb_right, pFOCUS)) { + if(mouse_press(mb_right, pFOCUS)) menuCall("notification_log_menu", rightClickMenu); - } } } \ No newline at end of file diff --git a/scripts/pathAnchorBox/pathAnchorBox.gml b/scripts/pathAnchorBox/pathAnchorBox.gml index 430cf109e..666809585 100644 --- a/scripts/pathAnchorBox/pathAnchorBox.gml +++ b/scripts/pathAnchorBox/pathAnchorBox.gml @@ -1,25 +1,18 @@ function pathAnchorBox(_onModify) : widget() constructor { onModify = _onModify; - onModifySingle[0] = function(val) { return onModify(toNumber(val), 0); } - onModifySingle[1] = function(val) { return onModify(toNumber(val), 1); } + onModifySingle[0] = function(val) /*=>*/ {return onModify(toNumber(val), 0)}; + onModifySingle[1] = function(val) /*=>*/ {return onModify(toNumber(val), 1)}; + onModifySingle[2] = function(val) /*=>*/ {return onModify(toNumber(val), 2)}; + onModifySingle[3] = function(val) /*=>*/ {return onModify(toNumber(val), 3)}; + onModifySingle[4] = function(val) /*=>*/ {return onModify(toNumber(val), 4)}; + onModifySingle[5] = function(val) /*=>*/ {return onModify(toNumber(val), 5)}; - onModifySingle[2] = function(val) { return onModify(toNumber(val), 2); } - onModifySingle[3] = function(val) { return onModify(toNumber(val), 3); } - onModifySingle[4] = function(val) { return onModify(toNumber(val), 4); } - onModifySingle[5] = function(val) { return onModify(toNumber(val), 5); } + onModifySingle[6] = function(val) /*=>*/ {return onModify(toNumber(val), 6)}; //3d + onModifySingle[7] = function(val) /*=>*/ {return onModify(toNumber(val), 7)}; + onModifySingle[8] = function(val) /*=>*/ {return onModify(toNumber(val), 8)}; - for(var i = 0; i < 6; i++) { - tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); - tb[i].slidable = true; - } - - tb[0].setPrecision(2).setLabel("x"); - tb[1].setPrecision(2).setLabel("y"); - tb[2].setPrecision(2).setLabel("dx0"); - tb[3].setPrecision(2).setLabel("dy0"); - tb[4].setPrecision(2).setLabel("dx1"); - tb[5].setPrecision(2).setLabel("dy1"); + for(var i = 0; i < 9; i++) tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]).setPrecision(2).setHide(1); static setInteract = function(interactable = noone) { self.interactable = interactable; @@ -34,13 +27,14 @@ function pathAnchorBox(_onModify) : widget() constructor { } static isHovering = function() { - for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true; + for( var i = 0, n = array_length(tb); i < n; i++ ) + if(tb[i].isHovering()) return true; return false; } static drawParam = function(params) { setParam(params); - for(var i = 0; i < 6; i++) tb[i].setParam(params); + for(var i = 0; i < array_length(tb); i++) tb[i].setParam(params); return draw(params.x, params.y, params.w, params.h, params.data, params.m); } @@ -54,41 +48,97 @@ function pathAnchorBox(_onModify) : widget() constructor { for( var i = 0, n = array_length(tb); i < n; i++ ) tb[i].setFocusHover(active, hover); - var _tx = _x, _ty = _y; - var _tw = _w / 2 - 4; - var _th = _h; - - tb[0].draw(_tx, _ty, _tw, _th, _data[0], _m); - tb[1].draw(_tx + _w / 2, _ty, _tw, _th, _data[1], _m); + var _tx, _ty, _tw, _th, _w2; var _bw = ui(28); - var _ty = _y + _th + 6; - var _tw = (_w - _bw - 8) / 4 - 4; + var _li = 6; - tb[2].draw(_tx + (_tw + 4) * 0, _ty, _tw, _th, _data[2], _m); - tb[3].draw(_tx + (_tw + 4) * 1, _ty, _tw, _th, _data[3], _m); - - tb[4].draw(_tx + (_tw + 4) * 2 + _bw + 8, _ty, _tw, _th, _data[4], _m); - tb[5].draw(_tx + (_tw + 4) * 3 + _bw + 8, _ty, _tw, _th, _data[5], _m); + if(array_length(_data) < 9) { + tb[0].setLabel("x"); + tb[1].setLabel("y"); + + tb[2].setLabel("dx0"); + tb[3].setLabel("dy0"); + tb[4].setLabel("dx1"); + tb[5].setLabel("dy1"); + + _tx = _x; + _ty = _y; + _tw = _w / 2; + _th = _h; + + draw_sprite_stretched(THEME.textbox, 3, _tx, _ty, _w, _th); + tb[0].draw(_tx, _ty, _tw, _th, _data[0], _m); + tb[1].draw(_tx + _tw, _ty, _tw, _th, _data[1], _m); + + _ty = _y + _th + 6; + _w2 = _w / 2 - _bw / 2 - 4; + _tw = _w2 / 2; + + draw_sprite_stretched(THEME.textbox, 3, _tx, _ty, _w2, _th); + tb[2].draw(_tx + _tw * 0, _ty, _tw, _th, _data[2], _m); + tb[3].draw(_tx + _tw * 1, _ty, _tw, _th, _data[3], _m); + + _tx = _x + _w - _w2; + + draw_sprite_stretched(THEME.textbox, 3, _tx, _ty, _w2, _th); + tb[4].draw(_tx + _tw * 0, _ty, _tw, _th, _data[4], _m); + tb[5].draw(_tx + _tw * 1, _ty, _tw, _th, _data[5], _m); + + } else { + tb[0].setLabel("x"); + tb[1].setLabel("y"); + tb[2].setLabel("z"); + + tb[3].setLabel("dx0"); + tb[4].setLabel("dy0"); + tb[5].setLabel("dz0"); + + tb[6].setLabel("dx1"); + tb[7].setLabel("dy1"); + tb[8].setLabel("dz1"); + + _li = 9; + _tx = _x; + _ty = _y; + _tw = _w / 3; + _th = _h; + + draw_sprite_stretched(THEME.textbox, 3, _tx, _ty, _w, _th); + tb[0].draw(_tx + _tw * 0, _ty, _tw, _th, _data[0], _m); + tb[1].draw(_tx + _tw * 1, _ty, _tw, _th, _data[1], _m); + tb[2].draw(_tx + _tw * 2, _ty, _tw, _th, _data[2], _m); + + _ty = _y + _th + 6; + _w2 = _w / 2 - _bw / 2 - 4; + _tw = _w2 / 3; + + draw_sprite_stretched(THEME.textbox, 3, _tx, _ty, _w2, _th); + tb[3].draw(_tx + _tw * 0, _ty, _tw, _th, _data[3], _m); + tb[4].draw(_tx + _tw * 1, _ty, _tw, _th, _data[4], _m); + tb[5].draw(_tx + _tw * 2, _ty, _tw, _th, _data[5], _m); + + _tx = _x + _w - _w2; + + draw_sprite_stretched(THEME.textbox, 3, _tx, _ty, _w2, _th); + tb[6].draw(_tx + _tw * 0, _ty, _tw, _th, _data[6], _m); + tb[7].draw(_tx + _tw * 1, _ty, _tw, _th, _data[7], _m); + tb[8].draw(_tx + _tw * 2, _ty, _tw, _th, _data[8], _m); + + } - var _linked = array_safe_get(_data, 6); + var _linked = array_safe_get(_data, _li); var _blend = !_linked? COLORS._main_accent : COLORS._main_icon; - var bx = _x + _w / 2 - _bw / 2 - 2; + var bx = _x + _w / 2 - _bw / 2; var by = _ty + _th / 2 - _bw / 2; if(buttonInstant(THEME.button_hide, bx, by, _bw, _bw, _m, hover, active, "Linked", THEME.value_link, !_linked, _blend) == 2) - onModify(!_linked, 6); + onModify(!_linked, _li); resetFocus(); return h; } - static clone = function() { - var cln = new pathAnchorBox(onModify); - return cln; - } - - static free = function() { - for( var i = 0, n = array_length(tb); i < n; i++ ) tb[i].free(); - } + static clone = function() { return new pathAnchorBox(onModify); } + static free = function() { array_foreach(tb, function(t) /*=>*/ {return t.free()}); } } \ No newline at end of file