This commit is contained in:
Tanasart 2025-02-07 11:19:40 +07:00
parent 5dd685eff5
commit a2382a42cc
28 changed files with 459 additions and 334 deletions

View file

@ -1879,6 +1879,7 @@
{"name":"s_gizmo","order":3,"path":"sprites/s_gizmo/s_gizmo.yy",}, {"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_gmlayer","order":2,"path":"sprites/s_gmlayer/s_gmlayer.yy",},
{"name":"s_gmroom","order":1,"path":"sprites/s_gmroom/s_gmroom.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_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_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",}, {"name":"s_icon_64","order":3,"path":"sprites/s_icon_64/s_icon_64.yy",},

View file

@ -3205,6 +3205,7 @@
{"id":{"name":"s_gizmo","path":"sprites/s_gizmo/s_gizmo.yy",},}, {"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_gmlayer","path":"sprites/s_gmlayer/s_gmlayer.yy",},},
{"id":{"name":"s_gmroom","path":"sprites/s_gmroom/s_gmroom.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_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_256","path":"sprites/s_icon_256/s_icon_256.yy",},},
{"id":{"name":"s_icon_32","path":"sprites/s_icon_32/s_icon_32.yy",},}, {"id":{"name":"s_icon_32","path":"sprites/s_icon_32/s_icon_32.yy",},},

Binary file not shown.

View file

@ -1,5 +1,5 @@
{ {
"tooltip":"Genearte vector composite of 2 members.", "tooltip":"Generate vector composite of 2 members.",
"spr":"s_node_vector2", "spr":"s_node_vector2",
"baseNode":"Node_Vector2", "baseNode":"Node_Vector2",
"io":[ "io":[

View file

@ -1,5 +1,5 @@
{ {
"tooltip":"Genearte vector composite of 3 members.", "tooltip":"Generate vector composite of 3 members.",
"spr":"s_node_vector3", "spr":"s_node_vector3",
"baseNode":"Node_Vector3", "baseNode":"Node_Vector3",
"io":[ "io":[

View file

@ -1,5 +1,5 @@
{ {
"tooltip":"Genearte vector composite of 4 members.", "tooltip":"Generate vector composite of 4 members.",
"spr":"s_node_vector4", "spr":"s_node_vector4",
"baseNode":"Node_Vector4", "baseNode":"Node_Vector4",
"io":[ "io":[

Binary file not shown.

View file

@ -7,24 +7,24 @@ event_inherited();
mouse_init_inside = false; mouse_init_inside = false;
mouse_init_r_pressed = mouse_click(mb_right); mouse_init_r_pressed = mouse_click(mb_right);
selecting = -1; selecting = -1;
parentPanel = noone; parentPanel = noone;
context = noone;
menu_id = ""; menu_id = "";
alarm[0] = -1;
menu = 1; menu = 1;
font = f_p2;
hght = line_get_height(font, 10);
tooltips = []; tooltips = [];
show_icon = false; show_icon = false;
context = noone; font = f_p2;
hght = line_get_height(font, 10);
submenu = noone; submenu = noone;
submenuIt = noone; submenuIt = noone;
_hovering_ch = true; _hovering_ch = true;
init_press_l = MOUSE_POOL.lpress; init_press_l = MOUSE_POOL.lpress;
alarm[0] = -1;
setFocus(self.id); setFocus(self.id);
#endregion #endregion
#region menu #region menu
@ -33,7 +33,7 @@ event_inherited();
selecting_menu = noone; selecting_menu = noone;
hk_editing = 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); } with(_p_dialog) { if(on_top) continue; other.depth = min(depth - 1, other.depth); }
title = menu_id; title = menu_id;
@ -50,7 +50,7 @@ event_inherited();
tooltips = []; tooltips = [];
draw_set_text(font, fa_center, fa_center, COLORS._main_text); 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]; var _menuItem = menu[i];
if(_menuItem == -1) { if(_menuItem == -1) {
@ -67,7 +67,7 @@ event_inherited();
draw_set_font(font); draw_set_font(font);
var ww = string_width(_menuItem.name) + ui(64); 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); draw_set_font(font);
var _kw = _key? string_width(key_get_name(_key.key, _key.modi)) + ui(16) : 0; 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); 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_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_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; case fa_right: dialog_x = round(max(dialog_x - dialog_w, 2)); break;
@ -121,11 +121,6 @@ event_inherited();
dialog_y = 0; dialog_y = 0;
} }
} }
#endregion
#region focus function getContextPanel() { return is(context, PanelContent)? context.panel : context; }
function getContextPanel() {
if(is(context, PanelContent)) return context.panel;
return context;
}
#endregion #endregion

View file

@ -14,10 +14,9 @@ DIALOG_WINCLEAR1
item_sel_submenu = noone; item_sel_submenu = noone;
} }
var to_del = noone;
draw_sprite_stretched(THEME.box_r2_clr, 0, dialog_x, dialog_y, dialog_w, dialog_h); 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++ ) { for( var i = 0, n = array_length(menu); i < n; i++ ) {
var _menuItem = menu[i]; var _menuItem = menu[i];
@ -29,7 +28,7 @@ DIALOG_WINCLEAR1
continue; 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; _menuItem = _menuItem.shiftMenu;
if(_menuItem == -1) { if(_menuItem == -1) {
@ -43,10 +42,14 @@ DIALOG_WINCLEAR1
} }
var label = _menuItem.name; 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 cc = struct_try_get(_menuItem, "color", c_white);
var _key = _menuItem.hotkey != noone? find_hotkey(_menuItem.hotkey[0], _menuItem.hotkey[1]) : noone; var _key = _menuItem.hoykeyObject;
if(_key == noone && _menuItem.hotkey != noone) {
_key = find_hotkey(_menuItem.hotkey[0], _menuItem.hotkey[1]);
_menuItem.hoykeyObject = _key; _menuItem.hoykeyObject = _key;
}
//print($"{i}: {sHOVER} && {point_in_rectangle(mouse_mx, mouse_my, dialog_x, yy + 1, dialog_x + dialog_w, yy + _h - 1)}") //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)) { 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) { if(selecting == i) {
var _hc = cc == c_white? COLORS.dialog_menubox_highlight : cc; if(_menuItem.active && cc == c_white) cc = COLORS.dialog_menubox_highlight;
var _ha = cc == c_white? 0.75 : 0.8;
if(_menuItem.active) if(_hovering_ch) {
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, _hc); if(is(_menuItem, MenuItem) && _menuItem.active && _lclick) {
if(_hovering_ch && is_instanceof(_menuItem, MenuItem)) {
if(_menuItem.active && _lclick) {
var _par = _menuItem.params; var _par = _menuItem.params;
var _p = _par != noone;
if(_menuItem.isShelf) { if(_menuItem.isShelf) {
FOCUS_CONTENT = context; FOCUS_CONTENT = context;
@ -77,6 +75,7 @@ DIALOG_WINCLEAR1
if(submenuIt == _menuItem) { if(submenuIt == _menuItem) {
submenuIt = noone; submenuIt = noone;
} else { } else {
var _dat = { var _dat = {
_x: dialog_x, _x: dialog_x,
@ -97,16 +96,14 @@ DIALOG_WINCLEAR1
} else { } else {
FOCUS_CONTENT = context; FOCUS_CONTENT = context;
if(_p) _menuItem.func(_par); if(_par != noone) _menuItem.func(_par);
else _menuItem.func(); else _menuItem.func();
to_del = remove_parents? o_dialog_menubox : self; to_del = remove_parents? o_dialog_menubox : self;
} }
} }
}
if(_hovering_ch && (is_instanceof(_menuItem, MenuItem) || is_instanceof(_menuItem, MenuItemGroup))) { if((is(_menuItem, MenuItem) || is(_menuItem, MenuItemGroup)) && (_key && _rclick)) {
if(_key && _rclick) {
var _dat = { var _dat = {
_x: mouse_mx + ui(4), _x: mouse_mx + ui(4),
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 = submenuCall(_dat, context_menu_settings);
item_sel_submenu.remove_parents = false; item_sel_submenu.remove_parents = false;
}
} }
} }
} else if(cc != c_white) if(cc != c_white) draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, cc);
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, cc);
var _hx = dialog_x + dialog_w - ui(16); var _hx = dialog_x + dialog_w - ui(16);
var _hy = yy + hght / 2 + ui(2); var _hy = yy + hght / 2 + ui(2);
if(is_instanceof(_menuItem, MenuItemGroup)) { if(is(_menuItem, MenuItemGroup)) {
var _submenus = _menuItem.group; var _submenus = _menuItem.group;
draw_set_text(font, fa_center, fa_center, COLORS._main_text_sub); draw_set_text(font, fa_center, fa_center, COLORS._main_text_sub);
draw_set_alpha(_menuItem.active * 0.75 + 0.25); 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); 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_init_inside && (mouse_release(mb_left) || mouse_release(mb_right)))
if(mouse_release(mb_right)) mouse_init_r_pressed = false; mouse_init_inside = false;
if(mouse_release(mb_right))
mouse_init_r_pressed = false;
#endregion #endregion
#region debug #region debug

View file

@ -66,13 +66,11 @@ function functionObject(_context, _name, _key, _mod, _action, _param = noone) co
FUNCTIONS[$ fnName] = self; FUNCTIONS[$ fnName] = self;
CMD_FUNCTIONS[$ fnName] = { action: _action, args: [] }; CMD_FUNCTIONS[$ fnName] = { action: _action, args: [] };
static setArg = function(_args = []) { static setArg = function(_args = []) { CMD_FUNCTIONS[$ fnName] = { action, args: _args }; return self; }
CMD_FUNCTIONS[$ fnName] = { action, args: _args };
return self;
}
static setMenuAlt = function(_name, _id, _spr = noone, shelf = false) { static setMenuAlt = function(_name, _id, _spr = noone, shelf = false) {
menu = menuItem(__txt(_name), action, _spr, [ context, name ]); menu = menuItem(__txt(_name), action, _spr, [ context, name ]);
menu.hoykeyObject = hotkey;
if(shelf) menu.setIsShelf(); if(shelf) menu.setIsShelf();
MENU_ITEMS[$ _id] = menu; 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) { static setMenu = function(_id, _spr = noone, shelf = false) {
menu = menuItem(__txt(name), action, _spr, [ context, name ]); menu = menuItem(__txt(name), action, _spr, [ context, name ]);
menu.hoykeyObject = hotkey;
if(shelf) menu.setIsShelf(); if(shelf) menu.setIsShelf();
MENU_ITEMS[$ _id] = menu; MENU_ITEMS[$ _id] = menu;
return self; return self;
} }
static hidePalette = function() { static hidePalette = function() { hide = true; return self; }
hide = true;
return self;
}
} }
function callStatusFunction(name) { function callStatusFunction(name) {

View file

@ -43,7 +43,7 @@
LATEST_VERSION = 1_18_00_0; LATEST_VERSION = 1_18_00_0;
VERSION = 1_18_07_2; VERSION = 1_18_07_2;
SAVE_VERSION = 1_18_05_0; 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; BUILD_NUMBER = 118072.011;
PREF_VERSION = 1_17_1; PREF_VERSION = 1_17_1;

View file

@ -111,7 +111,7 @@ function hotkeyObject(_context, _name, _key, _mod = MOD_KEY.none, _action = noon
dKey = _key; dKey = _key;
dModi = _mod; 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 get_key_name = function() /*=>*/ {return key_get_name(key, modi)};
static serialize = function( ) /*=>*/ { return { context, name, key, modi } } static serialize = function( ) /*=>*/ { return { context, name, key, modi } }

View file

@ -408,11 +408,12 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
BLEND_MULTIPLY BLEND_MULTIPLY
draw_surface_safe(deferData.ssao); draw_surface_safe(deferData.ssao);
BLEND_NORMAL BLEND_NORMAL
_outData[4] = deferData.ssao;
} }
surface_reset_target(); surface_reset_target();
surface_free(_render); surface_free(_render);
_outData[4] = deferData.ssao;
#endregion #endregion
surface_depth_disable(true); surface_depth_disable(true);

View file

@ -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) { static processData = function(_outData, _data, _output_index, _array_index) {
draw_transforms[_array_index] = noone;
var _outSurf = _outData[0]; var _outSurf = _outData[0];
if(getInputAmount() == 0) return _outData; if(getInputAmount() == 0) return _outData;
@ -787,7 +789,6 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var cDep = attrDepth(); var cDep = attrDepth();
if(!is_surface(base)) return _outData; if(!is_surface(base)) return _outData;
draw_transforms[_array_index] = noone;
#region dimension #region dimension
var ww = 0, hh = 0; var ww = 0, hh = 0;

View file

@ -22,7 +22,22 @@ function Node_Composite_Tag(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
setDynamicInput(1, true, VALUE_TYPE.dynaSurface); 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) { static processData = function(_outSurf, _data, _output_index, _array_index = 0) {
draw_transforms[_array_index] = noone;
var _amo = getInputAmount(); var _amo = getInputAmount();
var _dim = _data[0]; var _dim = _data[0];
@ -79,6 +94,7 @@ function Node_Composite_Tag(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var _cy = _dim[1] / 2 - (miny + maxy) / 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); surface_set_shader(_outSurf);
for( var i = 0; i < _amo; i++ ) { for( var i = 0; i < _amo; i++ ) {
@ -102,9 +118,12 @@ function Node_Composite_Tag(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
_oy /= _tagArrAmo; _oy /= _tagArrAmo;
draw_surface(_surface, _cx - _ox, _cy - _oy); draw_surface(_surface, _cx - _ox, _cy - _oy);
_trans[i] = [ _cx - _ox, _cy - _oy, 1, 1, 0 ];
} }
surface_reset_shader(); surface_reset_shader();
draw_transforms[_array_index] = _trans;
return _outSurf; return _outSurf;
} }

View file

@ -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) { static onValueUpdate = function(index) {
if(index != 3) return; 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); surface_set_shader(_outSurf, noone);
draw_surface_safe(_inSurf, -_crop[2], -_crop[1]); draw_surface_safe(_inSurf, -_crop[2], -_crop[1]);
draw_transforms[_array_index] = [-_crop[2], -_crop[1], 1, 1, 0];
surface_reset_shader(); surface_reset_shader();
} else if(_fit == 0) { } 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); surface_set_shader(_outSurf, noone);
draw_surface_safe(_inSurf, -_x0, -_y0); draw_surface_safe(_inSurf, -_x0, -_y0);
draw_transforms[_array_index] = [-_x0, -_y0, 1, 1, 0];
surface_reset_shader(); surface_reset_shader();
} else { } else {
@ -400,6 +405,7 @@ function Node_Crop(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
surface_set_shader(_outSurf, noone); surface_set_shader(_outSurf, noone);
draw_surface_safe(_inSurf, -_x0, -_y0); draw_surface_safe(_inSurf, -_x0, -_y0);
draw_transforms[_array_index] = [-_x0, -_y0, 1, 1, 0];
surface_reset_shader(); surface_reset_shader();
} }

View file

@ -33,6 +33,9 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr
temp_surface = [ 0, 0 ]; temp_surface = [ 0, 0 ];
draw_transforms = [];
static drawOverlayTransform = function(_node) { return array_safe_get(draw_transforms, preview_index, noone); }
static update = function() { static update = function() {
var _inSurf = getInputData(0); var _inSurf = getInputData(0);
var _active = getInputData(1); 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 ]; if(!_arr) _inSurf = [ _inSurf ];
var _amo = array_length(_inSurf); var _amo = array_length(_inSurf);
var minx = array_create(_amo); var minx = array_create(_amo, infinity);
var miny = array_create(_amo); var miny = array_create(_amo, infinity);
var maxx = array_create(_amo); var maxx = array_create(_amo, -infinity);
var maxy = array_create(_amo); var maxy = array_create(_amo, -infinity);
var cDep = attrDepth(); var cDep = attrDepth();
for( var j = 0; j < _amo; j++ ) { for( var j = 0; j < _amo; j++ ) {
@ -104,6 +107,7 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr
maxx[j] = _maxx; maxx[j] = _maxx;
maxy[j] = _maxy; maxy[j] = _maxy;
} else { } else {
minx[0] = min(minx[0], _minx); minx[0] = min(minx[0], _minx);
miny[0] = min(miny[0], _miny); 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 res = [];
var crop = []; var crop = [];
var atlas = []; var atlas = [];
for( var i = 0, n = _amo; i < n; i++ ) { for( var i = 0; i < _amo; i++ ) {
var _surf = _inSurf[i]; var _surf = _inSurf[i];
var _ind = _array == 0? 0 : 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); 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 ]; 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); 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(); surface_reset_shader();
atlas[i] = new SurfaceAtlas(res[i], minx[_ind], miny[_ind]); atlas[i] = new SurfaceAtlas(res[i], minx[_ind], miny[_ind]);
draw_transforms[i] = [_sx, _sy, 1, 1, 0];
} }
if(!_arr) { if(!_arr) {

View file

@ -7,7 +7,7 @@
function Node_Delay_Value(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { function Node_Delay_Value(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Delay Value"; name = "Delay Value";
is_simulation = true; is_simulation = true;
setDimension(96, 32 + 24); setDimension(96, 48);
newInput(0, nodeValue("Value", self, CONNECT_TYPE.input, VALUE_TYPE.any, noone)) newInput(0, nodeValue("Value", self, CONNECT_TYPE.input, VALUE_TYPE.any, noone))
.setVisible(true, true); .setVisible(true, true);

View file

@ -26,10 +26,10 @@ function Node_Fn_WaveTable(_x, _y, _group = noone) : Node_Fn(_x, _y, _group) con
wavetable_selecting = noone; wavetable_selecting = noone;
wavetable_menu = [ wavetable_menu = [
new MenuItem("Sine", function() /*=>*/ { wavetable_apply(WAVETABLE_FN.sine); }, [ s_inspector_wavetable, 0 ]), new MenuItem("Sine", function() /*=>*/ {return wavetable_apply(WAVETABLE_FN.sine)} , [ s_inspector_wavetable, 0 ]),
new MenuItem("Square", function() /*=>*/ { wavetable_apply(WAVETABLE_FN.square); }, [ s_inspector_wavetable, 1 ]), new MenuItem("Square", function() /*=>*/ {return wavetable_apply(WAVETABLE_FN.square)} , [ s_inspector_wavetable, 1 ]),
new MenuItem("Triangle", function() /*=>*/ { wavetable_apply(WAVETABLE_FN.tri); }, [ s_inspector_wavetable, 2 ]), new MenuItem("Triangle", function() /*=>*/ {return wavetable_apply(WAVETABLE_FN.tri)} , [ s_inspector_wavetable, 3 ]),
new MenuItem("Sawtooth", function() /*=>*/ { wavetable_apply(WAVETABLE_FN.saw); }, [ 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) { 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]) { switch(attributes.wavetable[_ind]) {
case WAVETABLE_FN.sine : return sin(_x * pi * 2); case WAVETABLE_FN.sine : return sin(_x * pi * 2);
case WAVETABLE_FN.square : return (1 - floor(frac(_x) * 2)) * 2 - 1; 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.tri : return abs(frac(_x + .5) - .5) * 2 * 2 - 1;
case WAVETABLE_FN.saw : return abs(frac(_x + .5) - .5) * 2 * 2 - 1; case WAVETABLE_FN.saw : return frac(_x + 0.5) * 2 - 1;
} }
return 0; return 0;

View file

@ -38,6 +38,9 @@ function Node_Padding(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
attribute_surface_depth(); attribute_surface_depth();
draw_transforms = [];
static drawOverlayTransform = function(_node) { return array_safe_get(draw_transforms, preview_index, noone); }
static step = function() { static step = function() {
var mode = getInputData(5); var mode = getInputData(5);
@ -85,6 +88,9 @@ function Node_Padding(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
BLEND_NORMAL BLEND_NORMAL
surface_reset_target(); surface_reset_target();
} }
draw_transforms[_array_index] = [ padding[2], padding[1], 1, 1, 0];
} else if(mode == 1) { } else if(mode == 1) {
_outSurf = surface_verify(_outSurf, dim[0], dim[1], cDep); _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); draw_surface_safe(surf, sx, sy);
BLEND_NORMAL BLEND_NORMAL
surface_reset_target(); surface_reset_target();
draw_transforms[_array_index] = [ sx, sy, 1, 1, 0 ];
} }
return _outSurf; return _outSurf;

View file

@ -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(_ax0, _ay0, xx, yy);
draw_line(_ax1, _ay1, xx, yy); draw_line(_ax1, _ay1, xx, yy);
draw_sprite_colored(THEME.anchor_selector, 2, _ax0, _ay0); draw_circle_ui(_ax0, _ay0, 4, 0, COLORS._main_accent);
draw_sprite_colored(THEME.anchor_selector, 2, _ax1, _ay1); draw_circle_ui(_ax1, _ay1, 4, 0, COLORS._main_accent);
} }
draw_sprite_colored(THEME.anchor_selector, 0, xx, yy); 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; hover_type = 0;
} else if(cont && point_in_circle(_mx, _my, _ax0, _ay0, 8)) { } 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; anchor_hover = i;
hover_type = 1; hover_type = 1;
} else if(cont && point_in_circle(_mx, _my, _ax1, _ay1, 8)) { } 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; anchor_hover = i;
hover_type = -1; hover_type = -1;
} }

View file

@ -91,7 +91,7 @@ function Node_Path_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _g
if(is_path) { if(is_path) {
var _nodeFrom = inputs[in_d3d + 2].value_from.node; var _nodeFrom = inputs[in_d3d + 2].value_from.node;
if(struct_has(_nodeFrom, "drawOverlay3D")) 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(); var preObj = getPreviewObjects();

View file

@ -36,11 +36,13 @@ function Node_Scale(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
static step = function() { static step = function() {
var _surf = getSingleValue(0); var _surf = getSingleValue(0);
var _atlas = is_instanceof(_surf, SurfaceAtlas); var _atlas = is_instanceof(_surf, SurfaceAtlas);
inputs[5].setVisible(_atlas); 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) { static processData = function(_outSurf, _data, _output_index, _array_index) {
var surf = _data[0]; var surf = _data[0];
var scale = _data[1]; 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 _surf = isAtlas? _outSurf.getSurface() : _outSurf;
var ww, hh, scx = 1, scy = 1; var ww, hh, scx = 1, scy = 1;
var _sw = surface_get_width_safe(surf);
var _sh = surface_get_height_safe(surf);
switch(mode) { switch(mode) {
case 0 : case 0 :
scx = scale; scx = scale;
scy = scale; scy = scale;
ww = scale * surface_get_width_safe(surf); ww = scale * _sw;
hh = scale * surface_get_height_safe(surf); hh = scale * _sh;
break; break;
case 1 : case 1 :
scx = targ[0] / surface_get_width_safe(surf); scx = targ[0] / _sw;
scy = targ[1] / surface_get_height_safe(surf); scy = targ[1] / _sh;
ww = targ[0]; ww = targ[0];
hh = targ[1]; hh = targ[1];
break; 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); draw_surface_stretched_safe(_data[0], 0, 0, ww, hh);
surface_reset_shader(); surface_reset_shader();
draw_transforms[_array_index] = [ 0, 0, ww * _sw, hh * _sh, 0];
if(isAtlas) { if(isAtlas) {
if(_atlS) { if(_atlS) {
_outSurf.x = surf.x * scx; _outSurf.x = surf.x * scx;

View file

@ -48,6 +48,9 @@ function Node_Scale_Algo(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
attribute_surface_depth(); attribute_surface_depth();
draw_transforms = [];
static drawOverlayTransform = function(_node) { return array_safe_get(draw_transforms, preview_index, noone); }
static step = function() { static step = function() {
var _surf = getSingleValue(0); var _surf = getSingleValue(0);
var _type = getSingleValue(1); var _type = getSingleValue(1);
@ -117,6 +120,8 @@ function Node_Scale_Algo(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
surface_reset_shader(); surface_reset_shader();
gpu_set_texfilter(false); gpu_set_texfilter(false);
draw_transforms[_array_index] = [ 0, 0, sc, sc, 0 ];
if(isAtlas) { if(isAtlas) {
if(_atlS) { if(_atlS) {
_outSurf.x = _data[0].x * sc; _outSurf.x = _data[0].x * sc;

View file

@ -9,13 +9,7 @@ function ExpCreateFile(path) {
INLINE INLINE
if(struct_has(global.__temp_fileMap, path)) return global.__temp_fileMap[$ path]; if(struct_has(global.__temp_fileMap, path)) return global.__temp_fileMap[$ path];
var f; var f = directory_exists(path)? new ExpDir(path) : new ExpFile(path);
if(directory_exists(path))
f = new ExpDir(path);
else
f = new ExpFile(path);
global.__temp_fileMap[$ path] = f; global.__temp_fileMap[$ path] = f;
return f; return f;
} }
@ -32,10 +26,8 @@ function ExpFile(path) constructor {
th_h = 1; th_h = 1;
static getThumbnail = function() { static getThumbnail = function() {
if(thumbnail == -1) if(thumbnail == -1) return noone;
return noone; else if(thumbnail != noone && sprite_exists(thumbnail)) return thumbnail;
else if(thumbnail != noone && sprite_exists(thumbnail))
return thumbnail;
thumbnail = -1; thumbnail = -1;
switch(ext) { switch(ext) {
@ -84,29 +76,29 @@ function ExpDir(path) : ExpFile(path) constructor {
files = []; files = [];
if(!directory_exists(path)) return; if(!directory_exists(path)) return;
var f = file_find_first(path + "/*", fa_directory), fp;
var f = file_find_first(path + "/*", fa_directory);
while (f != "") { while (f != "") {
var _fp = $"{path}/{f}"; fp = $"{path}/{f}";
if(directory_exists(_fp)) { f = file_find_next();
var _fileObj = ExpCreateFile(_fp); if(!directory_exists(fp)) continue;
var _fileObj = ExpCreateFile(fp);
_fileObj.parent = self; _fileObj.parent = self;
array_push(directories, _fileObj); array_push(directories, _fileObj);
} }
f = file_find_next();
}
file_find_close(); file_find_close();
var f = file_find_first(path + "/*", fa_none); var f = file_find_first(path + "/*", fa_none);
while (f != "") { while (f != "") {
var _fp = $"{path}/{f}"; fp = $"{path}/{f}";
if(file_exists(_fp) && !directory_exists(_fp)) { f = file_find_next();
var _fileObj = ExpCreateFile(_fp); if(!file_exists(fp) || directory_exists(fp)) continue;
var _fileObj = ExpCreateFile(fp);
_fileObj.parent = self; _fileObj.parent = self;
array_push(files, _fileObj); array_push(files, _fileObj);
} }
f = file_find_next();
}
file_find_close(); file_find_close();
@ -151,8 +143,7 @@ function Panel_File_Explorer() : PanelContent() constructor {
rootFile = noone; rootFile = noone;
function setRoot(_root = "") { function setRoot(_root = "") {
if(rootFile) if(rootFile) rootFile.destroy();
rootFile.destroy();
if(_root != "" && directory_exists(_root)) { if(_root != "" && directory_exists(_root)) {
root = _root; root = _root;
@ -177,14 +168,12 @@ function Panel_File_Explorer() : PanelContent() constructor {
scroll_y_max = 0; scroll_y_max = 0;
item_height = ui(20); item_height = ui(20);
grid_size = ui(64);
cntPad = ui(4); cntPad = ui(4);
padding = ui(8); padding = ui(8);
top_bar = ui(44); top_bar = ui(44);
tb_root = new textBox(TEXTBOX_INPUT.text, function(v) /*=>*/ {return setRoot(v)});
grid_size = ui(64);
tb_root = new textBox(TEXTBOX_INPUT.text, function(val) { setRoot(val); });
file_selectings = []; file_selectings = [];
file_hovering = noone; file_hovering = noone;
@ -207,29 +196,28 @@ function Panel_File_Explorer() : PanelContent() constructor {
__menu_cnxt_selecting = noone; __menu_cnxt_selecting = noone;
menu_file_image = [ 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); var node = Node_create_Image_path(PANEL_GRAPH.graph_cx, PANEL_GRAPH.graph_cy, __menu_file_selecting.path);
PANEL_PREVIEW.setNodePreview(node); PANEL_PREVIEW.setNodePreview(node);
PANEL_INSPECTOR.inspecting = 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); var node = nodeBuild("Node_Canvas", PANEL_GRAPH.graph_cx, PANEL_GRAPH.graph_cy).loadImagePath(__menu_file_selecting.path);
PANEL_PREVIEW.setNodePreview(node); PANEL_PREVIEW.setNodePreview(node);
PANEL_INSPECTOR.inspecting = 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 = [ menu_file_project = [
menuItem("Open", function() { LOAD_AT(__menu_file_selecting.path); }), menuItem("Open", function() /*=>*/ { LOAD_AT(__menu_file_selecting.path); }),
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_general = [ menu_general = [
menuItem("New Canvas", function() { menuItem("New Canvas", function() /*=>*/ {
var dia = dialogCall(o_dialog_file_name, mouse_mx + 8, mouse_my + 8); var dia = dialogCall(o_dialog_file_name, mouse_mx + 8, mouse_my + 8);
dia.onModify = function (txt) { dia.onModify = function (txt) {
var _s = surface_create(DEF_SURF_W, DEF_SURF_H); 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 + "/"; dia.path = __menu_cnxt_selecting.path + "/";
}, THEME.new_file), }, THEME.new_file),
menuItem("New Folder", function() { menuItem("New Folder", function() /*=>*/ {
var dia = dialogCall(o_dialog_file_name, mouse_mx + 8, mouse_my + 8); var dia = dialogCall(o_dialog_file_name, mouse_mx + 8, mouse_my + 8);
dia.name = "New Folder"; dia.name = "New Folder";
dia.onModify = function (txt) { dia.onModify = function (txt) {
@ -257,153 +245,12 @@ function Panel_File_Explorer() : PanelContent() constructor {
}, THEME.folder), }, THEME.folder),
-1, -1,
menuItem("Refresh", function() { if(rootFile) rootFile.getContent() }), menuItem("Refresh", function() /*=>*/ { if(rootFile) rootFile.getContent() }),
]; ];
#endregion #endregion
function onFocusBegin() { PANEL_FILE = self; } 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) { function drawDir(dirObject, _x, _y, _w, _m) {
var _h = 0; var _h = 0;
var _sy = _y; var _sy = _y;
@ -469,10 +316,7 @@ function Panel_File_Explorer() : PanelContent() constructor {
} }
} }
if(array_length(dirObject.files)) { if(array_length(dirObject.files)) { _h += ui(4); _sy += ui(4); }
_h += ui(4);
_sy += ui(4);
}
if(view_mode == FILE_EXPLORER_VIEW.list) { if(view_mode == FILE_EXPLORER_VIEW.list) {
draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text); 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); array_push(file_selectings, _fil);
var _sel = array_exists(file_selectings, _fil); var _sel = array_exists(file_selectings, _fil);
var _tx = _px + ui(2); var _tx = _px + ui(2);
var _ty = _py + ui(2); var _ty = _py + ui(2);
var _th = _fil.getThumbnail(); var _th = _fil.getThumbnail();
draw_set_color(c_white); 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);
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(point_in_rectangle(_m[0], _m[1], _px, _py, _px + _pw, _py + _ph)) { if(point_in_rectangle(_m[0], _m[1], _px, _py, _px + _pw, _py + _ph)) {
var _bx = _px + _tw + ui(4); var _bx = _px + _tw + ui(4);
if(path_is_image(_fil.path)) { 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); Node_create_Image_path(_graph_x, _graph_y, _fil.path);
draggable = false; draggable = false;
} _bx += _ph + ui(2); } _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); var node = nodeBuild("Node_Canvas", _graph_x, _graph_y).loadImagePath(_fil.path);
PANEL_PREVIEW.setNodePreview(node); PANEL_PREVIEW.setNodePreview(node);
PANEL_INSPECTOR.inspecting = node; PANEL_INSPECTOR.inspecting = node;
@ -521,7 +359,7 @@ function Panel_File_Explorer() : PanelContent() constructor {
} _bx += _ph + ui(2); } _bx += _ph + ui(2);
} else if(path_is_project(_fil.path)) { } 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); LOAD_AT(_fil.path);
draggable = false; draggable = false;
} _bx += _ph + ui(2); } _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(contentPane.hover && point_in_rectangle(_m[0], _m[1], _px, _py, _px + _tw, _py + _ph)) {
if(!mouse_click(mb_left)) { 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)) if(!instance_exists(o_dialog_menubox))
TOOLTIP = [ _th, "sprite" ]; TOOLTIP = [ _th, "sprite" ];
} }
@ -555,12 +393,18 @@ function Panel_File_Explorer() : PanelContent() constructor {
} }
if(sprite_exists(_th)) { if(sprite_exists(_th)) {
gpu_set_texfilter(true);
var _ths = min(1, (_ph - ui(4)) / _fil.th_w, (_ph - ui(4)) / _fil.th_h); 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); 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); _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); draw_text_add(_tx, _ty, _fil.name);
_h += _ith + ui(2); _h += _ith + ui(2);
@ -587,31 +431,20 @@ function Panel_File_Explorer() : PanelContent() constructor {
var _pw = _grid_width; var _pw = _grid_width;
var _ph = _grid_height + _title_heigh; 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]; 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])) 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); array_push(file_selectings, _fil);
var _sel = array_exists(file_selectings, _fil); var _sel = array_exists(file_selectings, _fil);
var _tx = _px + _grid_width / 2; var _tx = _px + _grid_width / 2;
var _ty = _py + _grid_height + _title_heigh; var _ty = _py + _grid_height + _title_heigh;
var _th = _fil.getThumbnail(); var _th = _fil.getThumbnail();
draw_set_color(c_white); 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);
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(contentPane.hover && point_in_rectangle(_m[0], _m[1], _px, _py, _px + _pw, _py + _ph)) { if(contentPane.hover && point_in_rectangle(_m[0], _m[1], _px, _py, _px + _pw, _py + _ph)) {
if(!mouse_click(mb_left)) { 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)) if(!instance_exists(o_dialog_menubox))
TOOLTIP = [ _th, "sprite" ]; TOOLTIP = [ _th, "sprite" ];
} }
@ -635,11 +468,17 @@ function Panel_File_Explorer() : PanelContent() constructor {
} }
if(sprite_exists(_th)) { 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); 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); 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); 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; 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) { function drawContent(panel) {
draw_clear_alpha(COLORS.panel_bg_clear, 0); draw_clear_alpha(COLORS.panel_bg_clear, 1);
var pad = padding; var pad = padding;
var cnt_x = pad; 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); draw_sprite_stretched(THEME.ui_panel_bg, 1, cnt_x, cnt_y, cnt_w, cnt_h);
var bs = top_bar - pad - ui(8); 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)); 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_y = pad;
var tb_w = w - pad - tb_x - bs - ui(4); var tb_w = w - pad - tb_x - bs - ui(4);
var tb_h = top_bar - pad - ui(8); var tb_h = top_bar - pad - ui(8);
@ -690,22 +679,17 @@ function Panel_File_Explorer() : PanelContent() constructor {
} }
function drawGUI() { function drawGUI() {
if(path_dragging != -1) { if(path_dragging == -1) return;
for (var i = 0, n = array_length(file_selectings); i < n; i++) { for (var i = 0, n = array_length(file_selectings); i < n; i++) {
var f = file_selectings[i]; var f = file_selectings[i];
if(is_instanceof(f, ExpDir)) { if(is(f, ExpDir)) {
draw_sprite_ext(THEME.folder_content, 0, mouse_mx + 20 + 8 * i, draw_sprite_ext(THEME.folder_content, 0, mouse_mx + 20 + 8 * i, mouse_my + 20 + 8 * i, 1, 1, 0, c_white, 1);
mouse_my + 20 + 8 * i,
1, 1, 0, c_white, 1);
} else if(is_instanceof(f, ExpFile)) { } else if(is(f, ExpFile)) {
var _s = 64 / max(f.th_w, f.th_h); 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, 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);
mouse_my + f.th_h * _s / 2 + 8 * i,
_s, _s, 0, c_white, 1);
}
} }
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

View file

@ -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<MessageEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MessageEventKeyframe>",
"resourceVersion":"2.0",
},
"eventStubScript":null,
"eventToFunction":{},
"length":1.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
"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<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","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<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","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,
}