diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index eef8db41e..494c0ab44 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -1879,6 +1879,7 @@ {"name":"s_gizmo","order":3,"path":"sprites/s_gizmo/s_gizmo.yy",}, {"name":"s_gmlayer","order":2,"path":"sprites/s_gmlayer/s_gmlayer.yy",}, {"name":"s_gmroom","order":1,"path":"sprites/s_gmroom/s_gmroom.yy",}, + {"name":"s_icon_16_white","order":4,"path":"sprites/s_icon_16_white/s_icon_16_white.yy",}, {"name":"s_icon_256","order":1,"path":"sprites/s_icon_256/s_icon_256.yy",}, {"name":"s_icon_32","order":2,"path":"sprites/s_icon_32/s_icon_32.yy",}, {"name":"s_icon_64","order":3,"path":"sprites/s_icon_64/s_icon_64.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 133a4ef77..37b621926 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -3205,6 +3205,7 @@ {"id":{"name":"s_gizmo","path":"sprites/s_gizmo/s_gizmo.yy",},}, {"id":{"name":"s_gmlayer","path":"sprites/s_gmlayer/s_gmlayer.yy",},}, {"id":{"name":"s_gmroom","path":"sprites/s_gmroom/s_gmroom.yy",},}, + {"id":{"name":"s_icon_16_white","path":"sprites/s_icon_16_white/s_icon_16_white.yy",},}, {"id":{"name":"s_icon_24","path":"sprites/s_icon_24/s_icon_24.yy",},}, {"id":{"name":"s_icon_256","path":"sprites/s_icon_256/s_icon_256.yy",},}, {"id":{"name":"s_icon_32","path":"sprites/s_icon_32/s_icon_32.yy",},}, diff --git a/datafiles/data/Nodes/Internal.zip b/datafiles/data/Nodes/Internal.zip index 7d60f12e2..c317b6d7d 100644 Binary files a/datafiles/data/Nodes/Internal.zip and b/datafiles/data/Nodes/Internal.zip differ diff --git a/datafiles/data/Nodes/Internal/Values/Vector/Node_Vector2/info.json b/datafiles/data/Nodes/Internal/Values/Vector/Node_Vector2/info.json index 0199cd3fe..ee461aaff 100644 --- a/datafiles/data/Nodes/Internal/Values/Vector/Node_Vector2/info.json +++ b/datafiles/data/Nodes/Internal/Values/Vector/Node_Vector2/info.json @@ -1,5 +1,5 @@ { - "tooltip":"Genearte vector composite of 2 members.", + "tooltip":"Generate vector composite of 2 members.", "spr":"s_node_vector2", "baseNode":"Node_Vector2", "io":[ diff --git a/datafiles/data/Nodes/Internal/Values/Vector/Node_Vector3/info.json b/datafiles/data/Nodes/Internal/Values/Vector/Node_Vector3/info.json index dd90d2cd0..61e9df121 100644 --- a/datafiles/data/Nodes/Internal/Values/Vector/Node_Vector3/info.json +++ b/datafiles/data/Nodes/Internal/Values/Vector/Node_Vector3/info.json @@ -1,5 +1,5 @@ { - "tooltip":"Genearte vector composite of 3 members.", + "tooltip":"Generate vector composite of 3 members.", "spr":"s_node_vector3", "baseNode":"Node_Vector3", "io":[ diff --git a/datafiles/data/Nodes/Internal/Values/Vector/Node_Vector4/info.json b/datafiles/data/Nodes/Internal/Values/Vector/Node_Vector4/info.json index 19ccfcd20..bf25e768f 100644 --- a/datafiles/data/Nodes/Internal/Values/Vector/Node_Vector4/info.json +++ b/datafiles/data/Nodes/Internal/Values/Vector/Node_Vector4/info.json @@ -1,5 +1,5 @@ { - "tooltip":"Genearte vector composite of 4 members.", + "tooltip":"Generate vector composite of 4 members.", "spr":"s_node_vector4", "baseNode":"Node_Vector4", "io":[ diff --git a/datafiles/data/Theme.zip b/datafiles/data/Theme.zip index a55392497..ba703c3f2 100644 Binary files a/datafiles/data/Theme.zip and b/datafiles/data/Theme.zip differ diff --git a/objects/o_dialog_menubox/Create_0.gml b/objects/o_dialog_menubox/Create_0.gml index 4ac06ccb8..4b174aaf1 100644 --- a/objects/o_dialog_menubox/Create_0.gml +++ b/objects/o_dialog_menubox/Create_0.gml @@ -7,33 +7,33 @@ event_inherited(); mouse_init_inside = false; mouse_init_r_pressed = mouse_click(mb_right); selecting = -1; + parentPanel = noone; + context = noone; - parentPanel = noone; - menu_id = ""; - alarm[0] = -1; - menu = 1; - font = f_p2; - hght = line_get_height(font, 10); - tooltips = []; - show_icon = false; - context = noone; - submenu = noone; - submenuIt = noone; + menu_id = ""; + menu = 1; + tooltips = []; + show_icon = false; + font = f_p2; + hght = line_get_height(font, 10); - _hovering_ch = true; + submenu = noone; + submenuIt = noone; + + _hovering_ch = true; init_press_l = MOUSE_POOL.lpress; + alarm[0] = -1; setFocus(self.id); - #endregion #region menu item_sel_submenu = noone; - remove_parents = true; - selecting_menu = noone; - hk_editing = noone; + remove_parents = true; + selecting_menu = noone; + hk_editing = noone; - function setMenu(_menu, align = fa_left) { + function setMenu(_menu, _align = fa_left) { with(_p_dialog) { if(on_top) continue; other.depth = min(depth - 1, other.depth); } title = menu_id; @@ -50,7 +50,7 @@ event_inherited(); tooltips = []; draw_set_text(font, fa_center, fa_center, COLORS._main_text); - for(var i = 0; i < array_length(menu); i++) { + for( var i = 0, n = array_length(menu); i < n; i++ ) { var _menuItem = menu[i]; if(_menuItem == -1) { @@ -67,7 +67,7 @@ event_inherited(); draw_set_font(font); var ww = string_width(_menuItem.name) + ui(64); - var _key = _menuItem.hotkey != noone? find_hotkey(_menuItem.hotkey[0], _menuItem.hotkey[1]) : noone; + var _key = _menuItem.hoykeyObject; draw_set_font(font); var _kw = _key? string_width(key_get_name(_key.key, _key.modi)) + ui(16) : 0; @@ -95,7 +95,7 @@ event_inherited(); dialog_y = min(dialog_y, _maxh - dialog_h - 2); - switch(align) { + switch(_align) { case fa_left: dialog_x = round(min(dialog_x, _maxw - dialog_w - 2)); break; case fa_center: dialog_x = round(min(dialog_x - dialog_w / 2, _maxw - dialog_w - 2)); break; case fa_right: dialog_x = round(max(dialog_x - dialog_w, 2)); break; @@ -121,11 +121,6 @@ event_inherited(); dialog_y = 0; } } -#endregion - -#region focus - function getContextPanel() { - if(is(context, PanelContent)) return context.panel; - return context; - } + + function getContextPanel() { return is(context, PanelContent)? context.panel : context; } #endregion \ No newline at end of file diff --git a/objects/o_dialog_menubox/Draw_64.gml b/objects/o_dialog_menubox/Draw_64.gml index 8bfc283a4..8a899c6b7 100644 --- a/objects/o_dialog_menubox/Draw_64.gml +++ b/objects/o_dialog_menubox/Draw_64.gml @@ -14,10 +14,9 @@ DIALOG_WINCLEAR1 item_sel_submenu = noone; } - var to_del = noone; - draw_sprite_stretched(THEME.box_r2_clr, 0, dialog_x, dialog_y, dialog_w, dialog_h); + var to_del = noone; for( var i = 0, n = array_length(menu); i < n; i++ ) { var _menuItem = menu[i]; @@ -29,7 +28,7 @@ DIALOG_WINCLEAR1 continue; } - if(is_instanceof(_menuItem, MenuItem) && _menuItem.shiftMenu != noone && key_mod_press(SHIFT)) + if(is(_menuItem, MenuItem) && _menuItem.shiftMenu != noone && key_mod_press(SHIFT)) _menuItem = _menuItem.shiftMenu; if(_menuItem == -1) { @@ -43,10 +42,14 @@ DIALOG_WINCLEAR1 } var label = _menuItem.name; - var _h = is_instanceof(_menuItem, MenuItemGroup)? hght * 2 : hght; + var _h = is(_menuItem, MenuItemGroup)? hght * 2 : hght; var cc = struct_try_get(_menuItem, "color", c_white); - var _key = _menuItem.hotkey != noone? find_hotkey(_menuItem.hotkey[0], _menuItem.hotkey[1]) : noone; - _menuItem.hoykeyObject = _key; + var _key = _menuItem.hoykeyObject; + + if(_key == noone && _menuItem.hotkey != noone) { + _key = find_hotkey(_menuItem.hotkey[0], _menuItem.hotkey[1]); + _menuItem.hoykeyObject = _key; + } //print($"{i}: {sHOVER} && {point_in_rectangle(mouse_mx, mouse_my, dialog_x, yy + 1, dialog_x + dialog_w, yy + _h - 1)}") if(sHOVER && point_in_rectangle(mouse_mx, mouse_my, dialog_x, yy + 1, dialog_x + dialog_w, yy + _h - 1)) { @@ -56,16 +59,11 @@ DIALOG_WINCLEAR1 } if(selecting == i) { - var _hc = cc == c_white? COLORS.dialog_menubox_highlight : cc; - var _ha = cc == c_white? 0.75 : 0.8; + if(_menuItem.active && cc == c_white) cc = COLORS.dialog_menubox_highlight; - if(_menuItem.active) - draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, _hc); - - if(_hovering_ch && is_instanceof(_menuItem, MenuItem)) { - if(_menuItem.active && _lclick) { + if(_hovering_ch) { + if(is(_menuItem, MenuItem) && _menuItem.active && _lclick) { var _par = _menuItem.params; - var _p = _par != noone; if(_menuItem.isShelf) { FOCUS_CONTENT = context; @@ -77,6 +75,7 @@ DIALOG_WINCLEAR1 if(submenuIt == _menuItem) { submenuIt = noone; + } else { var _dat = { _x: dialog_x, @@ -97,16 +96,14 @@ DIALOG_WINCLEAR1 } else { FOCUS_CONTENT = context; - if(_p) _menuItem.func(_par); - else _menuItem.func(); + if(_par != noone) _menuItem.func(_par); + else _menuItem.func(); to_del = remove_parents? o_dialog_menubox : self; } } - } - - if(_hovering_ch && (is_instanceof(_menuItem, MenuItem) || is_instanceof(_menuItem, MenuItemGroup))) { - if(_key && _rclick) { + + if((is(_menuItem, MenuItem) || is(_menuItem, MenuItemGroup)) && (_key && _rclick)) { var _dat = { _x: mouse_mx + ui(4), x: mouse_mx + ui(4), @@ -128,16 +125,17 @@ DIALOG_WINCLEAR1 item_sel_submenu = submenuCall(_dat, context_menu_settings); item_sel_submenu.remove_parents = false; + } } - - } else if(cc != c_white) - draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, cc); + } + + if(cc != c_white) draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, cc); var _hx = dialog_x + dialog_w - ui(16); var _hy = yy + hght / 2 + ui(2); - if(is_instanceof(_menuItem, MenuItemGroup)) { + if(is(_menuItem, MenuItemGroup)) { var _submenus = _menuItem.group; draw_set_text(font, fa_center, fa_center, COLORS._main_text_sub); draw_set_alpha(_menuItem.active * 0.75 + 0.25); @@ -282,8 +280,11 @@ DIALOG_WINCLEAR1 draw_sprite_stretched(THEME.box_r2_clr, 1, dialog_x, dialog_y, dialog_w, dialog_h); - if(mouse_init_inside && (mouse_release(mb_left) || mouse_release(mb_right))) mouse_init_inside = false; - if(mouse_release(mb_right)) mouse_init_r_pressed = false; + if(mouse_init_inside && (mouse_release(mb_left) || mouse_release(mb_right))) + mouse_init_inside = false; + + if(mouse_release(mb_right)) + mouse_init_r_pressed = false; #endregion #region debug diff --git a/scripts/function_register/function_register.gml b/scripts/function_register/function_register.gml index 56083e638..c3989b445 100644 --- a/scripts/function_register/function_register.gml +++ b/scripts/function_register/function_register.gml @@ -66,13 +66,11 @@ function functionObject(_context, _name, _key, _mod, _action, _param = noone) co FUNCTIONS[$ fnName] = self; CMD_FUNCTIONS[$ fnName] = { action: _action, args: [] }; - static setArg = function(_args = []) { - CMD_FUNCTIONS[$ fnName] = { action, args: _args }; - return self; - } + static setArg = function(_args = []) { CMD_FUNCTIONS[$ fnName] = { action, args: _args }; return self; } static setMenuAlt = function(_name, _id, _spr = noone, shelf = false) { menu = menuItem(__txt(_name), action, _spr, [ context, name ]); + menu.hoykeyObject = hotkey; if(shelf) menu.setIsShelf(); MENU_ITEMS[$ _id] = menu; @@ -81,16 +79,14 @@ function functionObject(_context, _name, _key, _mod, _action, _param = noone) co static setMenu = function(_id, _spr = noone, shelf = false) { menu = menuItem(__txt(name), action, _spr, [ context, name ]); + menu.hoykeyObject = hotkey; if(shelf) menu.setIsShelf(); MENU_ITEMS[$ _id] = menu; return self; } - static hidePalette = function() { - hide = true; - return self; - } + static hidePalette = function() { hide = true; return self; } } function callStatusFunction(name) { diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 279af77a3..236c781bf 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -43,7 +43,7 @@ LATEST_VERSION = 1_18_00_0; VERSION = 1_18_07_2; SAVE_VERSION = 1_18_05_0; - VERSION_STRING = MAC? "1.18.003m" : "1.18.8.012"; + VERSION_STRING = MAC? "1.18.003m" : "1.18.8"; BUILD_NUMBER = 118072.011; PREF_VERSION = 1_17_1; diff --git a/scripts/hotkey_data/hotkey_data.gml b/scripts/hotkey_data/hotkey_data.gml index c5dddc432..d90f4bd4e 100644 --- a/scripts/hotkey_data/hotkey_data.gml +++ b/scripts/hotkey_data/hotkey_data.gml @@ -111,7 +111,7 @@ function hotkeyObject(_context, _name, _key, _mod = MOD_KEY.none, _action = noon dKey = _key; dModi = _mod; - static full_name = function() /*=>*/ {return string_to_var(context == ""? $"global.{name}" : $"{context}.{name}")}; + static full_name = function() /*=>*/ {return string_to_var(context == 0? $"global.{name}" : $"{context}.{name}")}; static get_key_name = function() /*=>*/ {return key_get_name(key, modi)}; static serialize = function( ) /*=>*/ { return { context, name, key, modi } } diff --git a/scripts/node_3d_camera/node_3d_camera.gml b/scripts/node_3d_camera/node_3d_camera.gml index 7ad039947..7a3b4b83e 100644 --- a/scripts/node_3d_camera/node_3d_camera.gml +++ b/scripts/node_3d_camera/node_3d_camera.gml @@ -408,11 +408,12 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group) BLEND_MULTIPLY draw_surface_safe(deferData.ssao); BLEND_NORMAL + + _outData[4] = deferData.ssao; } surface_reset_target(); surface_free(_render); - _outData[4] = deferData.ssao; #endregion surface_depth_disable(true); diff --git a/scripts/node_composite/node_composite.gml b/scripts/node_composite/node_composite.gml index 4548bc6e9..55c4d8630 100644 --- a/scripts/node_composite/node_composite.gml +++ b/scripts/node_composite/node_composite.gml @@ -777,6 +777,8 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) } static processData = function(_outData, _data, _output_index, _array_index) { + draw_transforms[_array_index] = noone; + var _outSurf = _outData[0]; if(getInputAmount() == 0) return _outData; @@ -787,7 +789,6 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var cDep = attrDepth(); if(!is_surface(base)) return _outData; - draw_transforms[_array_index] = noone; #region dimension var ww = 0, hh = 0; diff --git a/scripts/node_composite_tag/node_composite_tag.gml b/scripts/node_composite_tag/node_composite_tag.gml index 376b6ece3..2d95ab3ee 100644 --- a/scripts/node_composite_tag/node_composite_tag.gml +++ b/scripts/node_composite_tag/node_composite_tag.gml @@ -22,7 +22,22 @@ function Node_Composite_Tag(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr setDynamicInput(1, true, VALUE_TYPE.dynaSurface); + draw_transforms = []; + static drawOverlayTransform = function(_node) { + var _df = array_safe_get(draw_transforms, preview_index, noone); + if(_df == noone) return noone; + + var _amo = getInputAmount(); + for( var i = 0; i < _amo; i++ ) { + if(_node == inputs[input_fix_len + i].getNodeFrom()) + return _df[i]; + } + + return noone; + } + static processData = function(_outSurf, _data, _output_index, _array_index = 0) { + draw_transforms[_array_index] = noone; var _amo = getInputAmount(); var _dim = _data[0]; @@ -78,7 +93,8 @@ function Node_Composite_Tag(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr var _cx = _dim[0] / 2 - (minx + maxx) / 2; var _cy = _dim[1] / 2 - (miny + maxy) / 2; - _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); + _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); + var _trans = array_create(_amo, noone); surface_set_shader(_outSurf); for( var i = 0; i < _amo; i++ ) { @@ -102,8 +118,11 @@ function Node_Composite_Tag(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr _oy /= _tagArrAmo; draw_surface(_surface, _cx - _ox, _cy - _oy); + _trans[i] = [ _cx - _ox, _cy - _oy, 1, 1, 0 ]; } surface_reset_shader(); + + draw_transforms[_array_index] = _trans; return _outSurf; } diff --git a/scripts/node_crop/node_crop.gml b/scripts/node_crop/node_crop.gml index 746602f29..ddc15543b 100644 --- a/scripts/node_crop/node_crop.gml +++ b/scripts/node_crop/node_crop.gml @@ -329,6 +329,9 @@ function Node_Crop(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons } + // draw_transforms = []; + // static drawOverlayTransform = function(_node) { return array_safe_get(draw_transforms, preview_index, noone); } + static onValueUpdate = function(index) { if(index != 3) return; @@ -361,6 +364,7 @@ function Node_Crop(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons surface_set_shader(_outSurf, noone); draw_surface_safe(_inSurf, -_crop[2], -_crop[1]); + draw_transforms[_array_index] = [-_crop[2], -_crop[1], 1, 1, 0]; surface_reset_shader(); } else if(_fit == 0) { @@ -374,6 +378,7 @@ function Node_Crop(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons surface_set_shader(_outSurf, noone); draw_surface_safe(_inSurf, -_x0, -_y0); + draw_transforms[_array_index] = [-_x0, -_y0, 1, 1, 0]; surface_reset_shader(); } else { @@ -400,6 +405,7 @@ function Node_Crop(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons surface_set_shader(_outSurf, noone); draw_surface_safe(_inSurf, -_x0, -_y0); + draw_transforms[_array_index] = [-_x0, -_y0, 1, 1, 0]; surface_reset_shader(); } diff --git a/scripts/node_crop_content/node_crop_content.gml b/scripts/node_crop_content/node_crop_content.gml index 0d411834c..b8c013a60 100644 --- a/scripts/node_crop_content/node_crop_content.gml +++ b/scripts/node_crop_content/node_crop_content.gml @@ -33,6 +33,9 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr temp_surface = [ 0, 0 ]; + draw_transforms = []; + static drawOverlayTransform = function(_node) { return array_safe_get(draw_transforms, preview_index, noone); } + static update = function() { var _inSurf = getInputData(0); var _active = getInputData(1); @@ -58,10 +61,10 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(!_arr) _inSurf = [ _inSurf ]; var _amo = array_length(_inSurf); - var minx = array_create(_amo); - var miny = array_create(_amo); - var maxx = array_create(_amo); - var maxy = array_create(_amo); + var minx = array_create(_amo, infinity); + var miny = array_create(_amo, infinity); + var maxx = array_create(_amo, -infinity); + var maxy = array_create(_amo, -infinity); var cDep = attrDepth(); for( var j = 0; j < _amo; j++ ) { @@ -101,9 +104,10 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(_array) { minx[j] = _minx; miny[j] = _miny; - + maxx[j] = _maxx; maxy[j] = _maxy; + } else { minx[0] = min(minx[0], _minx); miny[0] = min(miny[0], _miny); @@ -113,11 +117,13 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr } } + print(minx, miny); + var res = []; var crop = []; var atlas = []; - for( var i = 0, n = _amo; i < n; i++ ) { + for( var i = 0; i < _amo; i++ ) { var _surf = _inSurf[i]; var _ind = _array == 0? 0 : i; @@ -128,11 +134,15 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr res[i] = surface_create_valid(resDim[DIMENSION.width], resDim[DIMENSION.height], cDep); crop[i] = [ surface_get_width_safe(_surf) - maxx[_ind] - 1, miny[_ind], minx[_ind], surface_get_height_safe(_surf) - maxy[_ind] - 1 ]; + var _sx = -minx[_ind] + _padd[PADDING.left]; + var _sy = -miny[_ind] + _padd[PADDING.top]; + surface_set_shader(res[i], noone); - draw_surface_safe(_surf, -minx[_ind] + _padd[PADDING.left], -miny[_ind] + _padd[PADDING.top]); + draw_surface_safe(_surf, _sx, _sy); surface_reset_shader(); atlas[i] = new SurfaceAtlas(res[i], minx[_ind], miny[_ind]); + draw_transforms[i] = [_sx, _sy, 1, 1, 0]; } if(!_arr) { diff --git a/scripts/node_delay_value/node_delay_value.gml b/scripts/node_delay_value/node_delay_value.gml index 8b68236ba..5cc9c0b28 100644 --- a/scripts/node_delay_value/node_delay_value.gml +++ b/scripts/node_delay_value/node_delay_value.gml @@ -7,7 +7,7 @@ function Node_Delay_Value(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Delay Value"; is_simulation = true; - setDimension(96, 32 + 24); + setDimension(96, 48); newInput(0, nodeValue("Value", self, CONNECT_TYPE.input, VALUE_TYPE.any, noone)) .setVisible(true, true); diff --git a/scripts/node_fn_wave_table/node_fn_wave_table.gml b/scripts/node_fn_wave_table/node_fn_wave_table.gml index 13be26c07..8780ce6f8 100644 --- a/scripts/node_fn_wave_table/node_fn_wave_table.gml +++ b/scripts/node_fn_wave_table/node_fn_wave_table.gml @@ -26,10 +26,10 @@ function Node_Fn_WaveTable(_x, _y, _group = noone) : Node_Fn(_x, _y, _group) con wavetable_selecting = noone; wavetable_menu = [ - new MenuItem("Sine", function() /*=>*/ { wavetable_apply(WAVETABLE_FN.sine); }, [ s_inspector_wavetable, 0 ]), - new MenuItem("Square", function() /*=>*/ { wavetable_apply(WAVETABLE_FN.square); }, [ s_inspector_wavetable, 1 ]), - new MenuItem("Triangle", function() /*=>*/ { wavetable_apply(WAVETABLE_FN.tri); }, [ s_inspector_wavetable, 2 ]), - new MenuItem("Sawtooth", function() /*=>*/ { wavetable_apply(WAVETABLE_FN.saw); }, [ s_inspector_wavetable, 3 ]), + new MenuItem("Sine", function() /*=>*/ {return wavetable_apply(WAVETABLE_FN.sine)} , [ s_inspector_wavetable, 0 ]), + new MenuItem("Square", function() /*=>*/ {return wavetable_apply(WAVETABLE_FN.square)} , [ s_inspector_wavetable, 1 ]), + new MenuItem("Triangle", function() /*=>*/ {return wavetable_apply(WAVETABLE_FN.tri)} , [ s_inspector_wavetable, 3 ]), + new MenuItem("Sawtooth", function() /*=>*/ {return wavetable_apply(WAVETABLE_FN.saw)} , [ s_inspector_wavetable, 2 ]), ]; wavetable_editor = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel = noone) { @@ -207,8 +207,8 @@ function Node_Fn_WaveTable(_x, _y, _group = noone) : Node_Fn(_x, _y, _group) con switch(attributes.wavetable[_ind]) { case WAVETABLE_FN.sine : return sin(_x * pi * 2); case WAVETABLE_FN.square : return (1 - floor(frac(_x) * 2)) * 2 - 1; - case WAVETABLE_FN.tri : return frac(_x + 0.5) * 2 - 1; - case WAVETABLE_FN.saw : return abs(frac(_x + .5) - .5) * 2 * 2 - 1; + case WAVETABLE_FN.tri : return abs(frac(_x + .5) - .5) * 2 * 2 - 1; + case WAVETABLE_FN.saw : return frac(_x + 0.5) * 2 - 1; } return 0; diff --git a/scripts/node_padding/node_padding.gml b/scripts/node_padding/node_padding.gml index 34978f4b7..934a89527 100644 --- a/scripts/node_padding/node_padding.gml +++ b/scripts/node_padding/node_padding.gml @@ -38,6 +38,9 @@ function Node_Padding(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c attribute_surface_depth(); + draw_transforms = []; + static drawOverlayTransform = function(_node) { return array_safe_get(draw_transforms, preview_index, noone); } + static step = function() { var mode = getInputData(5); @@ -85,6 +88,9 @@ function Node_Padding(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c BLEND_NORMAL surface_reset_target(); } + + draw_transforms[_array_index] = [ padding[2], padding[1], 1, 1, 0]; + } else if(mode == 1) { _outSurf = surface_verify(_outSurf, dim[0], dim[1], cDep); @@ -113,6 +119,8 @@ function Node_Padding(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c draw_surface_safe(surf, sx, sy); BLEND_NORMAL surface_reset_target(); + + draw_transforms[_array_index] = [ sx, sy, 1, 1, 0 ]; } return _outSurf; diff --git a/scripts/node_path_3d/node_path_3d.gml b/scripts/node_path_3d/node_path_3d.gml index 741f30252..9622092af 100644 --- a/scripts/node_path_3d/node_path_3d.gml +++ b/scripts/node_path_3d/node_path_3d.gml @@ -322,8 +322,8 @@ function Node_Path_3D(_x, _y, _group = noone) : Node(_x, _y, _group) constructor draw_line(_ax0, _ay0, xx, yy); draw_line(_ax1, _ay1, xx, yy); - draw_sprite_colored(THEME.anchor_selector, 2, _ax0, _ay0); - draw_sprite_colored(THEME.anchor_selector, 2, _ax1, _ay1); + draw_circle_ui(_ax0, _ay0, 4, 0, COLORS._main_accent); + draw_circle_ui(_ax1, _ay1, 4, 0, COLORS._main_accent); } draw_sprite_colored(THEME.anchor_selector, 0, xx, yy); @@ -339,12 +339,12 @@ function Node_Path_3D(_x, _y, _group = noone) : Node(_x, _y, _group) constructor hover_type = 0; } else if(cont && point_in_circle(_mx, _my, _ax0, _ay0, 8)) { - draw_sprite_colored(THEME.anchor_selector, 0, _ax0, _ay0); + draw_circle_ui(_ax0, _ay0, 6, 0, COLORS._main_accent); anchor_hover = i; hover_type = 1; } else if(cont && point_in_circle(_mx, _my, _ax1, _ay1, 8)) { - draw_sprite_colored(THEME.anchor_selector, 0, _ax1, _ay1); + draw_circle_ui(_ax1, _ay1, 6, 0, COLORS._main_accent); anchor_hover = i; hover_type = -1; } diff --git a/scripts/node_path_3d_camera/node_path_3d_camera.gml b/scripts/node_path_3d_camera/node_path_3d_camera.gml index 7e9b868e6..bfb36fa96 100644 --- a/scripts/node_path_3d_camera/node_path_3d_camera.gml +++ b/scripts/node_path_3d_camera/node_path_3d_camera.gml @@ -91,7 +91,7 @@ function Node_Path_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _g if(is_path) { var _nodeFrom = inputs[in_d3d + 2].value_from.node; if(struct_has(_nodeFrom, "drawOverlay3D")) - _nodeFrom.drawOverlay3D(false, params, _mx, _my, _snx, _sny, _panel); + _nodeFrom.drawOverlay3D(active, params, _mx, _my, _snx, _sny, _panel); } var preObj = getPreviewObjects(); diff --git a/scripts/node_scale/node_scale.gml b/scripts/node_scale/node_scale.gml index 0c07a0df1..4a70625d0 100644 --- a/scripts/node_scale/node_scale.gml +++ b/scripts/node_scale/node_scale.gml @@ -36,11 +36,13 @@ function Node_Scale(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con static step = function() { var _surf = getSingleValue(0); - var _atlas = is_instanceof(_surf, SurfaceAtlas); inputs[5].setVisible(_atlas); } + draw_transforms = []; + static drawOverlayTransform = function(_node) { return array_safe_get(draw_transforms, preview_index, noone); } + static processData = function(_outSurf, _data, _output_index, _array_index) { var surf = _data[0]; var scale = _data[1]; @@ -58,16 +60,19 @@ function Node_Scale(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con var _surf = isAtlas? _outSurf.getSurface() : _outSurf; var ww, hh, scx = 1, scy = 1; + var _sw = surface_get_width_safe(surf); + var _sh = surface_get_height_safe(surf); + switch(mode) { case 0 : scx = scale; scy = scale; - ww = scale * surface_get_width_safe(surf); - hh = scale * surface_get_height_safe(surf); + ww = scale * _sw; + hh = scale * _sh; break; case 1 : - scx = targ[0] / surface_get_width_safe(surf); - scy = targ[1] / surface_get_height_safe(surf); + scx = targ[0] / _sw; + scy = targ[1] / _sh; ww = targ[0]; hh = targ[1]; break; @@ -80,6 +85,8 @@ function Node_Scale(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con draw_surface_stretched_safe(_data[0], 0, 0, ww, hh); surface_reset_shader(); + draw_transforms[_array_index] = [ 0, 0, ww * _sw, hh * _sh, 0]; + if(isAtlas) { if(_atlS) { _outSurf.x = surf.x * scx; diff --git a/scripts/node_scale_algo/node_scale_algo.gml b/scripts/node_scale_algo/node_scale_algo.gml index e79c03bfc..30c8cfae8 100644 --- a/scripts/node_scale_algo/node_scale_algo.gml +++ b/scripts/node_scale_algo/node_scale_algo.gml @@ -48,6 +48,9 @@ function Node_Scale_Algo(_x, _y, _group = noone) : Node_Processor(_x, _y, _group attribute_surface_depth(); + draw_transforms = []; + static drawOverlayTransform = function(_node) { return array_safe_get(draw_transforms, preview_index, noone); } + static step = function() { var _surf = getSingleValue(0); var _type = getSingleValue(1); @@ -117,6 +120,8 @@ function Node_Scale_Algo(_x, _y, _group = noone) : Node_Processor(_x, _y, _group surface_reset_shader(); gpu_set_texfilter(false); + draw_transforms[_array_index] = [ 0, 0, sc, sc, 0 ]; + if(isAtlas) { if(_atlS) { _outSurf.x = _data[0].x * sc; diff --git a/scripts/panel_file_explorer/panel_file_explorer.gml b/scripts/panel_file_explorer/panel_file_explorer.gml index e036b1db9..ba23dd370 100644 --- a/scripts/panel_file_explorer/panel_file_explorer.gml +++ b/scripts/panel_file_explorer/panel_file_explorer.gml @@ -9,13 +9,7 @@ function ExpCreateFile(path) { INLINE if(struct_has(global.__temp_fileMap, path)) return global.__temp_fileMap[$ path]; - var f; - - if(directory_exists(path)) - f = new ExpDir(path); - else - f = new ExpFile(path); - + var f = directory_exists(path)? new ExpDir(path) : new ExpFile(path); global.__temp_fileMap[$ path] = f; return f; } @@ -32,10 +26,8 @@ function ExpFile(path) constructor { th_h = 1; static getThumbnail = function() { - if(thumbnail == -1) - return noone; - else if(thumbnail != noone && sprite_exists(thumbnail)) - return thumbnail; + if(thumbnail == -1) return noone; + else if(thumbnail != noone && sprite_exists(thumbnail)) return thumbnail; thumbnail = -1; switch(ext) { @@ -84,28 +76,28 @@ function ExpDir(path) : ExpFile(path) constructor { files = []; if(!directory_exists(path)) return; + var f = file_find_first(path + "/*", fa_directory), fp; - var f = file_find_first(path + "/*", fa_directory); while (f != "") { - var _fp = $"{path}/{f}"; - if(directory_exists(_fp)) { - var _fileObj = ExpCreateFile(_fp); - _fileObj.parent = self; - array_push(directories, _fileObj); - } - f = file_find_next(); + fp = $"{path}/{f}"; + f = file_find_next(); + if(!directory_exists(fp)) continue; + + var _fileObj = ExpCreateFile(fp); + _fileObj.parent = self; + array_push(directories, _fileObj); } file_find_close(); var f = file_find_first(path + "/*", fa_none); while (f != "") { - var _fp = $"{path}/{f}"; - if(file_exists(_fp) && !directory_exists(_fp)) { - var _fileObj = ExpCreateFile(_fp); - _fileObj.parent = self; - array_push(files, _fileObj); - } - f = file_find_next(); + fp = $"{path}/{f}"; + f = file_find_next(); + if(!file_exists(fp) || directory_exists(fp)) continue; + + var _fileObj = ExpCreateFile(fp); + _fileObj.parent = self; + array_push(files, _fileObj); } file_find_close(); @@ -141,9 +133,9 @@ function ExpRoot() constructor { } function Panel_File_Explorer() : PanelContent() constructor { - title = "File Explorer"; - w = ui(320); - h = ui(540); + title = "File Explorer"; + w = ui(320); + h = ui(540); auto_pin = true; fileMap = {}; @@ -151,8 +143,7 @@ function Panel_File_Explorer() : PanelContent() constructor { rootFile = noone; function setRoot(_root = "") { - if(rootFile) - rootFile.destroy(); + if(rootFile) rootFile.destroy(); if(_root != "" && directory_exists(_root)) { root = _root; @@ -177,59 +168,56 @@ function Panel_File_Explorer() : PanelContent() constructor { scroll_y_max = 0; item_height = ui(20); + grid_size = ui(64); cntPad = ui(4); padding = ui(8); top_bar = ui(44); - - grid_size = ui(64); - - tb_root = new textBox(TEXTBOX_INPUT.text, function(val) { setRoot(val); }); + tb_root = new textBox(TEXTBOX_INPUT.text, function(v) /*=>*/ {return setRoot(v)}); file_selectings = []; file_hovering = noone; context_hovering = noone; - file_dragging = false; - file_drag_mx = 0; - file_drag_my = 0; + file_dragging = false; + file_drag_mx = 0; + file_drag_my = 0; - draggable = true; - frame_dragging = false; - frame_drag_mx = false; - frame_drag_my = false; + draggable = true; + frame_dragging = false; + frame_drag_mx = false; + frame_drag_my = false; - path_dragging = -1; - file_focus = noone; + path_dragging = -1; + file_focus = noone; #region menu __menu_file_selecting = noone; __menu_cnxt_selecting = noone; menu_file_image = [ - menuItem("Add as node", function() { + menuItem("Add as node", function() /*=>*/ { var node = Node_create_Image_path(PANEL_GRAPH.graph_cx, PANEL_GRAPH.graph_cy, __menu_file_selecting.path); PANEL_PREVIEW.setNodePreview(node); PANEL_INSPECTOR.inspecting = node; }), - menuItem("Add as canvas", function() { + menuItem("Add as canvas", function() /*=>*/ { var node = nodeBuild("Node_Canvas", PANEL_GRAPH.graph_cx, PANEL_GRAPH.graph_cy).loadImagePath(__menu_file_selecting.path); PANEL_PREVIEW.setNodePreview(node); PANEL_INSPECTOR.inspecting = node; }), - menuItem("Copy path", function() { clipboard_set_text(__menu_file_selecting.path); }, THEME.copy), + menuItem("Copy path", function() /*=>*/ { clipboard_set_text(__menu_file_selecting.path); }, THEME.copy), ]; menu_file_project = [ - menuItem("Open", function() { LOAD_AT(__menu_file_selecting.path); }), - - menuItem("Copy path", function() { clipboard_set_text(__menu_file_selecting.path); }, THEME.copy), + menuItem("Open", function() /*=>*/ { LOAD_AT(__menu_file_selecting.path); }), + menuItem("Copy path", function() /*=>*/ { clipboard_set_text(__menu_file_selecting.path); }, THEME.copy), ]; menu_general = [ - menuItem("New Canvas", function() { + menuItem("New Canvas", function() /*=>*/ { var dia = dialogCall(o_dialog_file_name, mouse_mx + 8, mouse_my + 8); dia.onModify = function (txt) { var _s = surface_create(DEF_SURF_W, DEF_SURF_H); @@ -246,7 +234,7 @@ function Panel_File_Explorer() : PanelContent() constructor { dia.path = __menu_cnxt_selecting.path + "/"; }, THEME.new_file), - menuItem("New Folder", function() { + menuItem("New Folder", function() /*=>*/ { var dia = dialogCall(o_dialog_file_name, mouse_mx + 8, mouse_my + 8); dia.name = "New Folder"; dia.onModify = function (txt) { @@ -257,153 +245,12 @@ function Panel_File_Explorer() : PanelContent() constructor { }, THEME.folder), -1, - menuItem("Refresh", function() { if(rootFile) rootFile.getContent() }), + menuItem("Refresh", function() /*=>*/ { if(rootFile) rootFile.getContent() }), ]; #endregion function onFocusBegin() { PANEL_FILE = self; } - contentPane = new scrollPane(w - padding - padding - cntPad * 2, h - padding - top_bar - cntPad * 2, function(_y, _m, _r) { - draw_clear_alpha(COLORS.panel_bg_clear, 0); - - if(frame_dragging) file_selectings = []; - - file_hovering = noone; - context_hovering = noone; - draggable = true; - - contentPane.hover_content = true; - - var _h = drawDir(rootFile, 0, _y, contentPane.surface_w, _m); - - if(frame_dragging) draw_sprite_stretched_points_clamp(THEME.ui_selection, 0, frame_drag_mx, frame_drag_my, _m[0], _m[1], COLORS._main_accent); - if(context_hovering == noone) - context_hovering = rootFile; - - if(draggable && mouse_press(mb_left, pFOCUS)) { - if(file_hovering == noone) { - file_selectings = []; - frame_dragging = true; - frame_drag_mx = _m[0]; - frame_drag_my = _m[1]; - - } else { - if(key_mod_press(SHIFT)) { - if(!array_empty(file_selectings)) { - var _frm = file_selectings[array_length(file_selectings) - 1]; - var _to = file_hovering; - - if(is_instanceof(_frm, ExpFile) && is_instanceof(_to, ExpFile) && _frm.parent && _frm.parent == _to.parent) { - var _par = _frm.parent; - var _ifrm = array_find(_par.files, _frm); - var _ito = array_find(_par.files, _to); - - file_selectings = array_create(abs(_ifrm - _ito) + 1); - var _i = min(_ifrm, _ito); - var _j = max(_ifrm, _ito); - var _ind = 0; - - for(; _i <= _j; _i++) file_selectings[_ind++] = _par.files[_i]; - } - } - - } else if(!array_exists(file_selectings, file_hovering)) - file_selectings = [ file_hovering ]; - - path_dragging = -1; - file_dragging = true; - file_drag_mx = mouse_mx; - file_drag_my = mouse_my; - } - } - - if(mouse_release(mb_left)) frame_dragging = false; - - if(pFOCUS && mouse_press(mb_right)) { - __menu_cnxt_selecting = context_hovering; - - if(file_hovering == noone || is_instanceof(file_hovering, ExpDir)) - menuCall("", menu_general); - } - - if(file_dragging) { - if(path_dragging == -1 && point_distance(file_drag_mx, file_drag_my, mouse_mx, mouse_my) > 8) { - path_dragging = []; - - for (var i = 0, n = array_length(file_selectings); i < n; i++) - path_dragging[i] = file_selectings[i].path; - } - - if(path_dragging != -1 && !array_empty(path_dragging) && !pHOVER) { - if(HOVER && is_instanceof(HOVER, Panel)) { - var _cont = HOVER.getContent(); - if(is_instanceof(_cont, Panel_Preview) || is_instanceof(_cont, Panel_Graph)) - HOVER.draw_droppable = true; - } - } - - if(mouse_release(mb_left)) { - var _file_focus = file_focus; - file_focus = noone; - - if(path_dragging != -1 && !array_empty(path_dragging) && !pHOVER) { - var _dropped = false; - - if(HOVER && is_instanceof(HOVER, Panel)) { - var _cont = HOVER.getContent(); - - if(is_instanceof(_cont, Panel_Preview)) { - var _node = _cont.getNodePreview(); - - if(_node && _node.on_drop_file) { - _node.on_drop_file(path_dragging[0]); - _dropped = true; - } - } - - if(array_length(file_selectings) == 1) - file_focus = file_selectings[0]; - } - - if(!_dropped) - load_file_path(path_dragging); - } - - if(_file_focus != file_focus) - recordAction_variable_change(self, "file_focus", _file_focus); - - file_dragging = false; - path_dragging = -1; - - } else if(keyboard_check_pressed(vk_control)) { - __menu_file_selecting = file_selectings[0]; - - if(path_is_image(__menu_file_selecting.path)) - pieMenuCall("",,, menu_file_image); - - else if(path_is_project(__menu_file_selecting.path)) - pieMenuCall("",,, menu_file_project); - - file_dragging = false; - path_dragging = -1; - - } - } - - if(view_mode == FILE_EXPLORER_VIEW.grid && pHOVER && key_mod_press(CTRL)) { - if(mouse_wheel_down()) grid_size = clamp(grid_size - ui(8), ui(32), ui(128)); - if(mouse_wheel_up()) grid_size = clamp(grid_size + ui(8), ui(32), ui(128)); - } - - return _h; - - } ); - - function onResize() { #region - initSize(); - contentPane.resize(w - padding - padding - cntPad * 2, h - padding - top_bar - cntPad * 2); - } #endregion - function drawDir(dirObject, _x, _y, _w, _m) { var _h = 0; var _sy = _y; @@ -469,10 +316,7 @@ function Panel_File_Explorer() : PanelContent() constructor { } } - if(array_length(dirObject.files)) { - _h += ui(4); - _sy += ui(4); - } + if(array_length(dirObject.files)) { _h += ui(4); _sy += ui(4); } if(view_mode == FILE_EXPLORER_VIEW.list) { draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text); @@ -491,28 +335,22 @@ function Panel_File_Explorer() : PanelContent() constructor { array_push(file_selectings, _fil); var _sel = array_exists(file_selectings, _fil); - var _tx = _px + ui(2); var _ty = _py + ui(2); var _th = _fil.getThumbnail(); - draw_set_color(c_white); - gpu_set_colorwriteenable(1, 1, 1, 0); - draw_rectangle(_px, _py, _px + _tw, _py + _ph, false); - gpu_set_colorwriteenable(1, 1, 1, 1); - - if(_sel) draw_sprite_stretched_ext(THEME.ui_panel_bg, 4, _px, _py, _tw, _ph, merge_color(COLORS._main_icon_dark, COLORS._main_icon, 0.3), 1); + if(_sel) draw_sprite_stretched_ext(THEME.ui_panel_bg, 4, _px, _py, _tw, _ph, merge_color(COLORS._main_icon_dark, COLORS._main_icon, 0.2), 1); if(point_in_rectangle(_m[0], _m[1], _px, _py, _px + _pw, _py + _ph)) { var _bx = _px + _tw + ui(4); if(path_is_image(_fil.path)) { - if(buttonInstant(noone, _bx, _py, _ph, _ph, _m, pHOVER, pFOCUS, "", THEME.image_20, 0, [ COLORS._main_icon, c_white ]) == 2) { + if(buttonInstant(noone, _bx, _py, _ph, _ph, _m, pHOVER, pFOCUS, "Import as Image", THEME.image_20, 0, [ COLORS._main_icon, c_white ]) == 2) { Node_create_Image_path(_graph_x, _graph_y, _fil.path); draggable = false; } _bx += _ph + ui(2); - if(buttonInstant(noone, _bx, _py, _ph, _ph, _m, pHOVER, pFOCUS, "", THEME.canvas_20, 0, [ COLORS._main_icon, c_white ]) == 2) { + if(buttonInstant(noone, _bx, _py, _ph, _ph, _m, pHOVER, pFOCUS, "Import as Canvas", THEME.canvas_20, 0, [ COLORS._main_icon, c_white ]) == 2) { var node = nodeBuild("Node_Canvas", _graph_x, _graph_y).loadImagePath(_fil.path); PANEL_PREVIEW.setNodePreview(node); PANEL_INSPECTOR.inspecting = node; @@ -521,7 +359,7 @@ function Panel_File_Explorer() : PanelContent() constructor { } _bx += _ph + ui(2); } else if(path_is_project(_fil.path)) { - if(buttonInstant(noone, _bx, _py, _ph, _ph, _m, pHOVER, pFOCUS, "", THEME.path_open_20, 0, [ COLORS._main_icon, c_white ]) == 2) { + if(buttonInstant(noone, _bx, _py, _ph, _ph, _m, pHOVER, pFOCUS, "Open Project", THEME.path_open_20, 0, [ COLORS._main_icon, c_white ]) == 2) { LOAD_AT(_fil.path); draggable = false; } _bx += _ph + ui(2); @@ -531,7 +369,7 @@ function Panel_File_Explorer() : PanelContent() constructor { if(contentPane.hover && point_in_rectangle(_m[0], _m[1], _px, _py, _px + _tw, _py + _ph)) { if(!mouse_click(mb_left)) { - draw_sprite_stretched_ext(THEME.ui_panel, 1, _px, _py, _tw, _ph, COLORS._main_icon_light, 1); + draw_sprite_stretched_ext(THEME.ui_panel, 1, _px, _py, _tw, _ph, COLORS._main_icon, .75); if(!instance_exists(o_dialog_menubox)) TOOLTIP = [ _th, "sprite" ]; } @@ -555,12 +393,18 @@ function Panel_File_Explorer() : PanelContent() constructor { } if(sprite_exists(_th)) { + gpu_set_texfilter(true); var _ths = min(1, (_ph - ui(4)) / _fil.th_w, (_ph - ui(4)) / _fil.th_h); draw_sprite_ext(_th, 0, _tx + _ph / 2, _py + _ph / 2, _ths, _ths, 0, c_white, 1); + gpu_set_texfilter(false); } _tx += _ph + ui(4); - draw_set_color(_fil == file_focus? COLORS._main_value_positive : COLORS._main_text); + var _cc = COLORS._main_text; + if(_fil == file_focus) _cc = COLORS._main_value_positive; + if(_fil.path == PROJECT.path) _cc = COLORS._main_accent; + + draw_set_color(_cc); draw_text_add(_tx, _ty, _fil.name); _h += _ith + ui(2); @@ -587,31 +431,20 @@ function Panel_File_Explorer() : PanelContent() constructor { var _pw = _grid_width; var _ph = _grid_height + _title_heigh; - // if(i == _amo - 1) { - // draw_sprite_ext(THEME.add, 0, _px + _grid_width / 2, _py + _grid_height / 2, 1, 1, 0, COLORS._main_value_positive, 1); - // continue; - // } - var _fil = dirObject.files[i]; if(frame_dragging && rectangle_in_rectangle(_px, _py, _px + _pw, _py + _ph, frame_drag_mx, frame_drag_my, _m[0], _m[1])) array_push(file_selectings, _fil); var _sel = array_exists(file_selectings, _fil); - var _tx = _px + _grid_width / 2; var _ty = _py + _grid_height + _title_heigh; var _th = _fil.getThumbnail(); - draw_set_color(c_white); - gpu_set_colorwriteenable(1, 1, 1, 0); - draw_rectangle(_px, _py, _px + _pw, _py + _ph, false); - gpu_set_colorwriteenable(1, 1, 1, 1); - - if(_sel) draw_sprite_stretched_ext(THEME.ui_panel_bg, 4, _px, _py, _pw, _ph, merge_color(COLORS._main_icon_dark, COLORS._main_icon, 0.3), 1); + if(_sel) draw_sprite_stretched_ext(THEME.ui_panel_bg, 4, _px, _py, _pw, _ph, merge_color(COLORS._main_icon_dark, COLORS._main_icon, 0.2), 1); if(contentPane.hover && point_in_rectangle(_m[0], _m[1], _px, _py, _px + _pw, _py + _ph)) { if(!mouse_click(mb_left)) { - draw_sprite_stretched_ext(THEME.ui_panel, 1, _px, _py, _pw, _ph, COLORS._main_icon_light, 1); + draw_sprite_stretched_ext(THEME.ui_panel, 1, _px, _py, _pw, _ph, COLORS._main_icon, .75); if(!instance_exists(o_dialog_menubox)) TOOLTIP = [ _th, "sprite" ]; } @@ -635,11 +468,17 @@ function Panel_File_Explorer() : PanelContent() constructor { } if(sprite_exists(_th)) { + gpu_set_texfilter(true); var _ths = min((_grid_width - ui(4)) / _fil.th_w, (_grid_height - ui(4)) / _fil.th_h); draw_sprite_ext(_th, 0, _px + _grid_width / 2, _py + _grid_height / 2, _ths, _ths, 0, c_white, 1); + gpu_set_texfilter(false); } - draw_set_color(_fil == file_focus? COLORS._main_value_positive : COLORS._main_text); + var _cc = COLORS._main_text; + if(_fil == file_focus) _cc = COLORS._main_value_positive; + if(_fil.path == PROJECT.path) _cc = COLORS._main_accent; + + draw_set_color(_cc); draw_text_ext_add(_tx, _ty, _fil.name, -1, _grid_width, 1, true); } @@ -653,8 +492,148 @@ function Panel_File_Explorer() : PanelContent() constructor { return _h; } + contentPane = new scrollPane(w - padding - padding - cntPad * 2, h - padding - top_bar - cntPad * 2, function(_y, _m, _r) { + draw_clear_alpha(COLORS.panel_bg_clear_inner, 1); + + if(frame_dragging) file_selectings = []; + + file_hovering = noone; + context_hovering = noone; + draggable = true; + + contentPane.hover_content = true; + + var _h = drawDir(rootFile, 0, _y, contentPane.surface_w, _m); + + if(frame_dragging) draw_sprite_stretched_points_clamp(THEME.ui_selection, 0, frame_drag_mx, frame_drag_my, _m[0], _m[1], COLORS._main_accent); + if(context_hovering == noone) context_hovering = rootFile; + + if(draggable && mouse_press(mb_left, pFOCUS)) { + if(file_hovering == noone) { + file_selectings = []; + frame_dragging = true; + frame_drag_mx = _m[0]; + frame_drag_my = _m[1]; + + } else { + if(key_mod_press(SHIFT)) { + if(!array_empty(file_selectings)) { + var _frm = file_selectings[array_length(file_selectings) - 1]; + var _to = file_hovering; + + if(is(_frm, ExpFile) && is(_to, ExpFile) && _frm.parent && _frm.parent == _to.parent) { + var _par = _frm.parent; + var _ifrm = array_find(_par.files, _frm); + var _ito = array_find(_par.files, _to); + + file_selectings = array_create(abs(_ifrm - _ito) + 1); + var _i = min(_ifrm, _ito); + var _j = max(_ifrm, _ito); + var _ind = 0; + + for(; _i <= _j; _i++) file_selectings[_ind++] = _par.files[_i]; + } + } + + } else if(!array_exists(file_selectings, file_hovering)) + file_selectings = [ file_hovering ]; + + path_dragging = -1; + file_dragging = true; + file_drag_mx = mouse_mx; + file_drag_my = mouse_my; + } + } + + if(mouse_release(mb_left)) frame_dragging = false; + + if(pFOCUS && mouse_press(mb_right)) { + __menu_cnxt_selecting = context_hovering; + + if(file_hovering == noone || is(file_hovering, ExpDir)) + menuCall("", menu_general); + } + + if(file_dragging) { + if(path_dragging == -1 && point_distance(file_drag_mx, file_drag_my, mouse_mx, mouse_my) > 8) { + path_dragging = []; + + for (var i = 0, n = array_length(file_selectings); i < n; i++) + path_dragging[i] = file_selectings[i].path; + } + + if(path_dragging != -1 && !array_empty(path_dragging) && !pHOVER) { + if(HOVER && is(HOVER, Panel)) { + var _cont = HOVER.getContent(); + if(is(_cont, Panel_Preview) || is(_cont, Panel_Graph)) + HOVER.draw_droppable = true; + } + } + + if(mouse_release(mb_left)) { + var _file_focus = file_focus; + file_focus = noone; + + if(path_dragging != -1 && !array_empty(path_dragging) && !pHOVER) { + var _dropped = false; + + if(HOVER && is(HOVER, Panel)) { + var _cont = HOVER.getContent(); + + if(is(_cont, Panel_Preview)) { + var _node = _cont.getNodePreview(); + + if(_node && _node.on_drop_file) { + _node.on_drop_file(path_dragging[0]); + _dropped = true; + } + } + + if(array_length(file_selectings) == 1) + file_focus = file_selectings[0]; + } + + if(!_dropped) + load_file_path(path_dragging); + } + + if(_file_focus != file_focus) + recordAction_variable_change(self, "file_focus", _file_focus); + + file_dragging = false; + path_dragging = -1; + + } else if(keyboard_check_pressed(vk_control)) { + __menu_file_selecting = file_selectings[0]; + + if(path_is_image(__menu_file_selecting.path)) + pieMenuCall("",,, menu_file_image); + + else if(path_is_project(__menu_file_selecting.path)) + pieMenuCall("",,, menu_file_project); + + file_dragging = false; + path_dragging = -1; + + } + } + + if(view_mode == FILE_EXPLORER_VIEW.grid && pHOVER && key_mod_press(CTRL)) { + if(mouse_wheel_down()) grid_size = clamp(grid_size - ui(8), ui(32), ui(128)); + if(mouse_wheel_up()) grid_size = clamp(grid_size + ui(8), ui(32), ui(128)); + } + + return _h; + + } ); + + function onResize() { + initSize(); + contentPane.resize(w - padding - padding - cntPad * 2, h - padding - top_bar - cntPad * 2); + } + function drawContent(panel) { - draw_clear_alpha(COLORS.panel_bg_clear, 0); + draw_clear_alpha(COLORS.panel_bg_clear, 1); var pad = padding; var cnt_x = pad; @@ -665,10 +644,20 @@ function Panel_File_Explorer() : PanelContent() constructor { draw_sprite_stretched(THEME.ui_panel_bg, 1, cnt_x, cnt_y, cnt_w, cnt_h); var bs = top_bar - pad - ui(8); - if(buttonInstant(THEME.button_hide_fill, pad, pad, bs, bs, [mx, my], pHOVER, pFOCUS, "Go up", THEME.arrow, 1, root != ""? COLORS._main_icon : COLORS._main_icon_dark) == 2) + var bx = pad; + var bc = root != ""? COLORS._main_icon : COLORS._main_icon_dark; + if(buttonInstant(THEME.button_hide_fill, bx, pad, bs, bs, [mx, my], pHOVER, pFOCUS, "Go up", THEME.arrow, 1, bc) == 2) if(root != "") setRoot(filename_dir(root)); + bx += bs + ui(4); - var tb_x = cnt_x + ui(32); + if(buttonInstant(THEME.button_hide_fill, bx, pad, bs, bs, [mx, my], pHOVER, pFOCUS, "Go to current project", s_icon_16_white) == 2) { + var _pth = PROJECT.path; + if(_pth == "") return; + setRoot(filename_dir(_pth)); + } + bx += bs + ui(4); + + var tb_x = bx; var tb_y = pad; var tb_w = w - pad - tb_x - bs - ui(4); var tb_h = top_bar - pad - ui(8); @@ -690,22 +679,17 @@ function Panel_File_Explorer() : PanelContent() constructor { } function drawGUI() { - if(path_dragging != -1) { + if(path_dragging == -1) return; - for (var i = 0, n = array_length(file_selectings); i < n; i++) { - var f = file_selectings[i]; + for (var i = 0, n = array_length(file_selectings); i < n; i++) { + var f = file_selectings[i]; + + if(is(f, ExpDir)) { + draw_sprite_ext(THEME.folder_content, 0, mouse_mx + 20 + 8 * i, mouse_my + 20 + 8 * i, 1, 1, 0, c_white, 1); - if(is_instanceof(f, ExpDir)) { - draw_sprite_ext(THEME.folder_content, 0, mouse_mx + 20 + 8 * i, - mouse_my + 20 + 8 * i, - 1, 1, 0, c_white, 1); - - } else if(is_instanceof(f, ExpFile)) { - var _s = 64 / max(f.th_w, f.th_h); - if(f.thumbnail) draw_sprite_ext(f.thumbnail, 0, mouse_mx + f.th_w * _s / 2 + 8 * i, - mouse_my + f.th_h * _s / 2 + 8 * i, - _s, _s, 0, c_white, 1); - } + } else if(is(f, ExpFile)) { + var _s = 64 / max(f.th_w, f.th_h); + if(f.thumbnail) draw_sprite_ext(f.thumbnail, 0, mouse_mx + f.th_w * _s / 2 + 8 * i, mouse_my + f.th_h * _s / 2 + 8 * i, _s, _s, 0, c_white, 1); } } } diff --git a/sprites/s_icon_16_white/5be69b3e-a07f-48b0-98b1-36e6c85f1720.png b/sprites/s_icon_16_white/5be69b3e-a07f-48b0-98b1-36e6c85f1720.png new file mode 100644 index 000000000..ba553d028 Binary files /dev/null and b/sprites/s_icon_16_white/5be69b3e-a07f-48b0-98b1-36e6c85f1720.png differ diff --git a/sprites/s_icon_16_white/layers/5be69b3e-a07f-48b0-98b1-36e6c85f1720/97b2b845-2e62-4358-86bd-5ea8dd97bef1.png b/sprites/s_icon_16_white/layers/5be69b3e-a07f-48b0-98b1-36e6c85f1720/97b2b845-2e62-4358-86bd-5ea8dd97bef1.png new file mode 100644 index 000000000..ba553d028 Binary files /dev/null and b/sprites/s_icon_16_white/layers/5be69b3e-a07f-48b0-98b1-36e6c85f1720/97b2b845-2e62-4358-86bd-5ea8dd97bef1.png differ diff --git a/sprites/s_icon_16_white/s_icon_16_white.yy b/sprites/s_icon_16_white/s_icon_16_white.yy new file mode 100644 index 000000000..89754d86f --- /dev/null +++ b/sprites/s_icon_16_white/s_icon_16_white.yy @@ -0,0 +1,90 @@ +{ + "$GMSprite":"", + "%Name":"s_icon_16_white", + "bboxMode":0, + "bbox_bottom":15, + "bbox_left":0, + "bbox_right":15, + "bbox_top":0, + "collisionKind":1, + "collisionTolerance":0, + "DynamicTexturePage":false, + "edgeFiltering":false, + "For3D":false, + "frames":[ + {"$GMSpriteFrame":"","%Name":"5be69b3e-a07f-48b0-98b1-36e6c85f1720","name":"5be69b3e-a07f-48b0-98b1-36e6c85f1720","resourceType":"GMSpriteFrame","resourceVersion":"2.0",}, + ], + "gridX":0, + "gridY":0, + "height":16, + "HTile":false, + "layers":[ + {"$GMImageLayer":"","%Name":"97b2b845-2e62-4358-86bd-5ea8dd97bef1","blendMode":0,"displayName":"default","isLocked":false,"name":"97b2b845-2e62-4358-86bd-5ea8dd97bef1","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, + ], + "name":"s_icon_16_white", + "nineSlice":null, + "origin":4, + "parent":{ + "name":"meta", + "path":"folders/sprites/meta.yy", + }, + "preMultiplyAlpha":false, + "resourceType":"GMSprite", + "resourceVersion":"2.0", + "sequence":{ + "$GMSequence":"", + "%Name":"s_icon_16_white", + "autoRecord":true, + "backdropHeight":768, + "backdropImageOpacity":0.5, + "backdropImagePath":"", + "backdropWidth":1366, + "backdropXOffset":0.0, + "backdropYOffset":0.0, + "events":{ + "$KeyframeStore":"", + "Keyframes":[], + "resourceType":"KeyframeStore", + "resourceVersion":"2.0", + }, + "eventStubScript":null, + "eventToFunction":{}, + "length":1.0, + "lockOrigin":false, + "moments":{ + "$KeyframeStore":"", + "Keyframes":[], + "resourceType":"KeyframeStore", + "resourceVersion":"2.0", + }, + "name":"s_icon_16_white", + "playback":1, + "playbackSpeed":30.0, + "playbackSpeedType":0, + "resourceType":"GMSequence", + "resourceVersion":"2.0", + "showBackdrop":true, + "showBackdropImage":false, + "timeUnits":1, + "tracks":[ + {"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore":"","Keyframes":[ + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"5be69b3e-a07f-48b0-98b1-36e6c85f1720","path":"sprites/s_icon_16_white/s_icon_16_white.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"9a0266b0-bb17-477c-a4e2-2ef4de13f1c5","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + ],"resourceType":"KeyframeStore","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange":null, + "volume":1.0, + "xorigin":8, + "yorigin":8, + }, + "swatchColours":null, + "swfPrecision":0.5, + "textureGroupId":{ + "name":"Default", + "path":"texturegroups/Default", + }, + "type":0, + "VTile":false, + "width":16, +} \ No newline at end of file