diff --git a/scripts/node_ase_file_read/node_ase_file_read.gml b/scripts/node_ase_file_read/node_ase_file_read.gml index 401076e1e..c6d95a039 100644 --- a/scripts/node_ase_file_read/node_ase_file_read.gml +++ b/scripts/node_ase_file_read/node_ase_file_read.gml @@ -408,4 +408,11 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const if(struct_has(attr, "layer_visible")) attributes.layer_visible = attr.layer_visible; } + + static dropPath = function(path) { + if(is_array(path)) path = array_safe_get(path, 0); + if(!file_exists_empty(path)) return; + + inputs[| 0].setValue(path); + } } \ No newline at end of file diff --git a/scripts/node_byte_file_read/node_byte_file_read.gml b/scripts/node_byte_file_read/node_byte_file_read.gml index de7293f06..fe5a8ca1d 100644 --- a/scripts/node_byte_file_read/node_byte_file_read.gml +++ b/scripts/node_byte_file_read/node_byte_file_read.gml @@ -14,7 +14,7 @@ function Node_Byte_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons content = noone; - on_drop_file = function(path) { #region + on_drop_file = function(path) { path = path_get(path); inputs[| 0].setValue(path); @@ -24,7 +24,7 @@ function Node_Byte_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons } return false; - } #endregion + } path_current = ""; edit_time = 0; @@ -36,12 +36,12 @@ function Node_Byte_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons insp1UpdateTooltip = __txt("Refresh"); insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ]; - static onInspector1Update = function() { #region + static onInspector1Update = function() { updatePaths(path_get(getInputData(0))); triggerRender(); - } #endregion + } - function updatePaths(path = path_current) { #region + function updatePaths(path = path_current) { if(path == -1) return false; path_current = path; @@ -51,9 +51,9 @@ function Node_Byte_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons content = buffer_load(path_current); return true; - } #endregion + } - static step = function() { #region + static step = function() { if(attributes.file_checker && file_exists_empty(path_current)) { var _modi = file_get_modify_s(path_current); @@ -63,21 +63,28 @@ function Node_Byte_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons run_in(2, function() { updatePaths(); triggerRender(); }); } } - } #endregion + } - static update = function(frame = CURRENT_FRAME) { #region + static update = function(frame = CURRENT_FRAME) { var path = path_get(getInputData(0)); if(path_current != path) updatePaths(path); outputs[| 0].setValue(content); - } #endregion + } - static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { var bbox = drawGetBbox(xx, yy, _s); var str = filename_name(getInputData(0)); draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text); draw_text_bbox(bbox, str); - } #endregion + } + + static dropPath = function(path) { + if(is_array(path)) path = array_safe_get(path, 0); + if(!file_exists_empty(path)) return; + + inputs[| 0].setValue(path); + } } \ No newline at end of file diff --git a/scripts/node_canvas/node_canvas.gml b/scripts/node_canvas/node_canvas.gml index 49a789b73..0d0c13cec 100644 --- a/scripts/node_canvas/node_canvas.gml +++ b/scripts/node_canvas/node_canvas.gml @@ -1180,6 +1180,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } #endregion static dropPath = function(path) { + if(is_array(path)) path = array_safe_get(path, 0); if(!file_exists_empty(path)) return noone; if(tool_selection.is_selected) diff --git a/scripts/node_csv_file_read/node_csv_file_read.gml b/scripts/node_csv_file_read/node_csv_file_read.gml index 88bfa4cfe..5bc75cc1e 100644 --- a/scripts/node_csv_file_read/node_csv_file_read.gml +++ b/scripts/node_csv_file_read/node_csv_file_read.gml @@ -1,4 +1,4 @@ -function Node_create_CSV_File_Read(_x, _y, _group = noone) { #region +function Node_create_CSV_File_Read(_x, _y, _group = noone) { var path = ""; if(NODE_NEW_MANUAL) { path = get_open_filename_pxc("comma separated value|*.csv", ""); @@ -11,9 +11,9 @@ function Node_create_CSV_File_Read(_x, _y, _group = noone) { #region node.doUpdate(); return node; -} #endregion +} -function Node_create_CSV_File_Read_path(_x, _y, path) { #region +function Node_create_CSV_File_Read_path(_x, _y, path) { if(!file_exists_empty(path)) return noone; var node = new Node_CSV_File_Read(_x, _y, PANEL_GRAPH.getCurrentContext()); @@ -21,7 +21,7 @@ function Node_create_CSV_File_Read_path(_x, _y, path) { #region node.doUpdate(); return node; -} #endregion +} function Node_CSV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "CSV File In"; @@ -51,16 +51,16 @@ function Node_CSV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const first_update = false; - on_drop_file = function(path) { #region + on_drop_file = function(path) { if(updatePaths(path)) { doUpdate(); return true; } return false; - } #endregion + } - function updatePaths(path = path_current) { #region + function updatePaths(path = path_current) { path = path_get(path); if(path == -1) return false; @@ -94,17 +94,17 @@ function Node_CSV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const edit_time = max(edit_time, file_get_modify_s(path_current)); return true; - } #endregion + } insp1UpdateTooltip = __txt("Refresh"); insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ]; - static onInspector1Update = function() { #region + static onInspector1Update = function() { updatePaths(path_get(getInputData(0))); triggerRender(); - } #endregion + } - static step = function() { #region + static step = function() { if(attributes.file_checker && file_exists_empty(path_current)) { var _modi = file_get_modify_s(path_current); @@ -114,21 +114,28 @@ function Node_CSV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const run_in(2, function() { updatePaths(); triggerRender(); }); } } - } #endregion + } - static update = function(frame = CURRENT_FRAME) { #region + static update = function(frame = CURRENT_FRAME) { var path = path_get(getInputData(0)); if(path_current != path) updatePaths(path); outputs[| 0].setValue(content); - } #endregion + } - static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { var bbox = drawGetBbox(xx, yy, _s); var str = filename_name(path_current); draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text); var ss = string_scale(str, bbox.w, bbox.h); draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); - } #endregion + } + + static dropPath = function(path) { + if(is_array(path)) path = array_safe_get(path, 0); + if(!file_exists_empty(path)) return; + + inputs[| 0].setValue(path); + } } \ No newline at end of file diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index fa5d14683..ae5e829d5 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -1770,7 +1770,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { } if(draw_droppable) { - draw_sprite_stretched_ext(THEME.ui_panel_active, 0, xx, yy, w * _s, h * _s, COLORS._main_value_positive, 1); + // draw_sprite_stretched_ext(THEME.ui_panel_active, 0, xx, yy, w * _s, h * _s, COLORS._main_value_positive, 1); + draw_sprite_stretched_ext(THEME.color_picker_box, 0, xx - 2 * _s, yy - 2 * _s, w * _s + 4 * _s, h * _s + 4 * _s, COLORS._main_value_positive, 1); + draw_droppable = false; } diff --git a/scripts/node_directory_search/node_directory_search.gml b/scripts/node_directory_search/node_directory_search.gml index 2e47287be..6d335bf4d 100644 --- a/scripts/node_directory_search/node_directory_search.gml +++ b/scripts/node_directory_search/node_directory_search.gml @@ -1,4 +1,4 @@ -function Node_create_Directory_Search(_x, _y, _group = noone) { #region +function Node_create_Directory_Search(_x, _y, _group = noone) { var path = ""; if(NODE_NEW_MANUAL) { path = get_directory(""); @@ -11,16 +11,16 @@ function Node_create_Directory_Search(_x, _y, _group = noone) { #region if(NODE_NEW_MANUAL) node.doUpdate(); return node; -} #endregion +} -function Node_create_Directory_path(_x, _y, path) { #region +function Node_create_Directory_path(_x, _y, path) { if(!directory_exists(path)) return noone; var node = new Node_Directory_Search(_x, _y, PANEL_GRAPH.getCurrentContext()); node.inputs[| 0].setValue(path); node.doUpdate(); return node; -} #endregion +} function Node_Directory_Search(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "Directory Search"; @@ -51,12 +51,12 @@ function Node_Directory_Search(_x, _y, _group = noone) : Node(_x, _y, _group) co array_push(attributeEditors, [ "File Watcher", function() { return attributes.file_checker; }, new checkBox(function() { attributes.file_checker = !attributes.file_checker; }) ]); - function deleteSprite(pathObj) { #region + function deleteSprite(pathObj) { if(sprite_exists(pathObj.spr)) sprite_delete(pathObj.spr); - } #endregion + } - function refreshSprite(pathObj) { #region + function refreshSprite(pathObj) { var path = pathObj.path; var ext = string_lower(filename_ext(path)); @@ -80,9 +80,9 @@ function Node_Directory_Search(_x, _y, _group = noone) : Node(_x, _y, _group) co } return pathObj; - } #endregion + } - function refreshText(pathObj) { #region + function refreshText(pathObj) { var path = pathObj.path; var ext = string_lower(filename_ext(path)); @@ -90,9 +90,9 @@ function Node_Directory_Search(_x, _y, _group = noone) : Node(_x, _y, _group) co pathObj.edit_time = file_get_modify_s(path); return pathObj; - } #endregion + } - function updatePaths() { #region + function updatePaths() { var path = getInputData(0); var filter = getInputData(1); var type = getInputData(2); @@ -121,17 +121,17 @@ function Node_Directory_Search(_x, _y, _group = noone) : Node(_x, _y, _group) co var _p = string_trim_end(path, ["/", "\\"]); setDisplayName(filename_name_only(_p)); - } #endregion + } insp1UpdateTooltip = __txt("Refresh"); insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ]; - static onInspector1Update = function() { #region + static onInspector1Update = function() { updatePaths(); triggerRender(); - } #endregion + } - static step = function() { #region + static step = function() { if(attributes.file_checker) { var _update = false; var _paths = struct_get_names(paths); @@ -147,9 +147,9 @@ function Node_Directory_Search(_x, _y, _group = noone) : Node(_x, _y, _group) co if(_update) triggerRender(); } - } #endregion + } - static update = function(frame = CURRENT_FRAME) { #region + static update = function(frame = CURRENT_FRAME) { updatePaths(); var type = getInputData(2); @@ -186,5 +186,12 @@ function Node_Directory_Search(_x, _y, _group = noone) : Node(_x, _y, _group) co outputs[| 0].setType(type == 0? VALUE_TYPE.surface : VALUE_TYPE.text); outputs[| 0].setValue(_outsurf); outputs[| 1].setValue(_imgPaths); - } #endregion + } + + static dropPath = function(path) { + if(is_array(path)) path = array_safe_get(path, 0); + if(!directory_exists(path)) return; + + inputs[| 0].setValue(path); + } } \ No newline at end of file diff --git a/scripts/node_image/node_image.gml b/scripts/node_image/node_image.gml index 6f8ad12dd..a5ae9b0a7 100644 --- a/scripts/node_image/node_image.gml +++ b/scripts/node_image/node_image.gml @@ -160,7 +160,10 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { #endregion } #endregion - static dropPath = function(path) { - inputs[| 0].setValue(path); + static dropPath = function(path) { + if(is_array(path)) path = array_safe_get(path, 0); + if(!file_exists_empty(path)) return; + + inputs[| 0].setValue(path); } } \ No newline at end of file diff --git a/scripts/node_image_animated/node_image_animated.gml b/scripts/node_image_animated/node_image_animated.gml index 7ee891c67..42bba3ae7 100644 --- a/scripts/node_image_animated/node_image_animated.gml +++ b/scripts/node_image_animated/node_image_animated.gml @@ -290,4 +290,9 @@ function timelineItemNode_Image_Animated(node) : timelineItemNode(node) construc static onSerialize = function(_map) { _map.type = "timelineItemNode_Image_Animated"; } + + static dropPath = function(path) { + if(!is_array(path)) path = [ path ]; + inputs[| 0].setValue(path); + } } \ No newline at end of file diff --git a/scripts/node_image_gif/node_image_gif.gml b/scripts/node_image_gif/node_image_gif.gml index 482dc6d3e..5893ab3ab 100644 --- a/scripts/node_image_gif/node_image_gif.gml +++ b/scripts/node_image_gif/node_image_gif.gml @@ -234,6 +234,9 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct } #endregion static dropPath = function(path) { + if(is_array(path)) path = array_safe_get(path, 0); + if(!file_exists_empty(path)) return; + inputs[| 0].setValue(path); } } diff --git a/scripts/node_image_sequence/node_image_sequence.gml b/scripts/node_image_sequence/node_image_sequence.gml index aa6eba8f6..73dff91af 100644 --- a/scripts/node_image_sequence/node_image_sequence.gml +++ b/scripts/node_image_sequence/node_image_sequence.gml @@ -69,7 +69,7 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons array_push(attributeEditors, [ "File Watcher", function() { return attributes.file_checker; }, new checkBox(function() { attributes.file_checker = !attributes.file_checker; }) ]); - on_drop_file = function(path) { #region + on_drop_file = function(path) { if(directory_exists(path)) { with(dialogCall(o_dialog_drag_folder, WIN_W / 2, WIN_H / 2)) { dir_paths = path; @@ -87,17 +87,17 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons } return false; - } #endregion + } insp1UpdateTooltip = __txt("Refresh"); insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ]; - static onInspector1Update = function() { #region + static onInspector1Update = function() { updatePaths(path_get(getInputData(0))); triggerRender(); - } #endregion + } - function updatePaths(paths = path_current) { #region + function updatePaths(paths = path_current) { for(var i = 0; i < array_length(spr); i++) { if(spr[i] && sprite_exists(spr[i])) sprite_delete(spr[i]); @@ -136,9 +136,9 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons outputs[| 1].setValue(paths); return true; - } #endregion + } - static step = function() { #region + static step = function() { if(attributes.file_checker) for( var i = 0, n = array_length(path_current); i < n; i++ ) { var _ed = file_get_modify_s(path_current[i]); @@ -149,9 +149,9 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons break; } } - } #endregion + } - static update = function(frame = CURRENT_FRAME) { #region + static update = function(frame = CURRENT_FRAME) { var path = path_get(getInputData(0)); if(!array_equals(path_current, path)) @@ -246,5 +246,10 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons } outputs[| 0].setValue(surfs); - } #endregion + } + + static dropPath = function(path) { + if(!is_array(path)) path = [ path ]; + inputs[| 0].setValue(path); + } } \ No newline at end of file diff --git a/scripts/node_json_file_read/node_json_file_read.gml b/scripts/node_json_file_read/node_json_file_read.gml index b022c6544..b77b16762 100644 --- a/scripts/node_json_file_read/node_json_file_read.gml +++ b/scripts/node_json_file_read/node_json_file_read.gml @@ -1,4 +1,4 @@ -function Node_create_Json_File_Read(_x, _y, _group = noone) { #region +function Node_create_Json_File_Read(_x, _y, _group = noone) { var path = ""; if(NODE_NEW_MANUAL) { path = get_open_filename_pxc("JSON file|*.json", ""); @@ -11,9 +11,9 @@ function Node_create_Json_File_Read(_x, _y, _group = noone) { #region node.doUpdate(); return node; -} #endregion +} -function Node_create_Json_File_Read_path(_x, _y, path) { #region +function Node_create_Json_File_Read_path(_x, _y, path) { if(!file_exists_empty(path)) return noone; var node = new Node_Json_File_Read(_x, _y, PANEL_GRAPH.getCurrentContext()); @@ -21,7 +21,7 @@ function Node_create_Json_File_Read_path(_x, _y, path) { #region node.doUpdate(); return node; -} #endregion +} function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "JSON File In"; @@ -48,24 +48,24 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons first_update = false; - on_drop_file = function(path) { #region + on_drop_file = function(path) { if(updatePaths(path)) { doUpdate(); return true; } return false; - } #endregion + } insp1UpdateTooltip = __txt("Refresh"); insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ]; - static onInspector1Update = function() { #region + static onInspector1Update = function() { updatePaths(path_get(getInputData(0))); triggerRender(); - } #endregion + } - function updatePaths(path) { #region + function updatePaths(path) { if(path == -1) return false; var ext = string_lower(filename_ext(path)); @@ -83,9 +83,9 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons edit_time = max(edit_time, file_get_modify_s(path_current)); return true; - } #endregion + } - static step = function() { #region + static step = function() { if(attributes.file_checker && file_exists_empty(path_current)) { var _modi = file_get_modify_s(path_current); @@ -95,20 +95,27 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons run_in(2, function() { updatePaths(); triggerRender(); }); } } - } #endregion + } - static update = function(frame = CURRENT_FRAME) { #region + static update = function(frame = CURRENT_FRAME) { var path = path_get(getInputData(0)); if(path_current != path) updatePaths(path); outputs[| 1].setValue(content); - } #endregion + } - static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text); var str = filename_name(path_current); var bbox = drawGetBbox(xx, yy, _s); var ss = string_scale(str, bbox.w, bbox.h); draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); - } #endregion + } + + static dropPath = function(path) { + if(is_array(path)) path = array_safe_get(path, 0); + if(!file_exists_empty(path)) return; + + inputs[| 0].setValue(path); + } } \ No newline at end of file diff --git a/scripts/node_svg/node_svg.gml b/scripts/node_svg/node_svg.gml index 82944db96..df30687ca 100644 --- a/scripts/node_svg/node_svg.gml +++ b/scripts/node_svg/node_svg.gml @@ -116,6 +116,9 @@ function Node_SVG(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { } static dropPath = function(path) { + if(is_array(path)) path = array_safe_get(path, 0); + if(!file_exists_empty(path)) return; + inputs[| 0].setValue(path); } } \ No newline at end of file diff --git a/scripts/node_text_file_read/node_text_file_read.gml b/scripts/node_text_file_read/node_text_file_read.gml index 5014917d2..cb6c9c998 100644 --- a/scripts/node_text_file_read/node_text_file_read.gml +++ b/scripts/node_text_file_read/node_text_file_read.gml @@ -1,4 +1,4 @@ -function Node_create_Text_File_Read(_x, _y, _group = noone) { #region +function Node_create_Text_File_Read(_x, _y, _group = noone) { var path = ""; if(NODE_NEW_MANUAL) { path = get_open_filename_pxc("text file|*.txt", ""); @@ -11,9 +11,9 @@ function Node_create_Text_File_Read(_x, _y, _group = noone) { #region node.doUpdate(); return node; -} #endregion +} -function Node_create_Text_File_Read_path(_x, _y, path) { #region +function Node_create_Text_File_Read_path(_x, _y, path) { if(!file_exists_empty(path)) return noone; var node = new Node_Text_File_Read(_x, _y, PANEL_GRAPH.getCurrentContext()); @@ -21,7 +21,7 @@ function Node_create_Text_File_Read_path(_x, _y, path) { #region node.doUpdate(); return node; -} #endregion +} function Node_Text_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "Text File In"; @@ -47,24 +47,24 @@ function Node_Text_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons first_update = false; - on_drop_file = function(path) { #region + on_drop_file = function(path) { if(updatePaths(path)) { doUpdate(); return true; } return false; - } #endregion + } insp1UpdateTooltip = __txt("Refresh"); insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ]; - static onInspector1Update = function() { #region + static onInspector1Update = function() { updatePaths(path_get(getInputData(0))); triggerRender(); - } #endregion + } - function updatePaths(path = path_current) { #region + function updatePaths(path = path_current) { if(path == -1) return false; var ext = string_lower(filename_ext(path)); @@ -80,9 +80,9 @@ function Node_Text_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons edit_time = max(edit_time, file_get_modify_s(path_current)); return true; - } #endregion + } - static step = function() { #region + static step = function() { if(attributes.file_checker && file_exists_empty(path_current)) { var _modi = file_get_modify_s(path_current); @@ -92,21 +92,28 @@ function Node_Text_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons run_in(2, function() { updatePaths(); triggerRender(); }); } } - } #endregion + } - static update = function(frame = CURRENT_FRAME) { #region + static update = function(frame = CURRENT_FRAME) { var path = path_get(getInputData(0)); if(path_current != path) updatePaths(path); outputs[| 0].setValue(content); - } #endregion + } - static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { var bbox = drawGetBbox(xx, yy, _s); var str = filename_name(path_current); draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text); var ss = string_scale(str, bbox.w, bbox.h); draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); - } #endregion + } + + static dropPath = function(path) { + if(is_array(path)) path = array_safe_get(path, 0); + if(!file_exists_empty(path)) return; + + inputs[| 0].setValue(path); + } } \ No newline at end of file diff --git a/scripts/node_wav_file_read/node_wav_file_read.gml b/scripts/node_wav_file_read/node_wav_file_read.gml index 014fdc2ff..20ebcd8e4 100644 --- a/scripts/node_wav_file_read/node_wav_file_read.gml +++ b/scripts/node_wav_file_read/node_wav_file_read.gml @@ -1,4 +1,4 @@ -function Node_create_WAV_File_Read(_x, _y, _group = noone) { #region +function Node_create_WAV_File_Read(_x, _y, _group = noone) { var path = ""; if(NODE_NEW_MANUAL) { path = get_open_filename_pxc("audio|*.wav", ""); @@ -11,9 +11,9 @@ function Node_create_WAV_File_Read(_x, _y, _group = noone) { #region if(NODE_NEW_MANUAL) node.doUpdate(); return node; -} #endregion +} -function Node_create_WAV_File_Read_path(_x, _y, path) { #region +function Node_create_WAV_File_Read_path(_x, _y, path) { if(!file_exists_empty(path)) return noone; var node = new Node_WAV_File_Read(_x, _y, PANEL_GRAPH.getCurrentContext()); @@ -21,7 +21,7 @@ function Node_create_WAV_File_Read_path(_x, _y, path) { #region node.doUpdate(); return node; -} #endregion +} function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "WAV File In"; @@ -89,16 +89,16 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const })]); #endregion - on_drop_file = function(path) { #region + on_drop_file = function(path) { if(updatePaths(path)) { doUpdate(); return true; } return false; - } #endregion + } - function updatePaths(path) { #region + function updatePaths(path) { if(path == -1) return false; if(path_current == "") @@ -117,9 +117,9 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const content = file_read_wav(path); return true; - } #endregion + } - function readSoundComplete() { #region + function readSoundComplete() { outputs[| 0].setValue(content); outputs[| 2].setValue(content.sample); outputs[| 3].setValue(content.channels); @@ -140,7 +140,7 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const preview_audio = audio_create_buffer_sound(bufferId, buffer_s16, content.sample, 0, content.packet * 2, audio_mono); var surf = content.checkPreview(320, 128, true); - } #endregion + } #region ++++ inspector ++++ insp1UpdateTooltip = __txt("Refresh"); @@ -162,7 +162,7 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const } #endregion - static step = function() { #region + static step = function() { if(file_read_wav_step()) { print("Load audio complete"); readSoundComplete(); @@ -202,9 +202,9 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const run_in(2, function() { updatePaths(); triggerRender(); }); } } - } #endregion + } - static update = function(frame = CURRENT_FRAME) { #region + static update = function(frame = CURRENT_FRAME) { var path = path_get(getInputData(0)); var mono = getInputData(2); @@ -212,9 +212,9 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const if(!is_instanceof(content, audioObject)) return; content.mono = mono; - } #endregion + } - static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { if(content == noone) return; var bbox = drawGetBbox(xx, yy, _s); var surf = content.checkPreview(320, 128); @@ -248,9 +248,9 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text); var ss = string_scale(str, bbox.w, bbox.h); draw_text_transformed(bbox.xc, bbox.y1, str, ss, ss, 0); - } #endregion + } - static drawAnimationTimeline = function(_shf, _w, _h, _s) { #region + static drawAnimationTimeline = function(_shf, _w, _h, _s) { if(content == noone) return; draw_set_color(COLORS._main_icon_dark); draw_set_alpha(1); @@ -274,5 +274,12 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const } draw_set_alpha(1); - } #endregion + } + + static dropPath = function(path) { + if(is_array(path)) path = array_safe_get(path, 0); + if(!file_exists_empty(path)) return; + + inputs[| 0].setValue(path); + } } \ No newline at end of file diff --git a/scripts/node_xml_file_read/node_xml_file_read.gml b/scripts/node_xml_file_read/node_xml_file_read.gml index a203d1eb0..c4ff4f617 100644 --- a/scripts/node_xml_file_read/node_xml_file_read.gml +++ b/scripts/node_xml_file_read/node_xml_file_read.gml @@ -1,4 +1,4 @@ -function Node_create_XML_File_Read(_x, _y, _group = noone) { #region +function Node_create_XML_File_Read(_x, _y, _group = noone) { var path = ""; if(NODE_NEW_MANUAL) { path = get_open_filename_pxc("xml|*.xml", ""); @@ -11,9 +11,9 @@ function Node_create_XML_File_Read(_x, _y, _group = noone) { #region node.doUpdate(); return node; -} #endregion +} -function Node_create_XML_File_Read_path(_x, _y, path) { #region +function Node_create_XML_File_Read_path(_x, _y, path) { if(!file_exists_empty(path)) return noone; var node = new Node_XML_File_Read(_x, _y, PANEL_GRAPH.getCurrentContext()); @@ -21,7 +21,7 @@ function Node_create_XML_File_Read_path(_x, _y, path) { #region node.doUpdate(); return node; -} #endregion +} function Node_XML_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { name = "XML File In"; @@ -46,16 +46,16 @@ function Node_XML_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const array_push(attributeEditors, [ "File Watcher", function() { return attributes.file_checker; }, new checkBox(function() { attributes.file_checker = !attributes.file_checker; }) ]); - on_drop_file = function(path) { #region + on_drop_file = function(path) { if(updatePaths(path)) { doUpdate(); return true; } return false; - } #endregion + } - function updatePaths(path = path_current) { #region + function updatePaths(path = path_current) { path = path_get(path); if(path == -1) return false; @@ -74,17 +74,17 @@ function Node_XML_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const edit_time = max(edit_time, file_get_modify_s(path_current)); return true; - } #endregion + } insp1UpdateTooltip = __txt("Refresh"); insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ]; - static onInspector1Update = function() { #region + static onInspector1Update = function() { updatePaths(getInputData(0)); triggerRender(); - } #endregion + } - static step = function() { #region + static step = function() { if(attributes.file_checker && file_exists_empty(path_current)) { var _modi = file_get_modify_s(path_current); @@ -94,21 +94,28 @@ function Node_XML_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const run_in(2, function() { updatePaths(); triggerRender(); }); } } - } #endregion + } - static update = function(frame = CURRENT_FRAME) { #region + static update = function(frame = CURRENT_FRAME) { var path = getInputData(0); if(path_current != path) updatePaths(path); outputs[| 0].setValue(content); - } #endregion + } - static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { var bbox = drawGetBbox(xx, yy, _s); var str = filename_name(path_current); draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text); var ss = string_scale(str, bbox.w, bbox.h); draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0); - } #endregion + } + + static dropPath = function(path) { + if(is_array(path)) path = array_safe_get(path, 0); + if(!file_exists_empty(path)) return; + + inputs[| 0].setValue(path); + } } \ No newline at end of file diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index cb981ec3f..0f47064d1 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -2271,32 +2271,44 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { ////////////////////////////////// File drop ////////////////////////////////// if(pHOVER) { - if(DRAGGING) { // file dropping - draw_sprite_stretched_ext(THEME.ui_panel_selection, 0, 8, 8, w - 16, h - 16, COLORS._main_value_positive, 1); - - if(node_hovering && node_hovering.droppable(DRAGGING)) { - node_hovering.draw_droppable = true; - if(mouse_release(mb_left)) - node_hovering.onDrop(DRAGGING); - } else { - if(mouse_release(mb_left)) - checkDropItem(); - } - } + var gr_x = graph_x * graph_s; + var gr_y = graph_y * graph_s; + var _gx = mx / graph_s - graph_x; + var _gy = my / graph_s - graph_y; + var _node_hover = noone; var _mx = (FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx) - x; var _my = (FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my) - y; - - var _gx = _mx / graph_s - graph_x; - var _gy = _my / graph_s - graph_y; - if(FILE_IS_DROPPING) + for(var i = 0; i < array_length(nodes_list); i++) { + var _n = nodes_list[i]; + if(is_instanceof(_n, Node_Frame)) continue; + + if(_n.pointIn(gr_x, gr_y, _mx, _my, graph_s)) + _node_hover = _n; + } + + if(DRAGGING || FILE_IS_DROPPING) draw_sprite_stretched_ext(THEME.ui_panel_selection, 0, 8, 8, w - 16, h - 16, COLORS._main_value_positive, 1); + + if(DRAGGING) { // file dropping + if(_node_hover && _node_hover.droppable(DRAGGING)) { + _node_hover.draw_droppable = true; + if(mouse_release(mb_left)) _node_hover.onDrop(DRAGGING); + + } else { + if(mouse_release(mb_left)) checkDropItem(); + } + } + + if(FILE_IS_DROPPING && _node_hover && _node_hover.dropPath != noone) + _node_hover.draw_droppable = true; if(FILE_DROPPED && !array_empty(FILE_DROPPING)) { - _gx = mx / graph_s - graph_x; - _gy = my / graph_s - graph_y; - run_in(1, load_file_path, [ FILE_DROPPING, _gx, _gy ]); + if(_node_hover && _node_hover.dropPath != noone) + _node_hover.dropPath(FILE_DROPPING); + else + run_in(1, load_file_path, [ FILE_DROPPING, _gx, _gy ]); } } diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index b4e1cb458..7aaf367ba 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -637,7 +637,9 @@ function Panel_Inspector() : PanelContent() constructor { var yy = hh + _y; if(i < amoIn) { // inputs - jun = _inspecting.input_display_list == -1? jun = _inspecting.inputs[| i] : _inspecting.inputs[| _inspecting.input_display_list[i]]; + if(_inspecting.input_display_list == -1) jun = _inspecting.inputs[| i]; + else if(is_real(_inspecting.input_display_list[i])) jun = _inspecting.inputs[| _inspecting.input_display_list[i]]; + else jun = _inspecting.input_display_list[i]; } else if(i == amoIn) { // output label hh += ui(8 + 32 + 8); @@ -648,11 +650,15 @@ function Panel_Inspector() : PanelContent() constructor { continue; } else { // outputs - var outInd = i - amoIn - 1; - jun = _inspecting.output_display_list == -1? _inspecting.outputs[| outInd] : _inspecting.outputs[| _inspecting.output_display_list[outInd]]; + var _oi = i - amoIn - 1; + + if(_inspecting.output_display_list == -1) jun = _inspecting.outputs[| _oi]; + else if(is_real(_inspecting.output_display_list[i])) jun = _inspecting.outputs[| _inspecting.output_display_list[_oi]]; + else jun = _inspecting.output_display_list[_oi]; } #region draw custom displayer + if(is_instanceof(jun, Inspector_Spacer)) { // SPACER var _hh = ui(jun.h); var _yy = yy + _hh / 2 - ui(2); @@ -685,6 +691,14 @@ function Panel_Inspector() : PanelContent() constructor { hh += _sh + ui(8); continue; + } else if(is_instanceof(jun, Inspector_Custom_Renderer)) { + jun.register(contentPane); + jun.rx = ui(16) + x; + jun.ry = top_bar_h + y; + + var _wdh = jun.draw(ui(6), yy, con_w - ui(12), _m, _hover, pFOCUS) + ui(8); + if(!is_undefined(_wdh)) hh += _wdh; + continue; } else if(is_array(jun)) { // LABEL var pad = i && _colsp == false? ui(4) : 0 _colsp = false; @@ -757,19 +771,11 @@ function Panel_Inspector() : PanelContent() constructor { continue; - } else if(is_struct(jun) && is_instanceof(jun, Inspector_Custom_Renderer)) { - jun.register(contentPane); - jun.rx = ui(16) + x; - jun.ry = top_bar_h + y; - - var _wdh = jun.draw(ui(6), yy, con_w - ui(12), _m, _hover, pFOCUS) + ui(8); - if(!is_undefined(_wdh)) hh += _wdh; - continue; } + #endregion - if(!is_struct(jun)) continue; - if(instanceof(jun) != "NodeValue") continue; + if(!is_instanceof(jun, NodeValue)) continue; if(!jun.show_in_inspector || jun.type == VALUE_TYPE.object) continue; if(filter_text != "") {