Fix quaternion value does not auto convert vec3.

This commit is contained in:
Tanasart 2024-12-04 12:12:05 +07:00
parent d61439003b
commit 2120e95d59
11 changed files with 97 additions and 62 deletions

View file

@ -100,8 +100,8 @@
{"name":"Shaders","order":14,"path":"folders/nodes/data/simulation/smokeSim/Shaders.yy",},
{"name":"strandSim","order":5,"path":"folders/nodes/data/simulation/strandSim.yy",},
{"name":"VFX","order":6,"path":"folders/nodes/data/simulation/VFX.yy",},
{"name":"generators","order":1,"path":"folders/nodes/data/simulation/VFX/generators.yy",},
{"name":"__legacy","order":12,"path":"folders/nodes/data/simulation/VFX/__legacy.yy",},
{"name":"generators","order":1,"path":"folders/nodes/data/simulation/VFX/generators.yy",},
{"name":"tiler","order":31,"path":"folders/nodes/data/tiler.yy",},
{"name":"shaders","order":2,"path":"folders/nodes/data/tiler/shaders.yy",},
{"name":"sprites","order":4,"path":"folders/nodes/data/tiler/sprites.yy",},
@ -564,6 +564,7 @@
{"name":"event_recorder","order":4,"path":"scripts/event_recorder/event_recorder.yy",},
{"name":"export_portable","order":3,"path":"scripts/export_portable/export_portable.yy",},
{"name":"fft_functions","order":1,"path":"scripts/fft_functions/fft_functions.yy",},
{"name":"file_dir_redirector","order":12,"path":"scripts/file_dir_redirector/file_dir_redirector.yy",},
{"name":"file_functions","order":10,"path":"scripts/file_functions/file_functions.yy",},
{"name":"FirebaseFirestoreMainFunctions","order":1,"path":"scripts/FirebaseFirestoreMainFunctions/FirebaseFirestoreMainFunctions.yy",},
{"name":"FirebaseFirestorePaths","order":2,"path":"scripts/FirebaseFirestorePaths/FirebaseFirestorePaths.yy",},

View file

@ -188,9 +188,9 @@
{"$GMFolder":"","%Name":"Shaders","folderPath":"folders/nodes/data/simulation/smokeSim/Shaders.yy","name":"Shaders","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"strandSim","folderPath":"folders/nodes/data/simulation/strandSim.yy","name":"strandSim","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"VFX","folderPath":"folders/nodes/data/simulation/VFX.yy","name":"VFX","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"__legacy","folderPath":"folders/nodes/data/simulation/VFX/__legacy.yy","name":"__legacy","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"affector","folderPath":"folders/nodes/data/simulation/VFX/affector.yy","name":"affector","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"generators","folderPath":"folders/nodes/data/simulation/VFX/generators.yy","name":"generators","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"__legacy","folderPath":"folders/nodes/data/simulation/VFX/__legacy.yy","name":"__legacy","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"tiler","folderPath":"folders/nodes/data/tiler.yy","name":"tiler","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"shaders","folderPath":"folders/nodes/data/tiler/shaders.yy","name":"shaders","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"sprites","folderPath":"folders/nodes/data/tiler/sprites.yy","name":"sprites","resourceType":"GMFolder","resourceVersion":"2.0",},
@ -1079,6 +1079,7 @@
{"id":{"name":"event_recorder","path":"scripts/event_recorder/event_recorder.yy",},},
{"id":{"name":"export_portable","path":"scripts/export_portable/export_portable.yy",},},
{"id":{"name":"fft_functions","path":"scripts/fft_functions/fft_functions.yy",},},
{"id":{"name":"file_dir_redirector","path":"scripts/file_dir_redirector/file_dir_redirector.yy",},},
{"id":{"name":"file_functions","path":"scripts/file_functions/file_functions.yy",},},
{"id":{"name":"FirebaseFirestore_operationFromSymbol","path":"scripts/FirebaseFirestore_operationFromSymbol/FirebaseFirestore_operationFromSymbol.yy",},},
{"id":{"name":"FirebaseFirestoreMainFunctions","path":"scripts/FirebaseFirestoreMainFunctions/FirebaseFirestoreMainFunctions.yy",},},

View file

@ -37,8 +37,8 @@ function GMRoom_Background(_raw) : GMRoom_Layer(_raw) constructor {
index = 0;
x = _raw.x;
y = _raw.y;
y = _raw.y;
colour = _raw.colour;
}

View file

@ -0,0 +1,25 @@
function check_directory_redirector(path) {
var _dir = filename_dir(path) + "\\";
var _rep = 0;
// print($"Checkin rediect for {array_length(PROJECT.pathInputs)} inputs to {_dir}");
for( var i = 0, n = array_length(PROJECT.pathInputs); i < n; i++ ) {
var _j = PROJECT.pathInputs[i];
if(!is(_j, NodeValue)) continue;
if(!_j.node.active) continue;
var _p = _j.getValue();
if(file_exists(_p)) continue;
var _fname = filename_name(_p);
var _npath = _dir + _fname;
if(file_exists(_npath)) {
_j.setValue(_npath);
_rep++;
}
}
if(_rep) noti_warning($"Redirect {_rep} file input(s) to use the new directory.");
}

View file

@ -0,0 +1,13 @@
{
"$GMScript":"v1",
"%Name":"file_dir_redirector",
"isCompatibility":false,
"isDnD":false,
"name":"file_dir_redirector",
"parent":{
"name":"files",
"path":"folders/functions/files.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
}

View file

@ -245,20 +245,7 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c
static pointIn = function(_x, _y, _mx, _my, _s) { return false; }
static cullCheck = function(_x, _y, _s, minx, miny, maxx, maxy) {
var x0 = bbox[0] * _s + _x;
var y0 = bbox[1] * _s + _y;
var x1 = bbox[2] * _s + _x;
var y1 = bbox[3] * _s + _y;
draw_boundary[0] = minx;
draw_boundary[1] = miny;
draw_boundary[2] = maxx;
draw_boundary[3] = maxy;
draw_graph_culled = !rectangle_in_rectangle(minx, miny, maxx, maxy, x0, y0, x1, y1);
return !draw_graph_culled;
}
static cullCheck = function(_x, _y, _s, minx, miny, maxx, maxy) { return true; }
static drawNodeBG = function(_x, _y, _mx, _my, _s) {
refreshGroupBG();

View file

@ -709,7 +709,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
var _ou = preview_channel >= 0 && preview_channel < array_length(outputs) && outputs[preview_channel].type == VALUE_TYPE.surface;
var _prev_surf = previewable && preview_draw && (_ps || _ou);
junction_draw_hei_y = SHOW_PARAM? 32 : 16;
junction_draw_hei_y = SHOW_PARAM? 32 : 16;
junction_draw_pad_y = SHOW_PARAM? 128 : 24;
var _hi, _ho;
@ -732,7 +732,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
}
var _p = previewable;
for( var i = 0; i < array_length(inputs); i++ ) {
for( var i = 0, n = array_length(inputs); i < n; i++ ) {
var _inp = inputs[i];
if(is_instanceof(_inp, NodeValue) && _inp.isVisible()) {
if(_p) _hi += junction_draw_hei_y;
@ -743,13 +743,13 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(auto_input && dummy_input) _hi += junction_draw_hei_y;
var _p = previewable;
for( var i = 0; i < array_length(outputs); i++ ) {
for( var i = 0, n = array_length(outputs); i < n; i++ ) {
if(!outputs[i].isVisible()) continue;
if(_p) _ho += junction_draw_hei_y;
_p = true;
}
for( var i = 0; i < array_length(inputs); i++ ) {
for( var i = 0, n = array_length(inputs); i < n; i++ ) {
var _inp = inputs[i];
var _byp = _inp.bypass_junc;
if(_byp == noone) continue;
@ -758,7 +758,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
}
if(attributes.outp_meta) {
for( var i = 0; i < array_length(junc_meta); i++ ) {
for( var i = 0, n = array_length(junc_meta); i < n; i++ ) {
if(!junc_meta[i].isVisible()) continue;
_ho += junction_draw_hei_y;
}
@ -1359,22 +1359,24 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
} run_in(1, function() /*=>*/ { refreshNodeDisplay(); });
__preDraw_data = { _x: undefined, _y: undefined, _s: undefined, _p: undefined, sp: undefined, force: false };
__preDraw_data = { _x: undefined, _y: undefined, _w: undefined, _h: undefined, _s: undefined, _p: undefined, sp: undefined, force: false };
static preDraw = function(_x, _y, _s) {
var xx = x * _s + _x;
var yy = y * _s + _y;
var _upd = __preDraw_data._x != xx || __preDraw_data._y != yy || __preDraw_data._s != _s || __preDraw_data.force ||
__preDraw_data._p != previewable || __preDraw_data.sp != show_parameter
var _d = __preDraw_data;
var _upd = _d._x != xx || _d._y != yy || _d._s != _s || _d.force || _d._w != w || _d._h != h || _d._p != previewable || _d.sp != show_parameter
__preDraw_data._x = xx;
__preDraw_data._y = yy;
__preDraw_data._s = _s;
__preDraw_data._p = previewable;
__preDraw_data.sp = show_parameter;
_d._x = xx;
_d._y = yy;
_d._w = w;
_d._h = h;
_d._s = _s;
_d._p = previewable;
_d.sp = show_parameter;
__preDraw_data.force = false;
_d.force = false;
if(!_upd) {
if(SHOW_PARAM) h = h_param;
@ -2042,7 +2044,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(SHOW_PARAM) drawJunctionWidget(xx, yy, _mx, _my, _s, _hover, _focus);
draw_name = false;
if((previewable && _s >= 0.75) || (!previewable && h * _s >= name_height * .5)) drawNodeName(xx, yy, _s, _panel);
if((previewable && _s >= 0.5) || (!previewable && h * _s >= name_height * .5)) drawNodeName(xx, yy, _s, _panel);
if(attributes.annotation != "") {
draw_set_text(f_sdf_medium, fa_left, fa_bottom, attributes.annotation_color);

View file

@ -834,28 +834,27 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break;
case VALUE_DISPLAY.path_load :
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ {return setValueInspector(str)});
editWidget.align = fa_left;
editWidget.side_button = button(function() {
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ { if(NOT_LOAD) check_directory_redirector(str); setValueInspector(str); });
editWidget.align = fa_left;
array_append(node.project.pathInputs, self);
editWidget.side_button = button(function() /*=>*/ {
var path = display_data.filter == "dir"? get_directory("") : get_open_filename_pxc(display_data.filter, "");
key_release();
if(path == "") return noone;
if(NOT_LOAD) check_directory_redirector(path);
return setValueInspector(path);
}, THEME.button_path_icon).setTooltip(__txt("Open Explorer..."));
editWidget.front_button = button(function() {
var project = PROJECT;
if(project.path == "") {
noti_warning("Save the current project first.")
return;
}
editWidget.front_button = button(function() /*=>*/ {
if(node.project.path == "") { noti_warning("Save the current project first."); return; }
var _pth = getValue();
if(!file_exists(_pth)) return;
var _nam = filename_name(_pth);
var _dir = filename_dir(project.path);
var _dir = filename_dir(node.project.path);
var _newpath = _dir + "/" + _nam;
file_copy(_pth, _newpath);
@ -1626,6 +1625,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
static isConnectable = function(_valueFrom, checkRecur = true, _log = false) {
if(LOADING || APPENDING) return 1;
if(_valueFrom == -1 || _valueFrom == undefined || _valueFrom == noone) {
if(_log) noti_warning($"LOAD: Cannot set node connection from {_valueFrom} to {name} of node {node.name}.",, node);

View file

@ -13,10 +13,10 @@ function __NodeValue_Quaternion(_name, _node, _value, _tooltip = "") : __NodeVal
var typ = nod.type;
var dis = nod.display_type;
if(!is_array(val)) return [ val, val, val, val ];
if(!is_array(val)) return array_create(4, val);
var _convert = applyUnit && attributes.angle_display == QUARTERNION_DISPLAY.euler;
if(!_convert) return val;
if(!_convert) return array_verify(val, 4);
var _d = array_get_depth(val);

View file

@ -201,6 +201,7 @@ function Panel_Preview() : PanelContent() constructor {
preview_sequence = [ 0, 0 ];
_preview_sequence = preview_sequence;
preview_rate = 10;
preview_selecting = false;
right_menu_x = 0;
right_menu_y = 8;
@ -1459,8 +1460,11 @@ function Panel_Preview() : PanelContent() constructor {
var txt = $"{__txt("fps")} {fps}";
if(PREFERENCES.panel_preview_show_real_fps)
txt += $" / {FPS_REAL}";
draw_set_color(fps >= PROJECT.animator.framerate? COLORS._main_text_sub : COLORS._main_value_negative);
var cc = fps >= PROJECT.animator.framerate? COLORS._main_text_sub : COLORS._main_value_negative;
if(!window_has_focus()) cc = COLORS._main_text_sub;
draw_set_color(cc);
draw_text(right_menu_x, right_menu_y, txt);
right_menu_y += _lh;
@ -1544,6 +1548,8 @@ function Panel_Preview() : PanelContent() constructor {
#region surface array
preview_x_max = 0;
if(mouse_release(mb_left)) preview_selecting = false;
if(array_length(pseq) > 1) {
var _xx = tool_side_draw_l * ui(40);
var xx = _xx + preview_x + ui(8);
@ -1558,24 +1564,22 @@ function Panel_Preview() : PanelContent() constructor {
prev = prev.surface;
if(!is_surface(prev)) continue;
var prev_w = surface_get_width_safe(prev);
var prev_h = surface_get_height_safe(prev);
var ss = prev_size / max(prev_w, prev_h);
var prev_w = surface_get_width_safe(prev);
var prev_h = surface_get_height_safe(prev);
var ss = prev_size / max(prev_w, prev_h);
var prev_sw = prev_w * ss;
var _hov = hoverable && point_in_rectangle(mx, my, xx, yy, xx + prev_sw, yy + prev_h * ss);
draw_set_color(COLORS.panel_preview_surface_outline);
draw_rectangle(xx, yy, xx + prev_w * ss, yy + prev_h * ss, true);
if(hoverable && point_in_rectangle(mx, my, xx, yy, xx + prev_sw, yy + prev_h * ss)) {
if(mouse_press(mb_left, pFOCUS)) {
_node.preview_index = i;
_node.onValueUpdate(0);
if(resetViewOnDoubleClick)
do_fullView = true;
}
draw_surface_ext_safe(prev, xx, yy, ss, ss, 0, c_white, 1);
} else {
draw_surface_ext_safe(prev, xx, yy, ss, ss, 0, c_white, 0.5);
draw_surface_ext_safe(prev, xx, yy, ss, ss, 0, c_white, .5 + .5 * _hov);
if((_hov && mouse_press(mb_left, pFOCUS)) || (preview_selecting && mx > xx && mx <= xx + prev_sw)) {
_node.preview_index = i;
_node.onValueUpdate(0);
if(resetViewOnDoubleClick) do_fullView = true;
preview_selecting = true;
}
if(i == _node.preview_index) {

View file

@ -31,6 +31,8 @@
nodeMap = ds_map_create();
nodeNameMap = ds_map_create();
pathInputs = [];
composer = noone;
animator = new AnimationManager();
globalNode = new Node_Global();