[Path Extrude] Add profile angle property.

This commit is contained in:
Tanasart 2024-12-20 08:25:37 +07:00
parent 04ecbe8cbb
commit 83f61c732a
6 changed files with 113 additions and 62 deletions

View file

@ -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);

View file

@ -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, ".");

View file

@ -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,

View file

@ -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);
}
}
}

View file

@ -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);
if(array_length(_data) < 9) {
tb[0].setLabel("x");
tb[1].setLabel("y");
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);
tb[2].setLabel("dx0");
tb[3].setLabel("dy0");
tb[4].setLabel("dx1");
tb[5].setLabel("dy1");
var _linked = array_safe_get(_data, 6);
_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, _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()}); }
}